Skip to content
Snippets Groups Projects
Commit 3b5b720d authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'feature/docker-check-using-psql' into 'master'

[Docker] Use `SELECT 1` to wait for database

See merge request !535
parents 885cd0c1 a6d45dd5
No related branches found
No related tags found
1 merge request!535[Docker] Use `SELECT 1` to wait for database
Pipeline #6450 passed
Pipeline: AlekSIS

#6451

    ......@@ -31,6 +31,7 @@ RUN apt-get -y update && \
    libpq-dev \
    libssl-dev \
    netcat-openbsd \
    postgresql-client \
    yarnpkg && \
    eatmydata pip install uwsgi django-compressor
    ......
    ......@@ -2,9 +2,6 @@
    HTTP_PORT=${HTTP_PORT:8000}
    export ALEKSIS_database__host=${ALEKSIS_database__host:-127.0.0.1}
    export ALEKSIS_database__port=${ALEKSIS_database__port:-5432}
    if [[ -z $ALEKSIS_secret_key ]]; then
    if [[ ! -e /var/lib/aleksis/secret_key ]]; then
    touch /var/lib/aleksis/secret_key; chmod 600 /var/lib/aleksis/secret_key
    ......@@ -13,9 +10,12 @@ if [[ -z $ALEKSIS_secret_key ]]; then
    ALEKSIS_secret_key=$(</var/lib/aleksis/secret_key)
    fi
    while ! nc -z $ALEKSIS_database__host $ALEKSIS_database__port; do
    sleep 0.1
    echo -n "Waiting for database."
    while ! aleksis-admin dbshell -- -c "SELECT 1" >/dev/null 2>&1; do
    sleep 0.5
    echo -n .
    done
    echo
    aleksis-admin migrate
    aleksis-admin createinitialrevisions
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment