akkoma/start.sh
2023-08-02 16:07:03 -06:00

45 lines
877 B
Bash

#!/bin/bash
export SHELL="/bin/bash"
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
}
# Start the instance to verify that everything is working as expected
#Set Permissions
#chown -R pleroma /var/lib/pleroma
chmod 777 /saves
#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"&
postgres-check
su akkoma -s $SHELL -lc "/opt/akkoma/bin/pleroma start"