fix: sets trusted_domains correctly #118

Open
stevensting wants to merge 5 commits from trusted-domains into main
3 changed files with 17 additions and 1 deletions
+2
View File
@@ -6,6 +6,8 @@ ENABLE_BACKUPS=true
DOMAIN=nextcloud.example.com
## Domain aliases
#EXTRA_DOMAINS=', `www.nextcloud.example.com`'
# space separated list of trusted domains, only evaluated on first startup
stevensting marked this conversation as resolved Outdated
Outdated
Review

Maybe make the comments a bit more elaborate on what they both do?

Update the EXTRA_DOMAINS comment to #Additional domains for Traefik to listen on. Comma-separated, backtick-quoted, e.g. ', `www.nextcloud.example.com`'

And the comment for EXTRA_DOMAINS_TRUSTED:

# Same domains as above, but for Nextcloud to trust, space separated: "www.nextcloud.example.com alt.example.com"
# Only applied on first install. For existing instances run: occ config:system:set trusted_domains <idx> --value=<domain>
Maybe make the comments a bit more elaborate on what they both do? Update the EXTRA_DOMAINS comment to ```#Additional domains for Traefik to listen on. Comma-separated, backtick-quoted, e.g. ', `www.nextcloud.example.com`'``` And the comment for EXTRA_DOMAINS_TRUSTED: ``` # Same domains as above, but for Nextcloud to trust, space separated: "www.nextcloud.example.com alt.example.com" # Only applied on first install. For existing instances run: occ config:system:set trusted_domains <idx> --value=<domain> ```
#EXTRA_DOMAINS_TRUSTED=cloud.coquest.coop
stevensting marked this conversation as resolved
Review

User the same alt example domain instead of coquest: www.nextcloud.example.com

User the same alt example domain instead of coquest: `www.nextcloud.example.com`
LETS_ENCRYPT_ENV=production
COMPOSE_FILE="compose.yml"
+14
View File
@@ -24,6 +24,20 @@ Fully automated luxury Nextcloud via docker-swarm.
* `abra app secret generate -a <app-name>`
* `abra app deploy <app-name>`
### Accessing nextcloud from multiple domains
If you want to access the nextcloud instance from multiple domains, add the additional domains by using both env vars:
```
EXTRA_DOMAINS=', `nextcloud.example2.com`' # comma separated, for traefik
EXTRA_DOMAINS_TRUSTED=nextcloud.example2.com # space separated, for nextcloud
```
`EXTRA_DOMAINS_TRUSTED` is only evaluated by nextcloud on the first install. If you want to add domains later, you need to run this command additionally:
```
abra app cmd nextcloud.example.com app run_occ '"config:system:set trusted_domains <index> --value="nextcloud.example2.com""'
```
The indices 0 and 1 are taken, start with 2 for the first extra domain.
### Onlyoffice Integration
First, install onlyoffice following the instructions in the
+1 -1
View File
@@ -70,7 +70,7 @@ services:
- STACK_NAME
- NEXTCLOUD_ADMIN_USER=${ADMIN_USER}
- NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/admin_password
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN}
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN} ${EXTRA_DOMAINS_TRUSTED}
stevensting marked this conversation as resolved
Review

I don't think this line is needed. EXTRA_DOMAINS_TRUSTED is already interpolated into NEXTCLOUD_TRUSTED_DOMAINS from .env at deploy time.

I don't think this line is needed. `EXTRA_DOMAINS_TRUSTED` is already interpolated into `NEXTCLOUD_TRUSTED_DOMAINS` from .env at deploy time.
- TRUSTED_PROXIES=10.0.0.0/8
stevensting marked this conversation as resolved Outdated
Outdated
Review

From the docker-entrypoint.sh of Nextcloud, it looks like NEXTCLOUD_TRUSTED_DOMAINS is only applied on the first install (installed_version = 0.0.0.0) and not during restarts or upgrades.

So on an existing instance, this env var alone won't update the list. Needs a manual occ config:system:set trusted_domains Maybe add that as a comment to the .env.sample?

From the [docker-entrypoint.sh](https://github.com/nextcloud/docker/blob/583fbe383cedb716c7e8483e03b4d476992c6a7e/docker-entrypoint.sh#L215-L280) of Nextcloud, it looks like `NEXTCLOUD_TRUSTED_DOMAINS` is only applied on the first install (`installed_version = 0.0.0.0`) and not during restarts or upgrades. So on an existing instance, this env var alone won't update the list. Needs a manual `occ config:system:set trusted_domains` Maybe add that as a comment to the .env.sample?
- REDIS_HOST=cache
- OVERWRITEPROTOCOL=https