-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: script to start all service, database migration and starting up…
… the backend server all together. - update docs accordingly
- Loading branch information
1 parent
3e43356
commit 55039ca
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
# starting up all services including kratos | ||
docker-compose --profile kratos up -d | ||
|
||
# function to check if the docker container is running | ||
container_is_running() { | ||
docker inspect -f '{{.State.Running}}' "$1" 2>/dev/null | ||
} | ||
|
||
# function to wait for a docker container to start | ||
wait_for_container() { | ||
container_name=$1 | ||
while ! container_is_running $container_name; do | ||
sleep 1 | ||
done | ||
# extra delay to wait, otherwise gettinng error while connecting to database while migrating | ||
sleep 2 | ||
echo "===== Container $container_name is running" | ||
} | ||
|
||
wait_for_container "golang-api-postgresdb" | ||
|
||
echo "===== Running the migrations..." | ||
# running the migrations | ||
make -C ../../. migrate-up | ||
|
||
echo "===== Starting golang api server..." | ||
# starting the golang backend server | ||
make -C ../../. start-api |