Commit 7e308433 authored by David Foucher's avatar David Foucher

Add restart script for troubleshooting and script to update web

parent b551a9f1
Pipeline #3457 passed with stages
in 6 minutes and 13 seconds
......@@ -125,13 +125,11 @@ OLD_VERSION and BACK_VERSION must be compatible
### Update API
1. Update `VERSION` in `.env` file
2. Update API, in `docker` folder process : `update_api.sh trefle`
2. Update API, in `docker` folder process : `./update_api.sh trefle`
### Update WEB
1. Update `BACK_VERSION` in `.env` file
2. Update API, in `docker` folder process : `docker-compose up -d --no-deps`
3. Reload authorisations.csv : `sh update_access.sh`
2. Update the website, in `docker` folder process : `./update_web.sh`
## Update acces
......@@ -142,3 +140,9 @@ logs are in docker/logs
Format for authorisations.csv :
`email,password,files`
Note: multiple files must be separated with a "|"
## Troubleshooting
Try to restart the stack with `./restart_stack.sh`
#!/bin/bash
OPTION=$1
date >> update.log
echo $* >> update.log
if [ -n "$OPTION" ]
then
if [ "$OPTION" == "build-recreate" ]
then
echo "[INIT] Force rebuild and recreate new container" | tee -a update.log
docker-compose up -d --build --force-recreate \
|| { echo "[FAILED] Can't rebuild and recreate container - try ./restart_stack.sh build-local" | tee -a update.log; exit 1; }
echo "[DONE] All container rebuilt and restarted" | tee -a update.log
elif [ "$OPTION" == "build-local" ]
then
echo "[INIT] Force rebuild locally and recreate new container" | tee -a update.log
docker-compose -f docker-compose.yml -f docker-compose.override-build.yml up -d --build --force-recreate \
|| { echo "[FAILED] Can't rebuild and recreate container localy - try ./restart_stack.sh restart-docker" | tee -a update.log; exit 1; }
echo "[DONE] All container locally rebuilt and restarted" | tee -a update.log
elif [ "$OPTION" == "restart-docker" ]
then
echo "[INIT] Force restart docker" | tee -a update.log
systemctl restart docker.service && ./restart_stack.sh \
|| { echo "[FAILED] Can't restart docker service and rebuild trefle stack" | tee -a update.log; exit 1; }
echo "[DONE] Docker service restarted" | tee -a update.log
fi
else
echo "[INIT] restart container" | tee -a update.log
docker-compose restart \
|| { echo "[FAILED] Can't restart container - try ./restart_stack.sh build-recreate" | tee -a update.log; exit 1; }
echo "[DONE] All container restarted" | tee -a update.log
fi
exit 0;
#!/bin/bash
SERVICE_NAME=${1?"Usage: docker_update [trefle|trefle-old]"}
SERVICE_NAME=${1?"Usage: ./update_api.sh [trefle|trefle-old]"}
date >> update.log
echo $* >> update.log
......
#!/bin/bash
date >> update.log
echo $* >> update.log
echo "[INIT] rebuild"
docker-compose up -d --build --no-deps web \
|| { echo "[FAILED] Can't rebuild web container" | tee -a update.log; exit 1; }
echo "[INIT] refresh access" | tee -a update.log
./update_access.sh \
|| { echo "[FAILED] Can't refresh access" | tee -a update.log; exit 1; } \
echo "[DONE] refresh access" | tee -a update.log \
&& exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment