diff --git a/nextcloud/Dockerfile.11.0 b/nextcloud/Dockerfile.11.0 index 3e55ba45..a8411fd8 100644 --- a/nextcloud/Dockerfile.11.0 +++ b/nextcloud/Dockerfile.11.0 @@ -12,7 +12,8 @@ ENV UID=991 GID=991 \ CRON_MEMORY_LIMIT=1g \ TZ=Etc/UTC \ DB_TYPE=sqlite3 \ - DOMAIN=localhost + DOMAIN=localhost \ + DATASTORE_USE_PATH_STYLE=false RUN apk -U upgrade \ && apk add -t build-dependencies \ diff --git a/nextcloud/Dockerfile.12.0 b/nextcloud/Dockerfile.12.0 index 8a9ff47f..10f3ac07 100644 --- a/nextcloud/Dockerfile.12.0 +++ b/nextcloud/Dockerfile.12.0 @@ -12,7 +12,8 @@ ENV UID=991 GID=991 \ CRON_MEMORY_LIMIT=1g \ TZ=Etc/UTC \ DB_TYPE=sqlite3 \ - DOMAIN=localhost + DOMAIN=localhost \ + DATASTORE_USE_PATH_STYLE=false RUN apk -U upgrade \ && apk add -t build-dependencies \ diff --git a/nextcloud/Dockerfile.daily b/nextcloud/Dockerfile.daily index 4a4b23a7..5e301977 100644 --- a/nextcloud/Dockerfile.daily +++ b/nextcloud/Dockerfile.daily @@ -9,7 +9,8 @@ ENV UID=991 GID=991 \ CRON_MEMORY_LIMIT=1g \ TZ=Etc/UTC \ DB_TYPE=sqlite3 \ - DOMAIN=localhost + DOMAIN=localhost \ + DATASTORE_USE_PATH_STYLE=false RUN apk -U upgrade \ && apk add -t build-dependencies \ diff --git a/nextcloud/README.md b/nextcloud/README.md index f803bc2a..fe74d0c5 100644 --- a/nextcloud/README.md +++ b/nextcloud/README.md @@ -24,6 +24,7 @@ - GNU Libiconv for php iconv extension (avoiding errors with some apps). - No root processes. Never. - Environment variables provided (see below). +- Optional use of S3 bucket for primary storage (see below for config). ### Tags - **latest** : latest stable version. (12.0) @@ -58,7 +59,12 @@ Other tags than `daily` are built weekly. For security reasons, you should occas - **DB_USER** : username for database *(default : none)* - **DB_PASSWORD** : password for database user *(default : none)* - **DB_HOST** : database host *(default : none)* - +- **DATASTORE_BUCKET** : S3 bucket to use for primary storage *(default : none)* +- **DATASTORE_KEY** : S3 Key for about bucket *(default : none)* +- **DATASTORE_SECRET** : S3 secret for about bucket *(default : none)* +- **DATASTORE_HOST** : S3 host for above bucket *(default : none)* +- **DATASTORE_PORT** : S3 port for above bucket *(default : 443)* +- **DATASTORE_USE_PATH_STYLE** : Whether to use path style for S3 bucket *(default : false)* Don't forget to use a **strong password** for the admin account! ### Port @@ -86,7 +92,7 @@ docker run -d --name db_nextcloud \ -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud \ -e MYSQL_PASSWORD=supersecretpassword \ mariadb:10 - + docker run -d --name nextcloud \ --link db_nextcloud:db_nextcloud \ -v /mnt/nextcloud/data:/data \ @@ -170,7 +176,7 @@ nextcloud-db: - MYSQL_DATABASE=nextcloud - MYSQL_USER=nextcloud - MYSQL_PASSWORD=supersecretpassword - + # If using Nextant solr: image: solr:6-alpine diff --git a/nextcloud/rootfs/usr/local/bin/setup.sh b/nextcloud/rootfs/usr/local/bin/setup.sh index df299926..c56bec2c 100755 --- a/nextcloud/rootfs/usr/local/bin/setup.sh +++ b/nextcloud/rootfs/usr/local/bin/setup.sh @@ -63,6 +63,31 @@ cat >> /nextcloud/config/autoconfig.php < EOF +# Put S3 config into it's own config file +if [[ ! -z "$DATASTORE_BUCKET" ]]; then + cat >> /nextcloud/config/s3.config.php < array ( + 'class' => 'OC\\Files\\ObjectStore\\S3', + 'arguments' => array ( + 'bucket' => '${DATASTORE_BUCKET}', + 'autocreate' => false, + 'key' => '${DATASTORE_KEY}', + 'secret' => '${DATASTORE_SECRET}', + 'hostname' => '${DATASTORE_HOST}', + 'port' => '${DATASTORE_PORT:-443}', + 'use_ssl' => true, + // required for some non amazon s3 implementations + 'use_path_style' => %{DATASTORE_USE_PATH_STYLE}, + ), + ), +); +?> +EOF +fi + echo "Starting automatic configuration..." # Execute ownCloud's setup step, which creates the ownCloud database. # It also wipes it if it exists. And it updates config.php with database