Compare commits

...

56 commits

Author SHA1 Message Date
Micke Nordin a836417db2 Fix rclone cert issue 2024-06-19 09:09:59 +02:00
Micke Nordin a76397aafd Use correct variable 2024-06-19 08:59:05 +02:00
Micke Nordin ea51f0b56b Trigger extra backup jobs if they exist 2024-06-12 10:55:11 +02:00
Micke Nordin 6c8a4f430b See if we can get the jobs out 2024-06-12 09:47:05 +02:00
Micke Nordin 097fce5f87 Merge branch 'main' into testing 2024-06-12 09:40:36 +02:00
Magnus Andersson bd1519430f
Merge makebucket changes from 'main' into testing 2024-06-11 14:16:48 +02:00
Micke Nordin 45321052de Merge branch 'main' into testing 2024-06-05 11:17:32 +02:00
Micke Nordin 35362991d0 Merge branch 'main' into testing 2024-05-24 13:30:50 +02:00
Micke Nordin 3ad7d95161 Merge branch 'main' into testing 2024-05-21 19:46:36 +02:00
Micke Nordin 00a2f1f425 Merge branch 'main' into testing 2024-05-21 17:47:56 +02:00
Micke Nordin 5b7c702573 Merge branch 'main' into testing 2024-05-21 12:54:28 +02:00
Micke Nordin 5f74eaaab0 Merge branch 'main' into testing 2024-05-20 13:10:54 +02:00
Micke Nordin 4376aad6e2 Merge branch 'main' into testing 2024-05-20 11:47:10 +02:00
Micke Nordin 718bc0b496 Merge branch 'main' into testing 2024-05-20 10:44:56 +02:00
Magnus Andersson eba9546cdc
Merge branch 'main' into testing 2024-05-15 07:57:11 +02:00
Micke Nordin 2f548f2431 Merge branch 'mandersson-nmhost' into testing 2024-05-07 13:10:19 +02:00
Micke Nordin 72cf4e570c Merge branch 'main' into testing 2024-05-07 10:54:07 +02:00
Micke Nordin 02454ebd39 Merge branch 'main' into testing 2024-05-07 10:51:12 +02:00
Micke Nordin 5ba11977b0 Merge branch 'main' into testing 2024-04-29 16:39:41 +02:00
Micke Nordin 01fc5a9e86 Merge branch 'main' into testing 2024-04-29 16:35:35 +02:00
Micke Nordin 4a8a4d642c Fix syntax 2024-04-29 16:29:50 +02:00
Micke Nordin df4fe9985b Merge branch 'main' into testing 2024-04-29 16:25:47 +02:00
Micke Nordin 36f163414f Merge branch 'main' into testing 2024-04-22 12:48:45 +02:00
Micke Nordin 77ad3ac26d Merge branch 'main' into testing 2024-04-22 11:09:05 +02:00
Magnus Andersson 069eb7ce93
Merge branch 'main' into testing 2024-04-17 17:42:40 +02:00
Micke Nordin f626156c4c Add jupyter site 2024-03-18 15:17:57 +01:00
Magnus Andersson 314149c7f3
Fix proxysql container name. 2024-03-18 11:10:05 +01:00
Magnus Andersson 181f2e52fe
Hardcode nextcloud container name. 2024-03-18 10:33:00 +01:00
Magnus Andersson 49386124c3
Maria Backup: Add fixed container name to mitigate name statndard change docker-compose 2/3 2024-03-18 08:44:29 +01:00
Magnus Andersson 3fce5c6fab
Hardcode name of mariadb container to make name consistent between docker compose 2 and 3. 2024-03-08 11:13:37 +01:00
Micke Nordin 0837f82d87 Merge branch 'main' into testing 2024-03-04 10:58:19 +01:00
Micke Nordin 922de25fd8 Merge branch 'main' into testing 2024-03-01 10:13:32 +01:00
Micke Nordin 7f19e0de62 Fix typo 2024-02-27 16:35:39 +01:00
Micke Nordin 49243acaa9 Merge branch 'main' into testing 2024-02-27 16:31:45 +01:00
Micke Nordin f10864ff91 Merge branch 'main' into testing 2024-02-27 13:32:46 +01:00
Micke Nordin 668c1389d5
Merge branch 'main' into testing 2024-01-08 09:18:10 +01:00
Magnus Andersson 0d505d2482
Add focemfa as forcemfa group to template. 2023-12-17 23:36:11 +01:00
Magnus Andersson 8aa9c14d35
Multinode: Add support for twofactor_enforced(_excluded)_groups 2023-11-30 11:09:36 +01:00
Micke Nordin c425f90b0f Merge branch 'main' into testing 2023-11-22 12:13:09 +01:00
Micke Nordin 3b82d5b0e3 Merge branch 'main' into testing 2023-11-22 11:59:30 +01:00
Micke Nordin 31b1bcb92a Merge branch 'main' into testing 2023-11-22 11:53:34 +01:00
Micke Nordin a150d23f1a Merge branch 'main' into testing 2023-11-22 11:04:36 +01:00
Fredrik Kjellman 8cf9f0eafa Merge branch 'main' into testing 2023-11-10 12:40:23 +01:00
Micke Nordin c83e8b2982 Merge branch 'main' into testing 2023-11-07 14:01:27 +01:00
Micke Nordin 2f629c289c Merge branch 'main' into testing 2023-11-01 16:57:18 +01:00
Micke Nordin ec679013e3 Merge branch 'main' into testing 2023-11-01 16:36:09 +01:00
Micke Nordin 2ba33ad5d6 Merge branch 'main' into testing 2023-11-01 16:31:58 +01:00
Micke Nordin 689c625b90 Force installation of drive-utils 2023-11-01 15:26:10 +01:00
Micke Nordin 440bcec0d2 python3.9 -> python3 2023-11-01 15:21:27 +01:00
Fredrik Kjellman 3f1ea1b694 Merge branch 'main' into testing 2023-10-31 14:17:22 +01:00
Richard Freitag 3899dab9b3 Remove @ from mappingfile in test to comply with Nextcloud keys 2023-10-24 10:43:05 +01:00
Micke Nordin af873e7133 Remove test 2023-10-19 15:01:55 +02:00
Micke Nordin 65a6b1787d Allow smtp servers 2023-10-19 15:01:55 +02:00
Micke Nordin 4e496bcb13 Allow imap servers to connect 2023-10-19 15:01:55 +02:00
Micke Nordin a5f5ddb293 Allow smtp servers 2023-10-18 18:07:33 +02:00
Micke Nordin 333d712548 Allow imap servers to connect 2023-10-18 09:46:36 +02:00
2 changed files with 20 additions and 11 deletions

View file

@ -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

View file

@ -11,7 +11,7 @@ base_dir="${project}:${bucket}"
stat_dir="/opt/statistics"
customer_dir="${stat_dir}/${location}"
mkdir -p "${customer_dir}"
rclone mkdir "${base_dir}/${location}"
rclone mkdir --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${base_dir}/${location}"
echo "${userjson}" | jq . >"${customer_dir}/users.json"
status=${?}
if [[ ${status} -eq 0 ]]; then