forked from jakub/ansible
feat: add playbook and Docker Compose configuration for Valheim server deployment and updates
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
# Portainer stack name: valheim
|
||||
# Target: pve2_vm / vm-portainer-services
|
||||
# Create the host directories and password file before the first deployment.
|
||||
# Configuration lives here; the password is NOT stored in Git or Portainer ENV.
|
||||
name: valheim
|
||||
|
||||
services:
|
||||
valheim:
|
||||
image: ghcr.io/community-valheim-tools/valheim-server:latest
|
||||
container_name: valheim
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 2m
|
||||
|
||||
cap_add:
|
||||
- SYS_NICE
|
||||
|
||||
ports:
|
||||
- "2456-2457:2456-2457/udp"
|
||||
|
||||
environment:
|
||||
TZ: "Europe/Prague"
|
||||
# The game process uses these numeric IDs, not the bootstrap process.
|
||||
# They need not be the host login user's IDs.
|
||||
PUID: "1000"
|
||||
PGID: "1000"
|
||||
|
||||
SERVER_NAME: "Howard Valheim"
|
||||
WORLD_NAME: "Howardheim"
|
||||
SERVER_PORT: "2456"
|
||||
SERVER_PUBLIC: "false"
|
||||
CROSSPLAY: "false"
|
||||
SERVER_PASS_FILE: "/run/secrets/valheim_server_pass"
|
||||
|
||||
# No periodic game updates/restarts inside the container.
|
||||
# A container start still checks/downloads the game through SteamCMD.
|
||||
# Run update_valheim.yml in your chosen maintenance window.
|
||||
UPDATE_CRON: ""
|
||||
RESTART_CRON: ""
|
||||
|
||||
# Built-in world backups, hourly at minute 05, retained for 7 days.
|
||||
BACKUPS: "true"
|
||||
BACKUPS_CRON: "5 * * * *"
|
||||
BACKUPS_DIRECTORY: "/config/backups"
|
||||
BACKUPS_MAX_AGE: "7"
|
||||
BACKUPS_MAX_COUNT: "168"
|
||||
BACKUPS_IF_IDLE: "true"
|
||||
BACKUPS_ZIP: "true"
|
||||
|
||||
VALHEIM_PLUS: "false"
|
||||
BEPINEX: "false"
|
||||
# Do not publish 9001: the Portainer agent already uses it on this VM.
|
||||
SUPERVISOR_HTTP: "false"
|
||||
STATUS_HTTP: "false"
|
||||
|
||||
volumes:
|
||||
- type: bind
|
||||
source: /data/compose/valheim/config
|
||||
target: /config
|
||||
bind:
|
||||
create_host_path: false
|
||||
- type: bind
|
||||
source: /data/compose/valheim/data
|
||||
target: /opt/valheim
|
||||
bind:
|
||||
create_host_path: false
|
||||
- type: bind
|
||||
source: /backups/valheim/automatic
|
||||
target: /config/backups
|
||||
bind:
|
||||
create_host_path: false
|
||||
- type: bind
|
||||
source: /home/howard/.ansible-compose/env/valheim_server_pass
|
||||
target: /run/secrets/valheim_server_pass
|
||||
read_only: true
|
||||
bind:
|
||||
create_host_path: false
|
||||
|
||||
# Local readiness: supervised game process AND an open game/query UDP socket.
|
||||
# This does not test the router/firewall or an actual player connection.
|
||||
# The helpers ship in this image and also support non-public servers.
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- /bin/bash
|
||||
- -c
|
||||
- >-
|
||||
. /usr/local/etc/valheim/defaults &&
|
||||
. /usr/local/etc/valheim/common &&
|
||||
server_is_running && server_is_listening
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 30m
|
||||
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
# Docker allocates this bridge network's subnet and the container address.
|
||||
# Clients use the VM's LAN/public address and UDP port 2456, not this private IP.
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user