# Set up letsencrypt certificate. TODO: Is it auto-renewed?
certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
-# Prepare user and system info.
+# Prepare user.
adduser --system --shell /bin/false --home /opt/pleroma pleroma
-export FLAVOUR='amd64'
# Download and unzip latest stable release, set up Pleroma dirs.
+export FLAVOUR='amd64'
su pleroma -s $SHELL -lc "
curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=$FLAVOUR' -o /tmp/pleroma.zip
unzip /tmp/pleroma.zip -d /tmp/
chown -R pleroma /etc/pleroma
# Configure and set up DB.
-su pleroma -s $SHELL -lc './bin/pleroma_ctl instance gen '\
- '--output /etc/pleroma/config.exs' \
- '--output-psql /tmp/setup_db.psql' \
- "--domain ${domain}" \
- '--instance-name plom-roma' \
- "--admin-email ${mail}" \
- "--notify-email ${mail}" \
- '--dbhost localhost' \
- '--dbname pleroma' \
- '--dbuser pleroma' \
- "--dbpass $(pwgen -s 100 1)" \
- '--rum N' \
- '--indexable N' \
- '--uploads-dir /var/lib/pleroma/uploads' \
- '--static-dir /var/lib/pleroma/static' \
- '--listen-ip 127.0.0.1' \
- '--listen-port 4000'
+su pleroma -s $SHELL -lc "./bin/pleroma_ctl instance gen \
+--output /etc/pleroma/config.exs \
+--output-psql /tmp/setup_db.psql \
+--domain ${domain} \
+--instance-name plom-roma \
+--admin-email ${mail} \
+--notify-email ${mail} \
+--dbhost localhost \
+--dbname pleroma \
+--dbuser pleroma \
+--rum N \
+--indexable N \
+--uploads-dir /var/lib/pleroma/uploads \
+--static-dir /var/lib/pleroma/static \
+--listen-ip 127.0.0.1 \
+--listen-port 4000 \
+--dbpass $(pwgen -s 100 1)"
su postgres -s $SHELL -lc "psql -f /tmp/setup_db.psql"
su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"