blob: 7451b9da1d355a5456878e9c27adf1f4fba5339e [file] [log] [blame] [view]
Serge Bazanski31370b02021-01-07 16:31:14 +01001# Monogon Source Monorepo
Leopold Schabel67f9d092019-10-22 15:41:42 +02002
Serge Bazanski31370b02021-01-07 16:31:14 +01003This is the main repository containing Monogon's public source code, including Metropolis.
Leopold Schabel67f9d092019-10-22 15:41:42 +02004
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +02005## Environment
Leopold Schabel5c80aca2019-10-22 15:48:58 +02006
Leopold Schabeldb6283e2020-01-06 17:05:54 +01007We assume a Fedora host system provisioned using rW, and IntelliJ as the IDE.
Leopold Schabel67f9d092019-10-22 15:41:42 +02008
Leopold Schabel8b9c0552019-11-15 14:07:45 +01009For better reproducibility, all builds are executed in containers.
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
23This repository is compatible with the IntelliJ Bazel plugin. All commands run inside the container, and
24necessary paths are mapped into the container.
25
Leopold Schabel8b9c0552019-11-15 14:07:45 +010026The following steps are necessary:
27
Leopold Schabela4edfa92020-12-13 18:55:21 +010028- Install Google's [Bazel plugin](https://plugins.jetbrains.com/plugin/8609-bazel) in IntelliJ.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010029
Leopold Schabela4edfa92020-12-13 18:55:21 +010030- Add the absolute path to your `~/.cache/bazel-nxt` folder to your `idea64.vmoptions` (Help Edit Custom VM Options)
Leopold Schabel8b9c0552019-11-15 14:07:45 +010031 and restart IntelliJ:
32
33 `-Dbazel.bep.path=/home/leopold/.cache/bazel-nxt`
34
Leopold Schabela4edfa92020-12-13 18:55:21 +010035- Set "*Bazel Binary Location*" in Other Settings Bazel Settings to the absolute path of `scripts/bin/bazel`.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010036 This is a wrapper that will execute Bazel inside the container.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010037
Leopold Schabela4edfa92020-12-13 18:55:21 +010038- Use _File Import Bazel project_... to create a new project from `.bazelproject`.
Leopold Schabel8b9c0552019-11-15 14:07:45 +010039
Leopold Schabela4edfa92020-12-13 18:55:21 +010040After running the first sync, everything should now resolve in the IDE, including generated code.
Leopold Schabel18b4d652020-12-14 18:27:07 +010041
42It's strongly recommend to use our project presets for file watchers and other IDE features. Run this command and
43re-open the project in order to install them:
44
45 bazel run intellij/localconfig $(pwd)
Serge Bazanski31370b02021-01-07 16:31:14 +010046
47## Metropolis
48
49### Run a single node cluster
50
51Launch the node:
52
53 bazel run //:launch
54
55Run a kubectl command:
56
57 bazel run //metropolis/cli/dbg -- kubectl describe
58