diff --git a/.gitignore b/.gitignore index 3d1c146..2a3a117 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .venv/ .env node_modules/ -hardcoded-strings-report.md \ No newline at end of file +hardcoded-strings-report.md +backend.env \ No newline at end of file diff --git a/conf/backend.env.default b/conf/backend.env.default new file mode 100644 index 0000000..3753350 --- /dev/null +++ b/conf/backend.env.default @@ -0,0 +1,22 @@ + +TZ="Europe/Paris" +TEST_MODE=true +CSRF_COOKIE_SECURE=true +CSRF_COOKIE_DOMAIN=".localhost" +CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8080,http://127.0.0.1:8080 +CSRF_TRUSTED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8080,http://127.0.0.1:8080 +BASE_URL=http://localhost:3000 +DEBUG=false +EMAIL_HOST="smtp.hostinger.com" +EMAIL_PORT="587" +EMAIL_HOST_USER="" +EMAIL_HOST_PASSWORD='' +EMAIL_USE_TLS=true +EMAIL_USE_SSL=false +DB_NAME="school" +DB_USER="postgres" +DB_PASSWORD="postgres" +DB_HOST="database" +DB_PORT="5432" +URL_DJANGO="http://localhost:8080" +SECRET_KEY="" \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index ec0e204..f0d77e5 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,15 +1,19 @@ services: redis: - image: 'redis:latest' + image: "redis:latest" + volumes: + - redis-data:/data expose: - 6379 environment: - TZ=Europe/Paris database: - image: 'postgres:latest' + image: "postgres:latest" expose: - 5432 + volumes: + - postgres-data:/var/lib/postgresql/data environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -20,17 +24,13 @@ services: image: git.v0id.ovh/n3wt-innov/n3wt-school/backend:latest ports: - 8080:8080 - environment: - - TZ=Europe/Paris - - TEST_MODE=True + env_file: "./conf/backend.env" links: - "database:database" - "redis:redis" depends_on: - redis - database - volumes: - - ./conf/application.json:/Back-End/Subscriptions/Configuration/application.json command: python start.py frontend: @@ -40,6 +40,8 @@ services: environment: - TZ=Europe/Paris - NODE_ENV=production - - NEXT_PUBLIC_API_URL=http://toto:8080 - depends_on: - - backend \ No newline at end of file + volumes: + - ./conf/env:/app/.env +volumes: + postgres-data: + redis-data: diff --git a/docker-compose.yml b/docker-compose.yml index 62a8fd5..f000e9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,55 +1,24 @@ services: redis: image: "redis:latest" - ports: - - 6379:6379 - + volumes: + - redis-data:/data + expose: + - 6379 environment: - TZ=Europe/Paris database: image: "postgres:latest" - ports: - - 5432:5432 + expose: + - 5432 + volumes: + - postgres-data:/var/lib/postgresql/data environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: school TZ: Europe/Paris - # docuseal_db: - # image: postgres:latest - # environment: - # POSTGRES_USER: postgres - # POSTGRES_PASSWORD: postgres - # DOCUSEAL_DB_HOST: docuseal_db - # POSTGRES_DB: docuseal - # ports: - # - 5433:5432 # port différent si besoin d'accès direct depuis l'hôte - - # docuseal: - # image: docuseal/docuseal:latest - # container_name: docuseal_app - # depends_on: - # - docuseal_db - # ports: - # - "3001:3000" - # environment: - # DATABASE_URL: postgresql://postgres:postgres@docuseal_db:5432/docuseal - # volumes: - # - ./docuseal:/data/docuseal - - # caddy: - # image: caddy:2 - # container_name: caddy - # restart: unless-stopped - # ports: - # - "4000:4443" - # volumes: - # - ./Caddyfile:/etc/caddy/Caddyfile - # - caddy_data:/data - # - caddy_config:/config - # depends_on: - # - docuseal backend: build: @@ -58,54 +27,15 @@ services: - 8080:8080 volumes: - ./Back-End:/Back-End - environment: - - TZ=Europe/Paris - - TEST_MODE=True - - CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8080,http://127.0.0.1:8080 - - CSRF_TRUSTED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8080,http://127.0.0.1:8080 - - BASE_URL=http://localhost:3000 + env_file: "./conf/backend.env" links: - "database:database" - "redis:redis" depends_on: - redis - database - #- docuseal command: python start.py - # init_docuseal_users: - # build: - # context: . - # dockerfile: Dockerfile - # depends_on: - # - docuseal - # environment: - # DOCUSEAL_DB_HOST: docuseal_db - # POSTGRES_USER: postgres - # POSTGRES_PASSWORD: postgres - # USER_FIRST_NAME: n3wt - # USER_LAST_NAME: school - # USER_COMPANY: n3wt.innov - # USER_EMAIL: n3wt.school@gmail.com - # USER_PASSWORD: n3wt1234 - # volumes: - # - ./initDocusealUsers.sh:/docker-entrypoint-initdb.d/initDocusealUsers.sh - - # frontend: - # build: - # context: ./Front-End - # args: - # - BUILD_MODE=development - # ports: - # - 3000:3000 - # volumes: - # - ./Front-End:/app - # env_file: - # - .env - # environment: - # - TZ=Europe/Paris - # depends_on: - # - backend volumes: - caddy_data: - caddy_config: + postgres-data: + redis-data: