From de6a67b9beea72d0e70d11df59fa377cd4f834f6 Mon Sep 17 00:00:00 2001 From: Lucas Briese <lucas.briese@iem.fraunhofer.de> Date: Mon, 9 Dec 2024 09:10:24 +0100 Subject: [PATCH] doc: ktformat on save -> install & setup --- doc/install_and_setup.md | 52 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/doc/install_and_setup.md b/doc/install_and_setup.md index ecc8accc..2a8abc03 100644 --- a/doc/install_and_setup.md +++ b/doc/install_and_setup.md @@ -10,15 +10,15 @@ ## setup local folder structure 1. We have a recommended folder structure for developers, some scripts are expecting it: - ``` - opencode - ├── data-provider (this repo) - ├── dashboard - └── sublcuster1.yaml (optional kubeconfig) - ``` + ``` + opencode + ├── data-provider (this repo) + ├── dashboard + └── sublcuster1.yaml (optional kubeconfig) + ``` 2. [add ssh key for authentification and commit signing](https://gitlab.opencode.de/-/user_settings/ssh_keys) - - [local setup](https://docs.gitlab.com/ee/user/project/repository/signed_commits/ssh.html) - - Hint: if you have an issue that your signing key can't be found, check permissions and encoding (UTF-8). + - [local setup](https://docs.gitlab.com/ee/user/project/repository/signed_commits/ssh.html) + - Hint: if you have an issue that your signing key can't be found, check permissions and encoding (UTF-8). 3. install Docker 2.20.3+, we are using "docker compose" (v2) 4. for terminal stuff we suggest using the venv `source venv` @@ -27,23 +27,25 @@ 1. Download and install jdk-21, configure it on project level and for your gradle plugin 2. For code style and formatting, we are using [ktfmt](https://github.com/facebook/ktfmt?tab=readme-ov-file) - You can use it as an [IntelliJ plugin](https://plugins.jetbrains.com/plugin/14912-ktfmt) and configure it under Editor > ktfmt > `kotlinlang`. + - To execute it automatically on save it need to be enabled for every new project via _Settings → Editor → ktfmt Settings → Enable & Kotlinlang_ - You can also use it via the commands: `./gradlew ktfmtCheck` `./gradlew ktfmtFormat` 3. copy `.env.template` to `.env`, fill and follow our tasks in `.env` file 4. We have a separate category `opencode` for gradle tasks, check it out with `./gradlew tasks` for opencode 5. The data-provider requires the database and you may want to run the dashboard - - recommended before: `./gradlew run-db run-dashboard` - - recommended: run it outside of a container from terminal: - 1. `source venv` - - loads every `.env` entry as environment variable - - provides some alias - 2. `gradlew` which defaults to `./gradlew run` - - run data-provider inside of docker with `./gradlew run-container` or `docker compose up --build data-provider` - - you can ignore the pull warning + - recommended before: `./gradlew run-db run-dashboard` + - recommended: run it outside of a container from terminal: + 1. `source venv` + - loads every `.env` entry as environment variable + - provides some alias + 2. `gradlew` which defaults to `./gradlew run` + - run data-provider inside of docker with `./gradlew run-container` or `docker compose up --build data-provider` + - you can ignore the pull warning 6. verify it by checking the [dashboard on port 5000](localhost:5000), after a few seconds there should be example projects #### setup IntelliJ Ultimate for debugging IntelliJ Ultimate provides support for Spring Boot and has the best support for Kotlin. + 1. read and follow setup IDE 2. in `.run` is a default configurations to run and debug the application - start the database via gradle task `run-db` @@ -52,7 +54,7 @@ IntelliJ Ultimate provides support for Spring Boot and has the best support for ### access database - local database, for IntelliJ Ultimate you can connect to the `local` database via the right side of Tool window bars `Database` - - copy source below and choose `New` → `Import from Clipboard` + - copy source below and choose `New` → `Import from Clipboard` - You may need to install the driver at the bottom ``` #DataSourceSettings# @@ -66,17 +68,17 @@ IntelliJ Ultimate provides support for Spring Boot and has the best support for ### setup kubernetes 1. [Get the kubernetes version of our cluster:](https://kommone.cva-12889ja7.wizardtales.net/dashboard/c/c-gqst2/explorer#cluster-events) - - e.g. Kubernetes Version: v1.25.12 - - the used provider could be relevant later, e.g. RKE1 = Rancher Kubernetes Engine 1 + - e.g. Kubernetes Version: v1.25.12 + - the used provider could be relevant later, e.g. RKE1 = Rancher Kubernetes Engine 1 2. K8s support only one minor version step, so for 1.25 you can at max use kubectl 1.26 (e.g. v1.26.15) - - install via: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ - - depending on your installation route you may need: [github release](https://github.com/kubernetes/kubernetes/releases) + - install via: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ + - depending on your installation route you may need: [github release](https://github.com/kubernetes/kubernetes/releases) 3. download the KubeConfig file `subcluster1.yaml` from [Rancher dashboard](https://kommone.cva-12889ja7.wizardtales.net/dashboard/c/c-gqst2/explorer) - - use your config via `export KUBECONFIG=/$HOME/Downloads/subcluster1.yaml` - - or providing it via: `--kubeconfig` - - or move/rename this file to `~/.kube/config` + - use your config via `export KUBECONFIG=/$HOME/Downloads/subcluster1.yaml` + - or providing it via: `--kubeconfig` + - or move/rename this file to `~/.kube/config` 4. validate if your config got picked up, is this command successful?: `kubectl --namespace fraunhofer get pods` - - if you using the OpenCoDE venv just use `dev get pods` or `prod get pods` + - if you using the OpenCoDE venv just use `dev get pods` or `prod get pods` 5. (optional) [install bash completion for kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#enable-shell-autocompletion) - global installation `kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl-1.26` -- GitLab