Run container as host deploy user

This commit is contained in:
MiTHRAL 2026-05-13 22:16:06 -04:00
parent 991ccdbbb1
commit 3b2e7cdd12
4 changed files with 12 additions and 0 deletions

View file

@ -1,5 +1,7 @@
DISCORD_BOT_TOKEN=replace-with-your-discord-bot-token DISCORD_BOT_TOKEN=replace-with-your-discord-bot-token
DISCORD_CHANNEL_ID=1504278732070981683 DISCORD_CHANNEL_ID=1504278732070981683
PUID=1000
PGID=1000
ARCHIVE_STATUS_CONFIG=services.json ARCHIVE_STATUS_CONFIG=services.json
ARCHIVE_STATUS_STATE=state/status-message.json ARCHIVE_STATUS_STATE=state/status-message.json
CHECK_INTERVAL_SECONDS=60 CHECK_INTERVAL_SECONDS=60

View file

@ -1,5 +1,7 @@
DISCORD_BOT_TOKEN=replace-with-your-discord-bot-token DISCORD_BOT_TOKEN=replace-with-your-discord-bot-token
DISCORD_CHANNEL_ID=1504278732070981683 DISCORD_CHANNEL_ID=1504278732070981683
PUID=1000
PGID=1000
ARCHIVE_STATUS_CONFIG=services.json ARCHIVE_STATUS_CONFIG=services.json
ARCHIVE_STATUS_STATE=state/status-message.json ARCHIVE_STATUS_STATE=state/status-message.json
CHECK_INTERVAL_SECONDS=60 CHECK_INTERVAL_SECONDS=60

View file

@ -106,12 +106,19 @@ Paste the generated password hash into `.env` before starting the container.
Make sure Docker can read the service config and write runtime state: Make sure Docker can read the service config and write runtime state:
```sh ```sh
printf 'PUID=%s\nPGID=%s\n' "$(id -u)" "$(id -g)" >> .env
chmod 600 .env chmod 600 .env
chmod 644 services.json chmod 644 services.json
mkdir -p state mkdir -p state
chmod 755 state chmod 755 state
``` ```
If `state/` or `services.json` were created by a previous container as another user, fix ownership once:
```sh
sudo chown -R "$(id -u):$(id -g)" services.json state
```
The bot stores the Discord message ID in `state/status-message.json`. Keep that file mounted so the bot edits the same message after restarts. The bot stores the Discord message ID in `state/status-message.json`. Keep that file mounted so the bot edits the same message after restarts.
The deploy compose joins your existing reverse-proxy network: The deploy compose joins your existing reverse-proxy network:

View file

@ -3,6 +3,7 @@ services:
build: . build: .
container_name: archive-status-bot container_name: archive-status-bot
restart: unless-stopped restart: unless-stopped
user: "${PUID:-1000}:${PGID:-1000}"
env_file: env_file:
- .env - .env
expose: expose: