Skip to content

Commit

Permalink
Update compose-migrate action to run openfga container alongside (#2209)
Browse files Browse the repository at this point in the history
Signed-off-by: Vyom-Yadav <[email protected]>
  • Loading branch information
Vyom-Yadav authored Jan 27, 2024
1 parent f1ce958 commit 041e0f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/compose-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ jobs:
go-version-file: 'go.mod'
- name: Install ko
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
- name: Copy server-config.yaml
run: cp config/server-config.yaml.example server-config.yaml
- name: Start containers
run: KO_DOCKER_REPO=ko.local make run-docker services="postgres migrate"
run: KO_DOCKER_REPO=ko.local make run-docker services="postgres migrate openfga" COMPOSE="docker compose"
- name: Wait for the migrations to complete
timeout-minutes: 1
run: |
set -e
while [ "$(docker logs minder_migrate_1 | grep 'Database migration completed successfully')" = "" ]; do
sleep 1
while [ "$(docker inspect -f '{{.State.Running}}' minder_migrate_up)" == "true" ]; do
sleep 1
done
if [ "$(docker inspect -f '{{.State.ExitCode}}' minder_migrate_up)" != "0" ]; then
echo "Migrations failed"
docker logs minder_migrate_up
exit 1
fi
- name: Check that the database contains the tables found in the migrations folder
run: "set -e\n\ntables=$(grep -Ri 'CREATE TABLE' database/migrations | sed -E 's/.*CREATE TABLE (IF NOT EXISTS )?(.*) \\(/\\2/i')\nfor table in $tables; do\n docker exec $(docker ps -a | grep postgres | awk '{print $1}') psql -U postgres -d minder -c \"SELECT * FROM $table\"\ndone \n"
4 changes: 4 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
version: '3.2'
services:
minder:
container_name: minder_sever
build: .
image: minder:latest

Expand Down Expand Up @@ -66,6 +67,7 @@ services:
keycloak:
condition: service_healthy
migrate:
container_name: minder_migrate_up
build: .
image: minder:latest

Expand All @@ -92,6 +94,8 @@ services:
depends_on:
postgres:
condition: service_healthy
openfga:
condition: service_healthy
postgres:
container_name: postgres_container
image: postgres:15-alpine
Expand Down

0 comments on commit 041e0f8

Please sign in to comment.