Compare commits

...

119 commits

Author SHA1 Message Date
da7be10d58
Fix typos 2025-03-26 14:09:24 +01:00
44e398a418
Remove fault file 2025-03-26 12:58:12 +01:00
d903f4f90d
Merge branch 'stable' 2025-03-26 12:57:46 +01:00
ad13e65250
Remove fault file 2025-03-26 12:56:27 +01:00
b63229092c
Add sql for roundcube 2025-03-26 12:56:23 +01:00
4b3c189481
Add sql for roundcube
Signed-off-by: Micke Nordin <kano@sunet.se>
2025-03-26 12:56:19 +01:00
8d57b773a0
Add sql for roundcube 2025-03-26 12:53:28 +01:00
3c815b9a38
Add sql for roundcube
Signed-off-by: Micke Nordin <kano@sunet.se>
2025-03-26 12:52:14 +01:00
55cc71871f
Create dirs 2025-03-25 19:08:44 +01:00
46f1330b5c
Disable bruteforce 2025-03-25 19:07:38 +01:00
d774349950
Disable bruteforce 2025-03-25 19:07:34 +01:00
249fe90c54
Create dirs 2025-03-25 19:01:44 +01:00
87b6ea8ddb
Disable bruteforce 2025-03-24 15:06:39 +01:00
dc39cb5d85
Disable bruteforce 2025-03-24 15:00:35 +01:00
beff4242ac
Merge branch 'main' into stable 2025-03-14 14:37:25 +01:00
cc31a2f038
Remove sysctl file that did not help 2025-03-13 16:16:32 +01:00
6a63031f84
use (new) node3_hosts group for check that only runs on node3 2025-03-13 13:01:45 +01:00
1c3eecdd85
final version of the newline problem 2025-03-13 12:45:45 +01:00
16c4f3650c
and yet another newline 2025-03-13 12:25:21 +01:00
57b90cced4
Merge branch 'main' into testing 2025-03-13 12:21:38 +01:00
4e67d6f1b8
needs newlines 2025-03-13 12:21:18 +01:00
9bb2afa68b
Merge branch 'main' into testing 2025-03-13 12:16:08 +01:00
26ea8e8e8d
first attempt at creating extra_host_groups 2025-03-13 12:15:34 +01:00
5c42f9d7d2
Merge branch 'main' into testing 2025-03-12 11:56:34 +01:00
f87fac3c3b
Remove quotes 2025-03-12 11:56:22 +01:00
582d88d2f1
Merge branch 'main' into testing 2025-03-12 11:53:31 +01:00
4f84f71070
Typo 2025-03-12 11:53:20 +01:00
4caed83e80
Merge branch 'main' into testing 2025-03-12 11:49:47 +01:00
38174166a0
Typo 2025-03-12 11:49:00 +01:00
3b42817c57
Merge branch 'main' into testing 2025-03-12 11:44:53 +01:00
5950751c73
Merge branch 'main' of ssh://platform.sunet.se:22022/Drive/sunetdrive 2025-03-12 11:44:20 +01:00
d010d27f20
Let's gooooo 2025-03-12 11:44:08 +01:00
d5c3486425
don't print empty line 2025-03-11 08:13:35 +01:00
1aea2f5674
apparently "You do not need to declare variables before using them" in python - cleanup 2025-03-11 08:13:33 +01:00
0b3a2d43cb
buckets needs to be reset each loop 2025-03-11 08:13:30 +01:00
4b952bac40
trying to improve output of check_nextcloud_mounts script 2025-03-11 08:13:28 +01:00
e150fa3625
separating multinode from app_type 2025-03-11 08:13:26 +01:00
3579682de8
testing if $is_multinode is the problem - correcter regex 2025-03-11 08:13:23 +01:00
8f090bfcac
testing if $is_multinode is the problem 2025-03-11 08:13:20 +01:00
0e189ad0ef
change check_nextcloud_mounts.py output 2025-03-11 08:13:15 +01:00
e27cf34987
changed wording 2025-03-11 08:13:10 +01:00
17d8d8b2de
changed wording 2025-03-11 08:13:06 +01:00
3fbfe26c66
adding check for nextcloud mounts 2025-03-11 08:13:00 +01:00
4a6d35b984
Merge branch 'main' into stable 2025-03-10 14:50:17 +01:00
ef1eb5b4ad
Merge branch 'testing' of ssh://platform.sunet.se:22022/Drive/sunetdrive into testing 2025-03-10 14:49:51 +01:00
dc5b61c9e6
Merge branch 'main' into testing 2025-03-10 14:49:44 +01:00
33389e842a
Set useMultiPartCopy=true everywhere and switch to nocc 2025-03-10 14:49:29 +01:00
bb7ab09db8
don't print empty line 2025-03-07 08:35:33 +01:00
bc481d44d5
apparently "You do not need to declare variables before using them" in python - cleanup 2025-03-06 16:26:05 +01:00
5619cb8270
buckets needs to be reset each loop 2025-03-06 15:42:32 +01:00
fbe409efff
trying to improve output of check_nextcloud_mounts script 2025-03-06 15:05:00 +01:00
9096bf7c33
separating multinode from app_type 2025-03-05 16:23:42 +01:00
1c38cfbf3c
Merge branch 'main' into testing 2025-03-05 15:39:03 +01:00
d332a810b9
Add webmail 2025-03-05 15:38:44 +01:00
74da008b5e
testing if $is_multinode is the problem - correcter regex 2025-03-05 15:00:14 +01:00
a6eaddbd8f
testing if $is_multinode is the problem 2025-03-05 14:58:01 +01:00
0da62f097d
change check_nextcloud_mounts.py output 2025-03-05 14:15:45 +01:00
ed3d4b1b9c
changed wording 2025-03-05 13:28:33 +01:00
bb44e6da8f
changed wording 2025-03-05 13:21:56 +01:00
de3d18b0a1
adding check for nextcloud mounts 2025-03-05 12:49:32 +01:00
aa6be0ce34
StrictHostKeyChecking=no to avoid problems whith re-install 2025-03-03 15:39:57 +01:00
83fcc67c91
- bucketnames have to be lower case
- output from occ changed so --show-password is needed now
2025-03-03 13:22:40 +01:00
ec4e2bdb38
Merge branch 'main' into stable 2025-02-28 12:50:14 +01:00
a68fea86b8
Don' allocate tty 2025-02-28 12:48:42 +01:00
a1b7a03908
Merge branch 'main' into stable 2025-02-28 12:18:49 +01:00
7363284353
Missed one path 2025-02-28 12:17:03 +01:00
9f0eccdb3d
Merge branch 'main' into stable 2025-02-28 12:07:30 +01:00
be9f1a7152
Use full path 2025-02-28 12:06:24 +01:00
f6cd170e6f
Merge branch 'main' into stable 2025-02-27 12:53:52 +01:00
dcb0ca8e48
Remove scriptherder from count 2025-02-27 12:53:06 +01:00
e0f427fcc8
Merge branch 'main' into stable 2025-02-27 11:20:37 +01:00
7090f7ca5e
Run in prod 2025-02-27 11:15:12 +01:00
705479f29c
Merge branch 'main' into stable 2025-02-27 11:12:20 +01:00
3007fc6de4
shfmt 2025-02-27 11:09:29 +01:00
4a270b9f65
Fix check 2025-02-27 11:08:13 +01:00
e0e1d5148f
Merge branch 'main' into stable 2025-02-26 12:37:44 +01:00
8b216f6730
Merge branch 'main' into stable 2025-02-26 12:33:24 +01:00
434cd6d1e4
Remove gss related manifests and config 2025-02-26 12:32:50 +01:00
b3c42225e1
Remove lookup related manifests and config 2025-02-26 12:32:39 +01:00
cbb291be47
Make sure we know where our backups are located 2025-02-25 20:21:40 +01:00
76e110ab90
Merge branch 'main' into stable 2025-02-20 17:00:35 +01:00
96632b111b
Containers changed names 2025-02-10 10:26:31 +01:00
74343d15ef
Allow long running check for scriptherder 2025-02-03 15:11:45 +01:00
0046349756
Merge branch 'main' into stable 2025-02-03 15:06:16 +01:00
Lars Delhage
98158e1be5
Remove recursive for mysql db dir 2025-01-20 12:29:01 +01:00
78bc2b3f7e
Multinode: Double book keeping
Unfortunatly we must do the same calcultions for multinode
2025-01-20 12:28:59 +01:00
26ee034887
Set expiration for multinode 2025-01-20 12:28:56 +01:00
d891874202
Add full_backup_retention 2025-01-20 12:28:53 +01:00
c11e95f5fe
Only run this on monitor hosts, as it takes a long time 2025-01-20 12:28:49 +01:00
9596f9d210
Multinode: Double book keeping
Unfortunatly we must do the same calcultions for multinode
2025-01-20 12:28:47 +01:00
e57349f011
Set expiration for multinode 2025-01-20 12:28:44 +01:00
02578640a9
Add full_backup_retention 2025-01-20 12:28:42 +01:00
c9bdb766eb
Run as root user 2025-01-20 12:28:39 +01:00
9425d56716
Multinode: Double book keeping
Unfortunatly we must do the same calcultions for multinode
2025-01-20 12:28:37 +01:00
b2d3b80f37
Set expiration for multinode 2025-01-20 12:28:35 +01:00
d67cc24318
Add full_backup_retention 2025-01-20 12:28:32 +01:00
efd05971b1
SATOSA: Always have alwayshttps 2025-01-20 12:28:30 +01:00
8dd5534b0f
Multinode: Double book keeping
Unfortunatly we must do the same calcultions for multinode
2025-01-20 12:28:27 +01:00
d24fa23262
Set expiration for multinode 2025-01-20 12:28:24 +01:00
84fc07cffe
Add full_backup_retention 2025-01-20 12:28:21 +01:00
5b68f26771
Multinode: Double book keeping
Unfortunatly we must do the same calcultions for multinode
2025-01-20 12:28:19 +01:00
dc59842fe8
Set expiration for multinode 2025-01-20 12:28:16 +01:00
a91bb85313
Add full_backup_retention 2025-01-20 12:28:12 +01:00
5f0c24865f
added ability to set trashbin_retention_obligation and versions_retention_obligation in config.php 2025-01-20 12:28:09 +01:00
8ee75b0601
changed nft rules for proxysql - ipv6 2025-01-20 12:28:06 +01:00
62670483c1
changed nft rules for proxysql 2025-01-20 12:28:04 +01:00
ace56103fc
duplicate 2025-01-20 12:28:01 +01:00
4afec74a34
one more 2025-01-20 12:27:58 +01:00
d4d998cf81
Fix notify 2025-01-20 12:27:55 +01:00
9794b03d44
Can not redeclare class 2025-01-20 12:27:52 +01:00
45a44789a4
add back image 2025-01-20 12:27:50 +01:00
4201f18ce6
Fix path 2025-01-20 12:27:47 +01:00
8057a2fa22
convert config to use newer docker_compose class 2025-01-20 12:27:44 +01:00
6cfa2b3da7 Merge branch 'main' into stable 2024-12-24 16:10:24 +01:00
ee6887bfeb Fix redis name 2024-12-24 16:00:34 +01:00
5a04dcdd0f Add back proxysql networ 2024-12-24 16:00:20 +01:00
8927f194d9 Proxysql no longer has external network 2024-12-24 15:59:03 +01:00
04e4592f4c Revert "Use new uptime check"
This reverts commit 60fc3ef307.
2024-12-24 15:59:03 +01:00
45989b8d3d Use new uptime check 2024-12-24 15:59:03 +01:00
18 changed files with 181 additions and 59 deletions

