Skip to content

Commit c29fea3

Browse files
committed
only set variables if they're actively in use
1 parent 1581991 commit c29fea3

File tree

2 files changed

+56
-28
lines changed

2 files changed

+56
-28
lines changed

.config/s3.config.php

+33-7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
$use_path = getenv('OBJECTSTORE_S3_USEPATH_STYLE');
55
$use_legacyauth = getenv('OBJECTSTORE_S3_LEGACYAUTH');
66
$autocreate = getenv('OBJECTSTORE_S3_AUTOCREATE');
7+
$proxy = getenv('OBJECTSTORE_S3_PROXY');
8+
$verify_bucket_exists = getenv('OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS');
9+
$use_multipart_copy = getenv('OBJECTSTORE_S3_USEMULTIPARTCOPY');
10+
$concurrency = getenv('OBJECTSTORE_S3_CONCURRENCY');
11+
$timeout = getenv('OBJECTSTORE_S3_TIMEOUT');
12+
$upload_part_size = getenv('OBJECTSTORE_S3_UPLOADPARTSIZE');
13+
$put_size_limit = getenv('OBJECTSTORE_S3_PUTSIZELIMIT');
14+
$copy_size_limit = getenv('OBJECTSTORE_S3_COPYSIZELIMIT');
15+
716
$CONFIG = array(
817
'objectstore' => array(
918
'class' => '\OC\Files\ObjectStore\S3',
@@ -19,18 +28,35 @@
1928
// required for some non Amazon S3 implementations
2029
'use_path_style' => $use_path == true && strtolower($use_path) !== 'false',
2130
// required for older protocol versions
31+
'useMultipartCopy' => strtolower($useMultipartCopy) !== 'true',
2232
'legacy_auth' => $use_legacyauth == true && strtolower($use_legacyauth) !== 'false',
23-
'concurrency' => getenv('OBJECTSTORE_S3_CONCURRENCY') ?: '',
24-
'proxy' => getenv('OBJECTSTORE_S3_PROXY') ?: '',
25-
'timeout' => getenv('OBJECTSTORE_S3_TIMEOUT') ?: '',
26-
'uploadPartSize' => getenv('OBJECTSTORE_S3_UPLOADPARTSIZE') ?:'',
27-
'putSizeLimit' => getenv('OBJECTSTORE_S3_PUTSIZELIMIT') ?: '',
28-
'version' => getenv('OBJECTSTORE_S3_VERSION') ?: '',
29-
'verify_bucket_exists' => getenv('OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS') ?: ''
33+
'proxy' => strtolower($proxy) !== 'false',
34+
'version' => getenv('OBJECTSTORE_S3_VERSION') ?: 'latest',
35+
'verify_bucket_exists' => strtolower($verify_bucket_exists) !== 'true'
3036
)
3137
)
3238
);
3339

