Update Server

This commit is contained in:
octospacc 2023-03-06 12:07:10 +01:00
parent 33c20614d9
commit 1907645f88
14 changed files with 92 additions and 10 deletions

View File

@ -3,7 +3,11 @@ cd "$( dirname "$( realpath "$0" )" )"
cd ./Root
cp -v /etc/diycron ./etc/diycron
# nginx was done manually
cp -v /Server/Scripts/Backup/*.sh ./Server/Scripts/Backup/
cp -v /Server/Scripts/Backup/*.cfg ./Server/Scripts/Backup/
cp -v \
/etc/nginx/sites-available/*.conf /etc/nginx/sites-available/*.old \
./etc/nginx/sites-available/
cp -v \
/Server/Scripts/Backup/*.sh /Server/Scripts/Backup/*.cfg \
./Server/Scripts/Backup/

View File

@ -5,11 +5,13 @@ BackupsBase="/media/Disk/Backup"
# ScriptDir="$( dirname "$( realpath "$0" )" )"
# cd "$ScriptDir"
RunDate="$(date +%F)"
RunDate="$(date +%F)" # Current date in YYYY-MM-DD format
cd "${BackupsBase}"
. ./.BackupSecrects.sec
# Generate a good key for encrypting files, based on a primary secret key and a secondary string
# NOTE to self: Use this same function to get decryption key, plugging the YYYY-MM-DD date of the Git commit as $2
Hash2() {
BaseKey="$1"
SecStr="$2"

View File

@ -14,14 +14,34 @@ GitPullPushPath() {
cd "${BackPath}"
}
BackPathCrypt() {
Folder="$1"
Key="$2"
Ext="$([ -z "$3" ] && echo ".tar.xz" || echo "$3")"
cp "../${Folder}/Latest${Ext}" "./${Folder}${Ext}" && \
ccencryptNow "./${Folder}${Ext}" "${Key}"
}
cd ./Server-Backup-Limited
Item="Invidious-User" && cp "../${Item}/Latest.7z" "./${Item}.7z" && ccencryptNow "./${Item}.7z" "${BackupKey_Git_Invidious}"
Item="wallabag-data" && cp "../${Item}/Latest.tar.xz" "./${Item}.tar.xz" && ccencryptNow "./${Item}.tar.xz" "${BackupKey_Git_wallabag}"
Item="FreshRSS-data" && cp "../${Item}/Latest.tar.xz" "./${Item}.tar.xz" && ccencryptNow "./${Item}.tar.xz" "${BackupKey_Git_FreshRSS}"
BackPathCrypt "Invidious-User" "${BackupKey_Git_Invidious}" ".7z"
#BackPathCrypt "wallabag-data" "${BackupKey_Git_wallabag}"
BackPathCrypt "FreshRSS-data" "${BackupKey_Git_FreshRSS}"
#BackPathCrypt "shiori-data" "${BackupKey_Git_Shiori}"
#Item="Invidious-User" && cp "../${Item}/Latest.7z" "./${Item}.7z" && ccencryptNow "./${Item}.7z" "${BackupKey_Git_Invidious}"
#Item="wallabag-data" && cp "../${Item}/Latest.tar.xz" "./${Item}.tar.xz" && ccencryptNow "./${Item}.tar.xz" "${BackupKey_Git_wallabag}"
#Item="FreshRSS-data" && cp "../${Item}/Latest.tar.xz" "./${Item}.tar.xz" && ccencryptNow "./${Item}.tar.xz" "${BackupKey_Git_FreshRSS}"
#Item="shiori-data" && cp "../${Item}/Latest.tar.xz" "./${Item}.tar.xz" && ccencryptNow "./${Item}.tar.xz" "${BackupKey_Git_Shiori}"
GitPush
cd ..
cd ./Articles-Backup-Private
rm -rf ./shiori-data
cp -r "../shiori-data/Latest.d" "./shiori-data"
GitPush
cd ..
GitPullPushPath "/Cloud/Repos/Personal-Game-Saves"
#GitPullPushPath "/media/Disk/Configs"
#CloudDir="/home/octo/Cloud"
#cd "$CloudDir"

View File

@ -4,13 +4,18 @@
. "$(dirname "$(realpath "$0")")/BackupGlobals.cfg"
SimpleBackup() {
# $1: Folder
# $2: Optional prefix in /Server path
mkdir -p "./$1"
tar cvJSf "./$1/${RunDate}.tar.xz" "/Server/$1" && \
tar cvJSf "./$1/${RunDate}.tar.xz" "/Server/$2/$1" && \
cp "./$1/${RunDate}.tar.xz" "./$1/Latest.tar.xz"
rm -rf "./$1/Latest.d"
cp -r "/Server/$2/$1" "./$1/Latest.d"
}
SimpleBackup "wallabag-data"
#SimpleBackup "wallabag-data"
SimpleBackup "FreshRSS-data"
SimpleBackup "shiori-data" "Shiori"
# GoToSocial
#Name="GoToSocial"

View File

@ -24,7 +24,7 @@ do
# Declaration of all cronjobs like they are normal shell commands, made easy thanks to integrated functions.
# Daily checking for if the script is working
Ifn $Job1 && If $(IsDayMin $(hm2s 5 30)) && date > /tmp/CronTest.log && Job1=1
Ifn $Job1 && If $(IsDayMin $(hm2s 5 30)) && date > /tmp/CronTest.log && journalctl -u diycron >> /tmp/CronTest.log && Job1=1
# RSS to Misskey at HH:15 and HH:45
# If $(IsHourMin 15) || If $(IsHourMin 45) && sudo -u pi /Server/Bots/RSSToMisskey/Run.RSSToMisskey
# Downsync updated content to the sitoctt and push

View File

@ -0,0 +1,18 @@
server {
listen 443 ssl;
server_name private-analytics-not-for-public-use.octt.eu.org;
ssl_certificate /etc/letsencrypt/live/private-analytics-not-for-public-use.octt.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/private-analytics-not-for-public-use.octt.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location /octtkb/ {
#resolver 9.9.9.9;
proxy_http_version 1.1;
proxy_pass https://octtkb.goatcounter.com/;
proxy_set_header Host "octtkb.goatcounter.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";
}
}

View File

@ -0,0 +1,33 @@
server {
listen 443 ssl;
server_name articles.octt.eu.org;
ssl_certificate /etc/letsencrypt/live/articles.octt.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/articles.octt.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
proxy_pass http://localhost:8076;
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";
}
}
server {
listen 443 ssl;
server_name ShioriFeed.octt.eu.org;
ssl_certificate /etc/letsencrypt/live/shiorifeed.octt.eu.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/shiorifeed.octt.eu.org/privkey.pem;
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
proxy_pass http://localhost:8176;
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";
}
}