Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit 5250441

Browse files
author
Pete Brown
committed
Add support to nextcloud image to use an S3 bucket as primary storage
1 parent f33846f commit 5250441

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

nextcloud/README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- GNU Libiconv for php iconv extension (avoiding errors with some apps).
2525
- No root processes. Never.
2626
- Environment variables provided (see below).
27+
- Optional use of S3 bucket for primary storage (see below for config).
2728

2829
### Tags
2930
- **latest** : latest stable version. (12.0)
@@ -58,7 +59,11 @@ Other tags than `daily` are built weekly. For security reasons, you should occas
5859
- **DB_USER** : username for database *(default : none)*
5960
- **DB_PASSWORD** : password for database user *(default : none)*
6061
- **DB_HOST** : database host *(default : none)*
61-
62+
- **DATASTORE_BUCKET** : S3 bucket to use for primary storage *(default : none)*
63+
- **DATASTORE_KEY** : S3 Key for about bucket *(default : none)*
64+
- **DATASTORE_SECRET** : S3 secret for about bucket *(default : none)*
65+
- **DATASTORE_HOST** : S3 host for above bucket *(default : none)*
66+
- **DATASTORE_PORT** : S3 port for above bucket *(default : 443)*
6267
Don't forget to use a **strong password** for the admin account!
6368

6469
### Port
@@ -86,7 +91,7 @@ docker run -d --name db_nextcloud \
8691
-e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud \
8792
-e MYSQL_PASSWORD=supersecretpassword \
8893
mariadb:10
89-
94+
9095
docker run -d --name nextcloud \
9196
--link db_nextcloud:db_nextcloud \
9297
-v /mnt/nextcloud/data:/data \
@@ -170,7 +175,7 @@ nextcloud-db:
170175
- MYSQL_DATABASE=nextcloud
171176
- MYSQL_USER=nextcloud
172177
- MYSQL_PASSWORD=supersecretpassword
173-
178+
174179
# If using Nextant
175180
solr:
176181
image: solr:6-alpine

nextcloud/rootfs/usr/local/bin/setup.sh

+25
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,31 @@ cat >> /nextcloud/config/autoconfig.php <<EOF;
6363
?>
6464
EOF
6565

66+
# Put S3 config into it's own config file
67+
if [[ ! -z "$DATASTORE_BUCKET" ]]; then
68+
cat >> /nextcloud/config/s3.config.php <<EOF;
69+
<?php
70+
\$CONFIG = array (
71+
# Setup S3 as a backend for primary storage
72+
'objectstore' => array (
73+
'class' => 'OC\\Files\\ObjectStore\\S3',
74+
'arguments' => array (
75+
'bucket' => '${DATASTORE_BUCKET}',
76+
'autocreate' => false,
77+
'key' => '${DATASTORE_KEY}',
78+
'secret' => '${DATASTORE_SECRET}',
79+
'hostname' => '${DATASTORE_HOST}',
80+
'port' => '${DATASTORE_PORT:-443}',
81+
'use_ssl' => true,
82+
// required for some non amazon s3 implementations
83+
'use_path_style' => true,
84+
),
85+
),
86+
);
87+
?>
88+
EOF
89+
fi
90+
6691
echo "Starting automatic configuration..."
6792
# Execute ownCloud's setup step, which creates the ownCloud database.
6893
# It also wipes it if it exists. And it updates config.php with database

0 commit comments

Comments
 (0)