mirror of
https://github.com/furyhawk/cloudy.git
synced 2026-05-22 07:56:49 +00:00
Refactor docker-compose.yml to remove unnecessary network configurations
This commit is contained in:
+22
-13
@@ -10,10 +10,20 @@ x-environment: &default-environment
|
|||||||
STREAMLIT_BAI_SERVER_PORT: "8502"
|
STREAMLIT_BAI_SERVER_PORT: "8502"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
production_traefik: {}
|
|
||||||
portainer_data: {}
|
|
||||||
ghost_content: {}
|
ghost_content: {}
|
||||||
ghost_mysql: {}
|
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:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
@@ -27,7 +37,7 @@ services:
|
|||||||
LANG: en_US.utf8
|
LANG: en_US.utf8
|
||||||
TZ: Asia/Singapore
|
TZ: Asia/Singapore
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres-data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -52,7 +62,7 @@ services:
|
|||||||
TZ: Asia/Singapore
|
TZ: Asia/Singapore
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./pgadmin:/var/lib/pgadmin
|
- pgadmin:/var/lib/pgadmin
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
@@ -98,7 +108,7 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
volumes:
|
volumes:
|
||||||
- "./minio-data:/data"
|
- minio_data:/data
|
||||||
expose:
|
expose:
|
||||||
- 9000
|
- 9000
|
||||||
- 9001
|
- 9001
|
||||||
@@ -126,8 +136,8 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- traefik
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- ./neo4j/data:/data
|
- neo4j_data:/data
|
||||||
- ./neo4j/logs:/logs
|
- neo4j_logs:/logs
|
||||||
# Expose ports
|
# Expose ports
|
||||||
expose:
|
expose:
|
||||||
- 7474
|
- 7474
|
||||||
@@ -191,7 +201,7 @@ services:
|
|||||||
path: /tmp/kestra-wd/tmp
|
path: /tmp/kestra-wd/tmp
|
||||||
url: http://kestra.furyhawk.lol/
|
url: http://kestra.furyhawk.lol/
|
||||||
volumes:
|
volumes:
|
||||||
- ./kestra-data:/app/storage
|
- kestra_data:/app/storage
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- /tmp/kestra-wd:/tmp/kestra-wd
|
- /tmp/kestra-wd:/tmp/kestra-wd
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -201,7 +211,6 @@ services:
|
|||||||
- "8081"
|
- "8081"
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
- default
|
|
||||||
|
|
||||||
cheatsheets-app:
|
cheatsheets-app:
|
||||||
image: furyhawk/cheatsheets:${CHEATSHEETSTAG:-latest}
|
image: furyhawk/cheatsheets:${CHEATSHEETSTAG:-latest}
|
||||||
@@ -268,8 +277,8 @@ services:
|
|||||||
container_name: jellyfin
|
container_name: jellyfin
|
||||||
user: 1000:1000
|
user: 1000:1000
|
||||||
volumes:
|
volumes:
|
||||||
- ./jellyfin-config:/config
|
- jellyfin_config:/config
|
||||||
- ./jellyfin-cache:/cache
|
- jellyfin_cache:/cache
|
||||||
- type: bind
|
- type: bind
|
||||||
source: ~/media
|
source: ~/media
|
||||||
target: /media
|
target: /media
|
||||||
@@ -299,7 +308,7 @@ services:
|
|||||||
read_only: true
|
read_only: true
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
volumes:
|
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
|
# to persist after container stop or restart
|
||||||
- './config/conf.php:/srv/cfg/conf.php:ro' # second volume for custom configuration file
|
- './config/conf.php:/srv/cfg/conf.php:ro' # second volume for custom configuration file
|
||||||
expose:
|
expose:
|
||||||
@@ -336,7 +345,7 @@ services:
|
|||||||
- 9000
|
- 9000
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
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:
|
networks:
|
||||||
- net
|
- net
|
||||||
|
|
||||||
|
|||||||
Executable
+189
@@ -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 <<EOF
|
||||||
|
|
||||||
|
"Docker Volume Backup". Replicates image management commands for volumes.
|
||||||
|
|
||||||
|
export/import copies files between a host tarball and a volume. For making
|
||||||
|
volume backups and restores.
|
||||||
|
|
||||||
|
save/load copies files between an image and a volume. For when you want to use
|
||||||
|
image registries as a way to push/pull volume data.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
vackup export VOLUME FILE
|
||||||
|
Creates a gzip'ed tarball in current directory from a volume
|
||||||
|
|
||||||
|
vackup import FILE VOLUME
|
||||||
|
Extracts a gzip'ed tarball into a volume
|
||||||
|
|
||||||
|
vackup save VOLUME IMAGE
|
||||||
|
Copies the volume contents to a busybox image in the /volume-data directory
|
||||||
|
|
||||||
|
vackup load IMAGE VOLUME
|
||||||
|
Copies /volume-data contents from an image to a volume
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd_export() {
|
||||||
|
VOLUME_NAME="$2"
|
||||||
|
FILE_NAME="$3"
|
||||||
|
|
||||||
|
if [ -z "$VOLUME_NAME" ] || [ -z "$FILE_NAME" ]; then
|
||||||
|
echo "Error: Not enough arguments"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME";
|
||||||
|
then
|
||||||
|
echo "Error: Volume $VOLUME_NAME does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: check if file exists on host, if it does
|
||||||
|
# create a option for overwrite and check if that's set
|
||||||
|
# TODO: if FILE_NAME starts with / we need to error out
|
||||||
|
# unless we can translate full file paths
|
||||||
|
|
||||||
|
if ! docker run --rm \
|
||||||
|
-v "$VOLUME_NAME":/vackup-volume \
|
||||||
|
-v "$(pwd)":/vackup \
|
||||||
|
busybox \
|
||||||
|
tar -zcvf /vackup/"$FILE_NAME" /vackup-volume;
|
||||||
|
then
|
||||||
|
echo "Error: Failed to start busybox backup container"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Successfully tar'ed volume $VOLUME_NAME into file $FILE_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_import() {
|
||||||
|
FILE_NAME="$2"
|
||||||
|
VOLUME_NAME="$3"
|
||||||
|
|
||||||
|
if [ -z "$VOLUME_NAME" ] || [ -z "$FILE_NAME" ]; then
|
||||||
|
echo "Error: Not enough arguments"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME";
|
||||||
|
then
|
||||||
|
echo "Error: Volume $VOLUME_NAME does not exist"
|
||||||
|
docker volume create "$VOLUME_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: check if file exists on host, if it does
|
||||||
|
# create a option for overwrite and check if that's set
|
||||||
|
# TODO: if FILE_NAME starts with / we need to error out
|
||||||
|
# unless we can translate full file paths
|
||||||
|
|
||||||
|
if ! docker run --rm \
|
||||||
|
-v "$VOLUME_NAME":/vackup-volume \
|
||||||
|
-v "$(pwd)":/vackup \
|
||||||
|
busybox \
|
||||||
|
tar -xvzf /vackup/"$FILE_NAME" -C /;
|
||||||
|
then
|
||||||
|
echo "Error: Failed to start busybox container"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Successfully unpacked $FILE_NAME into volume $VOLUME_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_save() {
|
||||||
|
VOLUME_NAME="$2"
|
||||||
|
IMAGE_NAME="$3"
|
||||||
|
|
||||||
|
if [ -z "$VOLUME_NAME" ] || [ -z "$IMAGE_NAME" ]; then
|
||||||
|
echo "Error: Not enough arguments"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME";
|
||||||
|
then
|
||||||
|
echo "Error: Volume $VOLUME_NAME does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker run \
|
||||||
|
-v "$VOLUME_NAME":/mount-volume \
|
||||||
|
busybox \
|
||||||
|
cp -Rp /mount-volume/. /volume-data/;
|
||||||
|
then
|
||||||
|
echo "Error: Failed to start busybox container"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONTAINER_ID=$(docker ps -lq)
|
||||||
|
|
||||||
|
docker commit -m "saving volume $VOLUME_NAME to /volume-data" "$CONTAINER_ID" "$IMAGE_NAME"
|
||||||
|
|
||||||
|
docker container rm "$CONTAINER_ID"
|
||||||
|
|
||||||
|
echo "Successfully copied volume $VOLUME_NAME into image $IMAGE_NAME, under /volume-data"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_load() {
|
||||||
|
IMAGE_NAME="$2"
|
||||||
|
VOLUME_NAME="$3"
|
||||||
|
|
||||||
|
if [ -z "$VOLUME_NAME" ] || [ -z "$IMAGE_NAME" ]; then
|
||||||
|
echo "Error: Not enough arguments"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker volume inspect --format '{{.Name}}' "$VOLUME_NAME";
|
||||||
|
then
|
||||||
|
echo "Volume $VOLUME_NAME does not exist, creating..."
|
||||||
|
docker volume create "$VOLUME_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker run --rm \
|
||||||
|
-v "$VOLUME_NAME":/mount-volume \
|
||||||
|
"$IMAGE_NAME" \
|
||||||
|
cp -Rp /volume-data/. /mount-volume/;
|
||||||
|
then
|
||||||
|
echo "Error: Failed to start container from $IMAGE_NAME"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Successfully copied /volume-data from $IMAGE_NAME into volume $VOLUME_NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
COMMAND="$1"
|
||||||
|
case "$COMMAND" in
|
||||||
|
export) cmd_export "$@" ;;
|
||||||
|
import) cmd_import "$@" ;;
|
||||||
|
save) cmd_save "$@" ;;
|
||||||
|
load) cmd_load "$@" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user