Newer
Older
echo '' >> $pleroma_nginx_site
echo ' location /proxy {' >> $pleroma_nginx_site
nginx_limits $PLEROMA_DOMAIN_NAME '15m'
echo ' proxy_cache pleroma_media_cache;' >> $pleroma_nginx_site
echo ' proxy_cache_lock on;' >> $pleroma_nginx_site
echo " proxy_pass http://localhost:$PLEROMA_PORT;" >> $pleroma_nginx_site
echo ' }' >> $pleroma_nginx_site
echo ' # include snippets/well-known.conf;' >> $pleroma_nginx_site
echo '}' >> $pleroma_nginx_site
# back end
chown -R pleroma:pleroma *
sudo -u pleroma mix local.hex --force
if [ ! "$?" = "0" ]; then
echo $'mix local.hex failed'
exit 1745673
fi
sudo -u pleroma mix deps.get --force
if [ ! "$?" = "0" ]; then
echo $'mix deps.get failed'
exit 7325733
fi
function_check pleroma_create_database
pleroma_create_database
${PROJECT_NAME}-pass -u $MY_USERNAME -a pleroma -p "$PLEROMA_ADMIN_PASSWORD"
# NOTE: we don't need to install the frontend separately,
# since the backend contains a precompiled version of it
install_gnusocial_default_background "pleroma" "$PLEROMA_DOMAIN_NAME"
if [ ! -f $PLEROMA_DIR/priv/static/static/config.json ]; then
sed -i 's|"theme":.*|"theme": "base16-summerfruit-dark.css",|g' $PLEROMA_DIR/priv/static/static/config.json
pleroma_set_background_image_from_url $PLEROMA_DIR/priv/static "$PLEROMA_DOMAIN_NAME" "$PLEROMA_BACKGROUND_IMAGE_URL" "$PLEROMA_TITLE"
# Get certificate
function_check create_site_certificate
create_site_certificate $PLEROMA_DOMAIN_NAME 'yes'
function_check nginx_ensite
nginx_ensite $PLEROMA_DOMAIN_NAME
systemctl restart postgresql
systemctl restart nginx
set_completion_param "pleroma domain" "$PLEROMA_DOMAIN_NAME"
# We need to set up the url option again because it somehow gets
# lost during mix compile
pleroma_secret=$PLEROMA_DIR/config/dev.secret.exs
sed -i 's|watchers: \[\]|watchers: \[\],|g' $pleroma_secret
fi
if ! grep -q 'url:' $pleroma_secret; then
if [[ $ONION_ONLY == 'no' ]]; then
sed -i "/watchers: /a url: [host: \"$PLEROMA_DOMAIN_NAME\", scheme: \"https\", port: 443]" $pleroma_secret
sed -i "/watchers: /a url: [host: \"$PLEROMA_ONION_HOSTNAME\", scheme: \"http\", port: 80]" $pleroma_secret
# daemon
echo '[Unit]' > /etc/systemd/system/pleroma.service
echo 'Description=Pleroma social network' >> /etc/systemd/system/pleroma.service
echo 'After=network.target postgresql.service' >> /etc/systemd/system/pleroma.service
echo '' >> /etc/systemd/system/pleroma.service
echo '[Service]' >> /etc/systemd/system/pleroma.service
echo 'User=pleroma' >> /etc/systemd/system/pleroma.service
echo "WorkingDirectory=$PLEROMA_DIR" >> /etc/systemd/system/pleroma.service
echo "Environment=\"HOME=$PLEROMA_DIR\"" >> /etc/systemd/system/pleroma.service
echo 'ExecStart=/usr/local/bin/mix phx.server' >> /etc/systemd/system/pleroma.service
echo 'ExecReload=/bin/kill $MAINPID' >> /etc/systemd/system/pleroma.service
echo 'KillMode=process' >> /etc/systemd/system/pleroma.service
echo 'Restart=on-failure' >> /etc/systemd/system/pleroma.service
echo '' >> /etc/systemd/system/pleroma.service
echo '[Install]' >> /etc/systemd/system/pleroma.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/pleroma.service
echo 'Alias=pleroma.service' >> /etc/systemd/system/pleroma.service
systemctl daemon-reload
systemctl enable pleroma
systemctl start pleroma
APP_INSTALLED=1
}
# NOTE: deliberately there is no "exit 0"