Switch from bind mounts to named docker volumes

This commit is contained in:
2026-01-16 05:31:55 +00:00
parent 8a214c9610
commit 379bb85a42
13 changed files with 130 additions and 97 deletions

48
.gitignore vendored
View File

@@ -4,51 +4,3 @@
# Ignore environment variable files containing secrets. # Ignore environment variable files containing secrets.
/.env /.env
# Docker volumes
/velocity/data/**
!/velocity/data/.keep
/luckperms/data/**
!/luckperms/data/.keep
/schematics/**
/paper/data/**
!/paper/data/bukkit.yml
!/paper/data/spigot.yml
!/paper/data/commands.yml
!/paper/data/plugins
!/paper/data/plugins/WorldEdit
!/paper/data/plugins/WorldEdit/schematics/
!/paper/data/plugins/WorldEdit/schematics/.keep
!/paper/data/bluemap
!/paper/data/bluemap/web
!/paper/data/bluemap/web/maps
!/paper/data/bluemap/web/maps/.keep
/fabric/data/**
!/fabric/data/config
!/fabric/data/config/worldedit
!/fabric/data/config/worldedit/schematics
!/fabric/data/config/worldedit/schematics/.keep
!/fabric/data/bluemap
!/fabric/data/bluemap/web
!/fabric/data/bluemap/web/maps
!/fabric/data/bluemap/web/maps/.keep
/bluemap/data/**
!/bluemap/data/.keep
/bluemap/maps/**
!/bluemap/maps/.keep
/bluemap/web/**
!/bluemap/web/.keep
# Backups
/backups/**
!/backups/.keep
# Java binaries
/paper/plugins/*.jar

0
backups/.keep → bluemap/config/packs/.keep Executable file → Normal file
View File

View File

View File

View File

@@ -1,31 +1,33 @@
services: services:
velocity: velocity:
image: itzg/mc-proxy:java21-2025.1.0 image: itzg/mc-proxy:java21-2025.1.0
container_name: illegal_crime_velocity container_name: minecraft_server_velocity
user: 2015:2015 # minecraft_server:minecraft_server user: 2015:2015 # minecraft_server:minecraft_server
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
init_volumes:
condition: service_completed_successfully
luckperms_db:
condition: service_healthy
restart: true
fabric: fabric:
condition: service_healthy condition: service_healthy
restart: true restart: true
paper: paper:
condition: service_healthy condition: service_healthy
restart: true restart: true
luckperms_db:
condition: service_healthy
restart: true
secrets: secrets:
- rcon_password - rcon_password
- forwarding_secret - forwarding_secret
- dclink_token - dclink_token
- luckperms_db_password - luckperms_db_password
networks: networks:
illegal_crime_mc_network: minecraft_server_network:
ipv4_address: "10.100.1.3" ipv4_address: "10.100.1.3"
ports: ports:
- 25000:25565 - 25000:25565
volumes: volumes:
- ./velocity/data:/server:rw - velocity_data:/server:rw
- ./velocity/config:/config:ro - ./velocity/config:/config:ro
environment: environment:
TYPE: VELOCITY TYPE: VELOCITY
@@ -36,12 +38,15 @@ services:
REPLACE_ENV_VARIABLES: true REPLACE_ENV_VARIABLES: true
ENV_VARIABLE_PREFIX: CFG_ ENV_VARIABLE_PREFIX: CFG_
ENABLE_RCON: true ENABLE_RCON: true
RCON_PORT: 25575 RCON_PORT: 25575
RCON_PASSWORD_FILE: /run/secrets/rcon_password RCON_PASSWORD_FILE: /run/secrets/rcon_password
CFG_RCON_PASSWORD_FILE: /run/secrets/rcon_password CFG_RCON_PASSWORD_FILE: /run/secrets/rcon_password
CFG_DCLINK_GUILD: ${DCLINK_GUILD}
CFG_DCLINK_CHANNEL: ${DCLINK_CHANNEL}
CFG_DCLINK_ROLE: ${DCLINK_ROLE}
CFG_DCLINK_TOKEN_FILE: /run/secrets/dclink_token CFG_DCLINK_TOKEN_FILE: /run/secrets/dclink_token
CFG_LUCKPERMS_DB_PASSWORD_FILE: /run/secrets/luckperms_db_password CFG_LUCKPERMS_DB_PASSWORD_FILE: /run/secrets/luckperms_db_password
@@ -56,10 +61,12 @@ services:
bluemap: bluemap:
image: ghcr.io/bluemap-minecraft/bluemap:v5.7 image: ghcr.io/bluemap-minecraft/bluemap:v5.7
container_name: illegal_crime_bluemap container_name: minecraft_server_bluemap
user: 2015:2015 # minecraft_server:minecraft_server user: 2015:2015 # minecraft_server:minecraft_server
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
init_volumes:
condition: service_completed_successfully
fabric: fabric:
condition: service_healthy condition: service_healthy
restart: true restart: true
@@ -68,21 +75,23 @@ services:
restart: true restart: true
command: -g -w command: -g -w
networks: networks:
illegal_crime_mc_network: minecraft_server_network:
ipv4_address: "10.100.1.6" ipv4_address: "10.100.1.6"
ports: ports:
- 8100:8100 - 8100:8100
volumes: volumes:
- ./bluemap/data:/app/data:rw - bluemap_data:/app/data:rw
- ./bluemap/web:/app/web:rw - bluemap_web:/app/web:rw
- ./bluemap/config:/app/config:rw - bluemap_maps:/app/web/maps:ro
- ./bluemap/maps:/app/web/maps:ro - ./bluemap/config:/app/config:ro
paper: paper:
image: itzg/minecraft-server:2025.3.0-java23 image: itzg/minecraft-server:2025.3.0-java23
container_name: illegal_crime_paper container_name: minecraft_server_paper
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
init_volumes:
condition: service_completed_successfully
luckperms_db: luckperms_db:
condition: service_healthy condition: service_healthy
restart: true restart: true
@@ -96,14 +105,17 @@ services:
- forwarding_secret - forwarding_secret
- luckperms_db_password - luckperms_db_password
networks: networks:
illegal_crime_mc_network: minecraft_server_network:
ipv4_address: "10.100.1.4" ipv4_address: "10.100.1.4"
volumes: volumes:
- ./paper/data:/data:rw - paper_data:/data:rw
- schematics:/data/plugins/WorldEdit/schematics:rw
- bluemap_maps:/data/bluemap/web/maps:rw
- ./paper/config:/config:ro - ./paper/config:/config:ro
- ./paper/plugins:/plugins:ro - ./paper/plugins:/plugins:ro
- ./schematics:/data/plugins/WorldEdit/schematics:rw - ./paper/data/bukkit.yml:/data/bukkit.yml:ro
- ./bluemap/maps:/data/bluemap/web/maps:rw - ./paper/data/commands.yml:/data/commands.yml:ro
- ./paper/data/spigot.yml:/data/spigot.yml:ro
environment: environment:
UID: 2015 # minecraft_server UID: 2015 # minecraft_server
GID: 2015 # minecraft_server GID: 2015 # minecraft_server
@@ -125,22 +137,22 @@ services:
BROADCAST_CONSOLE_TO_OPS: false BROADCAST_CONSOLE_TO_OPS: false
BROADCAST_RCON_TO_OPS: false BROADCAST_RCON_TO_OPS: false
ONLINE_MODE: false ONLINE_MODE: false
OP_PERMISSION_LEVEL: 2 OP_PERMISSION_LEVEL: 2
MAX_PLAYERS: 50 MAX_PLAYERS: 50
DIFFICULTY: easy DIFFICULTY: easy
LEVEL: survival LEVEL: survival
MODE: creative MODE: creative
LEVEL_TYPE: minecraft:default LEVEL_TYPE: minecraft:normal
ENABLE_COMMAND_BLOCK: true ENABLE_COMMAND_BLOCK: true
GENERATE_STRUCTURES: false GENERATE_STRUCTURES: false
SPAWN_ANIMALS: false SPAWN_ANIMALS: false
SPAWN_MONSTERS: false SPAWN_MONSTERS: false
SPAWN_NPCS: false SPAWN_NPCS: false
SPAWN_PROTECTION: 0 SPAWN_PROTECTION: 0
USE_AIKAR_FLAGS: true USE_AIKAR_FLAGS: true
LOG_TIMESTAMP: true LOG_TIMESTAMP: true
@@ -155,7 +167,7 @@ services:
CFG_RCON_PASSWORD_FILE: /run/secrets/rcon_password CFG_RCON_PASSWORD_FILE: /run/secrets/rcon_password
CFG_FORWARDING_SECRET_FILE: /run/secrets/forwarding_secret CFG_FORWARDING_SECRET_FILE: /run/secrets/forwarding_secret
CFG_LUCKPERMS_DB_PASSWORD_FILE: /run/secrets/luckperms_db_password CFG_LUCKPERMS_DB_PASSWORD_FILE: /run/secrets/luckperms_db_password
PLUGINS: | PLUGINS: |
https://github.com/EssentialsX/Essentials/releases/download/2.20.1/EssentialsX-2.20.1.jar https://github.com/EssentialsX/Essentials/releases/download/2.20.1/EssentialsX-2.20.1.jar
@@ -171,12 +183,14 @@ services:
stfu-velocity:Y3nJXOQT stfu-velocity:Y3nJXOQT
vaultunlocked:fC53e1Vr vaultunlocked:fC53e1Vr
worldedit:4jRlujfz worldedit:4jRlujfz
fabric: fabric:
image: itzg/minecraft-server:2025.3.0-java23 image: itzg/minecraft-server:2025.3.0-java23
container_name: illegal_crime_fabric container_name: minecraft_server_fabric
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
init_volumes:
condition: service_completed_successfully
luckperms_db: luckperms_db:
condition: service_healthy condition: service_healthy
restart: true restart: true
@@ -190,13 +204,13 @@ services:
- forwarding_secret - forwarding_secret
- luckperms_db_password - luckperms_db_password
networks: networks:
illegal_crime_mc_network: minecraft_server_network:
ipv4_address: "10.100.1.5" ipv4_address: "10.100.1.5"
volumes: volumes:
- ./fabric/data:/data:rw - fabric_data:/data:rw
- schematics:/data/config/worldedit/schematics:rw
- bluemap_maps:/data/bluemap/web/maps:rw
- ./fabric/config:/config:ro - ./fabric/config:/config:ro
- ./schematics:/data/config/worldedit/schematics:rw
- ./bluemap/maps:/data/bluemap/web/maps:rw
environment: environment:
UID: 2015 # minecraft_server UID: 2015 # minecraft_server
GID: 2015 # minecraft_server GID: 2015 # minecraft_server
@@ -217,13 +231,13 @@ services:
BROADCAST_CONSOLE_TO_OPS: false BROADCAST_CONSOLE_TO_OPS: false
BROADCAST_RCON_TO_OPS: false BROADCAST_RCON_TO_OPS: false
ONLINE_MODE: false ONLINE_MODE: false
OP_PERMISSION_LEVEL: 2 OP_PERMISSION_LEVEL: 2
MAX_PLAYERS: 50 MAX_PLAYERS: 50
DIFFICULTY: easy DIFFICULTY: easy
LEVEL: world LEVEL: world
MODE: creative MODE: creative
LEVEL_TYPE: minecraft:flat LEVEL_TYPE: minecraft:flat
ENABLE_COMMAND_BLOCK: true ENABLE_COMMAND_BLOCK: true
@@ -232,7 +246,7 @@ services:
SPAWN_MONSTERS: false SPAWN_MONSTERS: false
SPAWN_NPCS: false SPAWN_NPCS: false
SPAWN_PROTECTION: 0 SPAWN_PROTECTION: 0
USE_AIKAR_FLAGS: true USE_AIKAR_FLAGS: true
LOG_TIMESTAMP: true LOG_TIMESTAMP: true
@@ -286,9 +300,12 @@ services:
luckperms_db: luckperms_db:
image: postgres:17.4 image: postgres:17.4
container_name: illegal_crime_luckperms_db container_name: minecraft_server_luckperms_db
user: 2015:2015 # minecraft_server:minecraft_server user: 2015:2015 # minecraft_server:minecraft_server
restart: unless-stopped restart: unless-stopped
depends_on:
init_volumes:
condition: service_completed_successfully
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U luckperms -d luckperms"] test: ["CMD-SHELL", "pg_isready -U luckperms -d luckperms"]
interval: 10s interval: 10s
@@ -298,20 +315,52 @@ services:
secrets: secrets:
- luckperms_db_password - luckperms_db_password
networks: networks:
illegal_crime_mc_network: minecraft_server_network:
ipv4_address: "10.100.1.2" ipv4_address: "10.100.1.2"
ports: ports:
- 5434:5432 - 5434:5432
volumes: volumes:
- luckperms_data:/var/lib/postgresql/data:rw
- /etc/passwd:/etc/passwd:ro - /etc/passwd:/etc/passwd:ro
- ./luckperms/data:/var/lib/postgresql/data:rw # - ./backups:/backups:rw
- ./backups:/backups:rw
environment: environment:
POSTGRES_PASSWORD_FILE: /run/secrets/luckperms_db_password POSTGRES_PASSWORD_FILE: /run/secrets/luckperms_db_password
POSTGRES_USER: luckperms POSTGRES_USER: luckperms
POSTGRES_DB: luckperms POSTGRES_DB: luckperms
PGDATA: /var/lib/postgresql/data/pgdata PGDATA: /var/lib/postgresql/data/pgdata
init_volumes:
container_name: minecraft_server_init_volumes
image: busybox:1.37.0
user: root:root
command: /init_volumes.sh
restart: no
network_mode: none
volumes:
- ./scripts/init_volumes.sh:/init_volumes.sh:ro
# Used for resolving user and group names within the init script
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
# Mount all named volumes so they can be initialised
- velocity_data:/velocity_data:rw
- bluemap_data:/bluemap_data:rw
- bluemap_web:/bluemap_web:rw
- bluemap_maps:/bluemap_maps:rw
- schematics:/schematics:rw
- paper_data:/paper_data:rw
- fabric_data:/fabric_data:rw
- luckperms_data:/luckperms_data:rw
networks:
minecraft_server_network:
name: minecraft_server_network
driver: bridge
ipam:
driver: default
config:
- subnet: "10.100.1.0/24"
gateway: "10.100.1.1"
secrets: secrets:
rcon_password: rcon_password:
environment: RCON_PASSWORD environment: RCON_PASSWORD
@@ -322,13 +371,12 @@ secrets:
luckperms_db_password: luckperms_db_password:
environment: LUCKPERMS_DB_PASSWORD environment: LUCKPERMS_DB_PASSWORD
networks: volumes:
illegal_crime_mc_network: velocity_data:
name: illegal_crime_mc_network bluemap_data:
driver: bridge bluemap_web:
ipam: bluemap_maps:
driver: default schematics:
config: paper_data:
- subnet: "10.100.1.0/24" fabric_data:
gateway: "10.100.1.1" luckperms_data:

30
scripts/init_volumes.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env sh
# Define a helper function that runs a command
# If the command fails, the script prints an error message
# and exits immediately.
run() {
# "$@" expands to all arguments passed to this function
# and preserves proper word splitting and quoting.
"$@" || {
echo "Error: command failed: $*" >&2
exit 1
}
}
# Ensure required directories exist
run mkdir -p /fabric_data/bluemap/web/maps
run mkdir -p /fabric_data/config/worldedit/schematics
run mkdir -p /paper_data/bluemap/web/maps
run mkdir -p /paper_data/plugins/WorldEdit/schematics
# Ensure correct permissions of docker volumes
run chown -R minecraft_server:minecraft_server /bluemap_data
run chown -R minecraft_server:minecraft_server /bluemap_web
run chown -R minecraft_server:minecraft_server /bluemap_maps
run chown -R minecraft_server:minecraft_server /fabric_data
run chown -R minecraft_server:minecraft_server /luckperms_data
run chown -R minecraft_server:minecraft_server /paper_data
run chown -R minecraft_server:minecraft_server /schematics
run chown -R minecraft_server:minecraft_server /velocity_data

View File

@@ -2,6 +2,9 @@ RCON_PASSWORD=${CFG_RCON_PASSWORD}
FORWARDING_SECRET=${CFG_FORWARDING_SECRET} FORWARDING_SECRET=${CFG_FORWARDING_SECRET}
DCLINK_GUILD=${CFG_DCLINK_GUILD}
DCLINK_CHANNEL=${CFG_DCLINK_CHANNEL}
DCLINK_ROLE=${CFG_DCLINK_ROLE}
DCLINK_TOKEN=${CFG_DCLINK_TOKEN} DCLINK_TOKEN=${CFG_DCLINK_TOKEN}
LUCKPERMS_DB_PASSWORD=${CFG_LUCKPERMS_DB_PASSWORD} LUCKPERMS_DB_PASSWORD=${CFG_LUCKPERMS_DB_PASSWORD}

View File

@@ -4,11 +4,11 @@ database {
} }
discord { discord {
# Guild ID of the Guild where the bot will run # Guild ID of the Guild where the bot will run
guild="1204371192727867393" guild="${CFG_DCLINK_GUILD}"
# Channel ID of the channel where the bot will send the message with the button to link their account # Channel ID of the channel where the bot will send the message with the button to link their account
link-channel="1206721349087793192" link-channel="${CFG_DCLINK_CHANNEL}"
# Role ID of the role that the bot will give to the linked players (If left blank, the bot will not give any roles) # Role ID of the role that the bot will give to the linked players (If left blank, the bot will not give any roles)
link-role="1206721407568969729" link-role="${CFG_DCLINK_ROLE}"
# Message to show on the bot's status # Message to show on the bot's status
status-message=Minecraft status-message=Minecraft
# Bot Token (see https://discord.com/developers/applications) # Bot Token (see https://discord.com/developers/applications)

View File