Merge branch 'main' into stable

This commit is contained in:
Micke Nordin 2025-03-10 14:50:17 +01:00
commit 4a6d35b984
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
7 changed files with 14 additions and 12 deletions

View file

@ -34,7 +34,7 @@ define sunetdrive::db_type(
if $location =~ /^multinode/ { if $location =~ /^multinode/ {
$from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6 + $config['kube'] + $config['kube_v6'] $from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6 + $config['kube'] + $config['kube_v6']
} elsif $location == 'sunet-test' or $location == 'sunet-prod' { } 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 { } else {
$from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6 $from = $db_ip + $nextcloud_ip + $backup_ip + $backup_ipv6 + $db_ipv6
} }

View file

@ -76,7 +76,7 @@ $CONFIG = array (
'region' => 'us-east-1', 'region' => 'us-east-1',
'hostname' => '<%= @s3_host %>', 'hostname' => '<%= @s3_host %>',
'port' => '', 'port' => '',
'useMultipartCopy' => false, 'useMultipartCopy' => true,
'objectPrefix' => 'urn:oid:', 'objectPrefix' => 'urn:oid:',
'autocreate' => false, 'autocreate' => false,
'use_ssl' => true, 'use_ssl' => true,

View file

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

View file

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
customer="${1}" customer="${1}"
multinode="${2}" multinode="${2}"
environment="<%= @environment %>" environment="<%= @environment %>"
location="${customer}-${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" project="statistics"
bucket="drive-server-coms" bucket="drive-server-coms"
base_dir="${project}:${bucket}" base_dir="${project}:${bucket}"

View file

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

View file

@ -33,12 +33,12 @@ fi
key=$(grep access_key_id "${rclone_config}" | awk '{print $3}') key=$(grep access_key_id "${rclone_config}" | awk '{print $3}')
secret=$(grep secret_access_key "${rclone_config}"| awk '{print $3}') secret=$(grep secret_access_key "${rclone_config}"| awk '{print $3}')
endpoint=$(grep endpoint "${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 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}" \ 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 \ 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 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 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 done

View file

@ -7,7 +7,7 @@ bucket=${4}
user=${5} user=${5}
/usr/local/bin/occ files_external:create "${bucket}" \ /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 \ 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 $(/usr/local/bin/occ files_external:export "${user}" | jq -r '.[].mount_id'); do for shareid in $(/usr/local/bin/nocc files_external:export "${user}" | jq -r '.[].mount_id'); do
/usr/local/bin/occ files_external:option "${shareid}" enable_sharing true /usr/local/bin/nocc files_external:option "${shareid}" enable_sharing true
done done