1
mirror of https://github.com/jakejarvis/mastodon-utils.git synced 2025-06-27 17:25:42 -04:00

renamed repo

This commit is contained in:
2022-12-15 13:45:37 -05:00
parent 046c63d220
commit 2b1b586d88
9 changed files with 81 additions and 40 deletions

View File

@ -6,26 +6,26 @@ set -euo pipefail
# default paths
MASTODON_ROOT=/home/mastodon
APP_ROOT="$MASTODON_ROOT/live"
SCRIPTS_ROOT="$MASTODON_ROOT/scripts"
UTILS_ROOT="$MASTODON_ROOT/utils"
RBENV_ROOT="$MASTODON_ROOT/.rbenv"
# clone this repo if it doesn't exist in the proper location
if [ ! -d "$SCRIPTS_ROOT" ]
if [ ! -d "$UTILS_ROOT" ]
then
sudo -u mastodon git clone https://github.com/jakejarvis/mastodon-scripts.git "$SCRIPTS_ROOT"
sudo -u mastodon git clone https://github.com/jakejarvis/mastodon-utils.git "$UTILS_ROOT"
# fix permissions
sudo chown -R mastodon:mastodon "$SCRIPTS_ROOT"
sudo git config --global --add safe.directory "$SCRIPTS_ROOT"
sudo chown -R mastodon:mastodon "$UTILS_ROOT"
sudo git config --global --add safe.directory "$UTILS_ROOT"
fi
# apply custom patches
cd "$APP_ROOT"
sudo -u mastodon git apply --reject --allow-binary-replacement "$SCRIPTS_ROOT"/patches/*.patch
sudo -u mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/*.patch
if [ -d "$APP_ROOT/app/javascript/flavours/glitch" ];
then
# apply additional glitch-only patches:
sudo -u mastodon git apply --reject --allow-binary-replacement "$SCRIPTS_ROOT"/patches/glitch/*.patch
sudo -u mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/glitch/*.patch
fi
# update dependencies

32
scripts/setup_nginx.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# symlinks files from this repo to their proper location
# exit when any step fails
set -euo pipefail
# default paths
MASTODON_ROOT=/home/mastodon
APP_ROOT="$MASTODON_ROOT/live"
UTILS_ROOT="$MASTODON_ROOT/utils"
# clone this repo if it doesn't exist in the proper location
if [ ! -d "$UTILS_ROOT" ]
then
sudo -u mastodon git clone https://github.com/jakejarvis/mastodon-utils.git "$UTILS_ROOT"
# fix permissions
sudo chown -R mastodon:mastodon "$UTILS_ROOT"
sudo git config --global --add safe.directory "$UTILS_ROOT"
fi
# setup nginx config
sudo rm -rf /etc/nginx/sites-available
sudo rm -rf /etc/nginx/sites-enabled/*
sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
sudo ln -sf "$UTILS_ROOT/etc/nginx/nginx.conf" /etc/nginx/nginx.conf
sudo ln -sf "$UTILS_ROOT/etc/nginx/modules" /usr/lib/nginx/modules
sudo ln -sf "$UTILS_ROOT/etc/nginx/sites-available" /etc/nginx/sites-available
sudo ln -sf /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf
sudo ln -sf /etc/nginx/sites-available/mastodon.conf /etc/nginx/sites-enabled/mastodon.conf
sudo nginx -t
sudo nginx -s reload

View File

@ -1,7 +1,5 @@
#!/bin/sh
set -e
MASTODON_ROOT=/home/mastodon
APP_ROOT="$MASTODON_ROOT/live"
RBENV_ROOT="$MASTODON_ROOT/.rbenv"

View File

@ -6,7 +6,7 @@ set -euo pipefail
# default paths
MASTODON_ROOT=/home/mastodon
APP_ROOT="$MASTODON_ROOT/live"
SCRIPTS_ROOT="$MASTODON_ROOT/scripts"
UTILS_ROOT="$MASTODON_ROOT/utils"
RBENV_ROOT="$MASTODON_ROOT/.rbenv"
# check for existing installation
@ -30,7 +30,7 @@ else
fi
# pull & apply latest patches
. "$SCRIPTS_ROOT/scripts/apply_patches.sh"
. "$UTILS_ROOT/scripts/apply_patches.sh"
# create blank custom.css (this overrides any CSS set in the admin panel, but if that's not being used, then
# this quickly saves a request to the backend)

View File

@ -2,7 +2,7 @@
# cronjob ran once per week at 3 AM on Sunday; see https://crontab.guru/#0_3_*_*_0
# syntax for crontab -e:
# 0 3 * * 0 root /home/mastodon/scripts/weekly_cleanup.sh >> /home/mastodon/logs/cron.log 2>&1
# 0 3 * * 0 root /home/mastodon/utils/weekly_cleanup.sh >> /home/mastodon/logs/cron.log 2>&1
set -e