View file

@ -0,0 +1,6 @@
net.core.rmem_max=67108864
net.core.wmem_max=67108864
net.ipv4.tcp_rmem=4096 87380 33554432
net.ipv4.tcp_wmem=4096 87380 33554432
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr

View file

@ -101,7 +101,24 @@ define sunetdrive::app_type (
content => template('sunetdrive/application/get_containers'),
mode => '0744',
}
if ($environment == 'test' and ($nodenumber == 3)) {
if ($nodenumber == 3) {
file { '/usr/lib/nagios/plugins/check_nextcloud_mounts.py':
ensure => present,
owner => 'root',
group => 'root',
content => template('sunetdrive/application/check_nextcloud_mounts.py'),
mode => '0744',
}
sunet::sudoer {'nagios_run_nextcloud_mounts_command':
user_name => 'nagios',
collection => 'nrpe_nextcloud_mounts_check',
command_line => '/usr/lib/nagios/plugins/check_nextcloud_mounts.py'
}
sunet::nagios::nrpe_command {'check_nextcloud_mounts':
command_line => '/usr/bin/sudo /usr/lib/nagios/plugins/check_nextcloud_mounts.py'
}
}
if ($nodenumber == 3) {
file { '/usr/local/bin/scan_external_mounts':
ensure => present,
force => true,
@ -117,10 +134,6 @@ define sunetdrive::app_type (
ok_criteria => ['exit_status=0','max_age=2d'],
warn_criteria => ['exit_status=1','max_age=3d'],
}
cron { 'scan_external_mounts':
ensure => absent,
command => 'true',
}
}
file { '/opt/nextcloud/cron.sh':
ensure => file,
@ -392,5 +405,4 @@ define sunetdrive::app_type (
}
}
}
}

