Compare commits
61 commits
16496dfded
...
f21a489e46
Author | SHA1 | Date | |
---|---|---|---|
Micke Nordin | f21a489e46 | ||
Micke Nordin | b20c4c7397 | ||
Micke Nordin | a836417db2 | ||
Micke Nordin | a76397aafd | ||
Micke Nordin | ea51f0b56b | ||
Micke Nordin | 6c8a4f430b | ||
Micke Nordin | 097fce5f87 | ||
Micke Nordin | 5c46f5bc38 | ||
Magnus Andersson | bd1519430f | ||
Magnus Andersson | 5f47ce7fca | ||
Micke Nordin | 45321052de | ||
Micke Nordin | 717350780f | ||
Micke Nordin | 35362991d0 | ||
Micke Nordin | 3ad7d95161 | ||
Micke Nordin | 00a2f1f425 | ||
Micke Nordin | 5b7c702573 | ||
Micke Nordin | 5f74eaaab0 | ||
Micke Nordin | 4376aad6e2 | ||
Micke Nordin | 718bc0b496 | ||
Magnus Andersson | eba9546cdc | ||
Micke Nordin | 2f548f2431 | ||
Micke Nordin | 72cf4e570c | ||
Micke Nordin | 02454ebd39 | ||
Micke Nordin | 5ba11977b0 | ||
Micke Nordin | 01fc5a9e86 | ||
Micke Nordin | 4a8a4d642c | ||
Micke Nordin | df4fe9985b | ||
Micke Nordin | 36f163414f | ||
Micke Nordin | 77ad3ac26d | ||
Magnus Andersson | 069eb7ce93 | ||
Micke Nordin | f626156c4c | ||
Magnus Andersson | 314149c7f3 | ||
Magnus Andersson | 181f2e52fe | ||
Magnus Andersson | 49386124c3 | ||
Magnus Andersson | 3fce5c6fab | ||
Micke Nordin | 0837f82d87 | ||
Micke Nordin | 922de25fd8 | ||
Micke Nordin | 7f19e0de62 | ||
Micke Nordin | 49243acaa9 | ||
Micke Nordin | f10864ff91 | ||
Micke Nordin | 668c1389d5 | ||
Magnus Andersson | 0d505d2482 | ||
Magnus Andersson | 8aa9c14d35 | ||
c425f90b0f | |||
3b82d5b0e3 | |||
31b1bcb92a | |||
a150d23f1a | |||
Fredrik Kjellman | 8cf9f0eafa | ||
Micke Nordin | c83e8b2982 | ||
Micke Nordin | 2f629c289c | ||
Micke Nordin | ec679013e3 | ||
Micke Nordin | 2ba33ad5d6 | ||
Micke Nordin | 689c625b90 | ||
Micke Nordin | 440bcec0d2 | ||
Fredrik Kjellman | 3f1ea1b694 | ||
Richard Freitag | 3899dab9b3 | ||
Micke Nordin | af873e7133 | ||
Micke Nordin | 65a6b1787d | ||
Micke Nordin | 4e496bcb13 | ||
Micke Nordin | a5f5ddb293 | ||
Micke Nordin | 333d712548 |
|
@ -20,6 +20,7 @@ class sunetdrive::script (
|
|||
$local_path = '/tmp/rclone-current-linux-amd64.deb'
|
||||
$singlenodes = lookup('singlenodes')
|
||||
$multinodes = keys(lookup('multinode_mapping'))
|
||||
$extra_backup_jobs = pick($config['extra_backup_jobs'], {})
|
||||
|
||||
if $customer == 'mdu' {
|
||||
$eppn_suffix = 'mdh.se'
|
||||
|
|
|
@ -64,7 +64,7 @@ class sunetdrive::scriptreceiver()
|
|||
}
|
||||
file { '/root/.bashrc':
|
||||
ensure => file,
|
||||
content => template('sunetdrive/scriptreceiver/baschrc.erb.sh'),
|
||||
content => template('sunetdrive/scriptreceiver/bashrc.erb.sh'),
|
||||
mode => '0644',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
|
|
|
@ -47,6 +47,12 @@ class sunetdrive::sitemonitornaemon() {
|
|||
content => template('sunetdrive/monitor/sunetdrive_thruk_templates.conf.erb'),
|
||||
mode => '0644',
|
||||
}
|
||||
nagioscfg::service {'check_scriptherder':
|
||||
hostgroup_name => ['nrpe'],
|
||||
check_command => 'check_nrpe_1arg_to30!check_scriptherder',
|
||||
description => 'Scriptherder Status',
|
||||
contact_groups => ['naemon-admins'],
|
||||
}
|
||||
nagioscfg::service {'check_galera_cluster':
|
||||
hostgroup_name => ['galera_monitor'],
|
||||
check_command => 'check_nrpe_1arg!check_galera_cluster',
|
||||
|
|
|
@ -15,9 +15,16 @@ password=$(${dexec} env | grep MYSQL_ROOT_PASSWORD | awk -F '=' '{print $2}')
|
|||
|
||||
mysql="${dexec} mysql -p${password}"
|
||||
|
||||
users="$(${mysql} -NB -e 'select uid,displayname from nextcloud.oc_global_scale_users')"
|
||||
users="${users}
|
||||
$(${mysql} -NB -e 'select uid,displayname from nextcloud.oc_users')"
|
||||
if [[ "$(${mysql} -NB -e 'select exists(select * from information_schema.TABLES where TABLE_SCHEMA = "nextcloud" and TABLE_NAME = "oc_global_scale_users")')" == "1" ]]
|
||||
then
|
||||
users="$(${mysql} -NB -e 'select uid,displayname from nextcloud.oc_global_scale_users')"
|
||||
fi
|
||||
users="${users}"$'\n'"$(${mysql} -NB -e 'select uid,displayname from nextcloud.oc_users')"
|
||||
if [[ "$(${mysql} -NB -e 'select exists(select * from information_schema.TABLES where TABLE_SCHEMA = "nextcloud" and TABLE_NAME = "oc_user_saml_users")')" == "1" ]]
|
||||
then
|
||||
users="${users}"$'\n'"$(${mysql} -NB -e 'select uid,displayname from nextcloud.oc_user_saml_users')"
|
||||
fi
|
||||
users="$(echo "${users}" | sort | uniq)"
|
||||
|
||||
project="statistics"
|
||||
bucket="drive-server-coms"
|
||||
|
|
|
@ -6,6 +6,12 @@ sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk
|
|||
number_of_full_to_keep='<%= @full_backup_retention %>'
|
||||
fork_limit=30 #in GB, if bigger than this number, we fork the backup to it's own process
|
||||
customer="<%= @customer %>"
|
||||
declare -A extra_backup_jobs
|
||||
#<% if @extra_backup_jobs.any? %>
|
||||
#<% @extra_backup_jobs.each do |client, job| %>
|
||||
extra_backup_jobs["<%= client %>"]="<%= job %>"
|
||||
#<% end %>
|
||||
#<% end %>
|
||||
#<% if @location.start_with?('common') %>
|
||||
declare -a sixmonths=('mau')
|
||||
if [[ " ${sixmonths[*]} " =~ " ${customer} " ]]; then
|
||||
|
@ -13,20 +19,20 @@ if [[ " ${sixmonths[*]} " =~ " ${customer} " ]]; then
|
|||
fi
|
||||
declare -a projects
|
||||
#<% @singlenodes.each do |singlenode| %>
|
||||
projects+=("<%= @full_project_mapping[singlenode][@environment]['primary_project'] %> <%= @full_project_mapping[singlenode][@environment]['mirror_project'] %>")
|
||||
projects+=("<%= @full_project_mapping[singlenode][@environment]['primary_project'] %> <%= @full_project_mapping[singlenode][@environment]['mirror_project'] %> <%= singlenode %>")
|
||||
#<% @full_project_mapping[singlenode][@environment]['assigned'].each do |project| %>
|
||||
projects+=("<%= project['project'] %> <%= project['mirror_project'] %>")
|
||||
projects+=("<%= project['project'] %> <%= project['mirror_project'] %> <%= singlenode %>")
|
||||
#<% end %>
|
||||
#<% end %>
|
||||
#<% else %>
|
||||
declare -a projects=("<%= @primary_project %> <%= @mirror_project %>")
|
||||
declare -a projects=("<%= @primary_project %> <%= @mirror_project %> <%= customer %>")
|
||||
#<% @assigned_projects.each do |project| %>
|
||||
projects+=("<%= project['project'] %> <%= project['mirror_project'] %>")
|
||||
projects+=("<%= project['project'] %> <%= project['mirror_project'] %> <%= customer %>")
|
||||
#<% end %>
|
||||
#<% end %>
|
||||
|
||||
if [[ ${customer} == 'common' ]]; then
|
||||
projects+=("<%= @location %> <%= @location %>-mirror")
|
||||
projects+=("<%= @location %> <%= @location %>-mirror ${customer}")
|
||||
fi
|
||||
|
||||
|
||||
|
@ -34,15 +40,17 @@ function do_backup {
|
|||
local project="${1}"
|
||||
local mirror="${2}"
|
||||
local bucket="${3}"
|
||||
local customer="${4}"
|
||||
local mirrorbucket="${bucket}-mirror"
|
||||
local mountpoint="/opt/backupmounts/${bucket}"
|
||||
ps aux | grep duplicity | grep "[^a-zA-Z]${bucket}" > /dev/null
|
||||
local oktorun=$? # 1 == this bucket has no other bakup process in progress
|
||||
mkdir -p ${mountpoint}
|
||||
[ ${oktorun} -ne 0 ] && rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
||||
[[ ${oktorun} -ne 0 ]] && rclone mount ${project}:${bucket} ${mountpoint}/ --daemon --allow-other --dir-cache-time 24h
|
||||
rclone mkdir ${mirror}:${mirrorbucket}
|
||||
[ ${oktorun} -ne 0 ] && duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
||||
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket}
|
||||
[[ ${oktorun} -ne 0 ]] && duplicity --full-if-older-than 1M --asynchronous-upload --tempdir /mnt --archive-dir /mnt \
|
||||
--no-encryption ${mountpoint} rclone://${mirror}:/${mirrorbucket} && \
|
||||
[[ -n "${extra_backup_jobs[${customer}]}" ]] && [[ -f ${extra_backup_jobs[${customer} ]] && ${extra_backup_jobs[${customer}]}
|
||||
umount ${mountpoint}
|
||||
rmdir ${mountpoint}
|
||||
# Clean up
|
||||
|
@ -53,6 +61,7 @@ function do_backup {
|
|||
for entry in "${projects[@]}"; do
|
||||
project=$(echo ${entry} | awk '{print $1}')
|
||||
mirror=$(echo ${entry} | awk '{print $2}')
|
||||
customer=$(echo ${entry} | awk '{print $3}')
|
||||
for bucket in $(rclone lsd ${project}:/ | awk '{print $5}'); do
|
||||
maybesize=$(timeout 30s rclone size --json ${project}:${bucket})
|
||||
if [[ ${?} -eq 124 ]]; then
|
||||
|
@ -62,9 +71,9 @@ for entry in "${projects[@]}"; do
|
|||
fi
|
||||
# If bucket is above 50 GB we fork
|
||||
if [[ ${size} -gt $((${fork_limit} * 1000000000)) ]]; then
|
||||
do_backup ${project} ${mirror} ${bucket} &
|
||||
do_backup ${project} ${mirror} ${bucket} ${customer} &
|
||||
else
|
||||
do_backup ${project} ${mirror} ${bucket}
|
||||
do_backup ${project} ${mirror} ${bucket} ${customer}
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue