This commit is contained in:
octospacc 2023-08-04 23:43:57 +02:00
parent e2bf7bca71
commit d139b218b9
12 changed files with 219 additions and 21 deletions

6
Lib.sh
View File

@ -18,8 +18,7 @@ CpItem(){
CpItems(){
for p in $@
do
CpItem "$p"
do CpItem "$p"
done
}
@ -27,8 +26,7 @@ CpSub(){
LBase="$1"; shift
RBase="$1"; shift
for s in $@
do
CpItems ${LBase}${s}${RBase}
do CpItems /${LBase}${s}${RBase}
done
}

View File

@ -1,6 +1,7 @@
#!/bin/sh
# Upload a backup of the Local Cloud and of local services backups to other clouds
set -e
. "$(dirname "$(realpath "$0")")/BackupGlobals.cfg"
GitPush() {
@ -37,13 +38,34 @@ EchoExec cp -rp "../shiori-data/Latest.d" "./shiori-data"
GitPush
cd ..
#McServer="SpaccCraft"
#McEdition="Beta-1.7.3"
#cd "/Server/${McServer}/spacccraft-b1.7.3-backup4"
#cp ../*.sh ./
#cp -rT "${BackupsBase}/${McServer}/${McEdition}/Latest" "./${McEdition}"
#GitPush
#cd "${BackupsBase}"
exit
cd ./SpaccBBS-Backup-phpBB-2023
EchoExec rm -rf ./SpaccBBS || true
EchoExec cp -rp ../SpaccBBS/Latest.d ./SpaccBBS
EchoExec cp ../SpaccBBS/Db.Latest.sql.tar.xz ./Db.sql.tar.xz
for File in \
./Db.sql.tar.xz \
./SpaccBBS/config.php \
./SpaccBBS/arrowchat/includes/config.php \
; do ccencryptNow "$File" "$BackupKey_Git_SpaccBBS"
done
GitPush
cd ..
McServer="SpaccCraft"
McEdition="Beta-1.7.3"
McGit="spacccraft-b1.7.3-backup4"
DestPath="${BackupsBase}/${McServer}/${McGit}"
if [ -d "${DestPath}" ]
then
#cd "/Server/${McServer}"
cd "${BackupsBase}/${McServer}"
rm -rf "${DestPath}/${McEdition}"
cp ./*.sh "${DestPath}/"
cp -r "./${McEdition}/Latest.d" "${DestPath}/${McEdition}"
GitPullPushPath "${DestPath}"
fi
GitPullPushPath "/Cloud/Repos/Personal-Game-Saves"
#GitPullPushPath "/media/Disk/Configs"

View File

@ -1,14 +1,18 @@
#!/bin/sh
# Make local backups of our data from various third-party services
set -e
. "$(dirname "$(realpath "$0")")/BackupGlobals.cfg"
# Invidious personal JSON dump
InvidiousPersonalJsonDump(){
Name="Invidious-User"
mkdir -vp "./${Name}"
curl \
"${Invidious_Backup_URL}/subscription_manager?action_takeout=1&format=json" \
-H "${Invidious_Backup_Cookie}" \
| 7z a -mmt1 -mx9 "./${Name}/${RunDate}.7z" -si && cp -v "./${Name}/${RunDate}.7z" "./${Name}/Latest.7z"
}
#InvidiousPersonalJsonDump
WriteLastLog

View File

@ -1,25 +1,37 @@
#!/bin/sh
# Make local backups of the data from the hosted services
set -e
. "$(dirname "$(realpath "$0")")/BackupGlobals.cfg"
SimpleBackup() {
SimpleCompress(){
EchoExec tar cJSf "$1.tar.xz" "$2"
}
SimpleBackup(){
# $1: Folder
# $2: Optional prefix relative to path in /Server
mkdir -vp "./$1"
#tar cvJSf "./$1/${RunDate}.tar.xz" "/Server/$2/$1" && \
#cp "./$1/${RunDate}.tar.xz" "./$1/Latest.tar.xz"
EchoExec rm -rf "./$1/Latest.d"
EchoExec rm "./$1/Latest.tar.xz" || true
EchoExec rm -rf "./$1/Latest.d" || true
EchoExec cp -rp "/Server/$2/$1" "./$1/Latest.d"
EchoExec tar cJSf "./$1/${RunDate}.tar.xz" "./$1/Latest.d" && \
cp -v "./$1/${RunDate}.tar.xz" "./$1/Latest.tar.xz"
SimpleCompress "./$1/${RunDate}" "./$1/Latest.d"
#cp -v "./$1/${RunDate}.tar.xz" "./$1/Latest.tar.xz"
EchoExec ln -s "./${RunDate}.tar.xz" "./$1/Latest.tar.xz"
}
#SimpleBackup "wallabag-data"
SimpleBackup "FreshRSS-data"
SimpleBackup "shiori-data" "Shiori"
rm -v "./shiori-data/Latest.d/archive/*"
rm -v ./shiori-data/Latest.d/archive/* || true
SimpleBackup SpaccBBS www
EchoExec mariadb-dump phpBB > ./SpaccBBS/Db.Latest.sql
SimpleCompress "./SpaccBBS/Db.${RunDate}.sql" ./SpaccBBS/Db.Latest.sql
EchoExec ln -s "./Db.${RunDate}.sql.tar.xz" ./SpaccBBS/Db.Latest.sql.tar.xz
# GoToSocial
#Name="GoToSocial"

View File

@ -1,6 +1,7 @@
#!/bin/sh
cd "$( dirname "$( realpath "$0" )" )"
sh -c 'while true; do echo "nameserver 127.0.0.1" > /etc/resolv.conf; sleep 30; done' &
sh ./MountRoots.sh &
while true; do sleep 30; done

View File

@ -0,0 +1,75 @@
upstream php {
server unix:/var/run/php/php7.4-fpm.sock;
}
server {
listen 80;
listen 443 ssl;
server_name bbs.spacc.eu.org;
ssl_certificate /etc/letsencrypt/live/bbs.spacc.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bbs.spacc.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
root /Server/www/SpaccBBS;
index index.php index.html index.htm;
# Loggers
error_log /var/log/nginx/SpaccBBS.error.log warn;
access_log /var/log/nginx/SpaccBBS.access.log;
location / {
try_files $uri $uri/ @rewriteapp;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_pass php;
}
# Deny access to internal phpbb files.
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|install.bak|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
location /includes {
deny all;
internal;
}
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# Correctly pass scripts for installer
location /install/ {
try_files $uri $uri/ @rewrite_installapp =404;
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /install/app.php$is_args$args =404;
fastcgi_pass php;
}
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
deny all;
internal;
}
}

View File

@ -0,0 +1,62 @@
server {
listen 443 ssl;
server_name x.spacc.eu.org;
ssl_certificate /etc/letsencrypt/live/x.spacc.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/x.spacc.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location / {
root /Server/www/XSpacc;
if ($request_uri ~ ^([^.\?]*[^/])$) {
return 301 $1/;
}
try_files $uri $uri/ $uri.html;
autoindex off;
}
}
server {
listen 443 ssl;
server_name graph.x.spacc.eu.org;
ssl_certificate /etc/letsencrypt/live/graph.x.spacc.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/graph.x.spacc.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
proxy_pass https://149.154.164.13:443;
proxy_set_header Host telegra.ph;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Accept-Encoding ''; # Needed for sub_filter
sub_filter '<body>' '<body><link rel="stylesheet" href="//x.spacc.eu.org/x.css"/><p class="x-spacc">Content Proxied from <a href="//x.spacc.eu.org">X by Spacc Inc.</a> — <a href="//telegra.ph$request_uri">Upstream</a></p>';
sub_filter_once off;
}
}
server {
listen 443 ssl;
server_name reddit.x.spacc.eu.org;
ssl_certificate /etc/letsencrypt/live/reddit.x.spacc.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/reddit.x.spacc.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
proxy_pass https://old.reddit.com;
proxy_set_header Host old.reddit.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Accept-Encoding ''; # Needed for sub_filter
sub_filter '</head>' '<meta name="viewport" content="width=device-width, initial-scale=1.0"/></head>';
sub_filter '<body ' '<body><link rel="stylesheet" href="//x.spacc.eu.org/reddit.css"/><p class="x-spacc">Content Proxied from <a href="//x.spacc.eu.org">X by Spacc Inc.</a> — <a href="//old.reddit.com$request_uri">Upstream</a></p><meta ';
sub_filter '<a href="https://old.reddit.com/' '<a href="/';
sub_filter '<script>' '<delscript>';
sub_filter '<script ' '<delscript ';
sub_filter '</script>' '</delscript>';
sub_filter_once off;
}
}

View File

@ -6,7 +6,7 @@ server {
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
proxy_pass http://localhost:8331;
proxy_pass http://192.168.1.157:8311;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -16,6 +16,14 @@ server {
sub_filter '</body>' '<link rel="stylesheet" href="/fediii-static/Kbin.css"/><script src="/fediii-static/Kbin.js"></script></body>';
sub_filter_once on;
}
location /.well-known/mercure {
proxy_pass http://192.168.1.157:3000$request_uri;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /fediii-static/ {
root /Server/www/;
add_header Access-Control-Allow-Origin *;

View File

@ -0,0 +1,16 @@
server {
listen 443 ssl;
server_name wp-testing.octt.eu.org;
ssl_certificate /etc/letsencrypt/live/wp-testing.octt.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wp-testing.octt.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
proxy_pass http://192.168.1.157:8048;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

View File

@ -7,6 +7,6 @@ Type=simple
Restart=always
RestartSec=15
User=pi
ExecStart=/Server/CringeInoltro/StartCringeInoltro.py
ExecStart=/Server/Bots/CringeInoltro/StartCringeInoltro.py
[Install]
WantedBy=multi-user.target

View File

@ -6,8 +6,8 @@ StartLimitIntervalSec=0
Type=simple
Restart=always
RestartSec=10
CPUQuota=75%
MemoryMax=350M
#CPUQuota=75%
#MemoryMax=384M
User=pi
ExecStart=script /dev/null -c "export TERM=vt100; screen -S SpaccCraft sh /Server/SpaccCraft/StartSpaccCraft.sh"
[Install]

View File

@ -7,6 +7,6 @@ Type=simple
Restart=always
RestartSec=10
User=pi
ExecStart=/Server/WinDog/StartWinDog
ExecStart=/Server/Bots/WinDog/StartWinDog
[Install]
WantedBy=multi-user.target