gisaf-backend/deployment/README.md
phil c4dba88ed6
All checks were successful
/ test (push) Successful in 31s
/ build (push) Successful in 7s
Update doc
2024-12-27 19:11:15 +01:00

105 lines
2.5 KiB
Markdown

# Gisaf deployment / installation
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.
*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>
```
## Plain Kubernetes (no Helm)
The `kubernetes` directory contains files for deployment on Kubernetes.
The standard installation uses a namespace named `gisaf`.
The Kubernetes configuration is split in 2 files: `gisaf.yaml` and `config.yaml`
Deployment:
```sh
kubectl create namespace gisaf
kubectl apply -f config.yaml
kubectl apply -f gisaf.yaml
```
Update after modification on the server (frontend and backend):
```sh
kubectl --namespace gisaf rollout restart deployment gisaf-server-deployment
```
## Helm
The `helm` chart is in the directory named `helm`.
### Deploy on Kubernetes
Deploying with Helm on Kubernetes makes it straightforward to
run on cloud services.
```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
helm package helm
```
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
```