mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-28 09:19:37 +02:00
Fix database connection issue and add database migration
This commit is contained in:
parent
3f24e44558
commit
cde83b35d6
2 changed files with 18 additions and 2 deletions
18
startup.sh
18
startup.sh
|
@ -1,8 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Function to check if the database is ready
|
||||||
|
wait_for_db() {
|
||||||
|
echo "Waiting for the database to start up..."
|
||||||
|
while ! nc -z db 5432; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "Database is now available."
|
||||||
|
}
|
||||||
|
|
||||||
# Start your application here
|
# Start your application here
|
||||||
# Example: node build/index.js
|
# Example: node build/index.js
|
||||||
# print message
|
# Print message
|
||||||
echo "Starting AdventureLog"
|
echo "Starting AdventureLog"
|
||||||
|
|
||||||
|
# Wait for the database to start up
|
||||||
|
wait_for_db
|
||||||
|
|
||||||
|
# Run database migration
|
||||||
npm run migrate
|
npm run migrate
|
||||||
|
|
||||||
|
# Start the application
|
||||||
node build/index.js
|
node build/index.js
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue