Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
74 lines (72 loc) · 3.07 KB
/
Copy pathdocker-compose.yml
File metadata and controls
74 lines (72 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# candygoogy-bot with Docker Compose, on a Linux host with rootful Docker Engine
# (Docker Desktop and rootless Docker can't reach the LAN the way the bot needs).
#
# Setup: cp .env.example .env (fill it in; TZ=Area/City sets the time zone)
# sudo install -d -o root -g 10001 -m 750 ssh
# sudo install -o root -g 10001 -m 640 <your key> ssh/id_ed25519
# (the container runs as UID/GID 10001: group 10001 lets it read the
# key, and root's ownership stops it from changing or deleting it)
# Start: docker compose pull && docker compose up -d
# Check: docker compose run --rm --no-deps bot python bot.py --check-config
# Logs: docker compose logs -f bot
#
# The image is the published one, for amd64 and arm64. By default it follows
# the latest 1.x release ("docker compose pull" updates it). To pin it, set
# CANDYGOOGY_TAG in .env: an exact version (CANDYGOOGY_TAG=1.1.0), or a version
# and its digest (CANDYGOOGY_TAG=1.1.0@sha256:<digest>), which can never change.
# To build the image from this checkout instead, add docker-compose.build.yml.
#
# Docker containers in /homelab: add docker-compose.docker-proxy.yml (see there).
# Never mount /var/run/docker.sock into this service: it is root on the host.
name: candygoogy
services:
bot:
image: ghcr.io/candygoogy/candygoogy-bot:${CANDYGOOGY_TAG:-1}
# The host's network: the Wake-on-LAN broadcast must reach the LAN and
# `ip neigh` must read the host's ARP table. No ports are opened.
network_mode: host
env_file: .env
environment:
# Paths inside the container. These win over the same names in .env.
SSH_KEY_PATH: /etc/candygoogy/ssh/id_ed25519
# With several machines, also mount the file below; its ssh_key_path
# entries must be paths in /etc/candygoogy/ssh/ too.
# MACHINES_FILE: /etc/candygoogy/machines.toml
# With the host's / mounted below (accurate disks, mount checks and
# "reboot required"):
# HOMELAB_HOST_ROOT: /host
user: "10001:10001"
read_only: true
tmpfs:
- /tmp:size=16m,mode=1777,nosuid,nodev,noexec
volumes:
# Timers, the last power action, alerts and ssh's known_hosts.
- state:/var/lib/candygoogy-bot
- ./ssh:/etc/candygoogy/ssh:ro
# Optional: several machines (MACHINES_FILE above).
# - ./machines.toml:/etc/candygoogy/machines.toml:ro
# Optional: backup monitoring; set BACKUP_DIR to the same path in .env.
# - /srv/backups:/srv/backups:ro
# Optional: the host's / for /homelab (HOMELAB_HOST_ROOT above).
# Read-only, but the bot can then read whatever on the host is
# world-readable; never combine it with access to Docker's socket.
# - type: bind
# source: /
# target: /host
# read_only: true
# bind:
# propagation: rslave
cap_drop: [ALL]
security_opt:
- no-new-privileges:true
pids_limit: 128
mem_limit: 256m
restart: unless-stopped
stop_grace_period: 30s
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
state: