diff --git a/nextcloud/README.md b/nextcloud/README.md index f803bc2a..a13d157d 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,11 @@ 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)* Don't forget to use a **strong password** for the admin account! ### Port @@ -86,7 +91,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 +175,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..b2dd6e9c 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' => true, + ), + ), +); +?> +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