Add nix shell informations

This commit is contained in:
Arnaud Delcasse 2024-11-27 19:21:16 +01:00
parent a68134667c
commit 3626abefe6
1 changed files with 36 additions and 24 deletions

View File

@ -13,21 +13,21 @@ Install Rancher Dektop or K3D or any other local Kubernetes. Make your Kubernete
Later, we will be using port 80 to access the cluster Ingress controller. On Linux, you must probably allow this. Later, we will be using port 80 to access the cluster Ingress controller. On Linux, you must probably allow this.
``` ```
$ sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80 sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
``` ```
To preserve this change across reboots as a custom kernel parameter setting, add the same command inside your /etc/sysctl.conf file (or a dedicated /etc/sysctl.d/xxxxx.conf). To preserve this change across reboots as a custom kernel parameter setting, add the same command inside your /etc/sysctl.conf file (or a dedicated /etc/sysctl.d/xxxxx.conf).
#### Rancher Desktop #### Rancher Desktop
See installation instructions here : https://docs.rancherdesktop.io/getting-started/installation See installation instructions here : <https://docs.rancherdesktop.io/getting-started/installation>
#### K3D #### K3D
Install K3D : Install K3D :
``` ```
$ curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
``` ```
Create config for the internal K3D registry to mirror your default docker images registry, for example in `/tmp/k3d-registry.yaml` : Create config for the internal K3D registry to mirror your default docker images registry, for example in `/tmp/k3d-registry.yaml` :
@ -41,11 +41,11 @@ mirrors:
Create cluster : Create cluster :
``` ```
$ k3d cluster create devcluster -p "80:80@loadbalancer" --registry-create devregistry:5000 --registry-config /tmp/k3d-registry.yaml k3d cluster create devcluster -p "80:80@loadbalancer" --registry-create devregistry:5000 --registry-config /tmp/k3d-registry.yaml
``` ```
### Install Tilt ### Install Tilt
[Follow instructions on Tilt documentation](https://docs.tilt.dev/install.html) [Follow instructions on Tilt documentation](https://docs.tilt.dev/install.html)
@ -77,7 +77,7 @@ MOBILITY_ACCOUNTS_IMAGE=my.own.registry/coopgo-platform/mobility-accounts
... ...
``` ```
#### K3D specific setup #### K3D specific setup
If you're using K3D, remove the registry part in the images (we'll use K3D local registry instead). It should look something like this : If you're using K3D, remove the registry part in the images (we'll use K3D local registry instead). It should look something like this :
@ -89,42 +89,42 @@ MOBILITY_ACCOUNTS_IMAGE=coopgo-platform/mobility-accounts
Then, set the K8S config to the dedicated overlay in k8s_config : Then, set the K8S config to the dedicated overlay in k8s_config :
```.env ```.env
K8S_CONFIG="k8s_config/k3d" K8S_CONFIG="k8s_config/k3d"
``` ```
### Set local hosts config ### Set local hosts config
Add `tilt-dev.svc.cluster.local parcoursmob.tilt-dev.svc.cluster.local mobility-accounts.tilt-dev.svc.cluster.local` to resolve `127.0.0.1` in your hosts config (`/etc/hosts` on Linux) Add `tilt-dev.svc.cluster.local parcoursmob.tilt-dev.svc.cluster.local mobility-accounts.tilt-dev.svc.cluster.local` to resolve `127.0.0.1` in your hosts config (`/etc/hosts` on Linux)
### Run the dev environment and start developing ### Run the dev environment and start developing
Run `tilt up` Run `tilt up`
After some time (you can see the services loading -or failing, if there is an error- through Tilt UI), PARCOURSMOB should be available on http://parcoursmob.tilt-dev.svc.cluster.local After some time (you can see the services loading -or failing, if there is an error- through Tilt UI), PARCOURSMOB should be available on <http://parcoursmob.tilt-dev.svc.cluster.local>
Once you can acess PARCOURSMOB UI, you can connect with the initially created user : Once you can acess PARCOURSMOB UI, you can connect with the initially created user :
- username: admin@parcoursmob.fr - username: <admin@parcoursmob.fr>
- password: parcoursmob - password: parcoursmob
Now, you're ready to code ! Now, you're ready to code !
## What it does ## What it does
Set up PARCOURSMOB along with the following dependencies : Set up PARCOURSMOB along with the following dependencies :
- COOPGO microservices : - COOPGO microservices :
- Mobility Accounts - Mobility Accounts
- Groups Management - Groups Management
- Fleets - Fleets
- Agenda - Agenda
- Carpool service (coming soon) - Carpool service (coming soon)
- Other software Dependencies : - Other software Dependencies :
- MongoDB (Next step, deploy with PostgreSQL as both should be supported) - MongoDB (Next step, deploy with PostgreSQL as both should be supported)
- Etcd for caching values - Etcd for caching values
- [Minio](https://min.io) to store files - [Minio](https://min.io) to store files
- [smtp4dev](https://github.com/rnwood/smtp4dev) to test outgoing emails - [smtp4dev](https://github.com/rnwood/smtp4dev) to test outgoing emails
Tilt handles livereloading Kubernetes pods when something changes in the code. You just have to checkout your code in the directory you've specified in .env (see quickstart), start developing on exsting microservices, and see the changes. Tilt handles livereloading Kubernetes pods when something changes in the code. You just have to checkout your code in the directory you've specified in .env (see quickstart), start developing on exsting microservices, and see the changes.
@ -137,3 +137,15 @@ By default, smtp4dev HTTP port is redirected to localhost:12345. You can change
```.env ```.env
SMTP4DEV_LOCAL_PORT=12345 SMTP4DEV_LOCAL_PORT=12345
``` ```
## Use Nix shell to start easily
You can use the "nix shell" (<https://nixos.org/>) utility to set your environment without having to install every dependency individually.
Install Nix, run `nix-shell`, and benefit from a shell providing :
- Tilt command
- K3D
- Protocol buffer dependencies (protoc, protoc-gen-go, protobuf) needed to build gRPC protocol buffer definitions in the Golang microservices with the COOPGO Platform
More to come to provide a full dev environment dedicated to the COOPGO Technical Platform