reorganizing build scripts

This commit is contained in:
badblocks 2025-04-17 12:21:21 -07:00
parent 633c1e87e8
commit b894b60b65
430 changed files with 136 additions and 53943 deletions

25
scripts/entrypoint.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
# Make the script exit when a command fails.
set -e
# Define a cleanup function to handle CTRL-C (SIGINT)
cleanup() {
echo "CTRL-C caught! Shutting down Docker Compose services..."
docker compose -f docker-compose_db_only.yml down
exit 1
}
# Set trap to call cleanup() when SIGINT (Ctrl-C) is received.
trap cleanup SIGINT
# Restart compose services.
echo "Restarting compose services..."
docker compose -f docker-compose_db_only.yml down
docker compose -f docker-compose_db_only.yml up -d
uv run python manage.py runserver &
cd theme/static_src
uv run npm run dev
docker compose -f docker-compose_db_only.yml down
echo "Done!"

View file

@ -0,0 +1,31 @@
#!/bin/bash
# Exit immediately if any command exits with a non-zero status.
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 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
# Wait for the database to be ready.
echo "Waiting for the database to be ready..."
sleep 10
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*
echo "Running deploy script..."
./deploy.sh
docker compose -f docker-compose_db_only.yml down
echo "Done!"