misskey/start.sh

36 lines
749 B
Bash
Raw Normal View History

2023-05-13 15:46:14 -06:00
#!/bin/bash
SHELL="/bin/bash"
MISSKEY='/opt/misskey'
FILE='/configured.txt'
postgres-check() {
2023-09-24 22:42:14 -06:00
POSTGRES_CHECK=$(ps aux | grep -i logical | head -1)
if [[ "$POSTGRES_CHECK" = *"replication"* ]]; then
echo "Postgres is running!"
else
echo "Postgres is not in Running yet!"
sleep 2
postgres-check
fi
2023-05-13 15:46:14 -06:00
}
cd $MISSKEY
2023-10-08 16:19:00 -06:00
cp -f /saves/dump.rdb /opt/misskey/
2023-05-13 15:46:14 -06:00
redis-server --protected-mode no --daemonize yes
sleep 30
if [ ! -f "$FILE" ]; then
2023-09-24 22:42:14 -06:00
bash /opt/setup.sh
touch /configured.txt
2023-05-13 15:46:14 -06:00
fi
su postgres -s $SHELL -lc "$PG_BIN/pg_ctl start -D $PG_DIR" &
postgres-check
nginx &
2023-09-24 22:42:14 -06:00
pnpm run migrate
NODE_ENV=production pnpm run start
2023-05-13 15:46:14 -06:00
tail -f /dev/null