dsql-admin/dsql-app/docker-entrypoint.sh
Benjamin Toby f56f2849e0 Updates
2025-01-13 22:25:20 +01:00

59 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
cd /app
echo "Installing Bun Dependencies ..."
bun install
bun update @moduletrace/datasquirel
echo "Bun Dependencies Installed Successfully!"
chmod +x init-sql.sh
bun init/init-sql/index.ts
if [[ $? == 0 ]]; then
echo "Dsql Database config complete"
else
echo "Dsql Database configuration failed. Exiting ..."
exit 1
fi
bun init/init-db/index.ts
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 ..."
bun /app/docker-root-user-init.ts
if [[ $? == 0 ]]; then
echo "First User Setup Complete"
else
echo "First User Setup Failed!. Exiting ..."
exit 1
fi
bun /app/package-shared/shell/mariadb-users/refreshUsersAndGrants.ts
bun run start:local
fi
else
echo "NEXT_PUBLIC_DSQL_LOCAL is not set."
if [ "${DSQL_HOST_ENV}" == "prod_prod" ]; then
echo "Main Production Environment"
bun run build
# nodecid
bun server.ts
else
echo "Dev Environment"
# batchrun
bun dev
fi
fi