Improve docker-compose

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2025-01-19 21:08:53 +01:00
parent 3bdcd4d459
commit 3b4c3cb54c
66 changed files with 122 additions and 83 deletions

View File

@ -19,7 +19,7 @@ DOCKER_PROFILES ?= main_infrastructure
PROFILE_CMD ?= $(addprefix --profile ,$(DOCKER_PROFILES))
COMPOSE_FILES ?= $(shell find ./$(PROJECT_DIRECTORY) -name 'docker-compose*.yml' -type f | sed -e 's/^/--file /')
COMPOSE_FILES ?= $(shell find ./$(PROJECT_DIRECTORY) -maxdepth 1 -name 'docker-compose*.yml' -type f | sed -e 's/^/--file /')
COMPOSE_DIR ?= --project-directory ./$(PROJECT_DIRECTORY)
UID ?= 1000

View File

@ -68,7 +68,7 @@ For all **bensuperpc.org**, you need to replace it with your domain, example: **
find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/bensuperpc.org/mydomain.com/g'
```
Check if all bensuperpc.* are replaced by your domain in [Caddyfile](caddy/wordpress/Caddyfile)
Check if all bensuperpc.* are replaced by your domain in [Caddyfile](caddy/services/wordpress/Caddyfile)
And then, caddy will generate the certificate for you and renew it automatically :D
@ -110,19 +110,19 @@ openssl rand -base64 32
Or online: [passwordsgenerator.net](https://passwordsgenerator.net/)
For [caddy_backup.env](infrastructure/caddy/env/caddy_backup.env) file, you need to change the password(s) for the restic backup.
For [caddy_backup.env](infrastructure/services/caddy/env/caddy_backup.env) file, you need to change the password(s) for the restic backup.
```sh
RESTIC_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
```
For the [wordpress.env](infrastructure/wordpress/env/wordpress.env) file, you need to change the password and user for the database.
For the [wordpress.env](infrastructure/services/wordpress/env/wordpress.env) file, you need to change the password and user for the database.
```sh
WORDPRESS_DB_USER=bensuperpc
WORDPRESS_DB_PASSWORD=lEOEf8cndnDjp84O4Uv5D9zJLJDFatLw
```
For [wordpress_db.env](infrastructure/wordpress/env/wordpress_db.env) file, you need to change the password(s) and user for the database.
For [wordpress_db.env](infrastructure/services/wordpress/env/wordpress_db.env) file, you need to change the password(s) and user for the database.
```sh
MARIADB_ROOT_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
@ -130,12 +130,12 @@ MARIADB_USER=bensuperpc
MARIADB_PASSWORD=lEOEf8cndnDjp84O4Uv5D9zJLJDFatLw
```
For [wordpress_backup.env](infrastructure/wordpress/env/wordpress_backup.env) file, you need to change the password(s) for the restic backup.
For [wordpress_backup.env](infrastructure/services/wordpress/env/wordpress_backup.env) file, you need to change the password(s) for the restic backup.
```sh
RESTIC_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
```
For [adminer.env](infrastructure/wordpress/env/adminer.env) file, you need to change the password(s) and user for the database.
For [adminer.env](infrastructure/services/wordpress/env/adminer.env) file, you need to change the password(s) and user for the database.
```sh
MARIADB_ROOT_PASSWORD=7L1Ncbquax0B2TCOmrjaQl9n5mnY88bQ
@ -143,7 +143,7 @@ MARIADB_USER=bensuperpc
MARIADB_PASSWORD=lEOEf8cndnDjp84O4Uv5D9zJLJDFatLw
```
For [gitea.env](infrastructure/gitea/env/gitea.env) file, you need to change the password(s) and user for the database.
For [gitea.env](infrastructure/services/gitea/env/gitea.env) file, you need to change the password(s) and user for the database.
```sh
GITEA__database__USER=bensuperpc
@ -151,7 +151,7 @@ GITEA__database__PASSWD=K7s5yoHknnEd7vsZoxb8I3dK9mjToF1j
GITEA__security__SECRET_KEY=ykcZt23an1E4lFHWvrCKdAyt16WAiK9c
```
For [gitea_db.env](infrastructure/gitea/env/gitea_db.env) file, you need to change the password(s) and user for the database.
For [gitea_db.env](infrastructure/services/gitea/env/gitea_db.env) file, you need to change the password(s) and user for the database.
```sh
MARIADB_ROOT_PASSWORD=xpc4zIhHZzWKqVHcjBu4aW6aS7jG8d7X
@ -159,19 +159,19 @@ MARIADB_USER=bensuperpc
MARIADB_PASSWORD=K7s5yoHknnEd7vsZoxb8I3dK9mjToF1j
```
For [psitransfer.env](infrastructure/psitransfer/env/psitransfer.env) file, you need to change the secret key.
For [psitransfer.env](infrastructure/services/psitransfer/env/psitransfer.env) file, you need to change the secret key.
```sh
PSITRANSFER_ADMIN_PASS=n9jLVNT9QUotTJTT91JqH4GyBTg9pvEn
```
For [yacht.env](infrastructure/yacht/env/yacht.env) file, you need to change the secret key.
For [yacht.env](infrastructure/services/yacht/env/yacht.env) file, you need to change the secret key.
```sh
SECRET_KEY=UZvg9nbcGIJlPEB3uI39TAEWyFOz9nm8
```
For [projectsend_db.env](infrastructure/projectsend/env/projectsend_db.env) file, you need to change the password(s) and user for the database.
For [projectsend_db.env](infrastructure/services/projectsend/env/projectsend_db.env) file, you need to change the password(s) and user for the database.
```sh
MARIADB_ROOT_PASSWORD=8O34297GrBfT3Ld34Lfg9mpotmZwbJtt
@ -179,19 +179,19 @@ MARIADB_USER=bensuperpc
MARIADB_PASSWORD=wdSUa1JEZhXie5AJ5NcX1w73xmpO12EY
```
For [picoshare.env](infrastructure/picoshare/env/picoshare.env) file, you need to change the secret key.
For [picoshare.env](infrastructure/services/picoshare/env/picoshare.env) file, you need to change the secret key.
```sh
PS_SHARED_SECRET=CBuS4DJLqIe93xF1KGYRrnhxUFBqLD2n
```
For [dufs.env](infrastructure/dufs/env/dufs.env) file, you need to change the secret key and if you want the user name.
For [dufs.env](infrastructure/services/dufs/env/dufs.env) file, you need to change the secret key and if you want the user name.
```sh
DUFS_AUTH="admin:heqihlOfBmJDESGFlpbPi7P7Mi6F7RkV@/:rw|@/:ro"
```
For [stirlingpdf.env](infrastructure/stirlingpdf/env/stirlingpdf.env) file, it's **completly optional**, you can change the password(s) and user.
For [stirlingpdf.env](infrastructure/services/stirlingpdf/env/stirlingpdf.env) file, it's **completly optional**, you can change the password(s) and user.
```sh
# Enable security, optional
@ -203,7 +203,7 @@ SECURITY_INITIALLOGIN_USERNAME=admin
SECURITY_INITIALLOGIN_PASSWORD=Jw9U039f5xc2mFcacvGvPD9RjwIh4DzO
```
You can need to add/change the public ssh key [id_ed25519.pub](infrastructure/openssh/config/authorized_keys/id_ed25519.pub) (its my public key), also change the config/password in [openssh.env](infrastructure/openssh/env/openssh.env):
You can need to add/change the public ssh key [id_ed25519.pub](infrastructure/services/openssh/config/authorized_keys/id_ed25519.pub) (its my public key), also change the config/password in [openssh.env](infrastructure/services/openssh/env/openssh.env):
```sh
SUDO_ACCESS=true
@ -245,10 +245,10 @@ To enable the gitea CI: https://medium.com/@lokanx/how-to-build-docker-container
You can change the homepage config in these files:
- [bookmarks.yaml](infrastructure/homepage/config/bookmarks.yaml)
- [services.yaml](infrastructure/homepage/config/services.yaml)
- [settings.yaml](infrastructure/homepage/config/settings.yaml)
- [widgets.yaml](infrastructure/homepage/config/widgets.yaml)
- [bookmarks.yaml](infrastructure/services/homepage/config/bookmarks.yaml)
- [services.yaml](infrastructure/services/homepage/config/services.yaml)
- [settings.yaml](infrastructure/services/homepage/config/settings.yaml)
- [widgets.yaml](infrastructure/services/homepage/config/widgets.yaml)
### Docker volumes

