Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use wait-for-it.sh to ensure Postgres is up before running migrations
  • Loading branch information
jaredtkatz committed Sep 28, 2020
commit 39ab6e7c27da00f8cb0cc8ab6741610b9dc2c7e7
8 changes: 3 additions & 5 deletions {{cookiecutter.project_slug}}/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
# Build and run containers
docker-compose up -d

# Hack to wait for postgres container to be up before running alembic migrations
sleep 5;

# Run migrations
docker-compose run --rm backend alembic upgrade head
# Wait 10 seconds for postgres service to appear on port 5432, then run alembic migrations
extern/wait-for-it/wait-for-it.sh postgres:5432 --strict --timeout=10 \
-- docker-compose run --rm backend alembic upgrade head

# Create initial data
docker-compose run --rm backend python3 app/initial_data.py