Skip to content

Commit

Permalink
Chore(deps): Update dependencies and refactor code (#1162)
Browse files Browse the repository at this point in the history
* chore: Remove version from docker compose files as the property is deprecated, apply proper 4 space indent to whole file

* chore: Update dependencies for Storybook to version 8.1.11

* chore(deps): Get rid of @testing-library/react-hooks

See also: https://github.com/testing-library/react-hooks-testing-library?tab=readme-ov-file#a-note-about-react-18-support

* Refactor: Upgrade testing library, react types and use React's "act" instead of the deprecated act from the testing library
  • Loading branch information
drikusroor authored Jul 1, 2024
1 parent fca85c1 commit 4ab1db5
Show file tree
Hide file tree
Showing 10 changed files with 5,893 additions and 3,589 deletions.
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

0 comments on commit 4ab1db5

Please sign in to comment.