2022-11-13 01:10:26 +01:00
|
|
|
version: '3'
|
|
|
|
|
|
|
|
includes:
|
2022-12-10 18:16:50 +01:00
|
|
|
util:
|
|
|
|
taskfile: ./utils.yml
|
2022-11-13 01:10:26 +01:00
|
|
|
internal: true
|
2022-11-22 20:46:51 +01:00
|
|
|
dir: ..
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
vars:
|
|
|
|
COMPOSE_FILES:
|
2023-09-13 22:33:47 +02:00
|
|
|
sh: touch enabled ; find ./services -iname docker-compose.yml | grep -f enabled || exit 0
|
2022-11-23 21:44:02 +01:00
|
|
|
COMPOSE_ARGS: -f services/docker-compose.yml -f {{.COMPOSE_FILES | splitLines | join " -f "}}
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
tasks:
|
2023-09-24 22:47:56 +02:00
|
|
|
config:
|
2022-12-10 18:16:50 +01:00
|
|
|
desc: Show merged compose config
|
|
|
|
deps:
|
|
|
|
- util:template
|
|
|
|
cmds:
|
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} config"
|
|
|
|
|
2022-11-13 01:10:26 +01:00
|
|
|
pull:
|
|
|
|
desc: Pull latest docker images
|
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} pull {{.CLI_ARGS}}"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
build:
|
|
|
|
desc: Build latest docker images (if applicable)
|
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} build {{.CLI_ARGS}}"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
up:
|
|
|
|
desc: Deploy given or active services
|
|
|
|
deps:
|
2022-12-10 18:16:50 +01:00
|
|
|
- util:template
|
2022-11-13 01:10:26 +01:00
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} up -d {{.CLI_ARGS}}"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
2024-01-03 17:47:01 +01:00
|
|
|
run:
|
|
|
|
desc: Run a one-time command in a given services
|
|
|
|
deps:
|
|
|
|
- util:template
|
|
|
|
cmds:
|
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} run --rm {{.CLI_ARGS}}"
|
|
|
|
|
2022-11-13 01:10:26 +01:00
|
|
|
restart:
|
|
|
|
desc: Restart given or active services
|
|
|
|
deps:
|
2022-12-10 18:16:50 +01:00
|
|
|
- util:template
|
2022-11-13 01:10:26 +01:00
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} restart {{.CLI_ARGS}}"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
2023-09-13 22:33:47 +02:00
|
|
|
recreate:
|
|
|
|
desc: Recreate given or active services
|
|
|
|
deps:
|
|
|
|
- util:template
|
|
|
|
cmds:
|
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} up -d --force-recreate {{.CLI_ARGS}}"
|
|
|
|
|
2022-11-13 01:10:26 +01:00
|
|
|
stop:
|
|
|
|
desc: Stop given or all services
|
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} stop {{.CLI_ARGS}}"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
down:
|
|
|
|
desc: Stop and remove all services
|
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} down"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
logs:
|
|
|
|
desc: Tail logs of given or all services
|
|
|
|
deps:
|
2022-12-10 18:16:50 +01:00
|
|
|
- util:template
|
2022-11-13 01:10:26 +01:00
|
|
|
cmds:
|
2022-12-10 18:16:50 +01:00
|
|
|
- "docker-compose {{.COMPOSE_ARGS}} logs --tail=50 --follow {{.CLI_ARGS}}"
|
2022-11-13 01:10:26 +01:00
|
|
|
|
|
|
|
upgrade:
|
|
|
|
desc: Pull and re-deploy active services
|
|
|
|
cmds:
|
|
|
|
- task: pull
|
|
|
|
- task: up
|
2022-12-10 18:16:50 +01:00
|
|
|
|
|
|
|
list:
|
|
|
|
desc: List current containers
|
|
|
|
cmds:
|
2022-12-11 23:24:48 +01:00
|
|
|
- docker ps -a --format 'table {{"{{.ID}}"}}\t{{"{{.Image}}"}}\t{{"{{.Names}}"}}\t{{"{{.CreatedAt}}"}}\t{{"{{.Status}}"}}\t{{"{{.Networks}}"}}'
|
2023-02-18 15:25:31 +01:00
|
|
|
|
|
|
|
uplogs:
|
|
|
|
desc: up & logs
|
|
|
|
cmds:
|
|
|
|
- task: up
|
|
|
|
- task: logs
|
2024-09-30 17:56:29 +02:00
|
|
|
|
|
|
|
headlogs:
|
|
|
|
desc: Head logs of given or all containers
|
|
|
|
cmds:
|
|
|
|
- |
|
|
|
|
for id in $(docker ps -q); do
|
|
|
|
echo "=== $(docker inspect $id --format='{{printf `{{.Name}}`}}') ==="
|
|
|
|
echo
|
|
|
|
docker logs $id |& head -n 25
|
|
|
|
echo
|
|
|
|
done
|