View File

@ -0,0 +1,73 @@
include:
# WordPress
- services/wordpress/docker-compose.adminer.yml
- services/wordpress/docker-compose.wordpress.yml
# Caddy
- services/caddy/docker-compose.caddy.yml
# Dufs
- services/dufs/docker-compose.dufs.yml
# Gitea
- services/gitea/docker-compose.gitea.yml
# Homepage
- services/homepage/docker-compose.homepage.yml
# It-tools
- services/it-tools/docker-compose.it-tools.yml
# Jellyfin
- services/jellyfin/docker-compose.jellyfin.yml
# Openssh
- services/openssh/docker-compose.openssh.yml
# Picoshare
- services/picoshare/docker-compose.picoshare.yml
# Privatebin
- services/privatebin/docker-compose.privatebin.yml
# Projectsend
- services/projectsend/docker-compose.projectsend.yml
# Psitransfer
- services/psitransfer/docker-compose.psitransfer.yml
# Qbittorrent
- services/qbittorrent/docker-compose.qbittorrent.yml
# Stirlingpdf
- services/stirlingpdf/docker-compose.stirlingpdf.yml
# Syncthing
- services/syncthing/docker-compose.syncthing.yml
# Transmission
- services/transmission/docker-compose.transmission.yml
# Uptime-kuma
- services/uptime-kuma/docker-compose.uptime-kuma.yml
# Yacht
- services/yacht/docker-compose.yacht.yml
services:
main_infrastructure:
container_name: main_infrastructure
image: alpine:latest
profiles:
- main_infrastructure
volumes:
- public_data:/public_data:rw
- private_data:/private_data:rw
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
# Fix root permissions on mounted volumes
command: chown -R ${PUID:-1000}:${PGID:-1000} /public_data /private_data
volumes:
public_data:
name: public_data
private_data:
name: private_data
networks:
infra-network:
driver: bridge
name: infra-network
intern-network:
driver: bridge
internal: true
name: intern-network

