From fedd3f28c3df028345c57d8b12b16256997be075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D0=B5=D0=B3=20=D0=93=D0=BE=D0=B2=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D1=81=D0=BA=D0=B8=D0=B9?= Date: Fri, 27 Sep 2024 19:41:12 +0500 Subject: [PATCH] test deploy8 --- .github/workflows/prod_deploy.yaml | 3 +-- infra/nginx/nginx_prod.conf | 39 +++++++++++++++++++++++++++++ infra/prod/docker-compose.prod.yaml | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 infra/nginx/nginx_prod.conf diff --git a/.github/workflows/prod_deploy.yaml b/.github/workflows/prod_deploy.yaml index 9fe87412..c408d675 100644 --- a/.github/workflows/prod_deploy.yaml +++ b/.github/workflows/prod_deploy.yaml @@ -93,7 +93,7 @@ jobs: source: "infra" target: "${{ env.DEPLOY_PATH }}" overwrite: true - + - name: Execute commands on VPS uses: appleboy/ssh-action@master with: @@ -103,7 +103,6 @@ jobs: passphrase: ${{ secrets.SSH_PASSPHRASE }} script: | cd ${{ env.DEPLOY_PATH }} - rm .env touch .env echo "${{ secrets.ENV_FILE }}" > .env diff --git a/infra/nginx/nginx_prod.conf b/infra/nginx/nginx_prod.conf new file mode 100644 index 00000000..73bcb779 --- /dev/null +++ b/infra/nginx/nginx_prod.conf @@ -0,0 +1,39 @@ +server { + listen 80; + listen [::]:80; + server_name _; + return 308 https://$host$request_uri; +} + +server { + listen 443 ssl http2; # REMOVED default_server + listen [::]:443 ssl http2; # REMOVED default_server + + server_name ${HOST}; # PUT YOUR DOMAIN HERE + + include /config/nginx/ssl.conf; + + location / { + proxy_pass http://site:8000; + 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; + } + + location /admin/ { + proxy_pass http://site:8000/admin/; + 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; + } + + location /media/ { + root /var/html/; + } + + location /static/ { + root /var/html/; + } +} diff --git a/infra/prod/docker-compose.prod.yaml b/infra/prod/docker-compose.prod.yaml index dc83a6b8..685219c4 100644 --- a/infra/prod/docker-compose.prod.yaml +++ b/infra/prod/docker-compose.prod.yaml @@ -38,7 +38,7 @@ services: - VALIDATION=http - STAGING=${ST} volumes: - - ../nginx/nginx_stage.conf:/config/nginx/site-confs/default.conf + - ../nginx/nginx_prod.conf:/config/nginx/site-confs/default.conf - swag_volume_stage:/config - static_value:/var/html/static/ - ../../media:/var/html/media/