Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore(deps): Update dependencies and refactor code #1162

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 110 additions & 112 deletions docker-compose-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,116 +1,114 @@
version: '3.8'

services:
db:
image: postgres
environment:
- POSTGRES_DB=${SQL_DATABASE}
- POSTGRES_USER=${SQL_USER}
- POSTGRES_PASSWORD=${SQL_PASSWORD}
- PGHOST=${SQL_HOST}
- PGPORT=${SQL_PORT}
- PGUSER=${SQL_USER}
- PGDATABASE=${SQL_DATABASE}
- PGPASSWORD=${SQL_PASSWORD}
volumes:
- /home/github-runner/podman-volumes/db-data:/var/lib/postgresql/data
- /home/github-runner/podman-volumes/db-backups:/backups
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
start_period: 5s
interval: 5s
timeout: 5s
retries: 5
restart: always
ip2country:
image: extrawurst/ip2country:latest
ports:
- 8854:5000
restart: always
db:
image: postgres
environment:
- POSTGRES_DB=${SQL_DATABASE}
- POSTGRES_USER=${SQL_USER}
- POSTGRES_PASSWORD=${SQL_PASSWORD}
- PGHOST=${SQL_HOST}
- PGPORT=${SQL_PORT}
- PGUSER=${SQL_USER}
- PGDATABASE=${SQL_DATABASE}
- PGPASSWORD=${SQL_PASSWORD}
volumes:
- /home/github-runner/podman-volumes/db-data:/var/lib/postgresql/data
- /home/github-runner/podman-volumes/db-backups:/backups
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
start_period: 5s
interval: 5s
timeout: 5s
retries: 5
restart: always
ip2country:
image: extrawurst/ip2country:latest
ports:
- 8854:5000
restart: always

server:
build:
context: ./backend
dockerfile: Dockerfile
depends_on:
db:
condition: service_healthy
ip2country:
condition: service_started
volumes:
- /home/github-runner/podman-volumes/server-static:/server/static
- /home/github-runner/podman-volumes/server-logs:/server/logs
- /home/github-runner/podman-volumes/server-uploads:/server/upload
environment:
- AML_ALLOWED_HOSTS=${AML_ALLOWED_HOSTS}
- CSRF_TRUSTED_ORIGINS=${CSRF_TRUSTED_ORIGINS}
- AML_DEBUG=${AML_DEBUG}
- AML_CORS_ORIGIN_WHITELIST=${AML_CORS_ORIGIN_WHITELIST}
- AML_LOCATION_PROVIDER=${AML_LOCATION_PROVIDER}
- AML_SECRET_KEY=${AML_SECRET_KEY}
- AML_SUBPATH=${AML_SUBPATH}
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
- DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME}
- DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}
- DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
- SENTRY_DSN=${SENTRY_DSN}
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
- SQL_DATABASE=${SQL_DATABASE}
- SQL_USER=${SQL_USER}
- SQL_PASSWORD=${SQL_PASSWORD}
- SQL_HOST=${SQL_HOST}
ports:
- 8000:8000
command: bash -c "python manage.py migrate && python manage.py bootstrap && python manage.py collectstatic --noinput && gunicorn aml.wsgi:application --bind 0.0.0.0:8000"
restart: always
server:
build:
context: ./backend
dockerfile: Dockerfile
depends_on:
db:
condition: service_healthy
ip2country:
condition: service_started
volumes:
- /home/github-runner/podman-volumes/server-static:/server/static
- /home/github-runner/podman-volumes/server-logs:/server/logs
- /home/github-runner/podman-volumes/server-uploads:/server/upload
environment:
- AML_ALLOWED_HOSTS=${AML_ALLOWED_HOSTS}
- CSRF_TRUSTED_ORIGINS=${CSRF_TRUSTED_ORIGINS}
- AML_DEBUG=${AML_DEBUG}
- AML_CORS_ORIGIN_WHITELIST=${AML_CORS_ORIGIN_WHITELIST}
- AML_LOCATION_PROVIDER=${AML_LOCATION_PROVIDER}
- AML_SECRET_KEY=${AML_SECRET_KEY}
- AML_SUBPATH=${AML_SUBPATH}
- DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
- DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME}
- DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}
- DJANGO_SUPERUSER_PASSWORD=${DJANGO_SUPERUSER_PASSWORD}
- SENTRY_DSN=${SENTRY_DSN}
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
- SQL_DATABASE=${SQL_DATABASE}
- SQL_USER=${SQL_USER}
- SQL_PASSWORD=${SQL_PASSWORD}
- SQL_HOST=${SQL_HOST}
ports:
- 8000:8000
command: bash -c "python manage.py migrate && python manage.py bootstrap && python manage.py collectstatic --noinput && gunicorn aml.wsgi:application --bind 0.0.0.0:8000"
restart: always

