You've already forked mastodon-utils
mirror of
https://github.com/jakejarvis/mastodon-utils.git
synced 2025-06-27 13:55:43 -04:00
fix super-linter complaints
This commit is contained in:
14
.github/workflows/super-linter.yml
vendored
14
.github/workflows/super-linter.yml
vendored
@ -1,5 +1,5 @@
|
||||
# This workflow executes several linters on changed files based on languages used in your code base whenever
|
||||
# you push a code or open a pull request.
|
||||
# This workflow executes several linters on changed files based on languages
|
||||
# used in your code base whenever you push a code or open a pull request.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
@ -8,9 +8,10 @@ name: Lint Code Base
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
run-lint:
|
||||
runs-on: ubuntu-latest
|
||||
@ -18,10 +19,13 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
# Full git history is needed to get a proper list of changed files within `super-linter`
|
||||
# Full git history is needed to get a proper
|
||||
# list of changed files within `super-linter`
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Lint Code Base
|
||||
# Using the slim image drastically reduces build and runtime, see:
|
||||
# https://github.com/github/super-linter#slim-image
|
||||
uses: github/super-linter/slim@v4
|
||||
env:
|
||||
DEFAULT_BRANCH: "main"
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
*.log
|
||||
|
||||
# here be secrets
|
||||
*.env*
|
||||
!.env.example
|
||||
|
16
init.sh
16
init.sh
@ -4,13 +4,13 @@
|
||||
export MASTODON_USER=mastodon
|
||||
|
||||
# default paths
|
||||
export MASTODON_ROOT="/home/$MASTODON_USER" # home dir of the user above
|
||||
export UTILS_ROOT="$MASTODON_ROOT/utils" # this repository
|
||||
export APP_ROOT="$MASTODON_ROOT/live" # actual Mastodon files
|
||||
export BACKUPS_ROOT="$MASTODON_ROOT/backups" # backups destination
|
||||
export LOGS_ROOT="$MASTODON_ROOT/logs" # logs destintation
|
||||
export RBENV_ROOT="$MASTODON_ROOT/.rbenv" # rbenv (w/ ruby-build plugin) directory
|
||||
export NVM_DIR="$MASTODON_ROOT/.nvm" # nvm directory
|
||||
export MASTODON_ROOT="/home/$MASTODON_USER" # home dir of the user above
|
||||
export UTILS_ROOT="$MASTODON_ROOT/utils" # this repository
|
||||
export APP_ROOT="$MASTODON_ROOT/live" # actual Mastodon files
|
||||
export BACKUPS_ROOT="$MASTODON_ROOT/backups" # backups destination
|
||||
export LOGS_ROOT="$MASTODON_ROOT/logs" # logs destintation
|
||||
export RBENV_ROOT="$MASTODON_ROOT/.rbenv" # rbenv (w/ ruby-build plugin) directory
|
||||
export NVM_DIR="$MASTODON_ROOT/.nvm" # nvm directory
|
||||
|
||||
# automatically detect glitch-soc
|
||||
# shellcheck disable=SC2155
|
||||
@ -75,7 +75,7 @@ as_mastodon() {
|
||||
|
||||
# run 'bin/tootctl' as MASTODON_USER in APP_ROOT from anywhere (`tootctl version`)
|
||||
tootctl() {
|
||||
( cd "$APP_ROOT" && as_mastodon RAILS_ENV=production ruby ./bin/tootctl "$@" )
|
||||
(cd "$APP_ROOT" && as_mastodon RAILS_ENV=production ruby ./bin/tootctl "$@")
|
||||
}
|
||||
|
||||
# ---
|
||||
|
@ -10,6 +10,7 @@ set -euo pipefail
|
||||
echo -e "\n===== backup.sh: started at $(date '+%Y-%m-%d %H:%M:%S') =====\n"
|
||||
|
||||
# initialize paths
|
||||
# shellcheck disable=SC1091
|
||||
. "$(dirname "${BASH_SOURCE[0]}")"/../init.sh
|
||||
|
||||
if [ "$(systemctl is-active mastodon-web.service)" = "active" ]; then
|
||||
|
@ -4,6 +4,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
# initialize paths
|
||||
# shellcheck disable=SC1091
|
||||
. "$(dirname "${BASH_SOURCE[0]}")"/../init.sh
|
||||
|
||||
# re-detect glitch-soc
|
||||
@ -48,7 +49,7 @@ fi
|
||||
# ---
|
||||
|
||||
# apply a more restrictive robots.txt
|
||||
as_mastodon tee "$APP_ROOT/public/robots.txt" > /dev/null <<EOT
|
||||
as_mastodon tee "$APP_ROOT/public/robots.txt" >/dev/null <<EOT
|
||||
# block everything except About page
|
||||
User-agent: *
|
||||
Allow: /about
|
||||
|
@ -14,6 +14,7 @@ if [ "$MY_NAME_IS_JAKE_JARVIS" != "pinky promise" ]; then
|
||||
fi
|
||||
|
||||
# initialize paths (and silence warnings about things not existing yet because that's why we're running the installer.)
|
||||
# shellcheck disable=SC1091
|
||||
. "$(dirname "${BASH_SOURCE[0]}")"/../init.sh >/dev/null
|
||||
|
||||
# check for existing installation
|
||||
@ -146,7 +147,10 @@ as_mastodon bundle install --jobs "$(getconf _NPROCESSORS_ONLN)"
|
||||
as_mastodon yarn install --pure-lockfile
|
||||
|
||||
# set up database w/ random alphanumeric password
|
||||
DB_PASSWORD=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c32; echo)
|
||||
DB_PASSWORD=$(
|
||||
tr </dev/urandom -dc A-Za-z0-9 | head -c32
|
||||
echo
|
||||
)
|
||||
echo "CREATE USER $MASTODON_USER WITH PASSWORD '$DB_PASSWORD' CREATEDB" | sudo -u postgres psql -f -
|
||||
|
||||
# populate .env.production config
|
||||
@ -283,14 +287,17 @@ as_mastodon touch "$LOGS_ROOT"/cron.log
|
||||
|
||||
# set cleanup & backup tasks to run weekly
|
||||
# https://docs.joinmastodon.org/admin/setup/#cleanup
|
||||
(sudo crontab -l; echo -e "\n$INSTALLER_WUZ_HERE
|
||||
(
|
||||
sudo crontab -l
|
||||
echo -e "\n$INSTALLER_WUZ_HERE
|
||||
@weekly bash -c \"$UTILS_ROOT/scripts/weekly_cleanup.sh >> $LOGS_ROOT/cron.log 2>&1\"
|
||||
@weekly bash -c \"$UTILS_ROOT/scripts/backup.sh >> $LOGS_ROOT/cron.log 2>&1\"
|
||||
|
||||
# automatically renew Let's Encrypt certificates
|
||||
# https://certbot.eff.org/instructions?ws=nginx&os=pip
|
||||
0 0,12 * * * root /opt/certbot/bin/python -c \"import random; import time; time.sleep(random.random() * 3600)\" && certbot renew -q
|
||||
") | sudo crontab -
|
||||
"
|
||||
) | sudo crontab -
|
||||
|
||||
echo "🎉 done! don't forget to fill in .env.production with optional credentials"
|
||||
echo "https://$MASTODON_DOMAIN/auth/sign_in"
|
||||
|
@ -14,6 +14,7 @@ if [ "$MY_NAME_IS_JAKE_JARVIS" != "pinky promise" ]; then
|
||||
fi
|
||||
|
||||
# initialize paths
|
||||
# shellcheck disable=SC1091
|
||||
. "$(dirname "${BASH_SOURCE[0]}")"/../init.sh
|
||||
|
||||
# pull latest mastodon source
|
||||
|
@ -4,6 +4,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
# initialize paths
|
||||
# shellcheck disable=SC1091
|
||||
. "$(dirname "${BASH_SOURCE[0]}")"/../init.sh
|
||||
|
||||
echo "* rbenv: $(rbenv --version)"
|
||||
|
@ -10,6 +10,7 @@ set -o pipefail
|
||||
echo -e "\n===== weekly_cleanup.sh: started at $(date '+%Y-%m-%d %H:%M:%S') =====\n"
|
||||
|
||||
# initialize paths
|
||||
# shellcheck disable=SC1091
|
||||
. "$(dirname "${BASH_SOURCE[0]}")"/../init.sh
|
||||
|
||||
tootctl media remove --days 14
|
||||
|
Reference in New Issue
Block a user