Skip to content

Commit

Permalink
Added nginx conf and changed compose
Browse files Browse the repository at this point in the history
  • Loading branch information
kimachinskiy committed Sep 20, 2023
1 parent f1376c1 commit b183abe
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 10 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/django_cd_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker compouse DOWN old containers

- name: Docker compouse DOWN old Django container
run: docker compose -f docker-compose.dev.yml down -v
- name: Docker compouse UP new containers
- name: Docker compouse UP Django container
run: docker compose -f docker-compose.dev.yml up -d --build
- name: Docker compouse MIGRATE models
run: docker compose -f docker-compose.dev.yml exec web-dev python manage.py migrate --noinput

- name: Docker compouse DOWN old Fronend container
run: docker compose -f FrontEnd/docker-compose.yml down -v
- name: Docker compouse UP Fronend container
run: docker compose -f FrontEnd/docker-compose.yml up -d --build

- name: Clean up old docker resources
run: |
docker container prune -f
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/django_cd_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker compouse DOWN old containers
run: docker compose -f docker-compose.prod.yml down -v
- name: Docker compouse UP new containers
run: docker compose -f docker-compose.prod.yml up -d --build

- name: Docker compouse DOWN old Django container
run: docker compose -f docker-compose.dev.yml down -v
- name: Docker compouse UP Django container
run: docker compose -f docker-compose.dev.yml up -d --build
- name: Docker compouse MIGRATE models
run: docker compose -f docker-compose.prod.yml exec web-prod python manage.py migrate --noinput
run: docker compose -f docker-compose.dev.yml exec web-dev python manage.py migrate --noinput

- name: Docker compouse DOWN old Fronend container
run: docker compose -f FrontEnd/docker-compose.yml down -v
- name: Docker compouse UP Fronend container
run: docker compose -f FrontEnd/docker-compose.yml up -d --build

- name: Clean up old docker resources
run: |
docker container prune -f
Expand Down
25 changes: 25 additions & 0 deletions configs/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
listen 80;
server_name 178.212.110.52;

# React
location / {
proxy_pass http://localhost:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

# Django Admin
location /admin/ {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

# PGAdmin
location /pgadmin/ {
proxy_pass http://localhost:5050;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
volumes:
- ./:/Forum
ports:
- 8001:8000
- 8000:8000
environment:
- DEBUG=${DEBUG}
- SECRET_KEY=${SECRET_KEY}
Expand Down
1 change: 0 additions & 1 deletion docker-compose.nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ services:
container_name: nginx
ports:
- 80:80
- 81:81
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
volumes:
- ./:/Forum
ports:
- 8000:8000
- 8001:8000
environment:
- DEBUG=${DEBUG}
- SECRET_KEY=${SECRET_KEY}
Expand Down

0 comments on commit b183abe

Please sign in to comment.