Update 99-run.sh

This commit is contained in:
Alexandre
2024-03-19 06:46:53 +01:00
committed by GitHub
parent f15330cf67
commit 4354c922aa

View File

@@ -1,37 +1,43 @@
#!/command/with-contenv bashio #!/command/with-contenv bashio
# shellcheck shell=bash # shellcheck shell=bash
set -e set -e
#################
# INITALISATION #
#################
bashio::log.info "Creating folders" bashio::log.info "Creating folders"
mkdir -p /config/library mkdir -p /config/library
mkdir -p /config/database
touch /config/database/linkwarden.sqlite
bashio::log.info "Applying migrations"
rm -r /data_linkwarden/prisma/migrations
cd /data_linkwarden
npx prisma db push
npx prisma generate
bashio::log.info "Starting app..."
yarn prisma migrate deploy
yarn start docker-entrypoint.sh & true
###################### ######################
# CONFIGURE POSTGRES # # CONFIGURE POSTGRES #
###################### ######################
bashio::log.info "Starting postgres..." bashio::log.info "Setting postgres..."
if [[ "$DATABASE_URL" == *"localhost"* ]]; then
echo "... with local database"
echo "... set database in /config/postgres"
mkdir -p /config/postgres mkdir -p /config/postgres
mkdir -p /var/run/postgresql mkdir -p /var/run/postgresql
chown postgres:postgres /var/run/postgresql chown postgres:postgres /var/run/postgresql
chown -R postgres:postgres /config/postgres chown -R postgres:postgres /config/postgres
chmod 0700 /config/postgres chmod 0700 /config/postgres
echo "... starting server"
service postgresql start & true
sleep 5
if [ -e /config/postgres/postgresql.conf ]; then if [ -e /config/postgres/postgresql.conf ]; then
echo "Database already configured" echo "... database already configured"
else else
echo "configure database"
postgres /usr/lib/postgresql/*/bin/initdb postgres /usr/lib/postgresql/*/bin/initdb
fi fi
bashio::log.info "Starting postgres..." ########################
service postgresql start # CONFIGURE LINKWARDEN #
########################
bashio::log.info "Starting app..."
yarn prisma migrate deploy
yarn start docker-entrypoint.sh & true