10 Commits

Author SHA1 Message Date
  Robin Thoni 4ac1b8a62c README 4 years ago
  Robin Thoni 3ed42bc87a Modified Collabora env variables 4 years ago
  Robin Thoni 1293b8a6e0 Added TZ env variable 4 years ago
  Robin Thoni 4f86b1122b Ignore override test file 4 years ago
  Robin Thoni 13a8f6b56a Added Collabora 4 years ago
  Robin Thoni ec57693efa Fixed typos 4 years ago
  Robin Thoni c4f4cfd5c3 Renamed docker network 4 years ago
  Robin Thoni 3666dce728 Moved to nextcloud 16 4 years ago
  Robin Thoni 42ffde2a23 Moved to postgres 11 (official, no backup) 4 years ago
  Robin Thoni d5718e3186 Ignored idea files 4 years ago
9 changed files with 190 additions and 27 deletions
  1. 2
    0
      .gitignore
  2. 142
    0
      README.md
  3. 1
    0
      collabora/Dockerfile
  4. 32
    16
      docker-compose.yml
  5. 7
    9
      env
  6. 4
    0
      env_collabora
  7. 1
    0
      nextcloud/Dockerfile
  8. 0
    1
      owncloud/Dockerfile
  9. 1
    1
      postgresql/Dockerfile

+ 2
- 0
.gitignore View File

2
 *.swp
2
 *.swp
3
 env_override
3
 env_override
4
 docker-compose.override.yml
4
 docker-compose.override.yml
5
+env_collabora_override
6
+.idea

+ 142
- 0
README.md View File

1
+## Abstract
2
+
3
+This docker-compose allows to easily run a Nextcloud instance with Collabora.
4
+
5
+## Prerequisites for production use
6
+
7
+- Domain records:
8
+  - One record for Nextcloud (eg: `nextcloud.example.com`)
9
+  - One record for Collabora (eg: `collabora.example.com`)
10
+  - BOTH records must be (resolvable AND accessible) from (Nextcloud container AND Collabora container AND final users)
11
+- HTTPS for Nextcloud and Collabora (eg: [Let’s Encrypt](https://letsencrypt.org/))
12
+- Reverse proxy for SSL termination
13
+
14
+## Installation
15
+
16
+### Tweak files
17
+
18
+- `env`
19
+  - Set `TZ`
20
+    - 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))
21
+    - Example: `Europe/Paris`
22
+  - Generate secure password for `POSTGRES_PASSWORD`
23
+    - 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.
24
+    - Example: [passwordsgenerator.net](https://passwordsgenerator.net/)
25
+  - Generate secure password for `NEXTCLOUD_ADMIN_PASSWORD`
26
+    - 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.
27
+    - Example: [passwordsgenerator.net](https://passwordsgenerator.net/)
28
+
29
+- `env_collabora`
30
+  - Set `domain`
31
+    - Regexp for domain(s) allowed to used Collabora. It must match your Nextcloud domain.
32
+    - Example: `nextcloud\.example\.com` (Note the backslashes to escape the dots)
33
+  - Generate secure password for `password`
34
+    - Password to be set for Collabora admin panel (https://collabora.example.com/loleaflet/dist/admin/admin.html)
35
+    - Example: [passwordsgenerator.net](https://passwordsgenerator.net/)
36
+
37
+- `docker-compose.yml`
38
+  - Set restart policies
39
+    - Uncomment `restart` lines to allow docker to automatically start the containers on reboot.
40
+
41
+### Reverse proxy
42
+
43
+`/etc/apache2/sites-available/nextcloud.example.com.conf`:
44
+```
45
+<IfModule mod_ssl.c>
46
+    <VirtualHost *:80>
47
+        ServerName nextcloud.example.com
48
+        Redirect permanent / https://nextcloud.example.com/
49
+    </VirtualHost>
50
+    <VirtualHost *:443>
51
+        Include sites-available/nextcloud.example.com.include
52
+
53
+        SSLEngine on
54
+        SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
55
+        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
56
+        SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
57
+    </VirtualHost>
58
+</IfModule>
59
+<IfModule !mod_ssl.c>
60
+    <VirtualHost *:80>
61
+        Include sites-available/nextcloud.example.com.include
62
+    </VirtualHost>
63
+</IfModule>
64
+```
65
+
66
+`/etc/apache2/sites-available/nextcloud.example.com.include`:
67
+```
68
+ServerName nextcloud.example.com
69
+ServerAlias nextcloud.example.com
70
+ProxyPreserveHost On
71
+ProxyRequests off
72
+ProxyPass / http://127.0.0.1:35081/
73
+ProxyPassReverse / http://127.0.0.1:35081/
74
+
75
+```
76
+
77
+`/etc/apache2/sites-available/collabora.example.com.conf`:
78
+```
79
+<IfModule mod_ssl.c>
80
+    <VirtualHost *:80>
81
+        ServerName collabora.example.com
82
+        Redirect permanent / https://collabora.example.com/
83
+    </VirtualHost>
84
+    <VirtualHost *:443>
85
+        Include sites-available/collabora.example.com.include
86
+
87
+        SSLEngine on
88
+        SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
89
+        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
90
+        SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
91
+    </VirtualHost>
92
+</IfModule>
93
+<IfModule !mod_ssl.c>
94
+    <VirtualHost *:80>
95
+        Include sites-available/collabora.example.com.include
96
+    </VirtualHost>
97
+</IfModule>
98
+
99
+```
100
+
101
+`/etc/apache2/sites-available/collabora.example.com.include`:
102
+```
103
+ServerName collabora.example.com
104
+ServerAlias collabora.example.com
105
+ProxyPreserveHost On
106
+ProxyRequests off
107
+
108
+AllowEncodedSlashes NoDecode
109
+
110
+# Order of ProxyPass matters
111
+
112
+ProxyPassMatch "/lool/(.*)/ws$" ws://127.0.0.1:35082/lool/$1/ws nocanon
113
+ProxyPass   /lool/adminws ws://127.0.0.1:35082/lool/adminws
114
+
115
+ProxyPass / http://127.0.0.1:35082/
116
+ProxyPassReverse / http://127.0.0.1:35082/
117
+
118
+```
119
+
120
+### Run
121
+
122
+```
123
+docker-compose up --build -d
124
+```
125
+
126
+### Install Nextcloud integration app
127
+
128
+- Login on Nextcloud with `root` account
129
+- Go to Upper right `account picture` / `Apps` / Upper right `search` icon
130
+- Type `Collabora Online`
131
+- Click `Download and enable`
132
+- Wait for installation to finish
133
+- Go to Upper right `account picture` / `Settings` / Lower left `Collabora Online`
134
+- Set your Collabora URL (eg: `https://collabora.example.com`)
135
+- Click `Apply`
136
+- Go back to Files
137
+- Click `+`
138
+- Click `New Document`
139
+- Type a name
140
+- Validate
141
+- Click the newly created document
142
+- Enjoy

+ 1
- 0
collabora/Dockerfile View File

1
+FROM collabora/code

+ 32
- 16
docker-compose.yml View File

3
 services:
3
 services:
4
     postgresql:
4
     postgresql:
5
         build: ./postgresql
5
         build: ./postgresql
6
-        container_name: owncloud-postgresql
6
+        container_name: nextcloud-postgresql
7
 #        restart: unless-stopped
7
 #        restart: unless-stopped
8
         networks:
8
         networks:
9
-            owncloud.internal.docker:
9
+            main:
10
                 aliases:
10
                 aliases:
11
-                    - postgresql.owncloud.internal.docker
11
+                    - postgresql.main.internal.docker
12
         volumes:
12
         volumes:
13
             - ./data/postgresql/data:/var/lib/postgresql/data
13
             - ./data/postgresql/data:/var/lib/postgresql/data
14
-            - ./data/postgresql/backup:/var/lib/postgresql/backup
15
         ports:
14
         ports:
16
-            - "127.0.0.1:35080:5432"
15
+            - "127.0.0.1:3580:5432"
17
         env_file:
16
         env_file:
18
             - env
17
             - env
19
 
18
 
20
-    owncloud:
21
-        build: ./owncloud
22
-        container_name: owncloud-owncloud
19
+    nextcloud:
20
+        build: ./nextcloud
21
+        container_name: nextcloud-nextcloud
23
 #        restart: unless-stopped
22
 #        restart: unless-stopped
24
         networks:
23
         networks:
25
-            owncloud.internal.docker:
24
+            main:
26
                 aliases:
25
                 aliases:
27
-                    - owncloud.owncloud.internal.docker
26
+                    - nextcloud.main.internal.docker
28
         volumes:
27
         volumes:
29
-            - ./data/owncloud/apps:/var/www/html/apps
30
-            - ./data/owncloud/config:/var/www/html/config
31
-            - ./data/owncloud/data:/var/www/html/data
28
+            - ./data/nextcloud/apps:/var/www/html/apps
29
+            - ./data/nextcloud/config:/var/www/html/config
30
+            - ./data/nextcloud/data:/var/www/html/data
32
         ports:
31
         ports:
33
-          #- "127.0.0.1:35081:80"
34
-            - "0.0.0.0:35081:80"
32
+            - "127.0.0.1:35081:80"
33
+        environment:
34
+          - POSTGRES_DB=nextcloud
35
         env_file:
35
         env_file:
36
             - env
36
             - env
37
 
37
 
38
+    collabora:
39
+        build: ./collabora
40
+        container_name: nextcloud-collabora
41
+#        restart: unless-stopped
42
+        networks:
43
+            main:
44
+                aliases:
45
+                    - collabora.main.internal.docker
46
+        ports:
47
+            - "127.0.0.1:35082:9980"
48
+        cap_add:
49
+          - MKNOD
50
+        env_file:
51
+            - env
52
+            - env_collabora
53
+
38
 networks:
54
 networks:
39
-    owncloud.internal.docker:
55
+    main:

+ 7
- 9
env View File

1
-POSTGRES_MASTER_MODE=1
2
-POSTGRES_HOST=postgresql.owncloud.internal.docker
3
-POSTGRES_USER=owncloud
1
+TZ=Europe/London
2
+
3
+POSTGRES_USER=postgres
4
 POSTGRES_PASSWORD=change_it
4
 POSTGRES_PASSWORD=change_it
5
-POSTGRES_DB=owncloud
6
-POSTGRES_REP_USER=replicator
7
-POSTGRES_REP_PASSWORD=change_it
8
-POSTGRES_REP_ALLOWED_HOST=127.0.0.1/32
9
-POSTGRES_RO_USER=owncloud_ro
10
-POSTGRES_RO_PASSWORD=change_it
5
+POSTGRES_HOST=postgresql.main.internal.docker:5432
6
+
7
+NEXTCLOUD_ADMIN_USER=root
8
+NEXTCLOUD_ADMIN_PASSWORD=change_it

+ 4
- 0
env_collabora View File

1
+domain=collabora\.example\.com
2
+extra_params=--o:ssl.enable=false --o:ssl.termination=true
3
+username=root
4
+password=change_it

+ 1
- 0
nextcloud/Dockerfile View File

1
+FROM nextcloud:16.0-apache

+ 0
- 1
owncloud/Dockerfile View File

1
-FROM owncloud:10.0-apache

+ 1
- 1
postgresql/Dockerfile View File

1
-FROM robinthoni/postgres-backup-multiarch:9.6-1.1.0
1
+FROM postgres:11