#!/usr/bin/env bash set -euo pipefail cp ~/games_app/deploy/release/tloto-deploy.sh /tmp/tloto-deploy.sh 2>/dev/null || true # expect scripts already uploaded beside this file in ~/gitea if [[ -f ~/gitea/tloto-deploy.sh ]]; then cp ~/gitea/tloto-deploy.sh ~/games_app/deploy/release/tloto-deploy.sh fi sudo cp ~/games_app/deploy/release/tloto-deploy.sh /opt/tloto/bin/tloto-deploy sudo chmod 755 /opt/tloto/bin/tloto-deploy bash ~/gitea/write-fetch-url.sh SHA="$(cd ~/games_app && git rev-parse HEAD)" /opt/tloto/bin/tloto-deploy --ref "$SHA" --mode http --skip-migrate echo "--- current.json ---" cat /var/lib/tloto/current.json echo bash ~/gitea/cleanup-oneshots.sh curl -fsS http://127.0.0.1:9080/health | head -c 100; echo cd ~/games_app sudo npm run db:migrate echo MIGRATE_CMD_OK sudo -u postgres psql -d gitea -c "SELECT id, left(title,40) AS title, status FROM action_run ORDER BY id DESC LIMIT 5;" sudo docker logs tloto_act_runner --tail 40 # edge mkdir -p ~/edge/certs cp -a ~/games_app/deploy/edge/docker-compose.yml ~/edge/ 2>/dev/null || true cp -a ~/games_app/deploy/edge/nginx.conf ~/edge/ 2>/dev/null || true cd ~/edge && sudo docker compose --profile edge up -d || true curl -fsS http://127.0.0.1:3000/api/v1/version; echo echo FINALIZE2_OK