Finish packaging and change to src-based packaging layout, replace caddy with haproxy for performance, and update docker-compose and Dockerfiles for new packaging.
This commit is contained in:
parent
959b06c425
commit
762361a21b
210 changed files with 235 additions and 168 deletions
|
|
@ -1,15 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Running makemigrations --check to make sure migrations are up to date..."
|
||||
django-admin makemigrations --noinput --check 2>&1
|
||||
echo "*** Running makemigrations --check to make sure migrations are up to date..."
|
||||
django-admin makemigrations --check --noinput 2>&1 || exit 1
|
||||
|
||||
echo "Running migrate to apply migrations..."
|
||||
echo "*** Running migrate to apply migrations..."
|
||||
django-admin migrate --noinput 2>&1
|
||||
|
||||
echo "Clearing django cache..."
|
||||
echo "*** Clearing django cache..."
|
||||
django-admin clear_cache 2>&1
|
||||
|
||||
echo "Running collectstatic..."
|
||||
echo "*** Running collectstatic..."
|
||||
django-admin collectstatic -c --no-input 2>&1
|
||||
|
||||
echo "Deployed successfully!"
|
||||
echo "*** Deployed successfully!"
|
||||
25
scripts/haproxy.entrypoint.sh
Normal file
25
scripts/haproxy.entrypoint.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
CERT_PATH="/certs/crt.pem"
|
||||
CA_PATH="/certs/ca.pem"
|
||||
|
||||
# Create the directory if it doesn't exist
|
||||
mkdir -p "$(dirname "$CERT_PATH")" "$(dirname "$CA_PATH")"
|
||||
|
||||
if [ -n "$HAPROXY_PEM_CERT" ]; then
|
||||
printf "%s" "$HAPROXY_PEM_CERT" > "$CERT_PATH"
|
||||
chmod 600 "$CERT_PATH"
|
||||
echo "HAProxy SSL certificate written to $CERT_PATH"
|
||||
else
|
||||
echo "Warning: HAPROXY_PEM_CERT environment variable is not set. SSL may not be configured."
|
||||
fi
|
||||
|
||||
if [ -n "$HAPROXY_PEM_CA" ]; then
|
||||
printf "%s" "$HAPROXY_PEM_CA" > "$CA_PATH"
|
||||
chmod 600 "$CA_PATH" # Set restrictive permissions
|
||||
echo "HAProxy SSL CA written to $CA_PATH"
|
||||
else
|
||||
echo "Warning: HAPROXY_PEM_CA environment variable is not set. SSL may not be configured."
|
||||
fi
|
||||
|
||||
exec /usr/local/bin/docker-entrypoint.sh "$@"
|
||||
|
|
@ -7,6 +7,6 @@ if [ -d "staticfiles" ]; then
|
|||
fi
|
||||
|
||||
# Build the tailwind theme css
|
||||
cd theme/static_src
|
||||
cd src/pkmntrade_club/theme/static_src
|
||||
npm install . && npm run build
|
||||
cd ../../
|
||||
|
|
@ -2,18 +2,23 @@
|
|||
# Exit immediately if any command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
# Reset the database and migrations.
|
||||
echo "Resetting database and migrations... "
|
||||
echo "Remaking migrations..."
|
||||
docker compose up -d
|
||||
find . -path "*/migrations/0*.py" -delete
|
||||
docker compose exec -it web bash -c "django-admin makemigrations --noinput"
|
||||
|
||||
echo "Resetting database... "
|
||||
docker compose down \
|
||||
&& docker volume prune -a --filter label=db_is_resettable_via_script \
|
||||
&& find . -path "*/migrations/00*.py" -delete \
|
||||
&& docker volume rm -f pkmntradeclub_postgres_data \
|
||||
&& docker compose up -d
|
||||
|
||||
# Wait for the database to be ready.
|
||||
echo "Waiting for the database to be ready..."
|
||||
echo "Waiting for the database to be ready, and migrations to be autorun..."
|
||||
sleep 10
|
||||
|
||||
echo "Loading seed data..."
|
||||
docker compose exec -it web bash -c "django-admin loaddata /seed/0*"
|
||||
|
||||
echo "Done & Started!"
|
||||
docker compose down
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue