forked from smdoh/pipebird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
34 lines (29 loc) · 873 Bytes
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
if [ ! -f .env ]
then
# Prisma expects a local .env file
echo "DATABASE_URL=$(printenv DATABASE_URL)" > .env
# TODO(cumason) refactor register_license.py -> register_license.ts and run as dockerfile build step
# PIPEBIRD_MONITOR_SECRET_KEY is set by register_license.py
echo "PIPEBIRD_MONITOR_SECRET_KEY=$(printenv PIPEBIRD_MONITOR_SECRET_KEY)" >> .env
fi
wait_for_temporal() {
until nc -z temporal 7233; do
echo 'API waiting for Temporal to startup.'
sleep 1
done
echo 'Temporal ready.'
}
wait_for_postgresql() {
until nc -z db 5432; do
echo 'API waiting for psql to startup.'
sleep 1
done
echo 'PostgreSQL ready.'
}
wait_for_temporal
wait_for_postgresql
npx prisma migrate deploy
npx prisma db push
npm run start:workers &
NODE_ENV="production" exec node dist/server/index.js