Skip to content
Snippets Groups Projects
Commit 8ade8283 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update docs

parent 144aaa67
Branches
No related tags found
No related merge requests found
# Backup target host
Setup a backup target host.
* define a working dir, eg. `/opt/imlbackup/server` - only some smaller logfiles will be generated there
* get sources as root
* extract the files in the repo <https://git-repo.iml.unibe.ch/iml-open-source/iml-backup-server> OR
* use git clone: \
`cd /var` \
`git clone https://git-repo.iml.unibe.ch/iml-open-source/iml-backup-server.git imlbackup`
* add a non privileged user with a login shell; e.g "imlbackup". Set the home directory to `/opt/imlbackup/server`
* Set owner on working dir: `chown -R imlbackup /opt/imlbackup/server`
* Set permissions: `chmod 0700 imlbackup /opt/imlbackup/server`
* create a ssh keypair for the backup user using `ssh-keygen`
* It needs diskspace capacity for all your systems you want to backup or you mount a storage
* define an backup endpoint, eg. `/netshare/backup/` and set the owner to the backup user:
* `mkdir /netshare/backup/`
* `chown imlbackup: /netshare/backup/`
* `chmod 0700 /netshare/backup/`
# Prepare backup client
TODO
* Put the ssh private key to all your devices you want to backup into `[installdir]/keys/imlbackup@targethost`
* Setup SSH connection for restic
* Host: backup-host
* User: imlbackup
* key: [installdir]/keys/imlbackup@targethost
* target dir: /netshare/backup/
* enable register functionality: storage_helper.sh
Test: as root
`ssh -i [installdir]/keys/imlbackup@targethost imlbackup@backup-host`
# Config
copy the .dist file to `inc_config.sh`.
```shell
# ======================================================================
#
# IML BACKUP STORAGE HELPER :: CONFIG
#
# ======================================================================
# max count of simultanous connections; 0 is unlimited
typeset -i iMaxConnections=10
typeset -i iConnections
sSelfdir="$( dirname $0 )"
# directory with backup data
# sublevel 1 is a name of backup tool
# sublevel 2 is a fqdn of a backed up server
# i.e. /netshare/restic-backup/server.example.com
sBackupBasedir="/netshare"
# where to store current connections
# sConncectionDir="${sBackupBasedir}/_active"
sConncectionDir="${sSelfdir}/_active_connections"
# where to store last backup status
sStatusDir="${sSelfdir}/_last_backup"
# log
sLogdir="${sSelfdir}/log"
sLogfile="$sLogdir/connections.log"
# ----------------------------------------------------------------------
```
You MUST verify:
* `BackupBasedir="/netshare"` - the target dir for backups
You optionally CAN change
* `typeset -i iMaxConnections=10` - the count of allowed parrallel backup connections (backup clients will wait until they get a free slot)
* `sLogdir="${sSelfdir}/log"` - to write sone small logs somewhere else
\ No newline at end of file
# storage_helper.sh
The script should be alwys started with the non privileged user (imlbackup).
Without a parameter you get a help:
```txt
imlbackup@backup-host:~$ ./storage_helper.sh
---------- :: STORAGE :: storage-connector :: ----------
SYNTAX:
storage_helper.sh [function]
backupstatus
show all servers and their backup times
register [hostname]
add a slot for a backup client
unregister [hostname] [statuscode]
remove slot for a backup client.
The statuscode is an integer of the return code.
setactive
Reactivate an inctave backup repo.
setinactive
Mark a backup repo as inactive.
This prevents errors of missing backup data
if a host is obsolete and was shut down.
status
show current reserved slots
usage [full|[filter to hostname]] - DEPRECATED
show used diskspace
you can set a string to show additionally details if these hosts
if you add "full" then details of all hosts will be shown
```
## What backup clients do
Before a backup client send its data it wants to register.
`./storage_helper.sh register [hostname]`
The exitcode is 0 if it got a free slot. And non-zero if all slots are in use (see iMaxConnections in config). The backup client will wait a random time until it gets a free slot to write its data.
If the backup is finished it sends
`./storage_helper.sh unregister [hostname]`
## Admin tasks
### See current activity
```txt
$ ./storage_helper.sh status
---------- :: STORAGE :: storage-connector :: ----------
STATUS: 0 existing connection(s). Allowed maximum is 10.
```
### Backup status
You get a table of all servers that sent backup data.
There are listed
* last backup with start time, end time, duration, existcode
* age of the last backup (to see if a system does not send data anymore)
* size of backup data
* Each line per server is colored depending on backup status or time of last sent data
```txt
$ ./storage_helper.sh backupstatus
---------- :: STORAGE :: storage-connector :: ----------
STATUS: 0 existing connection(s). Allowed maximum is 10.
This table shows the time and duration [s] of the last backup for each server.
server | start | end | duration | rc | age [h] | size
-----------------------------------------------------------------------------------------------------------------------------
. srv1.example.com | 2022-09-19 23:04:14 | 2022-09-19 23:17:52 | 818 | 0 | 12 | 951G /netshare/restic-backup/srv1.example.com
. srv2.example.com | 2022-09-19 23:03:06 | 2022-09-19 23:18:28 | 922 | 0 | 12 | 955G /netshare/restic-backup/srv2.example.com
...
Legend
. OK | ? not started | R running | D disabled | E error
total : 26 servers
errors: 0
rc=0
```
### deactivate a backup folder
If you delete a host but must keep its backup data then you can set it inactive. Then you don't get an error because of missing incoming data.
To disable a backup target:
```txt
$ ./storage_helper.sh setinactive
---------- :: STORAGE :: storage-connector :: ----------
--- list of backup repositories
/netshare/restic-backup/srv1.example.com (active)
/netshare/restic-backup/srv1.example.com (active)
...
Repo to deactivate >
```
Enter the full path here, eg. `/netshare/restic-backup/srv1.example.com` and Return.
Then comes an optional input for a hint - that is just for you and your team. Leave a message if the host is deprecated, the application was moved etc.
In the backup status the deactivated target is listed with D = Disabled and is gray.
BTW: the opposite way is possible to:
`./storage_helper.sh setactive`
# IML Backup server
Bash scripts of an SSH target for IML Backup clients (those use Restic).
Runs on Linux.
📄 Source: https://git-repo.iml.unibe.ch/iml-open-source/iml-backup-server/ \
📜 License: GNU GPL 3.0 \
📗 Docs: see docs folder or online https://os-docs.iml.unibe.ch/iml-backup-server/
Related projects:
* IML backup client: https://os-docs.iml.unibe.ch/iml-backup/
\ No newline at end of file
{
"title": "IML Backup server",
"author": "Axel Hahn",
"tagline": "SSH Target for IML Backup clients",
"ignore": {
"files": ["30_PHP-client/Plugins/Checks/_skeleton.md"],
"folders": ["99_Not_Ready"]
},
"html": {
"auto_toc": true,
"auto_landing": false,
"date_modified": false,
"jump_buttons": true,
"edit_on_github_": "iml-it/__PROJECT__/tree/master/docs",
"edit_on_": {
"name": "Gitlab",
"basepath": "https://git-repo.iml.unibe.ch/iml-open-source/iml-backup-server/tree/master/docs"
},
"links": {
"Git Repo": "https://git-repo.iml.unibe.ch/iml-open-source/iml-backup-server"
},
"theme": "daux-blue",
"search": true
}
}
\ No newline at end of file
/*
patch css elements of daux.io blue theme
version 2022-05-13
*/
/* ---------- vars ---------- */
:root{
/* background colors */
--bg:none;
--bg-body: #fff;
--bg-navlinkactive:#f4f4f4;
--bg-navlinkactive: linear-gradient(-90deg,rgba(0,0,0,0), rgba(40,60,80,0.05) 30%);
--bg-pre:#f8f8f8;
--bg-toc: #fff;
/* foreground colors */
--color: #234;
--navlinkactive:#f33;
--title: #aaa;
--link:#12a;
--toclink:rgba(40,60,80,0.8);
--h1: rgba(40,60,80,0.8);
--h1-bottom: 1px solid rgba(40,60,80,0.1);
--h2: #468;
--h3: #579;
}
/* ---------- tags ---------- */
a.Brand::before {
background: rgb(255,0,51);
color: #fff;
font-family: arial;
font-weight: bold;
padding: 0.5em 0.3em;
content: 'IML';
margin-right: 0.4em;
}
body, *{color: var(--color);}
body{background: var(--bg-body);}
a{color: var(--link);}
a:hover{opacity: 0.7;}
h1>a{ color:var(--title);}
_h1:nth-child(1){position: fixed; background: var(--bg); box-shadow: 0 0 1em #ccc; padding: 0 1em}
h1:nth-child(1)>a{ color:var(--navlinkactive); }
.s-content h1{color: var(--h1); font-size: 200%; font-weight:bold; margin-top: 2em; border-bottom: var(--h1-bottom);}
.s-content h2{color: var(--h2); font-size: 160%; }
.s-content h3{color: var(--h3); font-size: 140%; }
.s-content h4{margin: 0; font-size: 100%; text-align: center; background-color: rgba(0,0,0,0.05);padding: 0.3em;}
.s-content pre{
background: var(--bg-pre);
}
/* ---------- classes ---------- */
.required{color:#a42;}
.optional{color:#888;}
/* ----- top left */
.Brand,
.Columns__left {
background: var(--bg);
border-right: 0px solid #e7e7e9;
color: var(--color);
}
.Brand{font-size: 200%;
background_: linear-gradient(-10deg,#fff 50%, #ddd);
background: var(--bg);
}
.Columns__right__content {
background: var(--bg);
}
/* ----- Navi left */
.Nav a:hover{
background: none;
color: var(--navlinkactive) !important;
}
.Nav__item--active {
border-right_: 0.3em solid var(--navlinkactive);
}
.Nav__item--active > a{
background: var(--bg-navlinkactive);
color: var(--navlinkactive);
}
.Nav .Nav .Nav__item--active a {
color: var(--navlinkactive);
}
.Nav .Nav .Nav__item a {
opacity: 1;
}
.Nav__item--open > a {
background-color: var(--bg);
}
.Nav a[href*="__Welcome"]{
background: url("/icons/house.png") no-repeat 10px 4px ;
padding-left: 40px;
}
.Nav a[href*="__How_does_it_work"]{
background: url("/icons/light-bulb.png") no-repeat 10px 4px ;
padding-left: 40px;
}
/* ---------- classes ---------- */
/* FIX smaller fnt size in tables */
.s-content table {
font-size: 1em;
}
/* TOC */
@media(min-width:1700px){
.TableOfContentsContainer{
position: fixed;
right: 2em;
top: 1em;
}
}
.TableOfContentsContainer{
border-top-left-radius: 1em;
background-color: var(--bg-toc);
border-left: 2px solid rgba(0,0,0,0.05);
padding: 0em;
}
.TableOfContentsContainer__content {
border: none;
font-size: 0.5em;
}
ul.TableOfContents ul{
list-style-type: none;
padding-left: 1em;
}
.TableOfContentsContainer a{ color:var(--toclink);}
.TableOfContentsContainer__content > .TableOfContents > li + li {
border-top: none;
}
.TableOfContentsContainer__content > .TableOfContents > li {
border-bottom: 1px dashed #ddd;
}
/* pager - prev .. next */
.s-content{
margin-bottom: 6em;
}
.Pager{
border-top: 1px dashed #aaa; margin: 0; padding: 1em;
}
.Pager a{
color:var(--navlinkactive);
}
# IML Backup server
Bash scripts of an SSH target for IML Backup clients (those use Restic).
Runs on Linux.
📄 Source: https://git-repo.iml.unibe.ch/iml-open-source/iml-backup-server/ \
📜 License: GNU GPL 3.0 \
📗 Docs: see docs folder or online https://os-docs.iml.unibe.ch/iml-backup-server/
Related projects:
* IML backup client: https://os-docs.iml.unibe.ch/iml-backup/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment