dsql-admin/dsql-app/docker-entrypoint.sh

55 lines
1.2 KiB
Bash
Raw Normal View History

2024-11-05 11:12:42 +00:00
#!/bin/bash
cd /app
npm install
2024-11-05 15:05:56 +00:00
npm update datasquirel
2024-11-05 11:12:42 +00:00
2024-11-05 18:42:02 +00:00
chmod +x init-sql.sh
2024-11-05 11:12:42 +00:00
./init-sql.sh
if [[ $? == 0 ]]; then
echo "Dsql Database config complete"
else
echo "Dsql Database configuration failed. Exiting ..."
exit 1
fi
node /app/shell/createDbFromSchema.js
2024-11-05 14:18:40 +00:00
if [[ $? == 0 ]]; then
echo "Dsql Schema Setup Complete"
else
echo "Dsql Schema Setup failed. Exiting ..."
exit 1
fi
if [ -n "${NEXT_PUBLIC_DSQL_LOCAL}" ]; then
if [[ "$DSQL_HOST_ENV" == *"dev_dev"* ]]; then
echo "NEXT_PUBLIC_DSQL_LOCAL is set in dev environment."
batchrun
else
echo "NEXT_PUBLIC_DSQL_LOCAL is set. Running Local initialization ..."
node /app/docker-root-user-init.js
if [[ $? == 0 ]]; then
echo "First User Setup Complete"
else
echo "First User Setup Failed!. Exiting ..."
exit 1
fi
node /app/shell/mariadb-users/refreshUsersAndGrants.js
npm run start:local
fi
else
2024-11-05 11:12:42 +00:00
echo "NEXT_PUBLIC_DSQL_LOCAL is not set."
2024-11-05 18:42:02 +00:00
npm run build
2024-11-05 11:12:42 +00:00
if [ "${DSQL_HOST_ENV}" == "prod_prod" ]; then
echo "Main Production Environment"
nodecid
else
echo "Dev Environment"
batchrun
fi
fi