| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 1 | # Monogon Monorepo |
| Leopold Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 2 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 3 | This 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 Schabel | 67f9d09 | 2019-10-22 15:41:42 +0200 | [diff] [blame] | 6 | |
| Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 7 | ## Environment |
| Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 8 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 9 | Our build environment required a working podman or docker environment. |
| 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 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 23 | This repository is compatible with the IntelliJ Bazel plugin, which enables |
| 24 | full autocompletion for external dependencies and generated code. All commands |
| 25 | run inside the container, and necessary paths are mapped into the container. |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 26 | |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 27 | The following steps are necessary: |
| 28 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 29 | - 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 Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 31 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 32 | - 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] | 33 | and restart IntelliJ: |
| 34 | |
| 35 | `-Dbazel.bep.path=/home/leopold/.cache/bazel-nxt` |
| 36 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 37 | - 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] | 38 | This is a wrapper that will execute Bazel inside the container. |
| 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 | - Use _File → Import Bazel project_... to create a new project from `.bazelproject`. |
| Leopold Schabel | 8b9c055 | 2019-11-15 14:07:45 +0100 | [diff] [blame] | 41 | |
| Leopold Schabel | a4edfa9 | 2020-12-13 18:55:21 +0100 | [diff] [blame] | 42 | 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] | 43 | |
| 44 | It's strongly recommend to use our project presets for file watchers and other IDE features. Run this command and |
| 45 | re-open the project in order to install them: |
| 46 | |
| 47 | bazel run intellij/localconfig $(pwd) |
| Serge Bazanski | 31370b0 | 2021-01-07 16:31:14 +0100 | [diff] [blame] | 48 | |
| 49 | ## Metropolis |
| 50 | |
| 51 | ### Run a single node cluster |
| 52 | |
| 53 | Launch the node: |
| 54 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 55 | scripts/bin/bazel run //:launch |
| Serge Bazanski | 31370b0 | 2021-01-07 16:31:14 +0100 | [diff] [blame] | 56 | |
| 57 | Run a kubectl command: |
| 58 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 59 | scripts/bin/bazel run //metropolis/cli/dbg -- kubectl describe |
| Serge Bazanski | 31370b0 | 2021-01-07 16:31:14 +0100 | [diff] [blame] | 60 | |
| Leopold Schabel | 55f01c3 | 2021-03-30 22:12:24 +0200 | [diff] [blame^] | 61 | Run tests: |
| 62 | |
| 63 | scripts/bin/bazel test //... |