2021-08-06 14:07:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
if grep __required__ .env
|
|
|
|
|
then
|
|
|
|
|
echo "Please set the required values within the .env file"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
export $(grep -v '^#' .env | xargs)
|
|
|
|
|
|
2022-08-03 07:18:41 +00:00
|
|
|
if psql -d postgresql://$PG_USER:$PG_PASS@$PG_HOST/postgres -c 'select now()' > /dev/null 2>&1
|
2021-08-06 14:07:45 +00:00
|
|
|
then
|
|
|
|
|
echo "Successfully pinged the database!";
|
|
|
|
|
else
|
|
|
|
|
echo "Can't connect to the database. Kindly check the credenials provided in the .env file!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if sudo systemctl start openresty
|
|
|
|
|
then
|
|
|
|
|
echo "Successfully started reverse proxy!"
|
|
|
|
|
else
|
|
|
|
|
echo "Failed to start reverse proxy"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2023-01-09 09:27:48 +00:00
|
|
|
if $ENABLE_TOOLJET_DB == "true"
|
|
|
|
|
then
|
|
|
|
|
if sudo systemctl start postgrest
|
|
|
|
|
then
|
|
|
|
|
echo "Successfully started PostgREST server!"
|
|
|
|
|
else
|
|
|
|
|
echo "Failed to start PostgREST server"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2023-02-06 12:08:44 +00:00
|
|
|
npm --prefix server run db:setup:prod
|
2021-08-06 14:07:45 +00:00
|
|
|
|
|
|
|
|
if sudo systemctl start nest
|
|
|
|
|
then
|
|
|
|
|
echo "The app will be served at ${TOOLJET_HOST}"
|
|
|
|
|
else
|
|
|
|
|
echo "Failed to start the server!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|