Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for Postgres to become available instead of naively sleeping before running Alembic migrations #126

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
version: 1
update_configs:
# Keep submodules up to date, batching pull requests monthly
- package_manager: 'submodules'
directory: '/extern'
update_schedule: 'monthly'
# Keep package.json (& lockfiles) up to date as soon as
# new versions are published to the npm registry
- package_manager: 'javascript'
directory: '{{cookiecutter.project_slug}}/frontend'
update_schedule: 'monthly'
# Keep Dockerfile up to date, batching pull requests weekly
# Keep Dockerfile up to date, batching pull requests monthly
- package_manager: 'python'
directory: '{{cookiecutter.project_slug}}/backend'
update_schedule: 'monthly'
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "extern/wait-for-it"]
path = extern/wait-for-it
url = git@github.com:vishnubob/wait-for-it.git
1 change: 1 addition & 0 deletions extern/wait-for-it
Submodule wait-for-it added at 81b137
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