dijkstra-backend-cloudron/start.sh

26 lines
644 B
Bash
Executable File

#!/bin/bash
set -eu
# ensure that data directory is owned by 'cloudron' user
chown -R cloudron:cloudron /app/data
echo "-> Create the database"
# Move to the data writable folder
cd /app/data/
# Create database with empty table
sqlite3 database_file.db3 "CREATE TABLE test (id INTEGER PRIMARY KEY)";
#Delete the test table
sqlite3 database_file.db3 "DROP TABLE test";
echo "-> Importing data to the database"
# move back to code folder
cd /app/code
# Run the migration and seed database
npm run loadDB
echo "-> Starting Dijkstra Backend"
# run the app as user 'cloudron'
exec /usr/local/bin/gosu cloudron:cloudron node /app/code/index.js