misskey/start.sh
2023-09-25 04:42:14 +00:00

36 lines
714 B
Bash

#!/bin/bash
SHELL="/bin/bash"
MISSKEY='/opt/misskey'
FILE='/configured.txt'
postgres-check() {
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
}
cd $MISSKEY
redis-server --protected-mode no --daemonize yes
sleep 30
if [ ! -f "$FILE" ]; then
bash /opt/setup.sh
touch /configured.txt
fi
su postgres -s $SHELL -lc "$PG_BIN/pg_ctl start -D $PG_DIR" &
postgres-check
nginx &
pnpm run migrate
NODE_ENV=production pnpm run start
tail -f /dev/null