ToolJet/deploy/ec2/setup_app
Akshay a13a2d4d63
Chore: ToolJet setup to try locally (#3158)
* add dockerfile for try tooljet setup

* update npm scripts and logged messages

* refactor npm scripts for dist folder scripts

* update usages of db setup and seed

* setup script to init db and boot app

* fix dockerfile

* update dockerfile

* user production.Dockerfile as base image

* fix script

* fix script exit

* fix lint
2022-05-31 18:42:36 +05:30

36 lines
769 B
Bash
Executable file

#!/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)
if psql -d postgresql://$PG_USER:$PG_PASS@$PG_HOST -c 'select now()' > /dev/null 2>&1
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
sudo npm --prefix server run db:setup:prod
sudo npm --prefix server run db:seed:prod
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