From 415b47621f53029ddb1d7a3cc456e67a6176a132 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 9 Jan 2023 15:59:36 +0100 Subject: [PATCH] Implemented restart procedures --- README.md | 12 ++++++++++++ .../docker-funkwhale/templates/docker-compose.yml.j2 | 12 ++++++------ .../docker-pixelfed/templates/docker-compose.yml.j2 | 4 ++-- .../templates/docker-compose.yml.j2 | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3765ad97..0ec7323a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Server-Playbook [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) + ## Description Ansible script to manage servers. @@ -13,7 +14,18 @@ The system use the following role namings: |docker-|applications which run on docker containers on the system| ## Debug + ### Cleanup docker ``bash docker stop $(docker ps -aq); docker rm $(docker ps -aq); docker volume rm $(docker volume ls -q); `` + +### Restart + +To mercifull restart the server and to prevent data lost type in: + +``bash +docker stop $(docker ps -a -q) && systemctl stop docker && shutdown -r +2 "The system will shutdown in 2 minutes" +`` + +May it's neccessary to restart some of the the docker containers manual afterwards. diff --git a/roles/docker-funkwhale/templates/docker-compose.yml.j2 b/roles/docker-funkwhale/templates/docker-compose.yml.j2 index ba30a0a7..9f63ce78 100644 --- a/roles/docker-funkwhale/templates/docker-compose.yml.j2 +++ b/roles/docker-funkwhale/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: "3" services: postgres: - restart: unless-stopped + restart: always env_file: .env environment: - "POSTGRES_HOST_AUTH_METHOD=trust" @@ -11,14 +11,14 @@ services: - database:/var/lib/postgresql/data redis: - restart: unless-stopped + restart: always env_file: .env image: redis:7-alpine volumes: - redis:/data celeryworker: - restart: unless-stopped + restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: - postgres @@ -31,7 +31,7 @@ services: - "data:${MEDIA_ROOT}" celerybeat: - restart: unless-stopped + restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: - postgres @@ -40,7 +40,7 @@ services: command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO api: - restart: unless-stopped + restart: always image: funkwhale/api:${FUNKWHALE_VERSION:-latest} depends_on: - postgres @@ -53,7 +53,7 @@ services: - "5000" front: - restart: unless-stopped + restart: always image: funkwhale/front:${FUNKWHALE_VERSION:-latest} depends_on: - api diff --git a/roles/docker-pixelfed/templates/docker-compose.yml.j2 b/roles/docker-pixelfed/templates/docker-compose.yml.j2 index 72df6e12..239830b9 100644 --- a/roles/docker-pixelfed/templates/docker-compose.yml.j2 +++ b/roles/docker-pixelfed/templates/docker-compose.yml.j2 @@ -3,7 +3,7 @@ version: '2' services: application: image: zknt/pixelfed - restart: unless-stopped + restart: always logging: driver: journald env_file: @@ -18,7 +18,7 @@ services: - redis worker: image: zknt/pixelfed - restart: unless-stopped + restart: always logging: driver: journald env_file: diff --git a/roles/docker-roulette-wheel/templates/docker-compose.yml.j2 b/roles/docker-roulette-wheel/templates/docker-compose.yml.j2 index d55d4231..4a44adb6 100644 --- a/roles/docker-roulette-wheel/templates/docker-compose.yml.j2 +++ b/roles/docker-roulette-wheel/templates/docker-compose.yml.j2 @@ -6,4 +6,4 @@ services: context: . ports: - 127.0.0.1:{{http_port}}:8080 - restart: unless-stopped \ No newline at end of file + restart: always \ No newline at end of file