From 927522a5a86d9f65595d9f36d340afe4e2d08bf7 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Fri, 23 Aug 2024 13:58:01 +0200 Subject: [PATCH] Rework project structure Signed-off-by: Bensuperpc --- Makefile | 24 ++++++++++--------- docker-compose.networks.yml | 4 ---- docker-compose.volumes.yml | 3 --- .../caddy/config}/Caddyfile | 0 .../caddy/config}/bensuperpc.com/Caddyfile | 0 .../caddy/config}/bensuperpc.fr/Caddyfile | 0 .../caddy/config}/bensuperpc.net/Caddyfile | 0 .../caddy/config}/bensuperpc.org/Caddyfile | 0 .../caddy/config}/bensuperpc.ovh/Caddyfile | 0 .../caddy/docker-compose.caddy.yml | 9 +++++-- {env => infrastructure/caddy/env}/caddy.env | 0 .../gitea/config}/gitea_runner/config.yaml | 0 .../gitea/docker-compose.gitea.yml | 8 +++---- .../gitea/env}/gitea-runner.env | 0 {env => infrastructure/gitea/env}/gitea.env | 0 .../gitea/env}/gitea_db.env | 0 .../jellyfin/docker-compose.jellyfin.yml | 2 ++ infrastructure/jellyfin/env/jellyfin.env | 0 .../docker-compose.psitransfer.yml | 2 +- .../psitransfer/env}/psitransfer.env | 0 .../docker-compose.qbittorrent.yml | 2 +- .../qbittorrent/env}/qbittorrent.env | 0 .../syncthing/docker-compose.syncthing.yml | 2 +- .../syncthing/env}/syncthing.env | 0 .../docker-compose.transmission.yml | 2 +- .../transmission/env}/transmission.env | 0 .../docker-compose.uptime-kuma.yml | 4 ++++ .../watchtower/docker-compose.watchtower.yml | 0 .../wordpress/config}/wordpress/php.ini | 0 .../wordpress/docker-compose.adminer.yml | 2 +- .../wordpress/docker-compose.wordpress.yml | 8 +++---- .../wordpress/env}/adminer.env | 0 .../wordpress/env}/backup.env | 0 .../wordpress/env}/wordpress.env | 0 .../wordpress/env}/wordpress_db.env | 0 35 files changed, 39 insertions(+), 33 deletions(-) delete mode 100644 docker-compose.networks.yml delete mode 100644 docker-compose.volumes.yml rename {caddy => infrastructure/caddy/config}/Caddyfile (100%) rename {caddy => infrastructure/caddy/config}/bensuperpc.com/Caddyfile (100%) rename {caddy => infrastructure/caddy/config}/bensuperpc.fr/Caddyfile (100%) rename {caddy => infrastructure/caddy/config}/bensuperpc.net/Caddyfile (100%) rename {caddy => infrastructure/caddy/config}/bensuperpc.org/Caddyfile (100%) rename {caddy => infrastructure/caddy/config}/bensuperpc.ovh/Caddyfile (100%) rename docker-compose.caddy.yml => infrastructure/caddy/docker-compose.caddy.yml (82%) rename {env => infrastructure/caddy/env}/caddy.env (100%) rename {config => infrastructure/gitea/config}/gitea_runner/config.yaml (100%) rename docker-compose.gitea.yml => infrastructure/gitea/docker-compose.gitea.yml (89%) rename {env => infrastructure/gitea/env}/gitea-runner.env (100%) rename {env => infrastructure/gitea/env}/gitea.env (100%) rename {env => infrastructure/gitea/env}/gitea_db.env (100%) rename docker-compose.jellyfin.yml => infrastructure/jellyfin/docker-compose.jellyfin.yml (95%) create mode 100644 infrastructure/jellyfin/env/jellyfin.env rename docker-compose.psitransfer.yml => infrastructure/psitransfer/docker-compose.psitransfer.yml (93%) rename {env => infrastructure/psitransfer/env}/psitransfer.env (100%) rename docker-compose.qbittorrent.yml => infrastructure/qbittorrent/docker-compose.qbittorrent.yml (92%) rename {env => infrastructure/qbittorrent/env}/qbittorrent.env (100%) rename docker-compose.syncthing.yml => infrastructure/syncthing/docker-compose.syncthing.yml (92%) rename {env => infrastructure/syncthing/env}/syncthing.env (100%) rename docker-compose.transmission.yml => infrastructure/transmission/docker-compose.transmission.yml (93%) rename {env => infrastructure/transmission/env}/transmission.env (100%) rename docker-compose.uptime-kuma.yml => infrastructure/uptime-kuma/docker-compose.uptime-kuma.yml (85%) rename docker-compose.watchtower.yml => infrastructure/watchtower/docker-compose.watchtower.yml (100%) rename {config => infrastructure/wordpress/config}/wordpress/php.ini (100%) rename docker-compose.adminer.yml => infrastructure/wordpress/docker-compose.adminer.yml (89%) rename docker-compose.wordpress.yml => infrastructure/wordpress/docker-compose.wordpress.yml (86%) rename {env => infrastructure/wordpress/env}/adminer.env (100%) rename {env => infrastructure/wordpress/env}/backup.env (100%) rename {env => infrastructure/wordpress/env}/wordpress.env (100%) rename {env => infrastructure/wordpress/env}/wordpress_db.env (100%) diff --git a/Makefile b/Makefile index 0a3efce..5c4da8b 100644 --- a/Makefile +++ b/Makefile @@ -18,49 +18,51 @@ PROFILE_CMD := $(addprefix --profile ,$(PROFILES)) # gitea-runner transmission -COMPOSE_FILES := $(shell find docker-compose*.yml | sed -e 's/^/--file /') +COMPOSE_FILES := $(shell find . -name 'docker-compose*.yml' -type f | sed -e 's/^/--file /') + +COMPOSE_DIR := --project-directory ./infrastructure .PHONY: build all all: start .PHONY: build build: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) build + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) build .PHONY: start start: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) up -d + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) up -d .PHONY: start-at start-at: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) up + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) up .PHONY: docker-check docker-check: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) config + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) config .PHONY: stop stop: down .PHONY: down down: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) down + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) down .PHONY: restart restart: stop start .PHONY: logs logs: - docker compose $(COMPOSE_FILES) logs + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) logs .PHONY: state state: - docker compose $(COMPOSE_FILES) ps - docker compose $(COMPOSE_FILES) top + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) ps + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) top .PHONY: update-docker update-docker: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) pull + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) pull .PHONY: update update: update-docker @@ -73,4 +75,4 @@ clean: .PHONY: purge purge: - docker compose $(COMPOSE_FILES) $(PROFILE_CMD) down -v --rmi all \ No newline at end of file + docker compose $(COMPOSE_DIR) $(COMPOSE_FILES) $(PROFILE_CMD) down -v --rmi all \ No newline at end of file diff --git a/docker-compose.networks.yml b/docker-compose.networks.yml deleted file mode 100644 index 8e8c41b..0000000 --- a/docker-compose.networks.yml +++ /dev/null @@ -1,4 +0,0 @@ -networks: - infra-network: - driver: bridge - name: infra-network diff --git a/docker-compose.volumes.yml b/docker-compose.volumes.yml deleted file mode 100644 index a47a3b5..0000000 --- a/docker-compose.volumes.yml +++ /dev/null @@ -1,3 +0,0 @@ -volumes: - uptimekuma_data: - name: uptimekuma_data diff --git a/caddy/Caddyfile b/infrastructure/caddy/config/Caddyfile similarity index 100% rename from caddy/Caddyfile rename to infrastructure/caddy/config/Caddyfile diff --git a/caddy/bensuperpc.com/Caddyfile b/infrastructure/caddy/config/bensuperpc.com/Caddyfile similarity index 100% rename from caddy/bensuperpc.com/Caddyfile rename to infrastructure/caddy/config/bensuperpc.com/Caddyfile diff --git a/caddy/bensuperpc.fr/Caddyfile b/infrastructure/caddy/config/bensuperpc.fr/Caddyfile similarity index 100% rename from caddy/bensuperpc.fr/Caddyfile rename to infrastructure/caddy/config/bensuperpc.fr/Caddyfile diff --git a/caddy/bensuperpc.net/Caddyfile b/infrastructure/caddy/config/bensuperpc.net/Caddyfile similarity index 100% rename from caddy/bensuperpc.net/Caddyfile rename to infrastructure/caddy/config/bensuperpc.net/Caddyfile diff --git a/caddy/bensuperpc.org/Caddyfile b/infrastructure/caddy/config/bensuperpc.org/Caddyfile similarity index 100% rename from caddy/bensuperpc.org/Caddyfile rename to infrastructure/caddy/config/bensuperpc.org/Caddyfile diff --git a/caddy/bensuperpc.ovh/Caddyfile b/infrastructure/caddy/config/bensuperpc.ovh/Caddyfile similarity index 100% rename from caddy/bensuperpc.ovh/Caddyfile rename to infrastructure/caddy/config/bensuperpc.ovh/Caddyfile diff --git a/docker-compose.caddy.yml b/infrastructure/caddy/docker-compose.caddy.yml similarity index 82% rename from docker-compose.caddy.yml rename to infrastructure/caddy/docker-compose.caddy.yml index 727926d..8538ec2 100644 --- a/docker-compose.caddy.yml +++ b/infrastructure/caddy/docker-compose.caddy.yml @@ -13,11 +13,11 @@ services: - wordpress:/var/www/html:rw - caddy_data:/data:rw - caddy_config:/config:rw - - ./caddy:/etc/caddy:ro + - ./caddy/config:/etc/caddy:ro networks: - infra-network env_file: - - env/caddy.env + - ./caddy/env/caddy.env security_opt: - no-new-privileges:true #cap_drop: @@ -35,3 +35,8 @@ volumes: name: caddy_data caddy_config: name: caddy_config + +networks: + infra-network: + driver: bridge + name: infra-network diff --git a/env/caddy.env b/infrastructure/caddy/env/caddy.env similarity index 100% rename from env/caddy.env rename to infrastructure/caddy/env/caddy.env diff --git a/config/gitea_runner/config.yaml b/infrastructure/gitea/config/gitea_runner/config.yaml similarity index 100% rename from config/gitea_runner/config.yaml rename to infrastructure/gitea/config/gitea_runner/config.yaml diff --git a/docker-compose.gitea.yml b/infrastructure/gitea/docker-compose.gitea.yml similarity index 89% rename from docker-compose.gitea.yml rename to infrastructure/gitea/docker-compose.gitea.yml index f7771f5..41e360c 100644 --- a/docker-compose.gitea.yml +++ b/infrastructure/gitea/docker-compose.gitea.yml @@ -12,7 +12,7 @@ services: ports: - "22:22" env_file: - - env/gitea.env + - ./gitea/env/gitea.env volumes: - gitea_data:/var/lib/gitea - gitea_config:/etc/gitea @@ -34,7 +34,7 @@ services: volumes: - gitea_db:/var/lib/mysql:rw env_file: - - env/gitea_db.env + - ./gitea/env/gitea_db.env command: '--default-authentication-plugin=mysql_native_password' networks: - infra-network @@ -51,11 +51,11 @@ services: - gitea restart: on-failure:5 env_file: - - env/gitea-runner.env + - ./gitea/env/gitea-runner.env volumes: - /var/run/docker.sock:/var/run/docker.sock - gitea_runner:/data - - ./config/gitea_runner/config.yaml:/config.yaml:ro + - ./gitea/config/gitea_runner/config.yaml:/config.yaml:ro networks: - infra-network security_opt: diff --git a/env/gitea-runner.env b/infrastructure/gitea/env/gitea-runner.env similarity index 100% rename from env/gitea-runner.env rename to infrastructure/gitea/env/gitea-runner.env diff --git a/env/gitea.env b/infrastructure/gitea/env/gitea.env similarity index 100% rename from env/gitea.env rename to infrastructure/gitea/env/gitea.env diff --git a/env/gitea_db.env b/infrastructure/gitea/env/gitea_db.env similarity index 100% rename from env/gitea_db.env rename to infrastructure/gitea/env/gitea_db.env diff --git a/docker-compose.jellyfin.yml b/infrastructure/jellyfin/docker-compose.jellyfin.yml similarity index 95% rename from docker-compose.jellyfin.yml rename to infrastructure/jellyfin/docker-compose.jellyfin.yml index e10e464..a678cb1 100644 --- a/docker-compose.jellyfin.yml +++ b/infrastructure/jellyfin/docker-compose.jellyfin.yml @@ -8,6 +8,8 @@ services: restart: on-failure:5 depends_on: - caddy + env_file: + - ./jellyfin/env/jellyfin.env volumes: - jellyfin_config:/config - jellyfin_data_movies:/movies:rw diff --git a/infrastructure/jellyfin/env/jellyfin.env b/infrastructure/jellyfin/env/jellyfin.env new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.psitransfer.yml b/infrastructure/psitransfer/docker-compose.psitransfer.yml similarity index 93% rename from docker-compose.psitransfer.yml rename to infrastructure/psitransfer/docker-compose.psitransfer.yml index 37e7e0c..48e090c 100644 --- a/docker-compose.psitransfer.yml +++ b/infrastructure/psitransfer/docker-compose.psitransfer.yml @@ -9,7 +9,7 @@ services: depends_on: - caddy env_file: - - env/psitransfer.env + - ./psitransfer/env/psitransfer.env volumes: - psitransfer_data:/data networks: diff --git a/env/psitransfer.env b/infrastructure/psitransfer/env/psitransfer.env similarity index 100% rename from env/psitransfer.env rename to infrastructure/psitransfer/env/psitransfer.env diff --git a/docker-compose.qbittorrent.yml b/infrastructure/qbittorrent/docker-compose.qbittorrent.yml similarity index 92% rename from docker-compose.qbittorrent.yml rename to infrastructure/qbittorrent/docker-compose.qbittorrent.yml index 9c3dffc..37a8ab6 100644 --- a/docker-compose.qbittorrent.yml +++ b/infrastructure/qbittorrent/docker-compose.qbittorrent.yml @@ -9,7 +9,7 @@ services: depends_on: - caddy env_file: - - env/qbittorrent.env + - ./qbittorrent/env/qbittorrent.env volumes: - qbittorrent_config:/config - qbittorrent_data:/downloads diff --git a/env/qbittorrent.env b/infrastructure/qbittorrent/env/qbittorrent.env similarity index 100% rename from env/qbittorrent.env rename to infrastructure/qbittorrent/env/qbittorrent.env diff --git a/docker-compose.syncthing.yml b/infrastructure/syncthing/docker-compose.syncthing.yml similarity index 92% rename from docker-compose.syncthing.yml rename to infrastructure/syncthing/docker-compose.syncthing.yml index 8642a26..7e3d10c 100644 --- a/docker-compose.syncthing.yml +++ b/infrastructure/syncthing/docker-compose.syncthing.yml @@ -9,7 +9,7 @@ services: - caddy restart: on-failure:5 env_file: - - env/syncthing.env + - ./syncthing/env/syncthing.env volumes: - syncthing_config:/config - syncthing_data:/data1 diff --git a/env/syncthing.env b/infrastructure/syncthing/env/syncthing.env similarity index 100% rename from env/syncthing.env rename to infrastructure/syncthing/env/syncthing.env diff --git a/docker-compose.transmission.yml b/infrastructure/transmission/docker-compose.transmission.yml similarity index 93% rename from docker-compose.transmission.yml rename to infrastructure/transmission/docker-compose.transmission.yml index cde4b9e..240e078 100644 --- a/docker-compose.transmission.yml +++ b/infrastructure/transmission/docker-compose.transmission.yml @@ -9,7 +9,7 @@ services: depends_on: - caddy env_file: - - env/transmission.env + - ./transmission/env/transmission.env volumes: - transmission_config:/config - transmission_data:/downloads diff --git a/env/transmission.env b/infrastructure/transmission/env/transmission.env similarity index 100% rename from env/transmission.env rename to infrastructure/transmission/env/transmission.env diff --git a/docker-compose.uptime-kuma.yml b/infrastructure/uptime-kuma/docker-compose.uptime-kuma.yml similarity index 85% rename from docker-compose.uptime-kuma.yml rename to infrastructure/uptime-kuma/docker-compose.uptime-kuma.yml index 33fe56d..d9456b5 100644 --- a/docker-compose.uptime-kuma.yml +++ b/infrastructure/uptime-kuma/docker-compose.uptime-kuma.yml @@ -14,3 +14,7 @@ services: - infra-network security_opt: - no-new-privileges:true + +volumes: + uptimekuma_data: + name: uptimekuma_data diff --git a/docker-compose.watchtower.yml b/infrastructure/watchtower/docker-compose.watchtower.yml similarity index 100% rename from docker-compose.watchtower.yml rename to infrastructure/watchtower/docker-compose.watchtower.yml diff --git a/config/wordpress/php.ini b/infrastructure/wordpress/config/wordpress/php.ini similarity index 100% rename from config/wordpress/php.ini rename to infrastructure/wordpress/config/wordpress/php.ini diff --git a/docker-compose.adminer.yml b/infrastructure/wordpress/docker-compose.adminer.yml similarity index 89% rename from docker-compose.adminer.yml rename to infrastructure/wordpress/docker-compose.adminer.yml index 879839d..8018dde 100644 --- a/docker-compose.adminer.yml +++ b/infrastructure/wordpress/docker-compose.adminer.yml @@ -7,7 +7,7 @@ services: - adminer restart: on-failure:5 env_file: - - env/adminer.env + - ./wordpress/env/adminer.env depends_on: - wordpress_db - caddy diff --git a/docker-compose.wordpress.yml b/infrastructure/wordpress/docker-compose.wordpress.yml similarity index 86% rename from docker-compose.wordpress.yml rename to infrastructure/wordpress/docker-compose.wordpress.yml index f2f5444..327e48d 100644 --- a/docker-compose.wordpress.yml +++ b/infrastructure/wordpress/docker-compose.wordpress.yml @@ -10,9 +10,9 @@ services: - wordpress_db - caddy env_file: - - env/wordpress.env + - ./wordpress/env/wordpress.env volumes: - - ./config/wordpress/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro + - ./wordpress/config/wordpress/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro - wordpress:/var/www/html:rw networks: - infra-network @@ -32,7 +32,7 @@ services: volumes: - wordpress_db:/var/lib/mysql:rw env_file: - - env/wordpress_db.env + - ./wordpress/env/wordpress_db.env command: '--default-authentication-plugin=mysql_native_password' networks: - infra-network @@ -48,7 +48,7 @@ services: - wordpress restart: on-failure:5 env_file: - - env/backup.env + - ./wordpress/env/backup.env volumes: - wordpress_backup:/mnt/restic - wordpress_db:/data/wordpress_db:ro diff --git a/env/adminer.env b/infrastructure/wordpress/env/adminer.env similarity index 100% rename from env/adminer.env rename to infrastructure/wordpress/env/adminer.env diff --git a/env/backup.env b/infrastructure/wordpress/env/backup.env similarity index 100% rename from env/backup.env rename to infrastructure/wordpress/env/backup.env diff --git a/env/wordpress.env b/infrastructure/wordpress/env/wordpress.env similarity index 100% rename from env/wordpress.env rename to infrastructure/wordpress/env/wordpress.env diff --git a/env/wordpress_db.env b/infrastructure/wordpress/env/wordpress_db.env similarity index 100% rename from env/wordpress_db.env rename to infrastructure/wordpress/env/wordpress_db.env