| Serge Bazanski | 31370b0 | 2021-01-07 16:31:14 +0100 | [diff] [blame] | 1 | # Monogon Source Monorepo |
| Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 2 | |
| Serge Bazanski | 31370b0 | 2021-01-07 16:31:14 +0100 | [diff] [blame] | 3 | This is the main repository containing Monogon's public source code, including Metropolis. |
| Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 4 | |
| Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 5 | ## Environment |
| Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 6 | |
| Leopold Schabel | db6283e | 2020-01-06 17:05:54 +0100 | [diff] [blame] | 7 | We assume a Fedora host system provisioned using rW, and IntelliJ as the IDE. |
| Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 8 | |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 9 | For better reproducibility, all builds are executed in containers. |
| Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 10 | |
| Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 11 | #### Usage |
| Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 12 | |
| Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 13 | Spinning up: `scripts/create_container.sh` |
| Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 14 | |
| Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 15 | Spinning down: `scripts/destroy_container.sh` |
| 16 | |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 17 | Running commands: `scripts/run_in_container.sh <...>` |
| Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 18 | |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 19 | Using bazel using a wrapper script: `scripts/bin/bazel <...>` (add to your local $PATH for convenience) |
| Leopold Schabel | ac9947f | 2020-07-09 18:58:26 +0200 | [diff] [blame] | 20 | |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 21 | #### IntelliJ |
| 22 | |
| 23 | This repository is compatible with the IntelliJ Bazel plugin. All commands run inside the container, and |
| 24 | necessary paths are mapped into the container. |
| 25 | |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 26 | The following steps are necessary: |
| 27 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 28 | - Install Google's [Bazel plugin](https://plugins.jetbrains.com/plugin/8609-bazel) in IntelliJ. |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 29 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 30 | - Add the absolute path to your `~/.cache/bazel-nxt` folder to your `idea64.vmoptions` (Help → Edit Custom VM Options) |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 31 | and restart IntelliJ: |
| 32 | |
| 33 | `-Dbazel.bep.path=/home/leopold/.cache/bazel-nxt` |
| 34 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 35 | - Set "*Bazel Binary Location*" in Other Settings → Bazel Settings to the absolute path of `scripts/bin/bazel`. |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 36 | This is a wrapper that will execute Bazel inside the container. |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 37 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 38 | - Use _File → Import Bazel project_... to create a new project from `.bazelproject`. |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 39 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 40 | After running the first sync, everything should now resolve in the IDE, including generated code. |
| Leopold Schabel | 18b4d65 | 2020-12-14 18:27:07 +0100 | [diff] [blame] | 41 | |
| 42 | It's strongly recommend to use our project presets for file watchers and other IDE features. Run this command and |
| 43 | re-open the project in order to install them: |
| 44 | |
| 45 | bazel run intellij/localconfig $(pwd) |
| Serge Bazanski | 31370b0 | 2021-01-07 16:31:14 +0100 | [diff] [blame] | 46 | |
| 47 | ## Metropolis |
| 48 | |
| 49 | ### Run a single node cluster |
| 50 | |
| 51 | Launch the node: |
| 52 | |
| 53 | bazel run //:launch |
| 54 | |
| 55 | Run a kubectl command: |
| 56 | |
| 57 | bazel run //metropolis/cli/dbg -- kubectl describe |
| 58 | |