mirror of
https://gitlab.com/octospacc/Configs.git
synced 2025-03-12 08:40:16 +01:00
Auto-Backup $'Sun Sep 22 2024 14:38:14 GMT+0200 (Central European Summer Time)'
This commit is contained in:
parent
a750c83ae2
commit
115d90f91e
@ -1,14 +1,13 @@
|
||||
#!/usr/bin/env zx
|
||||
|
||||
let BackupsBase = '/Main/Backup';
|
||||
let Time = new Date();
|
||||
const BackupsBase = '/Main/Backup';
|
||||
const GenericBrowserUserAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0';
|
||||
const Time = new Date();
|
||||
|
||||
Time.Stamp = `${Time.getFullYear()}-${(Time.getMonth() + 1).toString().padStart(2, '0')}-${Time.getDate().toString().padStart(2, '0')}`;
|
||||
cd(BackupsBase);
|
||||
|
||||
const GenericBrowserUserAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0';
|
||||
|
||||
let [Jobs, Secrets] = [{}, {}];
|
||||
const [Jobs, Secrets] = [{}, {}];
|
||||
|
||||
// Import secrets from sh-formatted file
|
||||
for (let line of (await fs.readFile('./.BackupSecrects.sec', 'utf8')).split('\n')) {
|
||||
@ -69,7 +68,7 @@ const AltervistaFullBackup = async (domain) => {
|
||||
const [user, pass, key] = Secrets[`${domain.replaceAll('.', '_')}_Backup_Tokens`].split(':');
|
||||
cd(`./${domain}-Git`);
|
||||
await $`rclone sync ${domain}:/ ./www/wp-content/ --progress || true`;
|
||||
// await $`curl -u ${user}:${pass} https://${domain}/wp-json/octt-export-rest/v1/xrss-export?token=${key} > ./WordPress.xml || true`;
|
||||
await $`curl -u ${user}:${pass} https://${domain}/wp-json/octt-export-rest/v1/xrss-export?token=${key} > ./WordPress.xml || true`;
|
||||
await GitPullPush();
|
||||
};
|
||||
|
||||
@ -176,7 +175,7 @@ Jobs.Cloud_ArticlesBackupPrivate = async () => {
|
||||
Jobs.Cloud_SpaccBBS = async () => {
|
||||
await FolderGoCopyForCloud('SpaccBBS', 'SpaccBBS-Backup-phpBB-2023');
|
||||
await $`cp ../SpaccBBS/Db.Latest.sql.tar.xz ./Db.sql.tar.xz`;
|
||||
for (let File of ['Db.sql.tar.xz', 'SpaccBBS/old/config.php', 'SpaccBBS/old/arrowchat/includes/config.php']) {
|
||||
for (const File of ['Db.sql.tar.xz', 'SpaccBBS/old/config.php', 'SpaccBBS/old/arrowchat/includes/config.php']) {
|
||||
await ccencryptNow(`./${File}`, Secrets.BackupKey_Git_SpaccBBS);
|
||||
};
|
||||
await GitPullPush();
|
||||
@ -194,7 +193,7 @@ Jobs.Cloud_liminalgici = async () => {
|
||||
await $`cp ../pixelfed_liminalgici/Db.Latest.sql.tar.xz ./Db.sql.tar.xz`;
|
||||
await SimpleCompress('./pixelfed_liminalgici/config');
|
||||
await $`rm -rf ./pixelfed_liminalgici/config || true`;
|
||||
for (let File of ['Db.sql.tar.xz', './pixelfed_liminalgici/.env', './pixelfed_liminalgici/config.tar.xz']) {
|
||||
for (const File of ['Db.sql.tar.xz', './pixelfed_liminalgici/.env', './pixelfed_liminalgici/config.tar.xz']) {
|
||||
await ccencryptNow(`./${File}`, Secrets.BackupKey_Git_liminalgici);
|
||||
};
|
||||
//await $`rm ./pixelfed_liminalgici/storage/app/public/m/.gitignore || true`;
|
||||
|
38
Server/Root/Main/Server/Scripts/CleanBackups.zx.mjs
Normal file → Executable file
38
Server/Root/Main/Server/Scripts/CleanBackups.zx.mjs
Normal file → Executable file
@ -1 +1,39 @@
|
||||
#!/usr/bin/env zx
|
||||
|
||||
const BackupsBase = '/Main/Backup';
|
||||
const TimeLimit = [0, 1, 0];
|
||||
|
||||
let [year, month, day] = TimeLimit;
|
||||
const maxDate = { year, month, day };
|
||||
|
||||
const nowDate = (new Date());
|
||||
//const nowDate = {
|
||||
// year: Number(Time.getFullYear()),
|
||||
// month: Number((Time.getMonth() + 1).toString().padStart(2, '0')),
|
||||
// day: Number(Time.getDate().toString().padStart(2, '0')),
|
||||
//};
|
||||
|
||||
cd(BackupsBase);
|
||||
const allDirsList = String(await $`ls -d */`).trim().split('\n');
|
||||
const gitDirsList = String(await $`ls -d */.git`).trim().split('\n');
|
||||
for (const folder of allDirsList) {
|
||||
if (gitDirsList.includes(`${folder}.git`)) {
|
||||
continue;
|
||||
}
|
||||
const filesList = [
|
||||
...String(await $`ls ${folder}????-??-??.* || true`).trim().split('\n'),
|
||||
...String(await $`ls ${folder}*.????-??-??.* || true`).trim().split('\n'),
|
||||
];
|
||||
for (const file of filesList) {
|
||||
if (file.includes('?')) {
|
||||
continue;
|
||||
}
|
||||
let [year, month, day] = file.split('/')[1].split('-');
|
||||
year = year.split('.').slice(-1)[0];
|
||||
month = month;
|
||||
day = day.split('.')[0];
|
||||
const fileDate = (new Date(`${year}-${month}-${day}`));
|
||||
|
||||
//$`rm`
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
upstream host_octospacchub { server octospacchub.goatcounter.com; }
|
||||
upstream host_sitoctt { server sitoctt.goatcounter.com; }
|
||||
upstream host_octtkb { server octtkb.goatcounter.com; }
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl;
|
||||
@ -5,11 +9,11 @@ server {
|
||||
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 /sitoctt/ {
|
||||
location ~ /(.*)/count {
|
||||
resolver 9.9.9.9;
|
||||
proxy_http_version 1.1;
|
||||
proxy_pass https://sitoctt.goatcounter.com/;
|
||||
proxy_set_header Host "sitoctt.goatcounter.com";
|
||||
proxy_pass "https://$1.goatcounter.com/count$is_args$args";
|
||||
proxy_set_header Host "$1.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;
|
||||
@ -18,15 +22,28 @@ server {
|
||||
proxy_hide_header Content-Security-Policy;
|
||||
proxy_hide_header X-Frame-Options;
|
||||
}
|
||||
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";
|
||||
}
|
||||
# location /sitoctt/ {
|
||||
# resolver 9.9.9.9;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_pass https://sitoctt.goatcounter.com/;
|
||||
# proxy_set_header Host "sitoctt.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";
|
||||
# proxy_hide_header Content-Security-Policy;
|
||||
# proxy_hide_header X-Frame-Options;
|
||||
# }
|
||||
# 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";
|
||||
# }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user