catalog-service/bin/entrypoint.sh

40 lines
798 B
Bash
Raw Normal View History

2022-12-07 02:43:27 +01:00
#!/usr/bin/env sh
set +e
waitForService()
{
2022-12-17 06:36:55 +01:00
wait-for-it.sh $1 -t 2 1>/dev/null 2>&1
2022-12-07 02:43:27 +01:00
status=$?
while [ $status != 0 ]
do
echo "[x] wating for $1..."
2024-04-02 21:20:16 +02:00
sleep 3
2022-12-17 06:36:55 +01:00
wait-for-it.sh $1 -t 2 1>/dev/null 2>&1
2022-12-07 02:43:27 +01:00
status=$?
done
}
2024-04-02 21:20:16 +02:00
update-resolv # provided by stack - better approach - single copy
update-ca-certificates
waitForService "api-registry:8500"
2022-12-07 02:43:27 +01:00
waitForService "postgres-db:5432"
2024-04-02 21:20:16 +02:00
# waitForService "db-postgres.service.ego.io:5432"
2022-12-07 02:43:27 +01:00
waitForService "api-eventbus:5672"
2024-04-02 21:20:16 +02:00
# waitForService "esb.service.ego.io:5672"
2022-12-07 02:43:27 +01:00
waitForService "api-logger:24224"
2024-04-02 21:20:16 +02:00
# waitForService "logger.service.ego.io:24224"
# register-service
2022-12-07 02:43:27 +01:00
2022-12-17 06:36:55 +01:00
# run migrations
migrate.sh
2022-12-07 02:43:27 +01:00
2024-04-02 21:20:16 +02:00
# ping wp.pl
# apk add curl
# curl -v http://catalog-svc:80/health?name=catalog
2022-12-07 02:43:27 +01:00
2024-04-02 21:20:16 +02:00
# set -euo pipefail
2022-12-07 02:43:27 +01:00
exec "$@"