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

🔨(prefect) improve cross-service dependencies #213

Merged
merged 1 commit into from
Nov 5, 2024
Merged
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
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ bootstrap: ## bootstrap the project for development
bootstrap: \
build \
migrate-api \
migrate-prefect \
create-api-test-db \
create-metabase-db \
create-prefect-db \
Expand Down Expand Up @@ -207,6 +208,20 @@ migrate-api: ## run alembic database migrations for the api service
@bin/alembic upgrade head
.PHONY: migrate-api

migrate-prefect: ## run prefect database migrations
@echo "Running prefect service database engine…"
@$(COMPOSE_UP) --wait postgresql
@echo "Running migrations for prefect service…"
@$(COMPOSE_RUN_PREFECT_PIPENV) prefect server database upgrade -y
.PHONY: migrate-prefect

post-deploy-prefect: ## run prefect post-deployment script
@echo "Running prefect service…"
@$(COMPOSE_UP) --wait prefect
@echo "Running postdeploy script for prefect service…"
@$(COMPOSE) exec prefect pipenv run honcho start postdeploy
.PHONY: post-deploy-prefect

create-superuser: ## create super user
@echo "Creating super user…"
@$(COMPOSE_RUN_API_PIPENV) python -m qualicharge create-user \
Expand Down Expand Up @@ -236,6 +251,7 @@ reset-db: ## Reset the PostgreSQL database
$(MAKE) create-metabase-db
$(MAKE) seed-metabase
$(MAKE) create-prefect-db
$(MAKE) migrate-prefect
.PHONY: reset-db

seed-api: ## seed the API database (static data)
Expand Down
16 changes: 13 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ services:
environment:
NB_UID: ${DOCKER_UID:-1000}
NB_GID: ${DOCKER_GID:-1000}
CHOWN_HOME: 'yes'
CHOWN_HOME: "yes"
CHOWN_HOME_OPTS: -R
env_file:
- env.d/notebook
Expand Down Expand Up @@ -137,6 +137,15 @@ services:
env_file:
- env.d/prefect
- env.d/prefect-qc
healthcheck:
test:
- "CMD"
- "curl"
- "--fail"
- "http://localhost:4200/api/health"
interval: 2s
timeout: 5s
retries: 20
volumes:
- ./src/prefect:/app
depends_on:
Expand All @@ -147,12 +156,13 @@ services:
command: ["pipenv", "run", "honcho", "start", "worker"]
user: ${DOCKER_USER:-1000}
env_file:
- env.d/prefect
- env.d/prefect-worker
- env.d/prefect-qc
volumes:
- ./src/prefect:/app
depends_on:
- prefect
prefect:
condition: service_healthy

prefect-test:
image: "qualicharge:prefect"
Expand Down
2 changes: 1 addition & 1 deletion env.d/prefect
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ PREFECT_API_DATABASE_NAME=prefect
PREFECT_API_DATABASE_CONNECTION_URL=postgresql+asyncpg://qualicharge:pass@postgresql:5432/prefect
PREFECT_API_DATABASE_ECHO=False
PREFECT_API_DATABASE_MIGRATE_ON_START=False
PREFECT_API_URL=http://prefect:4200/api
PREFECT_API_URL=http://localhost:4200/api
PREFECT_SERVER_API_HOST=0.0.0.0
PREFECT_SERVER_ALLOW_EPHEMERAL_MODE=False
1 change: 1 addition & 0 deletions env.d/prefect-worker
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PREFECT_API_URL=http://prefect:4200/api
1 change: 1 addition & 0 deletions src/prefect/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ARG DOCKER_GID 1000
# Upgrade system packages to install security updates
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y curl && \
rm -rf /var/lib/apt/lists/*

# Upgrade pip to its latest release to speed up dependencies
Expand Down
Loading