From 8673377a899b0cac56ffe58fdf1bc0c167a48fbb Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Tue, 30 Jan 2018 08:36:21 +0100 Subject: [PATCH] update nextcloud --- Dockerfile | 4 +- README.md | 4 +- rootfs/etc/confd/conf.d/config.php.toml | 2 +- rootfs/etc/confd/templates/config.php.tmpl | 2 +- rootfs/etc/cont-init.d.stop/00-nextcloud | 53 ---------------------- rootfs/etc/cont-init.d/00-nextcloud | 51 +++++++++++++++++++++ 6 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 rootfs/etc/cont-init.d.stop/00-nextcloud create mode 100644 rootfs/etc/cont-init.d/00-nextcloud diff --git a/Dockerfile b/Dockerfile index 276b7af..556386b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,11 @@ RUN apk add --no-cache \ postgresql-client \ nextcloud \ nextcloud-user_ldap \ - nextcloud-pgsql + nextcloud-pgsql \ + php7-opcache RUN chown -R nginx:nginx /var/lib/nextcloud +RUN chown -R nginx:nginx /etc/nextcloud RUN chown -R nginx:nginx /usr/share/webapps/nextcloud RUN mkdir /run/nginx diff --git a/README.md b/README.md index 97f5b52..ee7f2be 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Local part in the from address for notification emails. ## MAIL_SMTP_HOST SMTP host used for notification emails. -## MAILSMTPPORT +## MAIL_SMTP_PORT - default: 587 SMTP host port. @@ -53,7 +53,7 @@ SMTP host port. Connection security for the SMTP host. ## MAIL_SMTP_AUTH -- default: true +- default: 1 Whether to use authentication with the SMTP host. diff --git a/rootfs/etc/confd/conf.d/config.php.toml b/rootfs/etc/confd/conf.d/config.php.toml index a465de0..d18ecfe 100644 --- a/rootfs/etc/confd/conf.d/config.php.toml +++ b/rootfs/etc/confd/conf.d/config.php.toml @@ -1,6 +1,6 @@ [template] src = "config.php.tmpl" -dest = "/var/lib/nextcloud/config/config.php" +dest = "/var/lib/nextcloud/config/config.php.sample" gid = 101 uid = 100 mode = "0660" diff --git a/rootfs/etc/confd/templates/config.php.tmpl b/rootfs/etc/confd/templates/config.php.tmpl index 10b366d..918aebd 100644 --- a/rootfs/etc/confd/templates/config.php.tmpl +++ b/rootfs/etc/confd/templates/config.php.tmpl @@ -23,7 +23,7 @@ $CONFIG = array( 'mail_smtpdebug' => false, 'mail_smtpmode' => 'smtp', 'mail_smtphost' => '{{getenv "MAIL_SMTP_HOST"}}', -'mail_smtpport' => {{getenv "MAILSMTPPORT" "587"}}, +'mail_smtpport' => {{getenv "MAIL_SMTP_PORT" "587"}}, 'mail_smtptimeout' => 10, 'mail_smtpsecure' => '{{getenv "MAIL_SMTP_SECURITY" "tls"}}', 'mail_smtpauth' => {{getenv "MAIL_SMTP_AUTH" "true"}}, diff --git a/rootfs/etc/cont-init.d.stop/00-nextcloud b/rootfs/etc/cont-init.d.stop/00-nextcloud deleted file mode 100644 index c9783a7..0000000 --- a/rootfs/etc/cont-init.d.stop/00-nextcloud +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/with-contenv sh -set -ex - -chmod +x /var/lib/nextcloud/occ # for some reason it doesn't work when done from the Dockerfile - -if [ ! -f /var/lib/nextcloud/data/.ocdata ]; then - touch /var/lib/nextcloud/data/.ocdata -fi - -PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '${DB_TABLE_PREFIX}appconfig')" | grep f - -if [ $? -ne 1 ]; then - cd /var/lib/nextcloud - - if [ -f /var/lib/nextcloud/config/config.php ]; then - sed -i -e "s/'installed' => true,/'installed' => false,/g" /var/lib/nextcloud/config/config.php - fi - - s6-setuidgid nginx ./occ maintenance:install \ - --database=pgsql \ - --database-host=$DB_HOST \ - --database-name=$DB_NAME \ - --database-user=$DB_USER \ - --database-pass=$DB_PASSWORD \ - --database-table-prefix=$DB_TABLE_PREFIX \ - --admin-user=$ADMIN_USER \ - --admin-pass=$ADMIN_PASSWORD \ - --no-interaction - - s6-setuidgid nginx ./occ config:app:set --value cron core backgroundjobs_mode - s6-setuidgid nginx ./occ app:enable user_ldap - - s6-setuidgid nginx ./occ ldap:create-empty-config - - s6-setuidgid nginx ./occ ldap:set-config 's01' hasMemberOfFilterSupport "1" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapExperiencedAdmin "1" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapIgnoreNamingRules "1" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapHost "$LDAP_HOST" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapPort "$LDAP_PORT" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapTLS "$LDAP_TLS" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapAgentName "$LDAP_BIND_USER" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapAgentPassword "$LDAP_BIND_PASSWORD" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapLoginFilter "$LDAP_LOGIN_FILTER" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapUserDisplayName "$LDAP_USER_DISPLAY_NAME" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapUserFilter "$LDAP_USER_FILTER" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapBase "$LDAP_BASE_DN" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapBaseUsers "$LDAP_BASE_USER_DN" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapEmailAttribute "$LDAP_EMAIL_ATTRIBUTE" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapBaseGroups "$LDAP_BASE_GROUP_DN" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapGroupFilter "$LDAP_GROUP_FILTER" - s6-setuidgid nginx ./occ ldap:set-config 's01' turnOffCertCheck "$LDAP_TURN_OFF_CERT_CHECK" - s6-setuidgid nginx ./occ ldap:set-config 's01' ldapConfigurationActive "1" -fi diff --git a/rootfs/etc/cont-init.d/00-nextcloud b/rootfs/etc/cont-init.d/00-nextcloud new file mode 100644 index 0000000..274e5ea --- /dev/null +++ b/rootfs/etc/cont-init.d/00-nextcloud @@ -0,0 +1,51 @@ +#!/usr/bin/with-contenv sh +set -ex + +PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = '${DB_TABLE_PREFIX}appconfig')" | grep f + +if [ $? -ne 1 ]; then + cd /usr/share/webapps/nextcloud + + s6-setuidgid nginx ./occ maintenance:install \ + --database=pgsql \ + --database-host=$DB_HOST \ + --database-name=$DB_NAME \ + --database-user=$DB_USER \ + --database-pass=$DB_PASSWORD \ + --database-table-prefix=$DB_TABLE_PREFIX \ + --admin-user=$ADMIN_USER \ + --admin-pass=$ADMIN_PASSWORD \ + --data-dir=/var/lib/nextcloud/data/ \ + --no-interaction + + s6-setuidgid nginx ./occ config:app:set --value cron core backgroundjobs_mode + s6-setuidgid nginx ./occ app:enable user_ldap + s6-setuidgid nginx ./occ app:enable files_sharing + + s6-setuidgid nginx ./occ config:system:set --value "https://$DOMAIN" overwrite.cli.url + s6-setuidgid nginx ./occ config:system:set --value ["localhost", "$DOMAIN"] trusted_domains + + s6-setuidgid nginx ./occ config:system:set --value "smtp" mail_smtpmode + s6-setuidgid nginx ./occ config:system:set --value "${MAIL_SMTP_AUTH_TYPE:-PLAIN}" mail_smtpauthtype + s6-setuidgid nginx ./occ config:system:set --value "$MAIL_FROM" mail_from_address + s6-setuidgid nginx ./occ config:system:set --value "$MAIL_DOMAIN" mail_domain + s6-setuidgid nginx ./occ config:system:set --value "${MAIL_SMTP_SECURITY:-tls}" mail_smtpsecure + s6-setuidgid nginx ./occ config:system:set --value "${MAIL_SMTP_AUTH:-1}" mail_smtpauth + s6-setuidgid nginx ./occ config:system:set --value "$MAIL_SMTP_HOST" mail_smtphost + s6-setuidgid nginx ./occ config:system:set --value "${MAIL_SMTP_PORT:-587}" mail_smtpport + s6-setuidgid nginx ./occ config:system:set --value "$MAIL_SMTP_NAME" mail_smtpname + s6-setuidgid nginx ./occ config:system:set --value "$MAIL_SMTP_PASSWORD" mail_smtppassword + + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_BASE_GROUP_DN" user_ldap ldap_base_groups + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_EMAIL_ATTRIBUTE" user_ldap ldap_email_attr + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_USER_FILTER" user_ldap ldap_userlist_filter + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_LOGIN_FILTER" user_ldap ldap_login_filter + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_TLS" user_ldap ldap_tls + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_HOST" user_ldap ldap_host + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_BIND_USER" user_ldap ldap_dn + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_BIND_PASSWORD" user_ldap ldap_agent_password + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_GROUP_FILTER" user_ldap ldap_group_filter + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_USER_DISPLAY_NAME" user_ldap ldap_display_name + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_PORT" user_ldap ldap_port + s6-setuidgid nginx ./occ config:app:set --value "$LDAP_BASE_USER_DN" user_ldap ldap_base_users +fi