diff --git a/.github/workflows/django_cd_dev.yml b/.github/workflows/django_cd_dev.yml index 813f1d96a..4e79ffbb5 100644 --- a/.github/workflows/django_cd_dev.yml +++ b/.github/workflows/django_cd_dev.yml @@ -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 diff --git a/.github/workflows/django_cd_prod.yml b/.github/workflows/django_cd_prod.yml index c9b52c7ba..d0655224e 100644 --- a/.github/workflows/django_cd_prod.yml +++ b/.github/workflows/django_cd_prod.yml @@ -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 diff --git a/configs/nginx/nginx.conf b/configs/nginx/nginx.conf new file mode 100644 index 000000000..e5ddd96bb --- /dev/null +++ b/configs/nginx/nginx.conf @@ -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; + } +} diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 87bc09ef6..b8508d091 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -9,7 +9,7 @@ services: volumes: - ./:/Forum ports: - - 8001:8000 + - 8000:8000 environment: - DEBUG=${DEBUG} - SECRET_KEY=${SECRET_KEY} diff --git a/docker-compose.nginx.yml b/docker-compose.nginx.yml index 7b8f78d29..217d6c122 100644 --- a/docker-compose.nginx.yml +++ b/docker-compose.nginx.yml @@ -6,4 +6,3 @@ services: container_name: nginx ports: - 80:80 - - 81:81 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 0f1a23170..4a143ebf3 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -9,7 +9,7 @@ services: volumes: - ./:/Forum ports: - - 8000:8000 + - 8001:8000 environment: - DEBUG=${DEBUG} - SECRET_KEY=${SECRET_KEY}