From dcc9e1b7a73ccb2570477ed7ef924aa1d1d0d1fb Mon Sep 17 00:00:00 2001 From: Teck Meng Date: Sun, 26 May 2024 21:38:13 +0800 Subject: [PATCH] Refactor docker-compose.yml to remove unnecessary network configurations --- docker-compose.yml | 35 +++++---- scripts/vackup.sh | 189 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+), 13 deletions(-) create mode 100755 scripts/vackup.sh diff --git a/docker-compose.yml b/docker-compose.yml index d0d6658..a8c462c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,10 +10,20 @@ x-environment: &default-environment STREAMLIT_BAI_SERVER_PORT: "8502" volumes: - production_traefik: {} - portainer_data: {} ghost_content: {} ghost_mysql: {} + jellyfin_config: {} + jellyfin_cache: {} + kestra_data: {} + minio_data: {} + neo4j_data: {} + neo4j_logs: {} + pgadmin: {} + privatebin_data: {} + production_traefik: {} + postgres_data: {} + portainer_data: {} + thelounge_data: {} services: postgres: @@ -27,7 +37,7 @@ services: LANG: en_US.utf8 TZ: Asia/Singapore volumes: - - ./postgres-data:/var/lib/postgresql/data + - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] interval: 30s @@ -52,7 +62,7 @@ services: TZ: Asia/Singapore user: "1000:1000" volumes: - - ./pgadmin:/var/lib/pgadmin + - pgadmin:/var/lib/pgadmin restart: unless-stopped depends_on: - postgres @@ -98,7 +108,7 @@ services: timeout: 5s retries: 5 volumes: - - "./minio-data:/data" + - minio_data:/data expose: - 9000 - 9001 @@ -126,8 +136,8 @@ services: depends_on: - traefik volumes: - - ./neo4j/data:/data - - ./neo4j/logs:/logs + - neo4j_data:/data + - neo4j_logs:/logs # Expose ports expose: - 7474 @@ -191,7 +201,7 @@ services: path: /tmp/kestra-wd/tmp url: http://kestra.furyhawk.lol/ volumes: - - ./kestra-data:/app/storage + - kestra_data:/app/storage - /var/run/docker.sock:/var/run/docker.sock - /tmp/kestra-wd:/tmp/kestra-wd depends_on: @@ -201,7 +211,6 @@ services: - "8081" networks: - net - - default cheatsheets-app: image: furyhawk/cheatsheets:${CHEATSHEETSTAG:-latest} @@ -268,8 +277,8 @@ services: container_name: jellyfin user: 1000:1000 volumes: - - ./jellyfin-config:/config - - ./jellyfin-cache:/cache + - jellyfin_config:/config + - jellyfin_cache:/cache - type: bind source: ~/media target: /media @@ -299,7 +308,7 @@ services: read_only: true user: "1000:1000" volumes: - - './privatebin-data:/srv/data' # data volume for pastes allows pastes + - privatebin_data:/srv/data # data volume for pastes allows pastes # to persist after container stop or restart - './config/conf.php:/srv/cfg/conf.php:ro' # second volume for custom configuration file expose: @@ -336,7 +345,7 @@ services: - 9000 restart: unless-stopped volumes: - - ~/.thelounge:/var/opt/thelounge # bind lounge config from the host's file system + - thelounge_data:/var/opt/thelounge # bind lounge config from the host's file system networks: - net diff --git a/scripts/vackup.sh b/scripts/vackup.sh new file mode 100755 index 0000000..168a963 --- /dev/null +++ b/scripts/vackup.sh @@ -0,0 +1,189 @@ +#!/bin/bash +# Docker Volume File Backup and Restore Tool +# Easily tar up a volume on a local (or remote) engine +# Inspired by CLIP from Lukasz Lach + +set -Eeo pipefail + +handle_error() { + exit_code=$? + if [ -n "${VACKUP_FAILURE_SCRIPT}" ]; then + /bin/bash "${VACKUP_FAILURE_SCRIPT}" "$1" $exit_code + fi + exit $exit_code +} + +trap 'handle_error $LINENO' ERR + +usage() { +cat <