View File

@ -1,34 +0,0 @@
services:
main_infrastructure:
container_name: main_infrastructure
image: alpine:latest
profiles:
- main_infrastructure
volumes:
- public_data:/public_data:rw
- private_data:/private_data:rw
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
# Fix root permissions on mounted volumes
command: chown -R ${PUID:-1000}:${PGID:-1000} /public_data /private_data
volumes:
public_data:
name: public_data
private_data:
name: private_data
networks:
infra-network:
driver: bridge
name: infra-network
intern-network:
driver: bridge
internal: true
name: intern-network

View File

@ -15,14 +15,14 @@ services:
volumes:
- caddy_data:/data:rw
- caddy_config:/config:rw
- ./caddy/config:/etc/caddy:ro
- ./config:/etc/caddy:ro
- wordpress:/var/www/html:rw
- public_data:/public_data:ro
networks:
- infra-network
env_file:
- ./caddy/env/caddy.env
- ./env/caddy.env
security_opt:
- no-new-privileges:true
healthcheck:
@ -40,7 +40,7 @@ services:
- caddy
restart: on-failure:5
env_file:
- ./caddy/env/caddy_backup.env
- ./env/caddy_backup.env
volumes:
- caddy_backup:/mnt/restic
- caddy_data:/data:ro

View File

@ -10,7 +10,7 @@ services:
depends_on:
- caddy
env_file:
- ./dufs/env/dufs.env
- ./env/dufs.env
volumes:
- public_data:/data
networks:

View File

@ -12,7 +12,7 @@ services:
ports:
- "22:22"
env_file:
- ./gitea/env/gitea.env
- ./env/gitea.env
volumes:
- gitea_data:/var/lib/gitea
- gitea_config:/etc/gitea
@ -36,7 +36,7 @@ services:
volumes:
- gitea_db:/var/lib/mysql:rw
env_file:
- ./gitea/env/gitea_db.env
- ./env/gitea_db.env
command: '--default-authentication-plugin=mysql_native_password'
networks:
- infra-network
@ -53,11 +53,11 @@ services:
- gitea
restart: on-failure:5
env_file:
- ./gitea/env/gitea-runner.env
- ./env/gitea-runner.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- gitea_runner:/data
- ./gitea/config/gitea_runner/config.yaml:/config.yaml:ro
- ./config/gitea_runner/config.yaml:/config.yaml:ro
networks:
- infra-network
security_opt:

