akkoma/start.sh

45 lines
877 B
Bash
Raw Permalink Normal View History

2023-03-27 09:39:11 -06:00
#!/bin/bash
export SHELL="/bin/bash"
FILE='/configured.txt'
2023-03-31 08:19:32 -06:00
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
}
2023-03-27 09:39:11 -06:00
# Start the instance to verify that everything is working as expected
#Set Permissions
#chown -R pleroma /var/lib/pleroma
2023-08-02 16:07:03 -06:00
chmod 777 /saves
2023-03-27 09:39:11 -06:00
#Configure Local Time
cp -f /usr/share/zoneinfo/US/Mountain /etc/localtime
#Start Cron and Postgresql
cron
#Restore latest Database if container is new
if [ ! -f "$FILE" ]
then
#bash /restore.sh
bash /setup.sh
touch /configured.txt
fi
#Configure and start Nginx
mkdir -p /run/nginx
nginx
#Start Akkoma
su postgres -s $SHELL -lc "$PG_BIN/pg_ctl start -D $PG_DIR"&
2023-03-31 08:19:32 -06:00
postgres-check
2023-03-27 09:39:11 -06:00
su akkoma -s $SHELL -lc "/opt/akkoma/bin/pleroma start"