diff --git a/docker-compose.yml b/docker-compose.yml index df605ea..e99841e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,24 +22,6 @@ services: image: "valkey/valkey:7.2-alpine" restart: always - postgres: - image: postgres:16-alpine - shm_size: 128mb - volumes: - - ../postgres:/var/lib/postgresql/data/ - - ${PWD}/scripts/postgres-init-db.sh:/docker-entrypoint-initdb.d/postgres-init-db.sh - env_file: .env - environment: - POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" - POSTGRES_USER: "hackathons_canada_superuser" - POSTGRES_DB: "hackathons" - restart: always - healthcheck: - test: ["CMD", "pg_isready -U ${POSTGRES_USER}", "-d", "${POSTGRES_DB}"] - interval: 5s - timeout: 20s - retries: 5 - celery_worker: build: context: . diff --git a/docs/internal/migrations/redirects.md b/docs/internal/migrations/redirects.md index 022bb54..55edf7b 100644 --- a/docs/internal/migrations/redirects.md +++ b/docs/internal/migrations/redirects.md @@ -74,4 +74,4 @@ python manage.py migrate socialaccount zero # Step 4: Reapply migrations python manage.py migrate -``` +``` diff --git a/scripts/django/start b/scripts/django/start index 0b9e994..7da3a4d 100644 --- a/scripts/django/start +++ b/scripts/django/start @@ -7,4 +7,4 @@ set -o nounset python manage.py migrate --no-input python manage.py collectstatic --no-input -gunicorn -w 1 --bind 0.0.0.0:22300 hackathons_canada.wsgi:application +gunicorn -w 2 --bind 0.0.0.0:22300 hackathons_canada.wsgi:application diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 932ebd5..5ef4e97 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -8,32 +8,32 @@ set -o pipefail set -o nounset source /opt/pysetup/.venv/bin/activate - - -postgres_ready() { -/opt/pysetup/.venv/bin/python << END -import sys - -import psycopg - -try: - psycopg.connect( - dbname="${POSTGRES_DB}", - user="${POSTGRES_USER}", - password="${POSTGRES_PASSWORD}", - host="${POSTGRES_HOST}", - port="${POSTGRES_PORT}", - ) -except psycopg.OperationalError: - sys.exit(-1) -sys.exit(0) - -END -} -until postgres_ready; do - >&2 echo 'Waiting for PostgreSQL to become available...' - sleep 1 -done ->&2 echo 'PostgreSQL is available' +# +# +#postgres_ready() { +#/opt/pysetup/.venv/bin/python << END +#import sys +# +#import psycopg +# +#try: +# psycopg.connect( +# dbname="${POSTGRES_DB}", +# user="${POSTGRES_USER}", +# password="${POSTGRES_PASSWORD}", +# host="${POSTGRES_HOST}", +# port="${POSTGRES_PORT}", +# ) +#except psycopg.OperationalError: +# sys.exit(-1) +#sys.exit(0) +# +#END +#} +#until postgres_ready; do +# >&2 echo 'Waiting for PostgreSQL to become available...' +# sleep 1 +#done +#>&2 echo 'PostgreSQL is available' exec "$@" diff --git a/scripts/postgres-init-db.sh b/scripts/postgres-init-db.sh deleted file mode 100644 index c28576b..0000000 --- a/scripts/postgres-init-db.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -echo '=== SETUP DATABASE' - -echo '--- setting up users' - -psql -v ON_ERROR_STOP=1 "$POSTGRES_DB" <