try fix launch order
This commit is contained in:
@@ -10,7 +10,8 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- stack.env
|
- stack.env
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:13
|
image: postgres:13
|
||||||
@@ -18,6 +19,11 @@ services:
|
|||||||
- stack.env
|
- stack.env
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|||||||
@@ -7,6 +7,14 @@ while ! nc -z db 5432; do
|
|||||||
done
|
done
|
||||||
echo "Database is ready!"
|
echo "Database is ready!"
|
||||||
|
|
||||||
|
# Wait for PostgreSQL to be ready to accept connections
|
||||||
|
echo "Waiting for PostgreSQL to accept connections..."
|
||||||
|
until PGPASSWORD=1253 psql -h db -U postgres -d docupulse -c '\q'; do
|
||||||
|
echo "PostgreSQL is unavailable - sleeping"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "PostgreSQL is up - executing command"
|
||||||
|
|
||||||
# Remove existing migrations and create fresh ones
|
# Remove existing migrations and create fresh ones
|
||||||
echo "Setting up fresh database migrations..."
|
echo "Setting up fresh database migrations..."
|
||||||
rm -rf migrations
|
rm -rf migrations
|
||||||
|
|||||||
Reference in New Issue
Block a user