This commit is contained in:
Gilles Mouchet 2025-04-24 10:22:19 +02:00
parent 13f213a12b
commit 1f12d55ad0

124
README.md
View File

@ -19,27 +19,31 @@ Complete or modify the values according to your needs
### Build ### Build
#### Install plugin php for elasticsearch #### Install plugin php for elasticsearch
```bash
./docker.sh install ./docker.sh install
```
#### Build image #### Build image
```bash
./docker.sh build ./docker.sh build
```
or or
```bash
./docker.sh build-no-cache ./docker.sh build-no-cache
```
### Start ### Start
```bash
./docker.sh start ./docker.sh start
```
#### Check #### Check
```bash
docker exec wwwgmo-mariadb mysql -uroot -p<MYSQL_ROOT_PASSWORD> mysql -e 'SELECT user,host FROM mysql.user;' docker exec wwwgmo-mariadb mysql -uroot -p<MYSQL_ROOT_PASSWORD> mysql -e 'SELECT user,host FROM mysql.user;'
```
docker exec wwwgmo-elasticsearch curl -u elastic:<ELASTIC_PASSWORD> http://wwwgmo-elasticsearch:9200/_cluster/health?pretty ```bash
docker exec wwwgmo-elasticsearch curl -u elastic:<ELASTIC_PASSWORD> http://wwwgmo-elasticsearch:9200/_cluster/health?pretty
docker exec wwwgmo-php-fpm curl -s -u elastic:<ELASTIC_PASSWORD> http://wwwgmo-elasticsearch:9200/_cluster/health?pretty ```
```bash
docker exec wwwgmo-php-fpm curl -s -u elastic:<ELASTIC_PASSWORD> http://wwwgmo-elasticsearch:9200/_cluster/health?pretty
```
#### Access #### Access
@ -65,22 +69,22 @@ or
You need credential to pull an image from private registry. You need credential to pull an image from private registry.
Create or modify the secret Create or modify the secret
``` ```bash
kubectl create secret docker-registry secret-regcred --dry-run \ kubectl create secret docker-registry secret-regcred --dry-run=client \
--docker-server=https://index.docker.io/v1/ \ --docker-server=https://index.docker.io/v1/ \
--docker-username=<username> \ --docker-username=<username> \
--docker-password=<secret> \ --docker-password=<secret> \
--docker-email=<adress@sample.com> -o yaml > helm/template/site/secret-regcred.yaml --docker-email=<adress@sample.com> -o yaml > helm/template/secret-regcred.yaml
``` ```
### Certificats ### Certificats
```bash
cat certs/gmolab.net.key | base64 -w0 cat certs/gmolab.net.key | base64 -w0
```
copy the base64 result into file `values-secrets-kXs.yaml` in ssl_key key copy the base64 result into file `values-secrets.yaml` in ssl_key key
```bash
cat certs/gmolab.net.crt | base64 -w0 cat certs/gmolab.net.crt | base64 -w0
```
copy the base64 result into file `values-config-kXs.yaml` in ssl_crt key copy the base64 result into file `values-config.yaml` in ssl_crt key
### Docker image version ### Docker image version
@ -91,54 +95,54 @@ In the `helm/Chart.yaml` file, the `appVersion` value must match the version of
This is the recommended way This is the recommended way
>This script builds the docker image based on the Kubernetes VM architecture (AMD64 or ARM64). At each deployment the minor version of the image is incremented by 1. >This script builds the docker image based on the Kubernetes VM architecture (AMD64 or ARM64). At each deployment the minor version of the image is incremented by 1.
```bash
./deploy.md -n wwwgmo -k k3s ./deploy.md -n wwwgmo -k k3s
```
## Manual deployment ## Manual deployment
### Set kubesystem config ### Set kubesystem config
```bash
rm -f $HOST/.kube/config rm -f $HOME/.kube/config
```
for **k3s** for **k3s**
```bash
ln -s $HOST/.kube/k3s $HOST/.kube/config ln -s $HOME/.kube/k3s $HOST/.kube/config
```
for **k8s** for **k8s**
```bash
ln -s $HOST/.kube/k8s $HOST/.kube/config ln -s $HOST/.kube/k8s $HOST/.kube/config
```
### Set namespace and kube system ### Set namespace and kube system
```bash
export NS=wwwgmo export NS=wwwgmo
export KUBE_SYS=k3s|k8s export KUBE_SYS=k3s|k8s
```
### Test template ### Test template
```bash
helm template $NS --set kube=$KUBE_SYS ./helm --values=./helm/values-configs.yaml --values=./helm/values-secrets.yaml --namespace $NS helm template $NS --set kube=$KUBE_SYS ./helm --values=./helm/values-configs.yaml --values=./helm/values-secrets.yaml --namespace $NS
```
### Chart deployment ### Chart deployment
```bash
helm upgrade $NS --set kube=$KUBE_SYS ./helm --install --atomic --cleanup-on-fail --values=./helm/values-configs.yaml --values=./helm/values-secrets.yaml --namespace $NS --create-namespace helm upgrade $NS --set kube=$KUBE_SYS ./helm --install --atomic --cleanup-on-fail --values=./helm/values-configs.yaml --values=./helm/values-secrets.yaml --namespace $NS --create-namespace
```
## Remove ## Remove
```bash
helm uninstall $NS -n $NS helm uninstall $NS -n $NS
kubectl delete namespaces $NS kubectl delete namespaces $NS
```
## NOTES ## NOTES
### Cronjob ### Cronjob
When we deploy manually (I do not why) you must trig manually the cronjob to make a DB backup to termine correctly the helm command When we deploy manually (I do not why) you must trig manually the cronjob to make a DB backup to termine correctly the helm command
```bash
kubectl create job -n $NS --from=cronjob/cronjob-mariadb-backupdb dbbackup-$(date +%Y-%m-%d-%H-%M-%S) kubectl create job -n $NS --from=cronjob/cronjob-mariadb-backupdb dbbackup-$(date +%Y-%m-%d-%H-%M-%S)
```
## Database ## Database
Not necessary because created during deployment. We leave the procedure below for information Not necessary because created during deployment. We leave the procedure below for information
First export NS environment variable First export NS environment variable
```bash
export NS=<your_namespace> export NS=<your_namespace>
```
You can use `createDBOnKube.sh` or create manually with below commands You can use `createDBOnKube.sh` or create manually with below commands
#### Create user #### Create user