version: '3' includes: prod: taskfile: ./deploy-prod.yml flatten: true tasks: deploy-dev: desc: Deploy develop branch to development host via SSH + Docker Compose cmds: - | set -eu : "${DEPLOY_HOST:?DEPLOY_HOST is required}" : "${DEPLOY_USER:?DEPLOY_USER is required}" : "${DEPLOY_PATH:?DEPLOY_PATH is required}" : "${DEPLOY_REF:?DEPLOY_REF is required}" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "${DEPLOY_USER}@${DEPLOY_HOST}" " set -euo pipefail cd '${DEPLOY_PATH}' PREV_REF=\$(git rev-parse HEAD) rollback() { echo 'Deployment failed, rolling back to previous ref' >&2 git checkout -f \"\${PREV_REF}\" docker compose -f infrastructure/prod/docker-compose.yml --env-file infrastructure/prod/.env.prod up -d --build } trap rollback ERR git fetch --all --tags --prune git checkout -f '${DEPLOY_REF}' git pull --ff-only origin '${DEPLOY_REF}' docker compose -f infrastructure/prod/docker-compose.yml --env-file infrastructure/prod/.env.prod config > /tmp/knowfoolery-compose-dev.txt docker compose -f infrastructure/prod/docker-compose.yml --env-file infrastructure/prod/.env.prod build docker compose -f infrastructure/prod/docker-compose.yml --env-file infrastructure/prod/.env.prod up -d for target in 8080 8081 8082 8083 8085 18086; do curl -fsS \"http://localhost:\\${target}/health\" > /tmp/knowfoolery-health-\\${target}.txt curl -fsS \"http://localhost:\\${target}/ready\" > /tmp/knowfoolery-ready-\\${target}.txt done curl -fsS http://localhost:8086/health > /tmp/knowfoolery-smoke-health.txt curl -fsS http://localhost:8086/ready > /tmp/knowfoolery-smoke-ready.txt curl -fsS http://localhost:8086/api/v1/leaderboard/top10 > /tmp/knowfoolery-smoke-top10.txt curl -fsS http://localhost:8086/api/v1/leaderboard/stats > /tmp/knowfoolery-smoke-stats.txt "