mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-12 02:21:28 +02:00
Update 99-run.sh
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user