-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: separate production and development django settings
- Separates out development/debugging django settings into a separate debug_settings.py file - Adds ability to set a non-default (non cantusdata.settings) django settings file via environment variables - Creates a compose-dev.yaml compose configuration file for development - Removes unnecessary port mappings from the production docker compose configuration - Updates the README to account for these changes
- Loading branch information
Showing
7 changed files
with
151 additions
and
51 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
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,22 @@ | ||
""" | ||
Overwrites some main settings that are used in development. | ||
""" | ||
|
||
from .settings import * | ||
|
||
DEBUG = is_development | ||
|
||
DEBUG_TOOLBAR_CONFIG = { | ||
"SHOW_TOOLBAR_CALLBACK": lambda request: ( | ||
False if request.headers.get("x-requested-with") == "XMLHttpRequest" else True | ||
), | ||
} | ||
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") | ||
INSTALLED_APPS.extend(["django_extensions", "debug_toolbar"]) | ||
|
||
|
||
SESSION_COOKIE_SECURE = False | ||
CSRF_COOKIE_SECURE = False | ||
|
||
SECURE_HSTS_INCLUDE_SUBDOMAINS = False | ||
SECURE_HSTS_PRELOAD = False |
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,108 @@ | ||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: ./app/Dockerfile | ||
args: | ||
DEVELOPMENT: ${DEVELOPMENT} | ||
container_name: cantus-app-1 | ||
command: /code/django-config.sh | ||
volumes: | ||
- ./app/public:/code/public | ||
- django_static_volume:/code/static | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
solr: | ||
condition: service_started | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
- APP_VERSION=${APP_VERSION} | ||
- DEVELOPMENT=${DEVELOPMENT} | ||
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} | ||
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY} | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- RABBIT_USER=${RABBIT_USER} | ||
- RABBIT_PASSWORD=${RABBIT_PASSWORD} | ||
- RABBIT_VHOST=${RABBIT_VHOST} | ||
|
||
postgres: | ||
build: ./postgres | ||
container_name: cantus-postgres-1 | ||
volumes: | ||
- ./data/postgres:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" | ||
interval: 30s | ||
timeout: 30s | ||
retries: 5 | ||
start_period: 30s | ||
|
||
nginx: | ||
container_name: cantus-nginx-1 | ||
build: ./nginx | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- app | ||
volumes: | ||
- ./cantaloupe/interim_files/manifests:/code/manifests | ||
- django_static_volume:/code/static/django | ||
|
||
solr: | ||
build: ./solr | ||
container_name: cantus-solr-1 | ||
ports: | ||
- "8983:8983" | ||
environment: | ||
- SOLR_SECURITY_MANAGER_ENABLED=false | ||
volumes: | ||
- solr_volume:/var/solr | ||
|
||
rabbitmq: | ||
build: ./rabbitmq | ||
container_name: cantus-rabbitmq-1 | ||
environment: | ||
- RABBITMQ_DEFAULT_USER=${RABBIT_USER} | ||
- RABBITMQ_DEFAULT_PASS=${RABBIT_PASSWORD} | ||
- RABBITMQ_DEFAULT_VHOST=${RABBIT_VHOST} | ||
ports: | ||
- "5672:5672" | ||
restart: always | ||
|
||
celery: | ||
image: cantus-app | ||
container_name: cantus-celery-1 | ||
volumes: | ||
- ./app/public:/code/public | ||
command: [ "/code/.venv/bin/python", "/code/.venv/bin/celery", "-A", "cantusdata", "worker", "-l", "INFO", "-c", "1" ] | ||
environment: | ||
- APP_VERSION=${APP_VERSION} | ||
- DEVELOPMENT=${DEVELOPMENT} | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- RABBIT_USER=${RABBIT_USER} | ||
- RABBIT_PASSWORD=${RABBIT_PASSWORD} | ||
- RABBIT_VHOST=${RABBIT_VHOST} | ||
restart: always | ||
|
||
cantaloupe: | ||
build: ./cantaloupe | ||
container_name: cantus-cantaloupe-1 | ||
volumes: | ||
- ./cantaloupe/interim_files/images:/srv/images | ||
command: [ "java", "-Dcantaloupe.config=/etc/cantaloupe/cantaloupe.properties", "-Xmx2g", "-jar", "/opt/cantaloupe/cantaloupe-5.0.5/cantaloupe-5.0.5.jar" ] | ||
|
||
volumes: | ||
django_static_volume: | ||
solr_volume: |
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