View file

@ -15,6 +15,7 @@ define sunetdrive::db_type(
$backup_password = safe_hiera('backup_password')
$proxysql_password = safe_hiera('proxysql_password')
$mysql_user_password = safe_hiera('mysql_user_password')
$roundcube_password = safe_hiera('roundcube_password')
$mariadb_dir = '/etc/mariadb'
$mycnf_path = 'sunetdrive/mariadb/my.cnf.erb'
$server_id = 1000 + Integer($facts['networking']['hostname'][-1])
@ -34,7 +35,7 @@ define sunetdrive::db_type(
if $location =~ /^multinode/ {
$from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6 + $config['kube'] + $config['kube_v6']
} elsif $location == 'sunet-test' or $location == 'sunet-prod' {
$from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6 + $config['imap'] + $config['imap_v6'] + $config['smtp'] + $config['smtp_v6']
$from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6 + $config['imap'] + $config['imap_v6'] + $config['smtp'] + $config['smtp_v6'] + $config['webmail'] + $config['webmail_v6']
} else {
$from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6
}
@ -46,7 +47,7 @@ define sunetdrive::db_type(
sunet::system_user {'mysql': username => 'mysql', group => 'mysql' }
$sql_files = ['02-backup_user.sql', '03-proxysql.sql', '04-nextcloud.sql']
$sql_files = ['02-backup_user.sql', '03-proxysql.sql', '04-nextcloud.sql', '05-roundcube.sql']
$sql_files.each |$sql_file|{
file { "${mariadb_dir}/init/${sql_file}":
ensure => present,

View file

@ -46,26 +46,35 @@ class sunetdrive::multinode (
content => template('sunetdrive/application/get_containers'),
mode => '0744',
}
if ($environment == 'test') {
file { '/usr/local/bin/scan_external_mounts':
ensure => present,
force => true,
owner => 'root',
group => 'root',
content => template('sunetdrive/application/scan_external_mounts.sh'),
mode => '0744',
}
sunet::scriptherder::cronjob { 'scriptherder_scan_external_mounts':
cmd => '/usr/local/bin/scan_external_mounts',
hour => '1',
minute => '20',
ok_criteria => ['exit_status=0','max_age=2d'],
warn_criteria => ['exit_status=1','max_age=3d'],
}
cron { 'scan_external_mounts':
ensure => absent,
command => 'true',
}
file { '/usr/lib/nagios/plugins/check_nextcloud_mounts.py':
ensure => present,
owner => 'root',
group => 'root',
content => template('sunetdrive/application/check_nextcloud_mounts.py'),
mode => '0744',
}
sunet::sudoer {'nagios_run_nextcloud_mounts_command':
user_name => 'nagios',
collection => 'nrpe_nextcloud_mounts_check',
command_line => '/usr/lib/nagios/plugins/check_nextcloud_mounts.py'
}
sunet::nagios::nrpe_command {'check_nextcloud_mounts':
command_line => '/usr/bin/sudo /usr/lib/nagios/plugins/check_nextcloud_mounts.py'
}
file { '/usr/local/bin/scan_external_mounts':
ensure => present,
force => true,
owner => 'root',
group => 'root',
content => template('sunetdrive/application/scan_external_mounts.sh'),
mode => '0744',
}
sunet::scriptherder::cronjob { 'scriptherder_scan_external_mounts':
cmd => '/usr/local/bin/scan_external_mounts',
hour => '1',
minute => '20',
ok_criteria => ['exit_status=0','max_age=2d'],
warn_criteria => ['exit_status=1','max_age=3d'],
}
file { '/usr/local/bin/nocc':
ensure => present,

View file

@ -41,7 +41,10 @@ class sunetdrive::multinode_db(){
group => 'root',
mode => '0600',
}
file { '/root/tasks/listusersbydep.sh':
file { '/root/tasks/':
ensure => directory,
}
-> file { '/root/tasks/listusersbydep.sh':
ensure => file,
content => template('sunetdrive/mariadb/listusersdep.sh.erb'),
owner => 'root',
@ -55,7 +58,10 @@ class sunetdrive::multinode_db(){
group => 'root',
mode => '0700',
}
file {'/opt/mariadb/statistics/custdata.json':
file {'/opt/mariadb/statistics/':
ensure => directory,
}
-> file {'/opt/mariadb/statistics/custdata.json':
ensure => file,
content => template('sunetdrive/mariadb/custconfig.json.erb'),
owner => 'root',

View file

@ -5,7 +5,19 @@ class sunetdrive::scriptreceiver()
sunet::system_user {'script': username => 'script', group => 'script', managehome => true, shell => '/bin/bash' }
# These tasks correspond to a ${task}.erb.sh template
$tasks = ['list_users', 'list_files_for_user', 'create_bucket', 'backup_db', 'purge_backups', 'maintenancemode', 'restart_sunet_service', 'start_sentinel', 'stop_sentinel', 'removeswap', 'backup_multinode_db']
$tasks = [
'list_users',
'list_files_for_user',
'create_bucket',
'backup_db',
'purge_backups',
'maintenancemode',
'restart_sunet_service',
'start_sentinel',
'stop_sentinel',
'removeswap',
'backup_multinode_db'
]
$environment = sunetdrive::get_environment()
$config = hiera_hash($environment)
@ -35,7 +47,9 @@ class sunetdrive::scriptreceiver()
type => 'ssh-ed25519',
key => $script_pub_key,
}
file { '/etc/sysctl.d/gofasta.conf':
ensure => 'absent',
}
file { '/opt/rotate':
ensure => directory,
mode => '0750',

View file

@ -11,6 +11,9 @@ class sunetdrive::sitemonitornaemon() {
$environment = sunetdrive::get_environment()
$influx_passwd = safe_hiera('influx_passwd')
$slack_url = safe_hiera('slack_url')
$extra_host_groups = {
node3_hosts => join($facts['configured_hosts_in_cosmos']['all'].filter |$host| { $host =~ /^node3\./ }, ',')
}
file { '/usr/local/bin/slack_nagios.sh':
ensure => present,
@ -45,6 +48,11 @@ class sunetdrive::sitemonitornaemon() {
content => template('sunetdrive/monitor/sunetdrive_thruk_templates.conf.erb'),
mode => '0644',
}
file { '/etc/naemon/conf.d/sunetdrive_extra_hostgroups.cfg':
ensure => present,
content => template('sunetdrive/monitor/sunetdrive_extra_hostgroups.cfg.erb'),
mode => '0644',
}
nagioscfg::service {'check_scriptherder':
hostgroup_name => ['sunetdrive::nrpe'],
check_command => 'check_nrpe_1arg_to300!check_scriptherder',
@ -99,6 +107,12 @@ class sunetdrive::sitemonitornaemon() {
description => 'Status of sarimner interface',
contact_groups => ['alerts']
}
nagioscfg::service {'check_nextcloud_mounts':
hostgroup_name => ['node3_hosts','sunetdrive::multinode'],
check_command => 'check_nrpe_1arg!check_nextcloud_mounts',
description => 'S3 buckets with multiple Nextcloud mounts',
contact_groups => ['alerts']
}
}

View file

@ -0,0 +1,42 @@
#!/usr/bin/env python3
from collections import Counter
import json
import shlex
import subprocess
import sys
exit = 0
base_message = "OK: no duplicate mounts"
long_message = ""
get_containers = subprocess.Popen('/usr/local/bin/get_containers', stdout=subprocess.PIPE).stdout.read()
containers = get_containers.decode().splitlines()
for i, container in enumerate(containers, start=1):
buckets = []
list_command = f"/usr/local/bin/nocc {container} files_external:list --all --show-password --output json"
command = shlex.split(list_command)
mount_data_byte = subprocess.Popen(command, stdout=subprocess.PIPE).stdout.read()
try:
mount_data = json.loads(mount_data_byte.decode())
except json.decoder.JSONDecodeError as err:
if i == 1 or i != len(containers):
base_message = "WARNING: invalid json"
long_message += f"\ncontainer: {container} - json decode error: {err}"
# lets do exit 0 for now
# exit = 1
continue
for items in mount_data:
buckets.append(items["configuration"]["bucket"])
bucket_count = dict(Counter(buckets))
for k, v in bucket_count.items():
if v > 1:
base_message = "WARNING: buckets with multiple mounts"
long_message += f"\ncontainer: {container} - bucket: {k} - {v}"
# lets do exit 0 for now
# exit = 1
print(base_message)
if long_message != "":
print(long_message.lstrip())
sys.exit(exit)

View file

@ -16,6 +16,7 @@ $CONFIG = array (
),
),
'appstoreenabled' => false,
'auth.bruteforce.protection.enabled' => false,
'config_is_read_only' => true,
'csrf.disabled' => true,
'datadirectory' => '/var/www/html/data',
@ -76,7 +77,7 @@ $CONFIG = array (
'region' => 'us-east-1',
'hostname' => '<%= @s3_host %>',
'port' => '',
'useMultipartCopy' => false,
'useMultipartCopy' => true,
'objectPrefix' => 'urn:oid:',
'autocreate' => false,
'use_ssl' => true,

View file

@ -15,7 +15,7 @@ if [[ "x${oc_list}" != "x" ]]; then
done
fi
docker exec -ti ${MY_VARS} -u www-data ${container} php --define apc.enable_cli=1 /var/www/html/occ "$@"
docker exec -i ${MY_VARS} -u www-data ${container} php --define apc.enable_cli=1 /var/www/html/occ "$@"
exit 0

View file

@ -52,7 +52,7 @@ echo '
"region": "'${region}'",
"secret": "'${secret}'",
"storageClass": "",
"useMultipartCopy": false,
"useMultipartCopy": true,
"use_path_style": true,
"use_ssl": true
},

View file

@ -3,28 +3,32 @@
error_ids=""
# Only run if this is the only instance of this script running
# note: since this script forks to run pgrep, we need -eq 2 here
if [[ $(pgrep -f "${0}" | wc -l) -eq 2 ]]; then
# shellcheck disable=SC2126
if [[ $(pgrep -a -f "${0}" | grep -v scriptherder | wc -l) -eq 2 ]]; then
# We sleep a deterministic amount of time, which will be between 0 an 128 m and allways the same within
# a specific host, but will differ between hosts
sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk '{print $1}') / 2))m
for container in $(get_containers); do
error_ids="${error_ids} ${container}: "
for id in $(nocc "${container}" files_external:list --all --output json | jq '.[].mount_id' | jq .); do
nocc "${container}" files_external:scan "${id}" | grep Error
# shellcheck disable=SC2181
if [[ ${?} -eq 0 ]]; then
error_ids="${error_ids} ${id}"
fi
errors=''
for container in $(/usr/local/bin/get_containers); do
error_ids="${error_ids} ${container}: "
for id in $(/usr/local/bin/nocc "${container}" files_external:list --all --output json | jq '.[].mount_id' | jq .); do
/usr/local/bin/nocc "${container}" files_external:scan "${id}" | grep Error
# shellcheck disable=SC2181
if [[ ${?} -eq 0 ]]; then
errors="${errors} ${id}"
error_ids="${error_ids} ${id}"
fi
done
done
else
echo "Another instance of this script is already running, exiting"
pgrep -a -f "${0}"
exit 0
echo "Another instance of this script is already running, exiting"
pgrep -a -f "${0}" | grep -v scriptherder
exit 0
fi
if [[ -n "${error_ids}" ]]; then
echo "Errors found in the following mounts: ${error_ids}"
exit 1
if [[ -n "${errors}" ]]; then
echo "Errors found in the following mounts: ${error_ids}"
exit 1
fi
echo "No errors found"
exit 0

View file

@ -0,0 +1,3 @@
CREATE SCHEMA roundcubemail;
CREATE USER 'roundcube'@'%' IDENTIFIED BY '<%= @roundcube_password %>';
GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'%' IDENTIFIED BY '<%= @roundcube_password %>';

View file

@ -0,0 +1,8 @@
<% @extra_host_groups.each do |group, members| -%>
# <%= group %>
define hostgroup {
hostgroup_name <%= group %>
alias <%= group %>
members <%= members %>
}
<% end -%>

View file

@ -1,10 +1,10 @@
#!/bin/bash
customer="${1}"
multinode="${2}"
customer="${1}"
multinode="${2}"
environment="<%= @environment %>"
location="${customer}-${environment}"
userjson=$(ssh "script@${multinode}" "sudo /home/script/bin/list_users.sh nextcloud-${customer}-app-1")
userjson=$(ssh -o StrictHostKeyChecking=no "script@${multinode}" "sudo /home/script/bin/list_users.sh nextcloud-${customer}-app-1")
project="statistics"
bucket="drive-server-coms"
base_dir="${project}:${bucket}"

View file

@ -43,9 +43,11 @@ for eppn in $(echo "${users}" | jq -r keys[]); do
username=${eppn%@*}
# Remove underscore from username
user=${username//_/-}
# convert user to lower case for bucket naming rules
user_lower=${user,,}
echo "$(date) - Check bucket status for ${eppn}"
bucketname="${user}-${site_name//./-}"
bucketname="${user_lower}-${site_name//./-}"
if ! echo "${buckets}" | grep "${bucketname}" &> /dev/null; then
echo "$(date) - ${eppn} has no mounts configured, adding bucket and mounts..."
${rclone} mkdir "${rcp}:${bucketname}"

View file

@ -33,12 +33,12 @@ fi
key=$(grep access_key_id "${rclone_config}" | awk '{print $3}')
secret=$(grep secret_access_key "${rclone_config}"| awk '{print $3}')
endpoint=$(grep endpoint "${rclone_config}" | awk '{print $3}')
preexisting="$(docker exec -u www-data -i "${container}" php --define apc.enable_cli=1 /var/www/html/occ files_external:list --output json "${user}" | jq -r '.[] | .configuration.bucket' | grep "${bucket}")"
preexisting="$(docker exec -u www-data -i "${container}" php --define apc.enable_cli=1 /var/www/html/occ files_external:list --output json --show-password "${user}" | jq -r '.[] | .configuration.bucket' | grep "${bucket}")"
if [[ -z ${preexisting} ]]; then
docker exec -u www-data -i "${container}" php --define apc.enable_cli=1 /var/www/html/occ files_external:create "${user_bucket_name}" \
amazons3 -c bucket="${bucket}" -c key="${key}" -c secret="${secret}" -c hostname="${endpoint}" -c use_ssl=true -c use_path_style=true -c region=us-east-1 \
-c useMultipartCopy=false amazons3::accesskey --user ${user}
-c useMultipartCopy=true amazons3::accesskey --user ${user}
for shareid in $(docker exec -u www-data -i ${container} php --define apc.enable_cli=1 /var/www/html/occ files_external:export ${user} | jq -r '.[].mount_id'); do
docker exec -u www-data -i ${container} php --define apc.enable_cli=1 /var/www/html/occ files_external:option ${shareid} enable_sharing true
done

View file

@ -7,7 +7,7 @@ bucket=${4}
user=${5}
/usr/local/bin/occ files_external:create "${bucket}" \
amazons3 -c bucket="${bucket}" -c key="${key}" -c secret="${secret}" -c hostname="${endpoint}" -c use_ssl=true -c use_path_style=true -c region=us-east-1 \
-c useMultipartCopy=false amazons3::accesskey --user "${user}"
for shareid in $(/usr/local/bin/occ files_external:export "${user}" | jq -r '.[].mount_id'); do
/usr/local/bin/occ files_external:option "${shareid}" enable_sharing true
-c useMultipartCopy=true amazons3::accesskey --user "${user}"
for shareid in $(/usr/local/bin/nocc files_external:export "${user}" | jq -r '.[].mount_id'); do
/usr/local/bin/nocc files_external:option "${shareid}" enable_sharing true
done