40+
if $concurrency {
41+
$CONFIG['objectstore']['arguments']['concurrency'] = $concurrency;
42+
}
43+
44+
if $timeout {
45+
$CONFIG['objectstore']['arguments']['timeout'] = $timeout;
46+
}
47+
48+
if $upload_part_size {
49+
$CONFIG['objectstore']['arguments']['uploadPartSize'] = $upload_part_size;
50+
}
51+
52+
if $put_size_limit {
53+
$CONFIG['objectstore']['arguments']['putSizeLimit'] = $put_size_limit;
54+
}
55+
56+
if $copy_size_limit {
57+
$CONFIG['objectstore']['arguments']['copySizeLimit'] = $copy_size_limit;
58+
}
59+
3460
if (getenv('OBJECTSTORE_S3_KEY_FILE')) {
3561
$CONFIG['objectstore']['arguments']['key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_KEY_FILE')));
3662
} elseif (getenv('OBJECTSTORE_S3_KEY')) {

README.md

+23-21
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Most Nextcloud Server administrative matters are covered in the official [Nextcl
3131
[![Discourse Users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)
3232
[![Discourse Posts](https://img.shields.io/discourse/posts?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)
3333

34-
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they are bugs of course). This helps the
35-
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
34+
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they are bugs of course). This helps the
35+
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
3636
on the [community help forum](https://help.nextcloud.com/).)
3737

3838
For the image specifically, we provide [some simple deployment examples](https://github.com/nextcloud/docker/?tab=readme-ov-file#running-this-image-with-docker-compose) as well as some more extensive [deployment examples](https://github.com/nextcloud/docker/tree/master/.examples). In addition, the [community help forum](https://help.nextcloud.com/) has a "how-to" section with further examples of other peoples' container based Nextcloud stacks.
@@ -172,11 +172,11 @@ The `--private` flag can also be specified, in order to output all configuration
172172

173173
## Auto configuration via environment variables
174174

175-
The Nextcloud image supports auto configuration of the Nextcloud Server installation via environment variables. You can preconfigure everything that would otherwise be prompted for by the Nextcloud Installation Wizard (as well as a few other key parameters relevant to initial installation).
175+
The Nextcloud image supports auto configuration of the Nextcloud Server installation via environment variables. You can preconfigure everything that would otherwise be prompted for by the Nextcloud Installation Wizard (as well as a few other key parameters relevant to initial installation).
176176

177177
### Database parameters
178178

179-
To enable auto configuration, define your database connection via the following environment variables. If you set any group of values (i.e. all of `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_HOST`), they will not be requested via the Installation Wizard on first run.
179+
To enable auto configuration, define your database connection via the following environment variables. If you set any group of values (i.e. all of `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_HOST`), they will not be requested via the Installation Wizard on first run.
180180

181181
You must specify all of the environment variables for a given database or the database environment variables defaults to SQLITE. ONLY use one database type!
182182

@@ -259,8 +259,8 @@ Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/adm
259259

260260
### Object Storage (Primary Storage)
261261

262-
By default, Nextcloud stores all files in `/var/www/html/data/` (or whatever custom data directory you've configured). Nextcloud also allows the use of object storages (like OpenStack
263-
Swift or any Amazon S3-compatible implementation) as *Primary Storage*. This semi-replaces the default storage of files in the data directory. Note: This data directory might still be
262+
By default, Nextcloud stores all files in `/var/www/html/data/` (or whatever custom data directory you've configured). Nextcloud also allows the use of object storages (like OpenStack
263+
Swift or any Amazon S3-compatible implementation) as *Primary Storage*. This semi-replaces the default storage of files in the data directory. Note: This data directory might still be
264264
used for compatibility reasons and still needs to exist. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html) for more information.
265265

266266
To use an external S3 compatible object store as primary storage, set the following variables:
@@ -277,13 +277,15 @@ To use an external S3 compatible object store as primary storage, set the follow
277277
- `OBJECTSTORE_S3_OBJECT_PREFIX` (default: `urn:oid:`): Prefix to prepend to the fileid
278278
- `OBJECTSTORE_S3_AUTOCREATE` (default: `true`): Create the container if it does not exist
279279
- `OBJECTSTORE_S3_SSE_C_KEY` (not set by default): Base64 encoded key with a maximum length of 32 bytes for server side encryption (SSE-C)
280-
- `OBJECTSTORE_S3_CONCURRENCY` (default: `''`) defines the maximum number of concurrent multipart uploads
281-
- `OBJECTSTORE_S3_PROXY` (default: `''`)
282-
- `OBJECTSTORE_S3_TIMEOUT` (default: `''`)
283-
- `OBJECTSTORE_S3_UPLOADPARTSIZE` (default: `''`)
284-
- `OBJECTSTORE_S3_PUTSIZELIMIT` (default: `''`)
285-
- `OBJECTSTORE_S3_VERSION` (default: `''`)
286-
- `OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS` (default: `''`)
280+
- `OBJECTSTORE_S3_CONCURRENCY` defines the maximum number of concurrent multipart uploads
281+
- `OBJECTSTORE_S3_PROXY` (default: `false`)
282+
- `OBJECTSTORE_S3_TIMEOUT` (not set by default)
283+
- `OBJECTSTORE_S3_UPLOADPARTSIZE` (not set by default)
284+
- `OBJECTSTORE_S3_PUTSIZELIMIT` (not set by default)
285+
- `OBJECTSTORE_S3_USEMULTIPARTCOPY` (default: `false`)
286+
- `OBJECTSTORE_S3_COPYSIZELIMIT` (not set by default)
287+
- `OBJECTSTORE_S3_VERSION` (default: `latest`)
288+
- `OBJECTSTORE_S3_VERIFY_BUCKET_EXISTS` (default: `true`) Setting this to `false` after confirming the bucket has been created may provide a performance benefit, but may not be possible in multibucket scenarios.
287289

288290
Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) for more information.
289291

@@ -496,9 +498,9 @@ Then run `docker compose up -d`, now you can access Nextcloud at http://localhos
496498

497499
# Docker Secrets
498500

499-
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to some the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/<secret_name>` files.
501+
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to some the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/<secret_name>` files.
500502

501-
Currently, this is only supported for `NEXTCLOUD_ADMIN_PASSWORD`, `NEXTCLOUD_ADMIN_USER`, `MYSQL_DATABASE`, `MYSQL_PASSWORD`, `MYSQL_USER`, `POSTGRES_DB`, `POSTGRES_PASSWORD`, `POSTGRES_USER`, `REDIS_HOST_PASSWORD`, `SMTP_PASSWORD`, `OBJECTSTORE_S3_KEY`, and `OBJECTSTORE_S3_SECRET`.
503+
Currently, this is only supported for `NEXTCLOUD_ADMIN_PASSWORD`, `NEXTCLOUD_ADMIN_USER`, `MYSQL_DATABASE`, `MYSQL_PASSWORD`, `MYSQL_USER`, `POSTGRES_DB`, `POSTGRES_PASSWORD`, `POSTGRES_USER`, `REDIS_HOST_PASSWORD`, `SMTP_PASSWORD`, `OBJECTSTORE_S3_KEY`, and `OBJECTSTORE_S3_SECRET`.
502504

503505
If you set any group of `_FILE` based values (i.e. all of `MYSQL_DATABASE_FILE`, `MYSQL_USER_FILE`, `MYSQL_PASSWORD_FILE`), their non-`_FILE` counterparts will be ignored (`MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`).
504506

@@ -577,7 +579,7 @@ We recommend using a reverse proxy in front of your Nextcloud installation. Your
577579
In our [examples](https://github.com/nextcloud/docker/tree/master/.examples) section we have an example for a fully automated setup using a reverse proxy, a container for [Let's Encrypt](https://letsencrypt.org/) certificate handling, database and Nextcloud. It uses the popular [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [acme-companion](https://github.com/nginx-proxy/acme-companion) containers. Please check the according documentations before using this setup.
578580

579581
# First use
580-
When you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account username, password and the database connection (unless of course you've provided all the necessary auto-config config values ahead of time).
582+
When you first access your Nextcloud, the setup wizard will appear and ask you to choose an administrator account username, password and the database connection (unless of course you've provided all the necessary auto-config config values ahead of time).
581583

582584
For the database use `db` as host and `nextcloud` as table and user name. Also enter the password you chose in your `compose.yaml` file.
583585

@@ -734,7 +736,7 @@ You're already using Nextcloud and want to switch to docker? Great! Here are som
734736

735737
## Migrating from a non-Alpine image to an Alpine image
736738

737-
If you already use one of our non-Alpine images, but want to switch to an Alpine-based image, you may experience permissions problems with your existing volumes. This is because the Alpine images uses a different user ID for `www-data`.
739+
If you already use one of our non-Alpine images, but want to switch to an Alpine-based image, you may experience permissions problems with your existing volumes. This is because the Alpine images uses a different user ID for `www-data`.
738740
So, you must change the ownership of the `/var/www/html` (or `$NEXTCLOUD_DATA_DIR`) folder to be compatible with Alpine:
739741

740742
```console
@@ -745,9 +747,9 @@ After changing the permissions, restart the container and the permission errors
745747

746748
# Reporting bugs or suggesting enhancements
747749

748-
If you believe you've found a bug in the image itself (or have an enhancement idea specific to the image), please [search for already reported bugs and enhancement ideas](https://github.com/nextcloud/docker/issues).
750+
If you believe you've found a bug in the image itself (or have an enhancement idea specific to the image), please [search for already reported bugs and enhancement ideas](https://github.com/nextcloud/docker/issues).
749751

750-
If there is a relevant existing open issue, you can either add to the discussion there or upvote it to indicate you're impacted by (or interested in) the same issue.
752+
If there is a relevant existing open issue, you can either add to the discussion there or upvote it to indicate you're impacted by (or interested in) the same issue.
751753

752754
If you believe you've found a new bug, please create a new Issue so that others can try to reproduce it and remediation can be tracked.
753755

@@ -756,8 +758,8 @@ If you believe you've found a new bug, please create a new Issue so that others
756758
![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/enhancement?style=flat&label=Enhancement%20Ideas&color=green)
757759
![GitHub Issues or Pull Requests by label](https://img.shields.io/github/issues/nextcloud/docker/good%20first%20issue?style=flat&label=Good%20First%20Issues)
758760

759-
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they really are bugs of course). This helps the
760-
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
761+
**If you have any problems or usage questions while using the image, please ask for assistance on the [Nextcloud Community Help Forum](https://help.nextcloud.com)** rather than reporting them as "bugs" (unless they really are bugs of course). This helps the
762+
maintainers (who are volunteers) remain focused on making the image better (rather than responding solely to one-on-one support issues). (Tip: Some of the maintainers are also regular responders to help requests
761763
on the [Nextcloud Community Help Forum](https://help.nextcloud.com).)
762764

763765
[![Discourse Users](https://img.shields.io/discourse/users?server=https%3A%2F%2Fhelp.nextcloud.com&label=Community%20Forum&color=blue&link=https%3A%2F%2Fhelp.nextcloud.com%2F)](https://help.nextcloud.com/)

0 commit comments

Comments
 (0)