mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-08-14 04:40:36 +03:00
Setup production env
This commit is contained in:
parent
6e81c13be5
commit
a4c31efdb6
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
# SECURITY SENSITIVE FILES
|
||||
# persistent/*
|
||||
secrets/
|
||||
|
||||
# External distributions
|
||||
rsconcept/backend/import/*.whl
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
version: "3.9"
|
||||
|
||||
volumes:
|
||||
postgres_volume:
|
||||
name: "postgres-db"
|
80
docker-compose-prod.yml
Normal file
80
docker-compose-prod.yml
Normal file
|
@ -0,0 +1,80 @@
|
|||
volumes:
|
||||
postgres_volume:
|
||||
name: "portal-db"
|
||||
django_static_volume:
|
||||
name: "portal-static"
|
||||
django_media_volume:
|
||||
name: "portal-media"
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: concept-api-net
|
||||
|
||||
secrets:
|
||||
django_key:
|
||||
file: ./secrets/django_key.txt
|
||||
db_password:
|
||||
file: ./secrets/db_password.txt
|
||||
|
||||
services:
|
||||
frontend:
|
||||
restart: always
|
||||
container_name: "portal-front"
|
||||
depends_on:
|
||||
- backend
|
||||
build:
|
||||
context: ./rsconcept/frontend
|
||||
ports:
|
||||
- 3000:3000
|
||||
command: serve -s /home/node -l 3000
|
||||
|
||||
|
||||
backend:
|
||||
restart: always
|
||||
container_name: "portal-back"
|
||||
depends_on:
|
||||
- postgresql-db
|
||||
- nginx
|
||||
secrets:
|
||||
- db_password
|
||||
- django_key
|
||||
build:
|
||||
context: ./rsconcept/backend
|
||||
env_file: ./rsconcept/backend/.env.prod
|
||||
environment:
|
||||
SECRET_KEY: /run/secrets/django_key
|
||||
DB_PASSWORD: /run/secrets/db_password
|
||||
ports:
|
||||
- 8000:8000
|
||||
volumes:
|
||||
- django_static_volume:/home/app/web/static
|
||||
- django_media_volume:/home/app/web/media
|
||||
command:
|
||||
gunicorn -w 3 project.wsgi --bind 0.0.0.0:8000
|
||||
|
||||
|
||||
postgresql-db:
|
||||
restart: always
|
||||
container_name: "portal-db"
|
||||
image: postgres:alpine
|
||||
secrets:
|
||||
- db_password
|
||||
env_file: ./postgresql/.env.prod
|
||||
environment:
|
||||
POSTGRES_PASSWORD: /run/secrets/db_password
|
||||
volumes:
|
||||
- postgres_volume:/var/lib/postgresql/data
|
||||
|
||||
|
||||
nginx:
|
||||
restart: always
|
||||
container_name: "portal-nginx"
|
||||
build:
|
||||
context: ./nginx
|
||||
ports:
|
||||
- 1337:80
|
||||
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
||||
volumes:
|
||||
- django_static_volume:/var/www/static
|
||||
- django_media_volume:/var/www/media
|
||||
|
|
@ -6,7 +6,7 @@ upstream innerdjango {
|
|||
|
||||
server {
|
||||
listen 80;
|
||||
server_name rs.acconcept.ru;
|
||||
server_name portal.acconcept.ru;
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
|
|
2
postgresql/.env.prod
Normal file
2
postgresql/.env.prod
Normal file
|
@ -0,0 +1,2 @@
|
|||
POSTGRES_USER=portal-admin
|
||||
POSTGRES_DB=portal-db
|
|
@ -4,8 +4,8 @@
|
|||
# Application settings
|
||||
SECRET_KEY=django-insecure-)rq@!&v7l2r%2%q#n!uq+zk@=&yc0^&ql^7%2!%9u)vt1x&j=d
|
||||
ALLOWED_HOSTS=rs.acconcept.ru;localhost;portal.acconcept.ru
|
||||
CSRF_TRUSTED_ORIGINS=http://rs.acconcept.ru:3000;http://localhost:3000;http://portal.acconcept.ru:3000
|
||||
CORS_ALLOWED_ORIGINS=http://rs.acconcept.ru:3000;http://localhost:3000;http://portal.acconcept.ru:3000
|
||||
CSRF_TRUSTED_ORIGINS=http://rs.acconcept.ru:3000;http://localhost:3000
|
||||
CORS_ALLOWED_ORIGINS=http://rs.acconcept.ru:3000;http://localhost:3000
|
||||
|
||||
|
||||
# File locations
|
||||
|
|
24
rsconcept/backend/.env.prod
Normal file
24
rsconcept/backend/.env.prod
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Application settings
|
||||
|
||||
ALLOWED_HOSTS=localhost;portal.acconcept.ru;dev.concept.ru
|
||||
CSRF_TRUSTED_ORIGINS=http://dev.concept.ru:3000;http://localhost:3000;http://portal.acconcept.ru:3000
|
||||
CORS_ALLOWED_ORIGINS=http://dev.concept.ru:3000;http://localhost:3000;http://portal.acconcept.ru:3000
|
||||
|
||||
|
||||
# File locations
|
||||
STATIC_ROOT=/home/app/web/static
|
||||
MEDIA_ROOT=/home/app/web/media
|
||||
|
||||
|
||||
# Database settings
|
||||
DB_ENGINE=django.db.backends.postgresql_psycopg2
|
||||
DB_NAME=portal-db
|
||||
DB_USER=portal-admin
|
||||
DB_HOST=postgresql-db
|
||||
DB_PORT=5432
|
||||
|
||||
|
||||
# Debug settings
|
||||
DEBUG=0
|
||||
PYTHONDEVMODE=0
|
||||
PYTHONTRACEMALLOC=0
|
|
@ -1,6 +1,7 @@
|
|||
// Constants
|
||||
const prod = {
|
||||
backend: 'http://rs.acconcept.ru:8000',
|
||||
// backend: 'http://dev.concept.ru:8000',
|
||||
backend: 'http://localhost:8000',
|
||||
};
|
||||
|
||||
const dev = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user