-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
210 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,3 +136,6 @@ deploy/eb/ | |
|
||
# tox | ||
./.tox | ||
|
||
backend/ | ||
geographical_data/ |
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 |
---|---|---|
|
@@ -28,3 +28,5 @@ build-ssr | |
.env | ||
.eslintcache | ||
tsconfig.tsbuildinfo | ||
|
||
geographical_data/ |
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,36 @@ | ||
{ | ||
email {$CADDY_EMAIL} | ||
} | ||
|
||
(file_server_config) { | ||
encode gzip | ||
file_server | ||
} | ||
|
||
|
||
{$CADDY_HOST} { | ||
handle /admin/* { | ||
reverse_proxy http://web:80 | ||
} | ||
|
||
handle /graphql* { | ||
reverse_proxy http://web:80 | ||
} | ||
|
||
handle_path /dj-static/* { | ||
root * /app-assests/server-static/static | ||
import file_server_config | ||
} | ||
|
||
handle_path /dj-media/* { | ||
root * /app-assests/server-static/media | ||
import file_server_config | ||
} | ||
|
||
# Serve your static site | ||
handle { | ||
try_files {path} /index.html | ||
root * /app-assests/client-static | ||
import file_server_config | ||
} | ||
} |
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,154 @@ | ||
name: alert-hub # NOTE: Define COMPOSE_PROJECT_NAME in .env to use custom name | ||
|
||
x-server: &base_server_setup | ||
build: | ||
context: ./backend/ | ||
# To attach to container with stdin `docker attach <container_name>` | ||
# Used for python debugging. | ||
stdin_open: true | ||
tty: true | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
env_file: | ||
- .env | ||
environment: &base_server_setup_environment | ||
DJANGO_APP_TYPE: web | ||
DJANGO_APP_ENVIRONMENT: ${DJANGO_APP_ENVIRONMENT:-prod} | ||
DJANGO_DEBUG: ${DJANGO_DEBUG:-false} | ||
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY?error}, | ||
# -- Domain configurations | ||
APP_DOMAIN: ${APP_DOMAIN?error} | ||
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS?error} | ||
APP_HTTP_PROTOCOL: ${APP_HTTP_PROTOCOL:-https} | ||
APP_FRONTEND_HOST: ${APP_FRONTEND_HOST?error} | ||
SESSION_COOKIE_DOMAIN: ${SESSION_COOKIE_DOMAIN?error} | ||
CSRF_COOKIE_DOMAIN: ${CSRF_COOKIE_DOMAIN?error} | ||
# Database config | ||
DB_HOST: ${DB_HOST?error} | ||
DB_PORT: ${DB_PORT?error} | ||
DB_NAME: ${DB_NAME?error} | ||
DB_USER: ${DB_USER?error} | ||
DB_PASSWORD: ${DB_PASSWORD?error} | ||
# Redis config | ||
CELERY_BROKER_URL: ${CELERY_BROKER_URL?error} | ||
CACHE_REDIS_URL: ${CACHE_REDIS_URL?error} | ||
# Email config (TODO: Configure this.. for now this is not used) | ||
EMAIL_HOST: ${EMAIL_HOST:-mailpit} | ||
EMAIL_PORT: ${EMAIL_PORT:-1025} | ||
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-mailpit} | ||
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD:-mailpit} | ||
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-alert-hub-dev <[email protected]>} | ||
# Static, Media configs | ||
DJANGO_STATIC_URL: ${DJANGO_STATIC_URL:-/dj-static/} | ||
DJANGO_MEDIA_URL: ${DJANGO_MEDIA_URL-/dj-media/} | ||
volumes: | ||
- ./geographical_data/:/code/apps/cap_feed/geographical/ifrc-go-admin1-geojson/ | ||
- backend_data:/data/ | ||
- ipython_data_local:/root/.ipython/profile_default # persist ipython data, including ipython history | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "100m" | ||
max-file: "5" | ||
|
||
|
||
x-worker: &base_worker_setup | ||
<<: *base_server_setup | ||
environment: | ||
<<: *base_server_setup_environment | ||
DJANGO_APP_TYPE: worker | ||
healthcheck: | ||
test: ["CMD-SHELL", "celery -A main inspect ping -d celery@$$HOSTNAME || exit 1"] | ||
interval: 30s | ||
timeout: 5s | ||
retries: 3 | ||
start_period: 30s | ||
|
||
|
||
services: | ||
mailpit: | ||
image: axllent/mailpit | ||
ports: | ||
- 127.0.0.1:8025:8025 # HTTP | ||
environment: | ||
MP_MAX_MESSAGES: 5000 | ||
MP_DATA_FILE: /data/mailpit.db | ||
MP_SMTP_AUTH_ACCEPT_ANY: 1 | ||
MP_SMTP_AUTH_ALLOW_INSECURE: 1 | ||
volumes: | ||
- mailpit-data:/data | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "100m" | ||
max-file: "5" | ||
|
||
frontend: | ||
tty: true | ||
build: | ||
context: . | ||
target: builder | ||
environment: | ||
NODE_OPTIONS: "--max_old_space_size=1024" | ||
APP_TITLE: ${FRONTEND_APP_TITLE:-IFRC Alert Hub} | ||
APP_MAPBOX_ACCESS_TOKEN: ${FRONTEND_APP_MAPBOX_ACCESS_TOKEN?error} | ||
APP_GRAPHQL_API_ENDPOINT: ${FRONTEND_APP_GRAPHQL_API_ENDPOINT?error} | ||
APP_GRAPHQL_ENDPOINT: ${FRONTEND_APP_GRAPHQL_ENDPOINT?error} | ||
APP_ENVIRONMENT: ${FRONTEND_APP_ENVIRONMENT?error} | ||
APP_GRAPHQL_CODEGEN_ENDPOINT: ${FRONTEND_APP_GRAPHQL_CODEGEN_ENDPOINT?error} | ||
env_file: | ||
- .env | ||
# TODO: Due to patch, we need yarn install for now. Try to resolve this in Dockerfile for builder | ||
command: | | ||
sh -c 'yarn install && yarn generate && yarn build && rm -rf /client-build/* ; cp -r build/* /client-build/' | ||
volumes: | ||
- client_static:/client-build/ | ||
profiles: [frontend] | ||
|
||
web: | ||
<<: *base_server_setup | ||
command: bash -c 'wait-for-it $$DB_HOST:$$DB_PORT && ./deploy/run_web.sh' | ||
|
||
worker: | ||
<<: *base_worker_setup | ||
# TODO: Use run_celery_dev | ||
command: bash -c './deploy/run_worker.sh' | ||
|
||
worker-beat: | ||
<<: *base_worker_setup | ||
command: bash -c './deploy/run_worker_beat.sh' | ||
|
||
caddy: | ||
image: caddy:2 | ||
restart: always | ||
volumes: | ||
# Caddy config | ||
- ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro | ||
# Static files | ||
- client_static:/app-assests/client-static:ro | ||
- backend_data:/app-assests/server-static:ro | ||
# Caddy data volumes | ||
- caddy_data:/data | ||
- caddy_config:/config | ||
environment: | ||
CADDY_EMAIL: ${CADDY_EMAIL?err} | ||
CADDY_HOST: ${CADDY_HOST?err} | ||
ports: | ||
- 80:80 | ||
- 443:443 | ||
depends_on: | ||
- web | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "100m" | ||
max-file: "5" | ||
|
||
|
||
volumes: | ||
ipython_data_local: | ||
mailpit-data: | ||
backend_data: | ||
client_static: | ||
caddy_data: | ||
caddy_config: |