Compare commits
No commits in common. "76f49f7d1e6f65f01409bdcaa9691aa0033c13cc" and "bb0fe1ee9fd75e61ffd4d716a88025bcc8b37948" have entirely different histories.
76f49f7d1e
...
bb0fe1ee9f
77
README.md
77
README.md
|
@ -2,56 +2,15 @@
|
||||||
|
|
||||||
Local dev environment for the COOPGO Technical Platform, using [Tilt](https://tilt.dev) and a local Kubernetes cluster (such as [Rancher Desktop](https://rancherdesktop.io/), K3D, ...)
|
Local dev environment for the COOPGO Technical Platform, using [Tilt](https://tilt.dev) and a local Kubernetes cluster (such as [Rancher Desktop](https://rancherdesktop.io/), K3D, ...)
|
||||||
|
|
||||||
Tested with Rancher Desktop and K3D.
|
Tested with Rancher Desktop.
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
### Install local cluster
|
1. Install Rancher Dektop or K3D or any other local Kubernetes. Make your Kubernetes context point to this cluster
|
||||||
|
|
||||||
Install Rancher Dektop or K3D or any other local Kubernetes. Make your Kubernetes context point to this cluster
|
2. [Install Tilt](https://docs.tilt.dev/install.html)
|
||||||
|
|
||||||
Later, we will be using port 80 to access the cluster Ingress controller. On Linux, you must probably allow this.
|
3. Create a .env file and configure environment
|
||||||
|
|
||||||
```
|
|
||||||
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).
|
|
||||||
|
|
||||||
#### Rancher Desktop
|
|
||||||
|
|
||||||
See installation instructions here : https://docs.rancherdesktop.io/getting-started/installation
|
|
||||||
|
|
||||||
#### K3D
|
|
||||||
|
|
||||||
Install K3D :
|
|
||||||
|
|
||||||
```
|
|
||||||
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` :
|
|
||||||
|
|
||||||
```
|
|
||||||
mirrors:
|
|
||||||
docker.io:
|
|
||||||
endpoint:
|
|
||||||
- "git.coopgo.io"
|
|
||||||
```
|
|
||||||
|
|
||||||
Create cluster :
|
|
||||||
|
|
||||||
```
|
|
||||||
k3d cluster create devcluster -p "80:80@loadbalancer" --registry-create devregistry:5000 --registry-config /tmp/k3d-registry.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install Tilt
|
|
||||||
|
|
||||||
[Follow instructions on Tilt documentation](https://docs.tilt.dev/install.html)
|
|
||||||
|
|
||||||
### Set the environment
|
|
||||||
|
|
||||||
Create a .env file and configure environment
|
|
||||||
|
|
||||||
For example, to set the source code directories (see default values in Tiltfile) :
|
For example, to set the source code directories (see default values in Tiltfile) :
|
||||||
|
|
||||||
|
@ -72,36 +31,18 @@ ALLOWED_K8S_CONTEXT="k3d-devcluster"
|
||||||
You might also want to set the default container images used if/while your local source code folder doesn't exist.
|
You might also want to set the default container images used if/while your local source code folder doesn't exist.
|
||||||
|
|
||||||
```
|
```
|
||||||
PARCOURSMOB_IMAGE=coopgo-apps/parcoursmob@v1.2
|
PARCOURSMOB_IMAGE=my.own.registry/coopgo-platform/parcoursmob@v1.2
|
||||||
MOBILITY_ACCOUNTS_IMAGE=my.own.registry/coopgo-platform/mobility-accounts
|
MOBILITY_ACCOUNTS_IMAGE=my.own.registry/coopgo-platform/mobility-accounts
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
#### K3D specific setup
|
4. 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)
|
||||||
|
|
||||||
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 :
|
5. Run `tilt up`
|
||||||
|
|
||||||
```
|
6. 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
|
||||||
PARCOURSMOB_IMAGE=coopgo-apps/parcoursmob
|
|
||||||
MOBILITY_ACCOUNTS_IMAGE=coopgo-platform/mobility-accounts
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, set the K8S config to the dedicated overlay in k8s_config :
|
To have this work, make sure port 80 is unprivileged if you're using Linux. This is described in Rancher Desktop documentation. If you're using something else to run Kubernetes, make sure you have the right port forwarding and an Ingress controller on your cluster to target port 80 on localhost.
|
||||||
|
|
||||||
```
|
|
||||||
K8S_CONFIG="k8s_config/k3d"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 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)
|
|
||||||
|
|
||||||
### Run the dev environment and start developing
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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 :
|
||||||
|
|
||||||
|
|
11
Tiltfile
11
Tiltfile
|
@ -5,6 +5,13 @@ dotenv()
|
||||||
|
|
||||||
allowed_k8s_context = os.environ.get('ALLOWED_K8S_CONTEXT', 'rancher-desktop')
|
allowed_k8s_context = os.environ.get('ALLOWED_K8S_CONTEXT', 'rancher-desktop')
|
||||||
|
|
||||||
|
# parcoursmob_dir = os.path.realpath(os.environ.get('PARCOURSMOB_DIR', 'src/parcoursmob'))
|
||||||
|
# parcoursmob_theme_dir = os.path.realpath(os.environ.get('PARCOURSMOB_THEME_DIR', 'src/parcoursmob/themes/default'))
|
||||||
|
# mobility_accounts_dir = os.path.realpath(os.environ.get('MOBILITY_ACCOUNTS_DIR', 'src/mobility-accounts'))
|
||||||
|
# agenda_dir = os.path.realpath(os.environ.get('AGENDA_DIR', 'src/agenda'))
|
||||||
|
# fleets_dir = os.path.realpath(os.environ.get('FLEETS_DIR', 'src/fleets'))
|
||||||
|
# groups_management_dir = os.path.realpath(os.environ.get('GROUPS_MANAGEMENT_DIR', 'src/groups-management'))
|
||||||
|
|
||||||
parcoursmob_dir = os.environ.get('PARCOURSMOB_DIR', 'src/parcoursmob')
|
parcoursmob_dir = os.environ.get('PARCOURSMOB_DIR', 'src/parcoursmob')
|
||||||
parcoursmob_theme_dir = os.environ.get('PARCOURSMOB_THEME_DIR', 'src/parcoursmob/themes/default')
|
parcoursmob_theme_dir = os.environ.get('PARCOURSMOB_THEME_DIR', 'src/parcoursmob/themes/default')
|
||||||
mobility_accounts_dir = os.environ.get('MOBILITY_ACCOUNTS_DIR', 'src/mobility-accounts')
|
mobility_accounts_dir = os.environ.get('MOBILITY_ACCOUNTS_DIR', 'src/mobility-accounts')
|
||||||
|
@ -18,9 +25,9 @@ agenda_image = os.environ.get('AGENDA_IMAGE', 'git.coopgo.io/coopgo-platform/age
|
||||||
fleets_image = os.environ.get('FLEETS_IMAGE', 'git.coopgo.io/coopgo-platform/fleets')
|
fleets_image = os.environ.get('FLEETS_IMAGE', 'git.coopgo.io/coopgo-platform/fleets')
|
||||||
groups_management_image = os.environ.get('GROUPS_MANAGEMENT_IMAGE', 'git.coopgo.io/coopgo-platform/groups-management')
|
groups_management_image = os.environ.get('GROUPS_MANAGEMENT_IMAGE', 'git.coopgo.io/coopgo-platform/groups-management')
|
||||||
|
|
||||||
|
|
||||||
allow_k8s_contexts(allowed_k8s_context)
|
allow_k8s_contexts(allowed_k8s_context)
|
||||||
|
|
||||||
k8s_config = os.environ.get('K8S_CONFIG', 'k8s_config/dev')
|
|
||||||
|
|
||||||
if os.path.exists(parcoursmob_dir) and os.path.exists(parcoursmob_theme_dir):
|
if os.path.exists(parcoursmob_dir) and os.path.exists(parcoursmob_theme_dir):
|
||||||
parcoursmob_dir = os.path.realpath(parcoursmob_dir)
|
parcoursmob_dir = os.path.realpath(parcoursmob_dir)
|
||||||
|
@ -65,5 +72,5 @@ if os.path.exists(groups_management_dir):
|
||||||
print("Directory : {dir}".format(dir=groups_management_dir))
|
print("Directory : {dir}".format(dir=groups_management_dir))
|
||||||
deploy_go('groups-management', groups_management_dir, groups_management_image)
|
deploy_go('groups-management', groups_management_dir, groups_management_image)
|
||||||
|
|
||||||
k8s_yaml(kustomize(k8s_config))
|
k8s_yaml(kustomize('k8s_config/dev'))
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
resources:
|
|
||||||
- ../dev/
|
|
||||||
|
|
||||||
images:
|
|
||||||
- name: git.coopgo.io/coopgo-apps/parcoursmob
|
|
||||||
newName: "coopgo-apps/parcoursmob"
|
|
||||||
- name: git.coopgo.io/coopgo-platform/mobility-accounts
|
|
||||||
newName: "coopgo-platform/mobility-accounts"
|
|
||||||
- name: git.coopgo.io/coopgo-platform/fleets
|
|
||||||
newName: "coopgo-platform/fleets"
|
|
||||||
- name: git.coopgo.io/coopgo-platform/agenda
|
|
||||||
newName: "coopgo-platform/agenda"
|
|
Loading…
Reference in New Issue