~singpolyma/soapbox-fly

ref: 4f925366b362637f2fb8df897aef31425b8f269c soapbox-fly/entrypoint.sh -rw-r--r-- 1.2 KiB
4f925366Stephen Paul Weber Tweak limits 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

mkdir -p /data/pleroma/uploads
mkdir -p /data/pleroma/static
chown -R pleroma:pleroma /data/pleroma

mkdir -p /data/pleroma/ssh_keys
if [ ! -f /data/pleroma/ssh_keys/ssh_host_rsa_key ]; then
	ssh-keygen -m PEM -N "" -b 2048 -t rsa -f /data/pleroma/ssh_keys/ssh_host_rsa_key
fi

export PATH="$PATH:/opt/pleroma/bin"

FLAGFILE="/opt/pleroma/instance/.soapbox_${SOAPBOX_FE_VERSION=latest}_ready"
if [ ! -f $FLAGFILE ]; then
	unzip -q -o /opt/pleroma/dist/soapbox-fe.zip -d /opt/pleroma/instance
	sed -i 's/<\/head>/<style>a[href="\/timeline\/local"] { display: none !important; }<\/style><\/head>/' /data/pleroma/static/index.html
	touch "$FLAGFILE"
	chown -R pleroma:pleroma /opt/pleroma/instance
fi

if [ ! -d /data/postgres ]; then
	cp -rp /var/lib/postgresql/14/main /data/postgres
	(
		while ! pg_isready; do
			sleep 1
		done
		runuser -u postgres -- psql -c "CREATE ROLE pleroma LOGIN"
		runuser -u postgres -- psql -c "CREATE DATABASE pleroma WITH OWNER pleroma"

		while [ ! -f /tmp/.pleroma-ever-started ]; do
			sleep 1
		done

		runuser -u pleroma -- /opt/pleroma/bin/pleroma_ctl config migrate_to_db
		echo "config :pleroma, configurable_from_database: true" >> /data/pleroma/config.exs
	) &
fi

cd /opt/pleroma
exec supervisord -n