-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DOCKER): split docker compose config for better managment (#225)
- Loading branch information
Showing
7 changed files
with
158 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from pathlib import Path | ||
|
||
from django.core.management import BaseCommand | ||
from loguru import logger | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **options): | ||
logger.debug("This is a command to be used as a playground") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,131 +2,12 @@ version: "3.7" | |
|
||
services: | ||
|
||
# Production environment services | ||
db: | ||
image: postgres:14 | ||
restart: always | ||
profiles: | ||
- production | ||
volumes: | ||
- postgress_db:/var/lib/postgresql/data | ||
|
||
environment: | ||
- POSTGRES_NAME=${DB_NAME} | ||
- POSTGRES_USER=${DB_USERNAME} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: "10s" | ||
timeout: "5s" | ||
retries: 5 | ||
start_period: "10s" | ||
|
||
bfportal_gg_production: | ||
image: docker.pkg.github.com/battlefield-portal-community/bfportal.gg/main:latest | ||
restart: always | ||
command: bash -c "python manage.py migrate --noinput && python manage.py ensure_superuser --username bfportal --email [email protected] --password '${SU_PASSWD}' && python manage.py ensure_initialization && gunicorn --workers 4 --bind 0.0.0.0:${PRODUCTION_PORT}" | ||
user: "33:33" | ||
profiles: | ||
- production | ||
ports: | ||
- "${PRODUCTION_PORT}:${PRODUCTION_PORT}" | ||
volumes: | ||
- type: "bind" | ||
source: /var/www/bfportal-media | ||
target: /app/media | ||
environment: | ||
- PRODUCTION_KEY=${PRODUCTION_KEY} | ||
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID} | ||
- DISCORD_SECRET=${DISCORD_SECRET} | ||
- DB_NAME=${DB_NAME} | ||
- DB_USERNAME=${DB_USERNAME} | ||
- DB_PASSWORD=${DB_PASSWORD} | ||
- POSTGRES_HOST=db # takes precedent over .env file | ||
- DEBUG=${DEBUG} | ||
- APPROVAL_CHANNEL_WEBHOOK_TOKEN=${APPROVAL_CHANNEL_WEBHOOK_TOKEN} | ||
- APPROVAL_CHANNEL_WEBHOOK_ID=${APPROVAL_CHANNEL_WEBHOOK_ID} | ||
- APPROVAL_SUCCESS_CHANNEL_WEBHOOK_TOKEN=${APPROVAL_SUCCESS_CHANNEL_WEBHOOK_TOKEN} | ||
- APPROVAL_SUCCESS_CHANNEL_WEBHOOK_ID=${APPROVAL_SUCCESS_CHANNEL_WEBHOOK_ID} | ||
- PRODUCTION_HOST=${PRODUCTION_HOST} | ||
- PRODUCTION_PORT=${PRODUCTION_PORT} | ||
- OWNERS=${OWNERS} | ||
depends_on: | ||
- db | ||
healthcheck: | ||
test: curl -fk http://0.0.0.0:${PRODUCTION_PORT}/ || exit 1 | ||
interval: "60s" | ||
timeout: "3s" | ||
retries: 3 | ||
start_period: "5s" | ||
|
||
# Dev environment services (on remote server) | ||
db_devel: | ||
image: postgres:14 | ||
restart: always | ||
profiles: | ||
- dev | ||
volumes: | ||
- postgress_db_devel:/var/lib/postgresql/data | ||
|
||
environment: | ||
- POSTGRES_NAME=${DB_NAME} | ||
- POSTGRES_USER=${DB_USERNAME} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: "10s" | ||
timeout: "5s" | ||
retries: 5 | ||
start_period: "10s" | ||
|
||
bfportal_gg_dev: | ||
image: docker.pkg.github.com/battlefield-portal-community/bfportal.gg/dev:latest | ||
restart: always | ||
command: bash -c "python manage.py migrate --noinput && python manage.py ensure_superuser --username bfportal --email [email protected] --password '${SU_PASSWD}' && python manage.py ensure_initialization && gunicorn --workers 4 --bind 0.0.0.0:${DEVEL_PORT}" | ||
user: "33:33" | ||
profiles: | ||
- dev | ||
ports: | ||
- "${DEVEL_PORT}:${DEVEL_PORT}" | ||
volumes: | ||
- type: "bind" | ||
source: /var/www/bfportal-devel-media | ||
target: /app/media | ||
environment: | ||
- PRODUCTION_KEY=${PRODUCTION_KEY} | ||
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID} | ||
- DISCORD_SECRET=${DISCORD_SECRET} | ||
- DB_NAME=${DB_NAME} | ||
- DB_USERNAME=${DB_USERNAME} | ||
- DB_PASSWORD=${DB_PASSWORD} | ||
- POSTGRES_HOST=db_devel # takes precedent over .env file | ||
- DEBUG=True | ||
- APPROVAL_CHANNEL_WEBHOOK_TOKEN=${APPROVAL_CHANNEL_WEBHOOK_TOKEN} | ||
- APPROVAL_CHANNEL_WEBHOOK_ID=${APPROVAL_CHANNEL_WEBHOOK_ID} | ||
- APPROVAL_SUCCESS_CHANNEL_WEBHOOK_TOKEN=${APPROVAL_SUCCESS_CHANNEL_WEBHOOK_TOKEN} | ||
- APPROVAL_SUCCESS_CHANNEL_WEBHOOK_ID=${APPROVAL_SUCCESS_CHANNEL_WEBHOOK_ID} | ||
- PRODUCTION_HOST=${PRODUCTION_HOST} | ||
- PRODUCTION_PORT=${PRODUCTION_PORT} | ||
- OWNERS=${OWNERS} | ||
- DEVEL_PORT=${DEVEL_PORT} | ||
depends_on: | ||
- db_devel | ||
healthcheck: | ||
test: curl -fk http://0.0.0.0:${DEVEL_PORT}/ || exit 1 | ||
interval: "60s" | ||
timeout: "3s" | ||
retries: 3 | ||
start_period: "5s" | ||
|
||
# Dev environment services (on local machine) | ||
db_dev_local: | ||
db: | ||
image: postgres:14 | ||
restart: always | ||
volumes: | ||
- postgress_db_dev_local:/var/lib/postgresql/data | ||
profiles: | ||
- dev_local | ||
- postgres_db_dev_local:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_NAME=${DB_NAME} | ||
- POSTGRES_USER=${DB_USERNAME} | ||
|
@@ -138,16 +19,14 @@ services: | |
retries: 5 | ||
start_period: "10s" | ||
|
||
bfportal_dev_local: | ||
bfportal: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
dockerfile: docker/Dockerfile | ||
target: dev | ||
restart: no | ||
command: bash -c "python manage.py migrate --noinput && python manage.py ensure_superuser --username bfportal --email [email protected] --password 1234 && python manage.py ensure_initialization && python manage.py mock -u 10 -e 50 --noregen && python manage.py runserver 0.0.0.0:8000" | ||
container_name: bfportal_dev_local | ||
profiles: | ||
- dev_local | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
|
@@ -158,7 +37,7 @@ services: | |
- DB_NAME=${DB_NAME} | ||
- DB_USERNAME=${DB_USERNAME} | ||
- DB_PASSWORD=${DB_PASSWORD} | ||
- POSTGRES_HOST=db_dev_local # takes precedent over .env file | ||
- POSTGRES_HOST=db # takes precedent over .env file | ||
- DEBUG=True | ||
- APPROVAL_CHANNEL_WEBHOOK_TOKEN=${APPROVAL_CHANNEL_WEBHOOK_TOKEN} | ||
- APPROVAL_CHANNEL_WEBHOOK_ID=${APPROVAL_CHANNEL_WEBHOOK_ID} | ||
|
@@ -175,26 +54,22 @@ services: | |
retries: 5 | ||
start_period: "10s" | ||
depends_on: | ||
- db_dev_local | ||
- db | ||
|
||
bfportal_dev_local_tailwind: | ||
tailwind: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
dockerfile: docker/dockerfile | ||
target: dev | ||
command: npm run watch | ||
restart: always | ||
container_name: bfportal_dev_local_tailwind | ||
profiles: | ||
- dev_local | ||
volumes: | ||
- ./bfportal:/app | ||
depends_on: | ||
bfportal_dev_local: | ||
bfportal: | ||
condition: service_healthy | ||
stdin_open: true | ||
|
||
volumes: | ||
postgress_db_devel: | ||
postgress_db: | ||
postgress_db_dev_local: | ||
postgres_db_dev_local: |
Oops, something went wrong.