client-builder:
build:
context: ./frontend
dockerfile: Dockerfile
target: builder
volumes:
- type: bind
source: ./frontend/src
target: /client/src
- type: bind
source: ./frontend/public
target: /client/public
- type: bind
source: ./frontend/.storybook
target: /client/.storybook
environment:
- VITE_API_ROOT=${FRONTEND_API_ROOT}
- VITE_EXPERIMENT_SLUG=${FRONTEND_EXPERIMENT_SLUG}
- VITE_AML_HOME=${FRONTEND_AML_HOME}
- VITE_LOGO_URL=${FRONTEND_LOGO_URL}
- VITE_HTML_FAVICON=${FRONTEND_HTML_FAVICON}
- VITE_HTML_PAGE_TITLE=${FRONTEND_HTML_PAGE_TITLE}
- VITE_HTML_OG_DESCRIPTION=${FRONTEND_HTML_OG_DESCRIPTION}
- VITE_HTML_OG_IMAGE=${FRONTEND_HTML_OG_IMAGE}
- VITE_HTML_OG_TITLE=${FRONTEND_HTML_OG_TITLE}
- VITE_HTML_OG_URL=${FRONTEND_HTML_OG_URL}
- VITE_HTML_BODY_CLASS=${FRONTEND_HTML_BODY_CLASS}
- VITE_SENTRY_DSN=${FRONTEND_SENTRY_DSN}
- VITE_STRICT=${FRONTEND_STRICT}
restart: "no"
client-builder:
build:
context: ./frontend
dockerfile: Dockerfile
target: builder
volumes:
- type: bind
source: ./frontend/src
target: /client/src
- type: bind
source: ./frontend/public
target: /client/public
- type: bind
source: ./frontend/.storybook
target: /client/.storybook
environment:
- VITE_API_ROOT=${FRONTEND_API_ROOT}
- VITE_EXPERIMENT_SLUG=${FRONTEND_EXPERIMENT_SLUG}
- VITE_AML_HOME=${FRONTEND_AML_HOME}
- VITE_LOGO_URL=${FRONTEND_LOGO_URL}
- VITE_HTML_FAVICON=${FRONTEND_HTML_FAVICON}
- VITE_HTML_PAGE_TITLE=${FRONTEND_HTML_PAGE_TITLE}
- VITE_HTML_OG_DESCRIPTION=${FRONTEND_HTML_OG_DESCRIPTION}
- VITE_HTML_OG_IMAGE=${FRONTEND_HTML_OG_IMAGE}
- VITE_HTML_OG_TITLE=${FRONTEND_HTML_OG_TITLE}
- VITE_HTML_OG_URL=${FRONTEND_HTML_OG_URL}
- VITE_HTML_BODY_CLASS=${FRONTEND_HTML_BODY_CLASS}
- VITE_SENTRY_DSN=${FRONTEND_SENTRY_DSN}
- VITE_STRICT=${FRONTEND_STRICT}
restart: "no"

# This service is responsible for serving
# 1. The built frontend from the client-builder service
# 2. The static files from the server service (e.g., static files & uploads from the Django app)
nginx-proxy:
build:
context: ./frontend
dockerfile: Dockerfile
target: runner
command: nginx -g 'daemon off;'
ports:
- 8080:80
depends_on:
- client-builder
- server
volumes:
- /home/github-runner/podman-volumes/server-static:/usr/share/nginx/html/django_static
- /home/github-runner/podman-volumes/server-uploads:/usr/share/nginx/html/upload
- ./nginx/custom-nginx.conf:/etc/nginx/conf.d/default.conf
restart: always
# This service is responsible for serving
# 1. The built frontend from the client-builder service
# 2. The static files from the server service (e.g., static files & uploads from the Django app)
nginx-proxy:
build:
context: ./frontend
dockerfile: Dockerfile
target: runner
command: nginx -g 'daemon off;'
ports:
- 8080:80
depends_on:
- client-builder
- server
volumes:
- /home/github-runner/podman-volumes/server-static:/usr/share/nginx/html/django_static
- /home/github-runner/podman-volumes/server-uploads:/usr/share/nginx/html/upload
- ./nginx/custom-nginx.conf:/etc/nginx/conf.d/default.conf
restart: always
Loading
Loading