Major refactoring of build_deploy action, along with docker building and packaging improvements. Added no_signups and other .env improvements. There is no longer a separate .env.dev, both use .env now.
This commit is contained in:
parent
76b2becc24
commit
6f57699c8d
28 changed files with 795 additions and 328 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "*** Running makemigrations --check to make sure migrations are up to date..."
|
||||
django-admin makemigrations --check --noinput 2>&1 || exit 1
|
||||
django-admin makemigrations --noinput --check 2>&1 || exit 1
|
||||
|
||||
echo "*** Running migrate to apply migrations..."
|
||||
django-admin migrate --noinput 2>&1
|
||||
|
|
|
|||
|
|
@ -1,18 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
# Load environment variables from .env file if it exists in /code/
|
||||
if [ -f /.env ]; then
|
||||
echo "Loading environment variables from .env"
|
||||
# Set allexport option to export all variables defined by sourcing the .env file.
|
||||
set -a
|
||||
source /.env
|
||||
# Unset allexport option.
|
||||
set +a
|
||||
else
|
||||
echo "Warning: Volume mount for /.env file not found. Make sure you are using env_file in docker-compose.yml or mounting it in the container."
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Startup command not set. Exiting"
|
||||
exit;
|
||||
|
|
@ -25,8 +13,8 @@ else
|
|||
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
|
||||
fi
|
||||
|
||||
echo "Running deploy.sh..."
|
||||
echo "Running deploy.sh... (if you get a APP_REGISTRY_NOT_READY error, there's probably an error in settings.py)"
|
||||
/deploy.sh
|
||||
|
||||
echo "Enviroment is correct and deploy.sh has been run - executing command: '$@'"
|
||||
echo "Environment is correct and deploy.sh has been run - executing command: '$@'"
|
||||
exec "$@" && exit 0
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/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 "$@"
|
||||
|
|
@ -8,5 +8,4 @@ fi
|
|||
|
||||
# Build the tailwind theme css
|
||||
cd src/pkmntrade_club/theme/static_src
|
||||
npm install . && npm run build
|
||||
cd ../../
|
||||
npm install . && npm run build
|
||||
|
|
@ -3,18 +3,23 @@
|
|||
set -e
|
||||
|
||||
echo "Remaking migrations..."
|
||||
docker compose up -d
|
||||
find . -path "*/migrations/0*.py" -delete
|
||||
docker compose exec -it web bash -c "django-admin makemigrations --noinput"
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
uv run manage.py makemigrations --noinput
|
||||
|
||||
echo "Resetting database... "
|
||||
docker compose down \
|
||||
&& docker volume rm -f pkmntradeclub_postgres_data \
|
||||
&& docker compose up -d
|
||||
&& ./scripts/rebuild-and-run.sh
|
||||
|
||||
# Wait for the database to be ready.
|
||||
echo "Waiting for the database to be ready, and migrations to be autorun..."
|
||||
sleep 10
|
||||
echo "Waiting 15 seconds for the database to be ready, and migrations to be autorun..."
|
||||
sleep 15
|
||||
|
||||
echo "Creating cache table..."
|
||||
docker compose exec -it web bash -c "django-admin createcachetable django_cache"
|
||||
|
||||
echo "Loading seed data..."
|
||||
docker compose exec -it web bash -c "django-admin loaddata /seed/0*"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue