Fix production deployment: preserve .env file + add missing volume + simplified pipeline

This commit is contained in:
Stiftung Development
2025-09-15 23:41:54 +02:00
parent 5ff7b7a3ed
commit 8a4a494610
3 changed files with 69 additions and 4 deletions

View File

@@ -195,14 +195,26 @@ jobs:
script: |
cd /opt/stiftung
# Stash any local changes to avoid conflicts
git stash push -m "Auto-stash before deployment $(date)"
# Check if production .env exists in root directory
if [ ! -f .env ]; then
echo "ERROR: No production .env file found at /opt/stiftung/.env"
echo "Please create it manually using the env-production.template as reference"
echo "Steps:"
echo "1. cp env-production.template .env"
echo "2. nano .env # Edit with real production values"
echo "3. chmod 600 .env # Secure permissions"
exit 1
fi
# Pull latest changes using Personal Access Token
echo "Production .env file found - proceeding with deployment"
# Pull latest code changes (.env is in .gitignore so won't be touched)
git pull https://$DEPLOY_TOKEN@github.com/remmerinio/stiftung-management-system.git main
# Backup current compose.yml
cp compose.yml compose.yml.backup
if [ -f compose.yml ]; then
cp compose.yml compose.yml.backup
fi
# Copy production docker compose file to the active compose.yml
cp deploy-production/docker-compose.prod.yml compose.yml