2024-12-27 19:11:15 +01:00
|
|
|
# Gisaf deployment / installation
|
2024-12-27 06:09:14 +01:00
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
This documentation covers the specifics of Gisaf deployment, but
|
|
|
|
it does no cover application configuration details,
|
|
|
|
the set up of a public facing web server handling dns domain / https security.
|
2024-12-27 06:09:14 +01:00
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
*Gisaf* is shipped as containers for easy and effective installation,
|
|
|
|
and packages to deploy them for different environments.
|
|
|
|
|
|
|
|
There are 4 containers:
|
|
|
|
|
|
|
|
- Frontend (Angular build: static files, served by an nginx process,
|
|
|
|
eventually forwarding requests to the backend)
|
|
|
|
- Backend (Python server)
|
|
|
|
- Postgis database server
|
|
|
|
- Redis server
|
|
|
|
|
|
|
|
Commands below assume that they are run from their respective directories
|
|
|
|
(`deployment/systemd`, `deployment/kubernetes`, ...).
|
|
|
|
|
|
|
|
## Systemd
|
|
|
|
|
|
|
|
With the help of *podman*, systemd can handle starting/restarting services, etc,
|
|
|
|
even with a non-privileged user.
|
|
|
|
|
|
|
|
The 4 containers are in the same *pod*, as it is meant primarily for a lightweight
|
|
|
|
production environment, but this can be easily adapted.
|
|
|
|
|
|
|
|
The `deployment/systemd` directory contains files used for running *Gisaf* with Systemd.
|
|
|
|
Podman is used to facilitate the creation of the relevant services.
|
|
|
|
|
|
|
|
### Deployment
|
|
|
|
|
|
|
|
```sh
|
|
|
|
cp -r * $HOME/.config/containers/systemd/
|
|
|
|
systemctl --user daemon-reload
|
|
|
|
systemctl --user start gisaf-pod.service
|
|
|
|
```
|
|
|
|
|
|
|
|
Environment variables for the Gisaf configuration can be added
|
|
|
|
in the `gisaf-backend.container` file.
|
|
|
|
|
|
|
|
Note that starting on system boot requires the user to be enabled accordingly with:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
sudo loginctl enable-linger <username>
|
|
|
|
```
|
2024-12-27 06:09:14 +01:00
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
## Plain Kubernetes (no Helm)
|
2024-12-27 06:09:14 +01:00
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
The `kubernetes` directory contains files for deployment on Kubernetes.
|
2024-12-27 06:09:14 +01:00
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
The standard installation uses a namespace named `gisaf`.
|
2024-12-27 06:09:14 +01:00
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
The Kubernetes configuration is split in 2 files: `gisaf.yaml` and `config.yaml`
|
|
|
|
|
|
|
|
Deployment:
|
2024-12-27 06:09:14 +01:00
|
|
|
|
|
|
|
```sh
|
|
|
|
kubectl create namespace gisaf
|
|
|
|
kubectl apply -f config.yaml
|
2024-12-27 19:11:15 +01:00
|
|
|
kubectl apply -f gisaf.yaml
|
2024-12-27 06:09:14 +01:00
|
|
|
```
|
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
Update after modification on the server (frontend and backend):
|
2024-12-27 06:09:14 +01:00
|
|
|
|
|
|
|
```sh
|
|
|
|
kubectl --namespace gisaf rollout restart deployment gisaf-server-deployment
|
|
|
|
```
|
|
|
|
|
|
|
|
## Helm
|
|
|
|
|
|
|
|
The `helm` chart is in the directory named `helm`.
|
|
|
|
|
|
|
|
### Deploy on Kubernetes
|
|
|
|
|
2024-12-27 19:11:15 +01:00
|
|
|
Deploying with Helm on Kubernetes makes it straightforward to
|
|
|
|
run on cloud services.
|
|
|
|
|
2024-12-27 06:09:14 +01:00
|
|
|
```sh
|
|
|
|
kubectl create namespace gisaf
|
|
|
|
helm install gisaf helm
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Update
|
|
|
|
|
|
|
|
```sh
|
|
|
|
helm upgrade gisaf helm
|
|
|
|
```
|
|
|
|
|
|
|
|
### Publish the Helm chart
|
|
|
|
|
|
|
|
First, build the Helm package:
|
|
|
|
|
|
|
|
```sh
|
2024-12-27 17:53:03 +01:00
|
|
|
helm package helm
|
2024-12-27 06:09:14 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
Then upload it:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
helm --user phil:<password> -X POST \
|
|
|
|
--upload-file gisaf-0.1.0.tgz \
|
|
|
|
https://code.philo.ydns.eu/api/packages/philorg/helm/api/charts
|
|
|
|
```
|