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
#### Install plugin php for elasticsearch
./docker.sh install
```bash
./docker.sh install
```
#### Build image
./docker.sh build
```bash
./docker.sh build
```
or
./docker.sh build-no-cache
```bash
./docker.sh build-no-cache
```
### Start
./docker.sh start
```bash
./docker.sh start
```
#### Check
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
docker exec wwwgmo-php-fpm curl -s -u elastic:<ELASTIC_PASSWORD> http://wwwgmo-elasticsearch:9200/_cluster/health?pretty
```bash
docker exec wwwgmo-mariadb mysql -uroot -p<MYSQL_ROOT_PASSWORD> mysql -e 'SELECT user,host FROM mysql.user;'
```
```bash
docker exec wwwgmo-elasticsearch curl -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
@ -65,22 +69,22 @@ or
You need credential to pull an image from private registry.
Create or modify the secret
```
kubectl create secret docker-registry secret-regcred --dry-run \
```bash
kubectl create secret docker-registry secret-regcred --dry-run=client \
--docker-server=https://index.docker.io/v1/ \
--docker-username=<username> \
--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
cat certs/gmolab.net.key | base64 -w0
copy the base64 result into file `values-secrets-kXs.yaml` in ssl_key key
cat certs/gmolab.net.crt | base64 -w0
copy the base64 result into file `values-config-kXs.yaml` in ssl_crt key
```bash
cat certs/gmolab.net.key | base64 -w0
```
copy the base64 result into file `values-secrets.yaml` in ssl_key key
```bash
cat certs/gmolab.net.crt | base64 -w0
```
copy the base64 result into file `values-config.yaml` in ssl_crt key
### 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 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.
./deploy.md -n wwwgmo -k k3s
```bash
./deploy.md -n wwwgmo -k k3s
```
## Manual deployment
### Set kubesystem config
rm -f $HOST/.kube/config
```bash
rm -f $HOME/.kube/config
```
for **k3s**
ln -s $HOST/.kube/k3s $HOST/.kube/config
```bash
ln -s $HOME/.kube/k3s $HOST/.kube/config
```
for **k8s**
ln -s $HOST/.kube/k8s $HOST/.kube/config
```bash
ln -s $HOST/.kube/k8s $HOST/.kube/config
```
### Set namespace and kube system
export NS=wwwgmo
export KUBE_SYS=k3s|k8s
```bash
export NS=wwwgmo
export KUBE_SYS=k3s|k8s
```
### Test template
helm template $NS --set kube=$KUBE_SYS ./helm --values=./helm/values-configs.yaml --values=./helm/values-secrets.yaml --namespace $NS
```bash
helm template $NS --set kube=$KUBE_SYS ./helm --values=./helm/values-configs.yaml --values=./helm/values-secrets.yaml --namespace $NS
```
### Chart deployment
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
```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
```
## Remove
helm uninstall $NS -n $NS
kubectl delete namespaces $NS
```bash
helm uninstall $NS -n $NS
kubectl delete namespaces $NS
```
## NOTES
### 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
kubectl create job -n $NS --from=cronjob/cronjob-mariadb-backupdb dbbackup-$(date +%Y-%m-%d-%H-%M-%S)
```bash
kubectl create job -n $NS --from=cronjob/cronjob-mariadb-backupdb dbbackup-$(date +%Y-%m-%d-%H-%M-%S)
```
## Database
Not necessary because created during deployment. We leave the procedure below for information
First export NS environment variable
export NS=<your_namespace>
```bash
export NS=<your_namespace>
```
You can use `createDBOnKube.sh` or create manually with below commands
#### Create user