Small refactor of scripts, Dockerfile, and docker-compose to support load balancing, and mutiple replicas. Various fixes related to playwright installation in container environment, static file handling, and etc.

This commit is contained in:
badblocks 2025-05-06 23:14:36 -07:00
parent 9b3b3d099f
commit 2dba19a77e
12 changed files with 109 additions and 127 deletions

View file

@ -4,31 +4,16 @@ set -e
# Reset the database and migrations.
echo "Resetting database and migrations... "
docker compose -f docker-compose_db_only.yml down \
&& docker compose -f docker-compose_entire_app.yml down \
docker compose down \
&& docker volume prune -a --filter label=db_is_resettable_via_script \
&& find . -path "*/migrations/00*.py" -delete \
&& docker compose -f docker-compose_db_only.yml up -d
&& docker compose up -d
# Wait for the database to be ready.
echo "Waiting for the database to be ready..."
sleep 10
echo "Resetting static files..."
uv run python manage.py collectstatic -c --no-input
echo "Running makemigrations..."
uv run python manage.py makemigrations
echo "Running migrations..."
uv run python manage.py migrate
echo "Loading seed data..."
uv run python manage.py loaddata seed/0*
docker compose exec -it web env DJANGO_SETTINGS_MODULE=django_project.settings django-admin loaddata /code/seed/0*
echo "Running deploy script..."
./deploy.sh
docker compose -f docker-compose_db_only.yml down
echo "Done!"
echo "Done & Started!"