Files
dyolink/infrastructure/scripts/prod-remote-deploy.sh
rameen 573e5e0886
All checks were successful
Production — tag build, push, deploy / build-and-push (push) Successful in 4m23s
Production — tag build, push, deploy / deploy (push) Successful in 11m52s
auto deploy on production server now finalized ready for smoke test.
2026-08-29 16:25:27 +03:30

27 lines
981 B
Bash
Executable File

#!/usr/bin/env bash
# Run on the Linux production host (CI SSHs here after pushing :v* images).
# Usage: ./prod-remote-deploy.sh v1.0.1
set -euo pipefail
TAG="${1:?usage: prod-remote-deploy.sh v1.0.1}"
INFRA="${PROD_INFRA_DIR:-/opt/dyolink/infrastructure}"
cd "$INFRA"
if [ ! -f .env ]; then
echo "Missing $INFRA/.env — copy deploy.prod.env.example and set DOMAIN=nudentic.ir REGISTRY_PREFIX=wixur.ir:3000/<owner>"
exit 1
fi
if ! grep -q '^REGISTRY_PREFIX=.\+' .env; then
echo "Set REGISTRY_PREFIX in .env (Gitea registry, e.g. wixur.ir:3000/admin). Do not use Docker Hub :latest for tag deploys."
exit 1
fi
export TAG
echo "Pulling backend/frontend :$TAG from Gitea (REGISTRY_PREFIX in .env)"
docker compose -f docker-compose.prod.yml --env-file .env pull backend frontend
docker compose -f docker-compose.prod.yml --env-file .env up -d
echo "=== Status ==="
docker compose -f docker-compose.prod.yml --env-file .env ps
echo "Health: https://nudentic.ir/api/health"