chore: set DEFAULT_AUTO_FIELD and automate nginx reverse proxy deployment in beta workflow
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 35s
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 35s
This commit is contained in:
parent
cfe1175e6b
commit
757cbc85ae
2 changed files with 29 additions and 4 deletions
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
- name: Checkout Code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Generate CloudWatch Config Locally
|
||||
- name: Generate CloudWatch and Nginx Configs Locally
|
||||
run: |
|
||||
mkdir -p tmp
|
||||
cat << 'EOF' > tmp/amazon-cloudwatch-agent.json
|
||||
|
|
@ -44,6 +44,20 @@ jobs:
|
|||
}
|
||||
}
|
||||
EOF
|
||||
cat << 'EOF' > tmp/nginx-proxy.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name partners.tipro.in;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Package Application
|
||||
run: |
|
||||
|
|
@ -57,7 +71,7 @@ jobs:
|
|||
chmod 600 ~/.ssh/id_rsa
|
||||
|
||||
# Copy app archive and configuration files
|
||||
scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa app.tar.gz tmp/amazon-cloudwatch-agent.json seller-central-backend.service ${{ secrets.BETA_EC2_USERNAME }}@${{ secrets.BETA_EC2_HOST }}:/tmp/
|
||||
scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa app.tar.gz tmp/amazon-cloudwatch-agent.json tmp/nginx-proxy.conf seller-central-backend.service ${{ secrets.BETA_EC2_USERNAME }}@${{ secrets.BETA_EC2_HOST }}:/tmp/
|
||||
|
||||
# Execute deployment commands on remote server
|
||||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.BETA_EC2_USERNAME }}@${{ secrets.BETA_EC2_HOST }} << 'EOF'
|
||||
|
|
@ -65,7 +79,7 @@ jobs:
|
|||
|
||||
# ── 2. Install Host Dependencies ──────────────────────────────
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-pip python3-venv python3-dev default-libmysqlclient-dev pkg-config libpq-dev build-essential
|
||||
sudo apt-get install -y python3-pip python3-venv python3-dev default-libmysqlclient-dev pkg-config libpq-dev build-essential nginx
|
||||
|
||||
# ── 3. Extract codebase to target directory ───────────────────
|
||||
sudo mkdir -p /home/ubuntu/seller_central_backend
|
||||
|
|
@ -104,6 +118,12 @@ jobs:
|
|||
-a fetch-config -m ec2 -s \
|
||||
-c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json
|
||||
|
||||
# ── 9. Cleanup tmp files ───────────────────────────────────────
|
||||
# ── 9. Configure Nginx Reverse Proxy ───────────────────────────
|
||||
sudo mv /tmp/nginx-proxy.conf /etc/nginx/sites-available/seller-central-backend
|
||||
sudo ln -sf /etc/nginx/sites-available/seller-central-backend /etc/nginx/sites-enabled/seller-central-backend
|
||||
sudo rm -f /etc/nginx/sites-enabled/default
|
||||
sudo systemctl restart nginx
|
||||
|
||||
# ── 10. Cleanup tmp files ───────────────────────────────────────
|
||||
rm -f /tmp/app.tar.gz
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -142,6 +142,11 @@ DATABASE_ROUTERS = ['config.db_router.DatabaseRouter']
|
|||
|
||||
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/6.1/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/6.1/ref/settings/#auth-password-validators
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue