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:
parent
9b3b3d099f
commit
2dba19a77e
12 changed files with 109 additions and 127 deletions
|
|
@ -1,23 +1,21 @@
|
|||
#!/bin/bash
|
||||
# Make the script exit when a command fails.
|
||||
set -e
|
||||
set -exc
|
||||
|
||||
# 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
|
||||
}
|
||||
# check if the startup command has been provided
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Startup command not set. Exiting"
|
||||
exit;
|
||||
fi
|
||||
|
||||
# Set trap to call cleanup() when SIGINT (Ctrl-C) is received.
|
||||
trap cleanup SIGINT
|
||||
# check if the $DJANGO_SETTINGS_MODULE environment variable has been set
|
||||
if [ "$DJANGO_SETTINGS_MODULE" == "" ]; then
|
||||
echo "Environment variable 'DJANGO_SETTINGS_MODULE' not set. Exiting."
|
||||
exit;
|
||||
else
|
||||
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
|
||||
fi
|
||||
|
||||
# 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
|
||||
/deploy.sh
|
||||
|
||||
cd theme/static_src
|
||||
uv run npm run dev &
|
||||
cd ../../
|
||||
uv run python manage.py runserver
|
||||
echo "Enviroment is correct and deploy.sh has been run - executing command: '$@'"
|
||||
exec "$@" && exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue