## Abstract
This docker-compose allows to easily run a Nextcloud instance with Collabora.
## Prerequisites for production use
- Domain records:
- One record for Nextcloud (eg: `nextcloud.example.com`)
- One record for Collabora (eg: `collabora.example.com`)
- BOTH records must be (resolvable AND accessible) from (Nextcloud container AND Collabora container AND final users)
- HTTPS for Nextcloud and Collabora (eg: [Let’s Encrypt](https://letsencrypt.org/))
- Reverse proxy for SSL termination
## Installation
### Tweak files
- `env`
- Set `TZ`
- The timezone to be used in the container (See [List_of_tz_database_time_zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones))
- Example: `Europe/Paris`
- Generate secure password for `POSTGRES_PASSWORD`
- Password to be set (and used) for the Nextcloud database user. It will only be set when postgres files (`./data/postgres/data/...`) are created. Any further change won't update it.
- Example: [passwordsgenerator.net](https://passwordsgenerator.net/)
- Generate secure password for `NEXTCLOUD_ADMIN_PASSWORD`
- Password to be set for Nextcloud `root` user. It will only be set when Nextcloud will install itself. Any further change won't update it.
- Example: [passwordsgenerator.net](https://passwordsgenerator.net/)
- `env_collabora`
- Set `domain`
- Regexp for domain(s) allowed to used Collabora. It must match your Nextcloud domain.
- Example: `nextcloud\.example\.com` (Note the backslashes to escape the dots)
- Generate secure password for `password`
- Password to be set for Collabora admin panel (https://collabora.example.com/loleaflet/dist/admin/admin.html)
- Example: [passwordsgenerator.net](https://passwordsgenerator.net/)
- `docker-compose.yml`
- Set restart policies
- Uncomment `restart` lines to allow docker to automatically start the containers on reboot.
### Reverse proxy
`/etc/apache2/sites-available/nextcloud.example.com.conf`:
```
ServerName nextcloud.example.com
Redirect permanent / https://nextcloud.example.com/
Include sites-available/nextcloud.example.com.include
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
Include sites-available/nextcloud.example.com.include
```
`/etc/apache2/sites-available/nextcloud.example.com.include`:
```
ServerName nextcloud.example.com
ServerAlias nextcloud.example.com
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://127.0.0.1:35081/
ProxyPassReverse / http://127.0.0.1:35081/
```
`/etc/apache2/sites-available/collabora.example.com.conf`:
```
ServerName collabora.example.com
Redirect permanent / https://collabora.example.com/
Include sites-available/collabora.example.com.include
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
Include sites-available/collabora.example.com.include
```
`/etc/apache2/sites-available/collabora.example.com.include`:
```
ServerName collabora.example.com
ServerAlias collabora.example.com
ProxyPreserveHost On
ProxyRequests off
AllowEncodedSlashes NoDecode
# Order of ProxyPass matters
ProxyPassMatch "/lool/(.*)/ws$" ws://127.0.0.1:35082/lool/$1/ws nocanon
ProxyPass /lool/adminws ws://127.0.0.1:35082/lool/adminws
ProxyPass / http://127.0.0.1:35082/
ProxyPassReverse / http://127.0.0.1:35082/
```
### Run
```
docker-compose up --build -d
```
### Install Nextcloud integration app
- Login on Nextcloud with `root` account
- Go to Upper right `account picture` / `Apps` / Upper right `search` icon
- Type `Collabora Online`
- Click `Download and enable`
- Wait for installation to finish
- Go to Upper right `account picture` / `Settings` / Lower left `Collabora Online`
- Set your Collabora URL (eg: `https://collabora.example.com`)
- Click `Apply`
- Go back to Files
- Click `+`
- Click `New Document`
- Type a name
- Validate
- Click the newly created document
- Enjoy