fix(Discovery): Add comprehensive debug logging for router initialization
- Add initializer count logging in DiscoveryServiceBootstrapper - Add route structure analysis in RouterSetup - Add request parameter logging in HttpRouter - Update PHP production config for better OPcache handling - Fix various config and error handling improvements
This commit is contained in:
32
deployment/infrastructure/scripts/deploy.sh
Executable file
32
deployment/infrastructure/scripts/deploy.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Simple Production Deployment Script
|
||||
# Usage: ./deploy.sh
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
INFRA_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
cd "$INFRA_DIR"
|
||||
|
||||
echo "🚀 Deploying to production..."
|
||||
echo "📍 Infrastructure directory: $INFRA_DIR"
|
||||
echo ""
|
||||
|
||||
# Check if vault password file exists
|
||||
if [[ ! -f ".vault_pass" ]]; then
|
||||
echo "❌ Vault password file not found: .vault_pass"
|
||||
echo " Create this file with your Ansible Vault password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run deployment playbook
|
||||
ansible-playbook \
|
||||
-i inventories/production/hosts.yml \
|
||||
playbooks/deploy-rsync-based.yml \
|
||||
--vault-password-file .vault_pass
|
||||
|
||||
echo ""
|
||||
echo "✅ Deployment complete!"
|
||||
echo "🔍 Check status:"
|
||||
echo " ansible web_servers -i inventories/production/hosts.yml -m shell -a 'docker ps' --vault-password-file .vault_pass"
|
||||
46
deployment/infrastructure/scripts/quick-sync.sh
Executable file
46
deployment/infrastructure/scripts/quick-sync.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# Quick Production Code Sync
|
||||
# Usage: ./quick-sync.sh
|
||||
# Note: Does NOT update .env.production (use update-env.sh for that)
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
INFRA_DIR="$PROJECT_ROOT/deployment/infrastructure"
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "🔄 Quick sync to production (code only)..."
|
||||
echo "📍 Project root: $PROJECT_ROOT"
|
||||
echo ""
|
||||
|
||||
# Sync code changes (excludes .env files and development artifacts)
|
||||
rsync -avz \
|
||||
--exclude '.env' \
|
||||
--exclude '.env.local' \
|
||||
--exclude '.env.development' \
|
||||
--exclude '.env.production' \
|
||||
--exclude 'node_modules/' \
|
||||
--exclude '.git/' \
|
||||
--exclude 'vendor/' \
|
||||
--exclude 'tests/' \
|
||||
--exclude '.idea/' \
|
||||
--exclude '.vscode/' \
|
||||
--exclude '*.log' \
|
||||
./ deploy@94.16.110.151:/home/deploy/michaelschiemer/current/
|
||||
|
||||
echo ""
|
||||
echo "🔄 Restarting PHP and web containers..."
|
||||
|
||||
ansible web_servers \
|
||||
-i "$INFRA_DIR/inventories/production/hosts.yml" \
|
||||
-m shell \
|
||||
-a "cd /home/deploy/michaelschiemer/current && docker compose restart php web" \
|
||||
--vault-password-file "$INFRA_DIR/.vault_pass"
|
||||
|
||||
echo ""
|
||||
echo "✅ Quick sync complete!"
|
||||
echo ""
|
||||
echo "⚠️ Note: This does NOT update .env.production"
|
||||
echo " To update configuration, use: ./update-env.sh"
|
||||
74
deployment/infrastructure/scripts/update-env.sh
Executable file
74
deployment/infrastructure/scripts/update-env.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# Update Production .env.production File
|
||||
# Usage: ./update-env.sh
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
INFRA_DIR="$PROJECT_ROOT/deployment/infrastructure"
|
||||
|
||||
SOURCE_ENV="$PROJECT_ROOT/deployment/applications/environments/.env.production"
|
||||
REMOTE_PATH="/home/deploy/michaelschiemer/shared/.env.production"
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "🔍 Validating .env.production..."
|
||||
|
||||
if [[ ! -f "$SOURCE_ENV" ]]; then
|
||||
echo "❌ Source .env.production not found at: $SOURCE_ENV"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate required variables
|
||||
REQUIRED_VARS=("DB_DRIVER" "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD")
|
||||
VALIDATION_FAILED=0
|
||||
|
||||
for var in "${REQUIRED_VARS[@]}"; do
|
||||
if ! grep -q "^${var}=" "$SOURCE_ENV"; then
|
||||
echo "❌ Missing required variable: $var"
|
||||
VALIDATION_FAILED=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Check PostgreSQL port
|
||||
if ! grep -q "^DB_PORT=5432" "$SOURCE_ENV"; then
|
||||
echo "⚠️ Warning: DB_PORT should be 5432 for PostgreSQL"
|
||||
read -p "Continue anyway? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $VALIDATION_FAILED -eq 1 ]]; then
|
||||
echo "❌ Validation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Validation passed"
|
||||
echo ""
|
||||
|
||||
echo "📤 Uploading .env.production to production server..."
|
||||
|
||||
ansible web_servers \
|
||||
-i "$INFRA_DIR/inventories/production/hosts.yml" \
|
||||
-m copy \
|
||||
-a "src=$SOURCE_ENV dest=$REMOTE_PATH mode=0644" \
|
||||
--vault-password-file "$INFRA_DIR/.vault_pass"
|
||||
|
||||
echo ""
|
||||
echo "🔄 Restarting containers..."
|
||||
|
||||
ansible web_servers \
|
||||
-i "$INFRA_DIR/inventories/production/hosts.yml" \
|
||||
-m shell \
|
||||
-a "cd /home/deploy/michaelschiemer/current && docker compose restart php web queue-worker" \
|
||||
--vault-password-file "$INFRA_DIR/.vault_pass"
|
||||
|
||||
echo ""
|
||||
echo "✅ .env.production updated and containers restarted!"
|
||||
echo ""
|
||||
echo "🔍 Verify:"
|
||||
echo " curl -I https://michaelschiemer.de"
|
||||
echo " (Should return HTTP/2 200 OK)"
|
||||
Reference in New Issue
Block a user