Added elkarbackup CT
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -14,3 +14,5 @@ CT-Files/aptcacherng/*_mirrors
|
|||||||
CT-Files/mailbackup/OfflineIMAP3-installed
|
CT-Files/mailbackup/OfflineIMAP3-installed
|
||||||
CT-Files/mailbackup/rainloop-installed
|
CT-Files/mailbackup/rainloop-installed
|
||||||
CT-Files/mailbackup/MailBackup-sys
|
CT-Files/mailbackup/MailBackup-sys
|
||||||
|
CT-Files/elkarbackupDEB/rsnapshot.deb
|
||||||
|
CT-Files/elkarbackupALP/Elkarbackup-installed
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
String[] ImgVariantList = ['minimal', 'default' , 'gitea' , 'nginx' , 'ddns' , 'transfersh' , 'iscsi' , 'z2mqtt' , 'nodered' , 'nodejs' , 'mqtt' , 'mailbackup' ]
|
String[] ImgVariantList = ['minimal', 'default' , 'gitea' , 'nginx' , 'ddns' , 'transfersh' , 'iscsi' , 'z2mqtt' , 'nodered' , 'nodejs' , 'mqtt' , 'mailbackup', 'elkarbackupALP' ]
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'LXCBuilder' }
|
agent { label 'LXCBuilder' }
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ files:
|
|||||||
variants:
|
variants:
|
||||||
- gitea
|
- gitea
|
||||||
- nextcloud
|
- nextcloud
|
||||||
|
- elkarbackupALP
|
||||||
|
|
||||||
## for run only version
|
## for run only version
|
||||||
- path: /root/ReadMe
|
- path: /root/ReadMe
|
||||||
@@ -345,6 +346,13 @@ files:
|
|||||||
variants:
|
variants:
|
||||||
- mailbackup
|
- mailbackup
|
||||||
|
|
||||||
|
#FileForElkarbackup
|
||||||
|
- path: /opt/Setup
|
||||||
|
generator: copy
|
||||||
|
source: CT-Files/elkarbackupALP
|
||||||
|
variants:
|
||||||
|
- elkarbackupALP
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
manager: apk
|
manager: apk
|
||||||
update: true
|
update: true
|
||||||
@@ -364,6 +372,7 @@ packages:
|
|||||||
- nginx
|
- nginx
|
||||||
- nextcloud
|
- nextcloud
|
||||||
- mailbackup
|
- mailbackup
|
||||||
|
- elkarbackupALP
|
||||||
|
|
||||||
#PKGS for Default
|
#PKGS for Default
|
||||||
- packages:
|
- packages:
|
||||||
@@ -511,6 +520,32 @@ packages:
|
|||||||
variants:
|
variants:
|
||||||
- mailbackup
|
- mailbackup
|
||||||
|
|
||||||
|
#PKGS for Elkarbackup
|
||||||
|
- packages:
|
||||||
|
- rsnapshot
|
||||||
|
- php7
|
||||||
|
- php7-openssl
|
||||||
|
- php7-phar
|
||||||
|
- php7-mbstring
|
||||||
|
- php7-iconv
|
||||||
|
- php7-json
|
||||||
|
- php7-ctype
|
||||||
|
- php7-xml
|
||||||
|
- php7-tokenizer
|
||||||
|
- php7-dom
|
||||||
|
- php7-session
|
||||||
|
- php7-simplexml
|
||||||
|
- php7-posix
|
||||||
|
- php7-fpm
|
||||||
|
- php7-pdo_mysql
|
||||||
|
- php7-pcntl
|
||||||
|
- php7-fileinfo
|
||||||
|
- coreutils
|
||||||
|
- sudo
|
||||||
|
action: install
|
||||||
|
variants:
|
||||||
|
- elkarbackupALP
|
||||||
|
|
||||||
repositories:
|
repositories:
|
||||||
- name: /etc/apk/repositories
|
- name: /etc/apk/repositories
|
||||||
url: |-
|
url: |-
|
||||||
@@ -579,6 +614,7 @@ actions:
|
|||||||
- nginx
|
- nginx
|
||||||
- nextcloud
|
- nextcloud
|
||||||
- mailbackup
|
- mailbackup
|
||||||
|
- elkarbackupALP
|
||||||
|
|
||||||
#Run provided init script
|
#Run provided init script
|
||||||
- trigger: post-files
|
- trigger: post-files
|
||||||
@@ -597,6 +633,7 @@ actions:
|
|||||||
- mqtt
|
- mqtt
|
||||||
- hass
|
- hass
|
||||||
- mailbackup
|
- mailbackup
|
||||||
|
- elkarbackupALP
|
||||||
|
|
||||||
# Enable service for iscsi CT
|
# Enable service for iscsi CT
|
||||||
- trigger: post-files
|
- trigger: post-files
|
||||||
|
|||||||
@@ -944,6 +944,13 @@ files:
|
|||||||
variants:
|
variants:
|
||||||
- aptcacherng
|
- aptcacherng
|
||||||
|
|
||||||
|
#FileForElkarbackup
|
||||||
|
- path: /opt/Setup
|
||||||
|
generator: copy
|
||||||
|
source: CT-Files/elkarbackupDEB
|
||||||
|
variants:
|
||||||
|
- elkarbackupDEB
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
manager: apt
|
manager: apt
|
||||||
update: true
|
update: true
|
||||||
@@ -966,6 +973,7 @@ packages:
|
|||||||
- tvheadend
|
- tvheadend
|
||||||
- x2go
|
- x2go
|
||||||
- aptcacherng
|
- aptcacherng
|
||||||
|
- elkarbackupDEB
|
||||||
|
|
||||||
#Https Repo pkgs
|
#Https Repo pkgs
|
||||||
- packages:
|
- packages:
|
||||||
@@ -1207,6 +1215,15 @@ packages:
|
|||||||
variants:
|
variants:
|
||||||
- aptcacherng
|
- aptcacherng
|
||||||
|
|
||||||
|
#elkarbackupDEB pkgs
|
||||||
|
- packages:
|
||||||
|
- nano
|
||||||
|
- cron
|
||||||
|
- ssl-cert
|
||||||
|
action: install
|
||||||
|
variants:
|
||||||
|
- elkarbackupDEB
|
||||||
|
|
||||||
|
|
||||||
repositories:
|
repositories:
|
||||||
- name: sources.list
|
- name: sources.list
|
||||||
@@ -1278,6 +1295,13 @@ packages:
|
|||||||
variants:
|
variants:
|
||||||
- x2go
|
- x2go
|
||||||
|
|
||||||
|
#Elkarbackup Repo
|
||||||
|
- name: elkarbackup.list
|
||||||
|
url: |-
|
||||||
|
deb [signed-by=/usr/share/keyrings/elkarbackup-archive-keyring.gpg arch=amd64] http://elkarbackup.org/apt/debian bullseye main
|
||||||
|
variants:
|
||||||
|
- elkarbackupDEB
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
- trigger: post-unpack
|
- trigger: post-unpack
|
||||||
action: |-
|
action: |-
|
||||||
@@ -1329,6 +1353,7 @@ actions:
|
|||||||
- smb
|
- smb
|
||||||
- x2go
|
- x2go
|
||||||
- aptcacherng
|
- aptcacherng
|
||||||
|
- elkarbackupDEB
|
||||||
|
|
||||||
- trigger: post-packages
|
- trigger: post-packages
|
||||||
action: |-
|
action: |-
|
||||||
@@ -1431,5 +1456,13 @@ actions:
|
|||||||
variants:
|
variants:
|
||||||
- x2go
|
- x2go
|
||||||
|
|
||||||
|
#ElkarBackup Repo key
|
||||||
|
- trigger: post-unpack
|
||||||
|
action: |-
|
||||||
|
#!/bin/sh
|
||||||
|
curl --retry 7 --retry-delay 5 -L -s http://elkarbackup.org/apt/archive.gpg.key | gpg --dearmor > /usr/share/keyrings/elkarbackup-archive-keyring.gpg
|
||||||
|
variants:
|
||||||
|
- elkarbackupDEB
|
||||||
|
|
||||||
mappings:
|
mappings:
|
||||||
architecture_map: debian
|
architecture_map: debian
|
||||||
1
CT-Files/elkarbackupALP/Configs/crontab
Normal file
1
CT-Files/elkarbackupALP/Configs/crontab
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* * * * * APP_ENV=prod APP_DEBUG=0 php /opt/elkarbackup/srv/bin/console elkarbackup:tick
|
||||||
27
CT-Files/elkarbackupALP/Configs/elkarbackupconf.yaml
Normal file
27
CT-Files/elkarbackupALP/Configs/elkarbackupconf.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
parameters:
|
||||||
|
database_driver: pdo_mysql
|
||||||
|
database_host: DBServer
|
||||||
|
database_port: null
|
||||||
|
database_name: DBName
|
||||||
|
database_user: DBUser
|
||||||
|
database_password: DBPass
|
||||||
|
mailer_transport: smtp
|
||||||
|
mailer_host: localhost
|
||||||
|
mailer_user: null
|
||||||
|
mailer_password: null
|
||||||
|
locale: en
|
||||||
|
secret: ElkarToken
|
||||||
|
database_path: null
|
||||||
|
upload_dir: /opt/elkarbackup/uploads
|
||||||
|
public_key: /opt/elkarbackup/home/.ssh/id_rsa.pub
|
||||||
|
max_log_age: P1Y
|
||||||
|
tmp_dir: /tmp
|
||||||
|
rsnapshot: /usr/bin/rsnapshot
|
||||||
|
warning_load_level: 0.8
|
||||||
|
pagination_lines_per_page: 20
|
||||||
|
url_prefix: null
|
||||||
|
disable_background: true
|
||||||
|
mailer_from: null
|
||||||
|
home: /opt/elkarbackup/home
|
||||||
|
max_parallel_jobs: 1
|
||||||
|
post_on_pre_fail: true
|
||||||
56
CT-Files/elkarbackupALP/Configs/nginx.conf
Normal file
56
CT-Files/elkarbackupALP/Configs/nginx.conf
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
error_log /var/log/nginx/error.log notice;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
server_tokens off;
|
||||||
|
client_body_buffer_size 10K;
|
||||||
|
client_header_buffer_size 1k;
|
||||||
|
client_max_body_size 8m;
|
||||||
|
large_client_header_buffers 4 4k;
|
||||||
|
server_names_hash_bucket_size 64;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
access_log off;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
#Server config for RainLoop
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
root /opt/elkarbackup/srv/public;
|
||||||
|
index index.html index.php;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/index\.php(/|$) {
|
||||||
|
fastcgi_pass unix:/run/php-fpm7/php-fpm.sock;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param APP_ENV prod;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
15
CT-Files/elkarbackupALP/Configs/php.conf
Normal file
15
CT-Files/elkarbackupALP/Configs/php.conf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[elkarbackup]
|
||||||
|
user = nginx
|
||||||
|
group = nginx
|
||||||
|
listen = /run/php-fpm7/php-fpm.sock
|
||||||
|
listen.owner = nginx
|
||||||
|
listen.group = nginx
|
||||||
|
php_admin_value[error_log] = /var/log/php-fpm.error.log
|
||||||
|
php_admin_value [date.timezone] = Europe/Amsterdam
|
||||||
|
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 5
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
chdir = /
|
||||||
2
CT-Files/elkarbackupALP/Configs/phpTimezone.ini
Normal file
2
CT-Files/elkarbackupALP/Configs/phpTimezone.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[Date]
|
||||||
|
date.timezone = Europe/Amsterdam
|
||||||
3
CT-Files/elkarbackupALP/Configs/sudofile
Normal file
3
CT-Files/elkarbackupALP/Configs/sudofile
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Cmnd_Alias ELKARBACKUP_SCRIPTS=/opt/elkarbackup/uploads/*
|
||||||
|
Defaults!ELKARBACKUP_SCRIPTS env_keep += "ELKARBACKUP_LEVEL ELKARBACKUP_EVENT ELKARBACKUP_URL ELKARBACKUP_ID ELKARBACKUP_PATH ELKARBACKUP_STATUS ELKARBACKUP_CLIENT_NAME ELKARBACKUP_JOB_NAME ELKARBACKUP_OWNER_EMAIL ELKARBACKUP_RECIPIENT_LIST ELKARBACKUP_CLIENT_TOTAL_SIZE ELKARBACKUP_JOB_TOTAL_SIZE ELKARBACKUP_JOB_RUN_SIZE ELKARBACKUP_CLIENT_STARTTIME ELKARBACKUP_CLIENT_ENDTIME ELKARBACKUP_JOB_STARTTIME ELKARBACKUP_JOB_ENDTIME ELKARBACKUP_SSH_ARGS"
|
||||||
|
nginx ALL = NOPASSWD: ELKARBACKUP_SCRIPTS
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
#Shoud be uploaded in Elkarbackup under scrips and set ran as Job Pre and Post
|
||||||
|
ssh -oStrictHostKeyChecking=no $(echo $ELKARBACKUP_URL | sed 's|:.*||') bash /opt/Elkar-MysqlBackup.sh "$ELKARBACKUP_EVENT"
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
##Should be as "/opt/Elkar-MysqlBackup.sh" on the MySQL server
|
||||||
|
## MysqlUser needs following Global privilleges: SELECT, PROCESS, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW
|
||||||
|
USER="<MysqlUserName>"
|
||||||
|
PASSWORD="<MysqlUserPassword>"
|
||||||
|
OUTPUT="/tmp/mysqlBCK"
|
||||||
|
|
||||||
|
PRE () {
|
||||||
|
mkdir $OUTPUT
|
||||||
|
ExcludeDatabases="Database|information_schema|performance_schema|mysql|sys"
|
||||||
|
databases=$(mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | egrep -v $ExcludeDatabases)
|
||||||
|
|
||||||
|
for db in $databases; do
|
||||||
|
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
|
||||||
|
echo "Dumping database: $db"
|
||||||
|
mysqldump -u $USER -p$PASSWORD --databases $db > $OUTPUT/$db.sql
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
POST () {
|
||||||
|
rm -rf /tmp/mysqlBCK
|
||||||
|
}
|
||||||
|
|
||||||
|
$1
|
||||||
25
CT-Files/elkarbackupALP/Extras/MySQLBackup/ReadMe.md
Normal file
25
CT-Files/elkarbackupALP/Extras/MySQLBackup/ReadMe.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# MySQL backup tool for Elkarbackup
|
||||||
|
|
||||||
|
## Explanation
|
||||||
|
* Elkarbackup server runs `MySQLBackup-RemoteTrigger.sh` before starting the backup to login to the target (MySQL) server to run `MySQLBackup-Tool.sh` with the PRE argument.
|
||||||
|
This will ask remote mysql to dump all databases to a SQL file to the local temporary backup location (default: /tmp/mysqlBCK)
|
||||||
|
* Elkarbackup will store the temporary backup location
|
||||||
|
* Elkarbackup server runs `MySQLBackup-RemoteTrigger.sh` after running the backup to login to the target (MySQL) server to run `MySQLBackup-Tool.sh` with the POST argument.
|
||||||
|
This will ask the remote to clean the temporary backup location
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### Steps on MySQL Server
|
||||||
|
* Make sure SSH server is running
|
||||||
|
1. Add the SSH public key from root@elkarbackupServer and elkarbackupAPP(Downloaded from cogwheel/settings icon > Manage parameters)
|
||||||
|
2. Create a Mysql user with the following Global privilleges: `SELECT, PROCESS, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW`
|
||||||
|
be carefull with special charactes in the password
|
||||||
|
3. Save `MySQLBackup-Tool.sh` to `/opt/Elkar-MysqlBackup.sh`
|
||||||
|
4. Update the variables in `/opt/Elkar-MysqlBackup.sh` to the newly created user
|
||||||
|
|
||||||
|
## Steps Elkarbackup WebUI
|
||||||
|
1. Under `script` tab add the `MySQLBackup-RemoteTrigger.sh` with `Run as` option Before and After Job
|
||||||
|
2. Under `Jobs` tab add the MySQL server as Client
|
||||||
|
3. Under `Jobs` tab> + on the mysql client to add job
|
||||||
|
4. Set Path to the temporary backup location (default: /tmp/mysqlBCK)
|
||||||
|
Pre and Post sctipt to the just created `script`
|
||||||
20
CT-Files/elkarbackupALP/Scripts/FirstRun.sh
Normal file
20
CT-Files/elkarbackupALP/Scripts/FirstRun.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
ThisScriptConfigured=no
|
||||||
|
##DB
|
||||||
|
MysqlIP=127.0.0.1
|
||||||
|
MysqlUsername=User
|
||||||
|
MysqlDatabase=DB
|
||||||
|
MysqlPassword=MysqlPassword
|
||||||
|
|
||||||
|
#Check if script is configured
|
||||||
|
if [ $ThisScriptConfigured = no ]; then
|
||||||
|
echo "Script is not configured"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e 's/DBServer/'$MysqlIP'/' -e 's/DBName/'$MysqlDatabase'/' -e 's/DBUser/'$MysqlUsername'/' -e 's/DBPass/'$MysqlPassword'/' -e 's/ElkarToken/'$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' 2>/dev/null </dev/urandom | head -c 20 ; echo )'/' /opt/elkarbackup/srv/config/parameters.yaml
|
||||||
|
ElkarConsole="sudo -u nginx APP_ENV=prod APP_DEBUG=0 php /opt/elkarbackup/srv/bin/console"
|
||||||
|
$ElkarConsole cache:clear
|
||||||
|
$ElkarConsole doctrine:schema:create
|
||||||
|
$ElkarConsole elkarbackup:generate_keypair
|
||||||
|
APP_ENV=prod APP_DEBUG=0 php /opt/elkarbackup/srv/bin/console elkarbackup:create_admin
|
||||||
44
CT-Files/elkarbackupALP/Scripts/Init.sh
Normal file
44
CT-Files/elkarbackupALP/Scripts/Init.sh
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
#Install Composer
|
||||||
|
EXPECTED_CHECKSUM="$(curl -L https://composer.github.io/installer.sig)"
|
||||||
|
curl -L -o /tmp/composer-setup.php https://getcomposer.org/installer
|
||||||
|
ACTUAL_CHECKSUM="$(sha384sum /tmp/composer-setup.php| awk '{ print $1 }')"
|
||||||
|
|
||||||
|
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
|
||||||
|
then
|
||||||
|
>&2 echo 'ERROR: Invalid installer checksum'
|
||||||
|
rm composer-setup.php
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /opt/composer
|
||||||
|
php /tmp/composer-setup.php --quiet --install-dir=/opt/composer
|
||||||
|
rm /tmp/composer-setup.php
|
||||||
|
|
||||||
|
#Install elkarbackup
|
||||||
|
mkdir -p /opt/elkarbackup/srv /opt/elkarbackup/home /opt/elkarbackup/uploads
|
||||||
|
tar -C /opt/elkarbackup/srv -xzf /opt/Setup/elkb.tar.gz --strip 1
|
||||||
|
rm -f /opt/Setup/elkb.tar.gz
|
||||||
|
chown -R nginx:nginx /opt/elkarbackup
|
||||||
|
sudo -u nginx php /opt/composer/composer.phar install -n --working-dir=/opt/elkarbackup/srv --no-dev
|
||||||
|
mv /opt/Setup/Configs/elkarbackupconf.yaml /opt/elkarbackup/srv/config/parameters.yaml
|
||||||
|
sed -i 's#/var/cache/nginx#/opt/elkarbackup/home#g' /etc/passwd
|
||||||
|
|
||||||
|
#Configure Nginx
|
||||||
|
rm -rf /etc/nginx/conf.d
|
||||||
|
mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
#Configure Php
|
||||||
|
rm -rf /etc/php8/php-fpm.d/*
|
||||||
|
mv /opt/Setup/Configs/php.conf /etc/php7/php-fpm.d/elkarbackup.conf
|
||||||
|
mv /opt/Setup/Configs/phpTimezone.ini /etc/php7/conf.d/04_date_timezone.ini
|
||||||
|
|
||||||
|
#Configure Crontab
|
||||||
|
mv /opt/Setup/Configs/crontab /etc/crontabs/nginx
|
||||||
|
|
||||||
|
#Configure Sudo
|
||||||
|
mv /opt/Setup/Configs/sudofile /etc/sudoers.d/elkarbackup
|
||||||
|
|
||||||
|
#Enable services on boot
|
||||||
|
rc-update add nginx
|
||||||
|
rc-update add php-fpm7
|
||||||
27
CT-Files/elkarbackupDEB/Configs/elkarbackupconf.yaml
Normal file
27
CT-Files/elkarbackupDEB/Configs/elkarbackupconf.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
parameters:
|
||||||
|
database_driver: pdo_mysql
|
||||||
|
database_host: DBServer
|
||||||
|
database_port: null
|
||||||
|
database_name: DBName
|
||||||
|
database_user: DBUser
|
||||||
|
database_password: DBPass
|
||||||
|
mailer_transport: smtp
|
||||||
|
mailer_host: localhost
|
||||||
|
mailer_user: null
|
||||||
|
mailer_password: null
|
||||||
|
locale: en
|
||||||
|
secret: ElkarToken
|
||||||
|
database_path: null
|
||||||
|
upload_dir: /var/spool/elkarbackup/uploads
|
||||||
|
public_key: /var/lib/elkarbackup/.ssh/id_rsa.pub
|
||||||
|
max_log_age: P1Y
|
||||||
|
tmp_dir: /tmp
|
||||||
|
rsnapshot: /usr/bin/rsnapshot
|
||||||
|
warning_load_level: 0.8
|
||||||
|
pagination_lines_per_page: 20
|
||||||
|
url_prefix: null
|
||||||
|
disable_background: true
|
||||||
|
mailer_from: null
|
||||||
|
home: /var/lib/elkarbackup
|
||||||
|
max_parallel_jobs: 1
|
||||||
|
post_on_pre_fail: true
|
||||||
16
CT-Files/elkarbackupDEB/Scripts/FirstRun.sh
Normal file
16
CT-Files/elkarbackupDEB/Scripts/FirstRun.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
ThisScriptConfigured=no
|
||||||
|
##DB
|
||||||
|
MysqlIP=127.0.0.1
|
||||||
|
MysqlUsername=elkarbackup
|
||||||
|
MysqlDatabase=elkarbackup
|
||||||
|
MysqlPassword=Password
|
||||||
|
|
||||||
|
#Check if script is configured
|
||||||
|
if [ $ThisScriptConfigured = no ]; then
|
||||||
|
echo "Script is not configured"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e 's/DBServer/'$MysqlIP'/' -e 's/DBName/'$MysqlDatabase'/' -e 's/DBUser/'$MysqlUsername'/' -e 's/DBPass/'$MysqlPassword'/' -e 's/ElkarToken/'$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' 2>/dev/null </dev/urandom | head -c 20 ; echo )'/' /etc/elkarbackup/parameters.yaml
|
||||||
|
dpkg --configure -a
|
||||||
7
CT-Files/elkarbackupDEB/Scripts/Init.sh
Normal file
7
CT-Files/elkarbackupDEB/Scripts/Init.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#Install elkarbackup
|
||||||
|
apt install /opt/Setup/rsnapshot.deb elkarbackup -y
|
||||||
|
echo "Apt intall being unable to configure elkarbackup is expected"
|
||||||
|
rm /opt/Setup/rsnapshot.deb
|
||||||
|
mv /opt/Setup/Configs/elkarbackupconf.yaml /etc/elkarbackup/parameters.yaml
|
||||||
|
apt clean all
|
||||||
@@ -6,6 +6,7 @@ listen.owner = nginx
|
|||||||
listen.group = nginx
|
listen.group = nginx
|
||||||
php_admin_value[disable_functions] = exec,passthru,system
|
php_admin_value[disable_functions] = exec,passthru,system
|
||||||
php_admin_value[error_log] = /var/log/php-fpm.error.log
|
php_admin_value[error_log] = /var/log/php-fpm.error.log
|
||||||
|
php_admin_value [date.timezone] = Europe/Amsterdam
|
||||||
; OPCACHE SETTINGS
|
; OPCACHE SETTINGS
|
||||||
php_admin_value[opcache.memory_consumption] = 256
|
php_admin_value[opcache.memory_consumption] = 256
|
||||||
php_admin_value[opcache.enable] = 1
|
php_admin_value[opcache.enable] = 1
|
||||||
|
|||||||
2
CT-Files/nextcloud/Configs/phpTimezone.ini
Normal file
2
CT-Files/nextcloud/Configs/phpTimezone.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[Date]
|
||||||
|
date.timezone = Europe/Amsterdam
|
||||||
@@ -6,6 +6,7 @@ mv /opt/Setup/Configs/nginx.conf /etc/nginx/nginx.conf
|
|||||||
#Configure Php-Fpm
|
#Configure Php-Fpm
|
||||||
rm -rf /etc/php8/php-fpm.d/*
|
rm -rf /etc/php8/php-fpm.d/*
|
||||||
mv /opt/Setup/Configs/php.conf /etc/php8/php-fpm.d/nextcloud.conf
|
mv /opt/Setup/Configs/php.conf /etc/php8/php-fpm.d/nextcloud.conf
|
||||||
|
mv /opt/Setup/Configs/phpTimezone.ini /etc/php8/conf.d/04_date_timezone.ini
|
||||||
|
|
||||||
#Install Nextcloud
|
#Install Nextcloud
|
||||||
mkdir /opt/nextcloud /var/nextcloud
|
mkdir /opt/nextcloud /var/nextcloud
|
||||||
|
|||||||
22
Readme.md
22
Readme.md
@@ -18,6 +18,7 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new
|
|||||||
|------|:------:|:-----------:|
|
|------|:------:|:-----------:|
|
||||||
| minimal | All | Minimal installed packages |
|
| minimal | All | Minimal installed packages |
|
||||||
| default | All | ssh-server and nano packages |
|
| default | All | ssh-server and nano packages |
|
||||||
|
| elkarbackup(ALP/DEB) | ALL | ElkarBackup rsyncsnapshot server |
|
||||||
| jenkins | Debian | Jenkins server |
|
| jenkins | Debian | Jenkins server |
|
||||||
| jenkinsBuilder | Debian | Basic node for Jenkins |
|
| jenkinsBuilder | Debian | Basic node for Jenkins |
|
||||||
| imgbuilder | Debian | LXC template builder node for Jenkins |
|
| imgbuilder | Debian | LXC template builder node for Jenkins |
|
||||||
@@ -73,6 +74,7 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new
|
|||||||
|
|
||||||
|
|
||||||
# Container Setup
|
# Container Setup
|
||||||
|
|
||||||
## imgbuilder
|
## imgbuilder
|
||||||
**This container should be set up as privileged**
|
**This container should be set up as privileged**
|
||||||
1. Enable features: Fuse, Nesting and 'Create Device Nodes'
|
1. Enable features: Fuse, Nesting and 'Create Device Nodes'
|
||||||
@@ -82,6 +84,7 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new
|
|||||||
5. Create folders on mountpoint using `mkdir /LXCBuild/template/cache`
|
5. Create folders on mountpoint using `mkdir /LXCBuild/template/cache`
|
||||||
6. Set permissions on the folder `chmod o+w -R /LXCBuild`
|
6. Set permissions on the folder `chmod o+w -R /LXCBuild`
|
||||||
7. Write down the ip of this server (for use in the jenkins container)
|
7. Write down the ip of this server (for use in the jenkins container)
|
||||||
|
|
||||||
## jenkins
|
## jenkins
|
||||||
1. In the container configure the setup script `nano /opt/Setup/Scripts/FirstRun.sh`
|
1. In the container configure the setup script `nano /opt/Setup/Scripts/FirstRun.sh`
|
||||||
2. In the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
2. In the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
@@ -93,31 +96,42 @@ Under Credentials click 'Add', enter 'jenkins' as username, and set the password
|
|||||||
Then select the created credential and click save
|
Then select the created credential and click save
|
||||||
7. Click 'Relaunch agent'
|
7. Click 'Relaunch agent'
|
||||||
8. Now you can build container images
|
8. Now you can build container images
|
||||||
|
|
||||||
## mysql
|
## mysql
|
||||||
* To configure the MySQL root password in the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
* To configure the MySQL root password in the container run the setup script `bash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
|
||||||
## gitea
|
## gitea
|
||||||
1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh`
|
1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh`
|
||||||
2. Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
2. Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
|
||||||
## nginx
|
## nginx
|
||||||
* Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
* Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
|
||||||
## pihole
|
## pihole
|
||||||
* Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
* Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
|
||||||
## colabora
|
## colabora
|
||||||
* Update the configuration in /etc/loolwsd/loolwsd.xml and reload the service `systemctl restart loolwsd`
|
* Update the configuration in /etc/loolwsd/loolwsd.xml and reload the service `systemctl restart loolwsd`
|
||||||
|
|
||||||
## jellyfin
|
## jellyfin
|
||||||
* To set-up the system follow the initial set-up wizard on http://`<ip>`:8096
|
* To set-up the system follow the initial set-up wizard on http://`<ip>`:8096
|
||||||
|
|
||||||
## domoticz
|
## domoticz
|
||||||
* Available on http://`<ip>`:8080
|
* Available on http://`<ip>`:8080
|
||||||
|
|
||||||
## transfersh
|
## transfersh
|
||||||
* Available on http://`<ip>`:8080
|
* Available on http://`<ip>`:8080
|
||||||
|
|
||||||
## omadaV3
|
## omadaV3
|
||||||
* To set-up the system follow the initial set-up wizard on http://`<ip>`:8088
|
* To set-up the system follow the initial set-up wizard on http://`<ip>`:8088
|
||||||
|
|
||||||
## docker
|
## docker
|
||||||
* Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
* Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
This container can be set up in two ways
|
This container can be set up in two ways
|
||||||
1. As controller with portainer
|
1. As controller with portainer
|
||||||
2. As remote with docker tcp on port 2375
|
2. As remote with docker tcp on port 2375
|
||||||
3. BONUS if FistRun script is skipped the CT has clean docker
|
3. BONUS if FistRun script is skipped the CT has clean docker
|
||||||
|
|
||||||
## iscsi
|
## iscsi
|
||||||
### In Proxmox
|
### In Proxmox
|
||||||
* Run following commands
|
* Run following commands
|
||||||
@@ -206,6 +220,13 @@ lxc.mount.entry: /dev/ttyACM-Zwave dev/ttyACM-Zwave none bind,optional,create=fi
|
|||||||
* Info html page available on http://`<ip>`:80
|
* Info html page available on http://`<ip>`:80
|
||||||
* Add user/storage space by running `ash /opt/AddMailBox.sh`
|
* Add user/storage space by running `ash /opt/AddMailBox.sh`
|
||||||
|
|
||||||
|
## elkarbackup
|
||||||
|
1. Edit the parameters in the FistRun script in the container `vi /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
2. Run the FistRun script in the container `ash /opt/Setup/Scripts/FirstRun.sh`
|
||||||
|
3. Available on http://`<ip>` (Default username/password: root/root
|
||||||
|
4. Click cogwheel/settings icon > Manage backup locations >New (make sure to create this directory and set ngix as the owner)
|
||||||
|
5. Add a retention policy under the `Policies` tab
|
||||||
|
|
||||||
# Further CT documentation
|
# Further CT documentation
|
||||||
|
|
||||||
## iscsi
|
## iscsi
|
||||||
@@ -219,7 +240,6 @@ create <client-iqn>
|
|||||||
exit
|
exit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Add Drive
|
### Add Drive
|
||||||
#### In Proxmox
|
#### In Proxmox
|
||||||
* Create LVM Volume (Available @ /dev/`<poolName>`/`<VolumeName>`)
|
* Create LVM Volume (Available @ /dev/`<poolName>`/`<VolumeName>`)
|
||||||
|
|||||||
@@ -33,3 +33,9 @@ echo "$OfflineIMAPVer" > CT-Files/mailbackup/OfflineIMAP3-installed
|
|||||||
GetResource mailbackup rlcl.zip http://www.rainloop.net/repository/webmail/rainloop-community-latest.zip
|
GetResource mailbackup rlcl.zip http://www.rainloop.net/repository/webmail/rainloop-community-latest.zip
|
||||||
GetResource mailbackup olim3.tar.gz https://github.com/OfflineIMAP/offlineimap3/archive/refs/tags/$OfflineIMAPVer.tar.gz -o /tmp/
|
GetResource mailbackup olim3.tar.gz https://github.com/OfflineIMAP/offlineimap3/archive/refs/tags/$OfflineIMAPVer.tar.gz -o /tmp/
|
||||||
git clone https://git.bprieshof.nl/Tools/MailBackup-sys.git CT-Files/mailbackup/MailBackup-sys
|
git clone https://git.bprieshof.nl/Tools/MailBackup-sys.git CT-Files/mailbackup/MailBackup-sys
|
||||||
|
|
||||||
|
GetResource elkarbackupDEB rsnapshot.deb http://ftp.debian.org/debian/pool/main/r/rsnapshot/rsnapshot_1.4.2-1_all.deb
|
||||||
|
|
||||||
|
elkarbackupVER="$(curl -s https://api.github.com/repos/elkarbackup/elkarbackup/releases/latest | grep 'tag_name.*' | cut -d : -f 2,3 | tr -d \" |tr -d , |tr -d " ")"
|
||||||
|
echo "$elkarbackupVER" > CT-Files/elkarbackupALP/Elkarbackup-installed
|
||||||
|
GetResource elkarbackupALP elkb.tar.gz https://github.com/elkarbackup/elkarbackup/archive/refs/tags/$elkarbackupVER.tar.gz -o /tmp/
|
||||||
Reference in New Issue
Block a user