container-server/tasks/services.yml

64 lines
1.7 KiB
YAML
Raw Normal View History

version: "3"
vars:
TMP_DIR: /tmp/container-server
tasks:
2023-09-24 22:47:56 +02:00
exec:
desc: Open shell in given container
cmds:
2023-10-29 20:22:54 +01:00
- docker exec -it {{.CLI_ARGS}} sh -c "ash || bash || sh"
2023-09-24 22:47:56 +02:00
mc-update:
desc: update minecraft mods
cmds:
- "docker exec -it -u amp -w /home/amp/.ampdata/instances/Main/Minecraft minecraft bash update_all.sh"
caddy-reload:
desc: Reload Caddy config
cmds:
- "docker exec -w /etc/caddy proxy caddy reload"
mail-setup:
desc: Docker-Mailserver setup utility
cmds:
- "docker exec -i mail setup {{.CLI_ARGS}}"
occ:
desc: Nextcloud cli
cmds:
- "docker exec -u 33 nextcloud php ./occ {{.CLI_ARGS}}"
fail2ban:
desc: Fail2Ban client
cmds:
- docker exec fail2ban fail2ban-client {{.CLI_ARGS}}
2023-09-24 22:47:56 +02:00
watchtower:
desc: Trigger watchtower update
cmds:
- 'curl -is -H "Authorization: Bearer $WATCHTOWER_TOKEN" http://${WATCHTOWER_IP}:8080/v1/update'
psql-dump:
desc: Dump postgres database for backup or update
cmds:
# - echo "{{.TMP_DIR}}/{{.CLI_ARGS}}.sql"
- mkdir -p {{.TMP_DIR}}
- docker exec pg-{{.CLI_ARGS}} pg_dumpall -U {{.CLI_ARGS}} > {{.TMP_DIR}}/{{.CLI_ARGS}}.sql
- ls -la {{.TMP_DIR}}/{{.CLI_ARGS}}.sql
psql-dump-all:
desc: Run 'psql-dump' task for each running postgres container
cmds:
- task compose:list | awk '/postgres/ { sub(/pg-/, "", $3) ; system("task srv:psql-dump -- "$3) }'
psql-restore:
desc: Load postgres database for restore
cmds:
- docker exec -i pg-{{.CLI_ARGS}} psql --echo-errors -U {{.CLI_ARGS}} < {{.TMP_DIR}}/{{.CLI_ARGS}}.sql
psql-clear-tmp:
desc: Clear temporary sql files created by psql-dump
cmds:
- rm -rv {{.TMP_DIR}}