blob: 6393910f27b61da21cc82a0c54590ca4dda0c870 [file] [log] [blame] [view]
Leopold Schabel55f01c32021-03-30 22:12:24 +02001# Monogon Monorepo
Leopold Schabel67f9d092019-10-22 15:41:42 +02002
Leopold Schabel55f01c32021-03-30 22:12:24 +02003This is the main repository containing the source code for the Monogon Project.
4
5*⚠️ This is pre-release software that happens to be publicly available. Nothing to see here, please move along.*
Leopold Schabel67f9d092019-10-22 15:41:42 +02006
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +02007## Environment
Leopold Schabel5c80aca2019-10-22 15:48:58 +02008
Leopold Schabel58ec09e2021-04-01 18:34:19 +02009Our build environment requires a working Podman binary (your distribution should have one).
Leopold Schabel67f9d092019-10-22 15:41:42 +020010
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020011#### Usage
Leopold Schabel5c80aca2019-10-22 15:48:58 +020012
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020013Spinning up: `scripts/create_container.sh`
Leopold Schabel5c80aca2019-10-22 15:48:58 +020014
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020015Spinning down: `scripts/destroy_container.sh`
16
Leopold Schabel8b9c0552019-11-15 14:07:45 +010017Running commands: `scripts/run_in_container.sh <...>`
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020018
Leopold Schabel8b9c0552019-11-15 14:07:45 +010019Using bazel using a wrapper script: `scripts/bin/bazel <...>` (add to your local $PATH for convenience)
Leopold Schabelac9947f2020-07-09 18:58:26 +020020
Leopold Schabel8b9c0552019-11-15 14:07:45 +010021#### IntelliJ
22
Leopold Schabel55f01c32021-03-30 22:12:24 +020023This repository is compatible with the IntelliJ Bazel plugin, which enables
24full autocompletion for external dependencies and generated code. All commands
25run inside the container, and necessary paths are mapped into the container.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010026
Leopold Schabel8b9c0552019-11-15 14:07:45 +010027The following steps are necessary:
28
Leopold Schabel55f01c32021-03-30 22:12:24 +020029- Install Google's [Bazel plugin](https://plugins.jetbrains.com/plugin/8609-bazel) in IntelliJ. On IntelliJ 2020.3 or later,
30 you need to install a [beta release](https://github.com/bazelbuild/intellij/issues/2102#issuecomment-801242977) of the plugin.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010031
Serge Bazanskiacae1ef2021-05-19 11:31:40 +020032- Add the absolute path to your `~/.cache/bazel-monogon` folder to your `idea64.vmoptions` (Help → Edit Custom VM Options)
Leopold Schabel8b9c0552019-11-15 14:07:45 +010033 and restart IntelliJ:
34
Serge Bazanskiacae1ef2021-05-19 11:31:40 +020035 `-Dbazel.bep.path=/home/leopold/.cache/bazel-monogon`
Leopold Schabel8b9c0552019-11-15 14:07:45 +010036
Leopold Schabela4edfa92020-12-13 18:55:21 +010037- Set "*Bazel Binary Location*" in Other Settings → Bazel Settings to the absolute path of `scripts/bin/bazel`.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010038 This is a wrapper that will execute Bazel inside the container.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010039
Leopold Schabela4edfa92020-12-13 18:55:21 +010040- Use _File → Import Bazel project_... to create a new project from `.bazelproject`.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010041
Leopold Schabela4edfa92020-12-13 18:55:21 +010042After running the first sync, everything should now resolve in the IDE, including generated code.
Leopold Schabel18b4d652020-12-14 18:27:07 +010043
44It's strongly recommend to use our project presets for file watchers and other IDE features. Run this command and
45re-open the project in order to install them:
46
47 bazel run intellij/localconfig $(pwd)
Serge Bazanski31370b02021-01-07 16:31:14 +010048
49## Metropolis
50
51### Run a single node cluster
52
53Launch the node:
54
Leopold Schabel55f01c32021-03-30 22:12:24 +020055 scripts/bin/bazel run //:launch
Serge Bazanski31370b02021-01-07 16:31:14 +010056
57Run a kubectl command:
58
Leopold Schabel55f01c32021-03-30 22:12:24 +020059 scripts/bin/bazel run //metropolis/cli/dbg -- kubectl describe
Serge Bazanski31370b02021-01-07 16:31:14 +010060
Leopold Schabel55f01c32021-03-30 22:12:24 +020061Run tests:
62
63 scripts/bin/bazel test //...