View File

@ -9,11 +9,11 @@ services:
depends_on:
- caddy
env_file:
- ./homepage/env/homepage.env
- ./env/homepage.env
volumes:
- homepage_log:/app/logs
- ./homepage/config:/app/config:ro
- ./homepage/image:/app/public/image:ro
- ./config:/app/config:ro
- ./image:/app/public/image:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
# develop:
# watch:

View File

Before

Width:  |  Height:  |  Size: 569 KiB

After

Width:  |  Height:  |  Size: 569 KiB

View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 295 KiB

After

Width:  |  Height:  |  Size: 295 KiB

View File

@ -12,7 +12,7 @@ services:
depends_on:
- caddy
env_file:
- ./jellyfin/env/jellyfin.env
- ./env/jellyfin.env
volumes:
- jellyfin_config:/config
- jellyfin_cache:/cache

View File

@ -9,13 +9,13 @@ services:
- caddy
restart: on-failure:5
env_file:
- ./openssh/env/openssh.env
- ./env/openssh.env
environment:
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}
volumes:
- openssh_config:/config:rw
- ./openssh/config/authorized_keys:/authorized_ssh_keys:ro
- ./config/authorized_keys:/authorized_ssh_keys:ro
- public_data:/public:rw
- private_data:/private:rw
- caddy_data:/caddy_data:rw

View File

@ -9,7 +9,7 @@ services:
depends_on:
- caddy
env_file:
- ./picoshare/env/picoshare.env
- ./env/picoshare.env
volumes:
- picoshare_data:/data
networks:

View File

@ -10,7 +10,7 @@ services:
- caddy
volumes:
- privatebin_data:/srv/data
- ./privatebin/config/conf.php:/srv/cfg/conf.php:ro
- ./config/conf.php:/srv/cfg/conf.php:ro
networks:
- infra-network
security_opt:

View File

@ -9,7 +9,7 @@ services:
depends_on:
- caddy
env_file:
- ./projectsend/env/projectsend.env
- ./env/projectsend.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- projectsend_config:/config
@ -34,7 +34,7 @@ services:
volumes:
- projectsend_db:/var/lib/mysql:rw
env_file:
- ./projectsend/env/projectsend_db.env
- ./env/projectsend_db.env
command: '--default-authentication-plugin=mysql_native_password'
networks:
- infra-network

View File

@ -10,7 +10,7 @@ services:
depends_on:
- caddy
env_file:
- ./psitransfer/env/psitransfer.env
- ./env/psitransfer.env
volumes:
- psitransfer_data:/data
networks:

View File

@ -9,7 +9,7 @@ services:
depends_on:
- caddy
env_file:
- ./qbittorrent/env/qbittorrent.env
- ./env/qbittorrent.env
environment:
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}

View File

@ -9,7 +9,7 @@ services:
depends_on:
- caddy
env_file:
- ./stirlingpdf/env/stirlingpdf.env
- ./env/stirlingpdf.env
volumes:
- stirlingpdf_config:/configs
- stirlingpdf_tessdata:/usr/share/tessdata

View File

@ -9,7 +9,7 @@ services:
- caddy
restart: on-failure:5
env_file:
- ./syncthing/env/syncthing.env
- ./env/syncthing.env
environment:
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}

View File

@ -9,7 +9,7 @@ services:
depends_on:
- caddy
env_file:
- ./transmission/env/transmission.env
- ./env/transmission.env
environment:
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}

View File

@ -7,7 +7,7 @@ services:
- adminer
restart: on-failure:5
env_file:
- ./wordpress/env/adminer.env
- ./env/adminer.env
depends_on:
- wordpress_db
- caddy

View File

@ -10,9 +10,9 @@ services:
- wordpress_db
- caddy
env_file:
- ./wordpress/env/wordpress.env
- ./env/wordpress.env
volumes:
- ./wordpress/config/wordpress/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro
- ./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:
- ./wordpress/env/wordpress_db.env
- ./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:
- ./wordpress/env/wordpress_backup.env
- ./env/wordpress_backup.env
volumes:
- wordpress_backup:/mnt/restic
- wordpress_db:/data/wordpress_db:ro

View File

@ -9,7 +9,7 @@ services:
depends_on:
- caddy
env_file:
- ./yacht/env/yacht.env
- ./env/yacht.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- yacht_config:/config