Skip to content

Commit 38994cb

Browse files
tzerberJ0WI
andauthored
Documentation and examples update for use with docker compose v2 (#2201)
* Update examples section according to the latest docker compose requirements. Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Minor readme updates to match the changes for the compose v2 syntax. Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Fix wrong environment variable Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Add missing headers to fpm config Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Fix cache control Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Add mjs file extension in a proper way. Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Typos fixed, minor clarification changes Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Removed logging from compose files. Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Restored MariaDB to 10.6 as per docs suggestions Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Remove extra nginx volume Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Removed GH specific markdown from Readme, change mariadb to recommended version Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * typo Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Update .examples/docker-compose/with-nginx-proxy/postgres/apache/compose.yaml Signed-off-by: J0WI <J0WI@users.noreply.github.com> * Update to correct MariaDB command Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Updated compose files for mariadb to match current docs Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Update outdated docker-compose command in Readme Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Added back --log-bin to MariaDB command. See PR 1881 Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Remove wrongly added logging to Readme.MD Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> * Use proper name for --log-bin param Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> --------- Signed-off-by: Kaloyan Nikolov <tzerber@gmail.com> Signed-off-by: J0WI <J0WI@users.noreply.github.com> Co-authored-by: J0WI <J0WI@users.noreply.github.com>
1 parent 9ff7b6a commit 38994cb

14 files changed

Lines changed: 144 additions & 154 deletions

File tree

.examples/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ The following Dockerfile commands are also necessary for a sucessfull cron insta
6666

6767
## docker-compose
6868
In `docker-compose` additional services are bundled to create a complete nextcloud installation. The examples are designed to run out-of-the-box.
69-
Before running the examples you have to modify the `db.env` and `docker-compose.yml` file and fill in your custom information.
69+
Before running the examples you have to modify the `db.env` and `compose.yaml` file and fill in your custom information.
7070

71-
The docker-compose examples make heavily use of derived Dockerfiles to add configuration files into the containers. This way they should also work on remote docker systems as _Docker for Windows_. When running docker-compose on the same host as the docker daemon, another possibility would be to simply mount the files in the volumes section in the `docker-compose.yml` file.
71+
The docker compose examples make heavily use of derived Dockerfiles to add configuration files into the containers. This way they should also work on remote docker systems as _Docker for Windows_. When running docker compose on the same host as the docker daemon, another possibility would be to simply mount the files in the volumes section in the `compose.yaml` file.
7272

7373

7474
### insecure
@@ -78,10 +78,10 @@ For this use one of the [with-nginx-proxy](#with-nginx-proxy) examples.
7878

7979
To use this example complete the following steps:
8080

81-
1. if you use mariadb or mysql choose a root password for the database in `docker-compose.yml` behind `MYSQL_ROOT_PASSWORD=`
81+
1. if you use mariadb or mysql choose a root password for the database in `compose.yaml` behind `MYSQL_ROOT_PASSWORD=`
8282
2. choose a password for the database user nextcloud in `db.env` behind `MYSQL_PASSWORD=` (for mariadb/mysql) or `POSTGRES_PASSWORD=` (for postgres)
83-
3. run `docker-compose build --pull` to pull the most recent base images and build the custom dockerfiles
84-
4. start nextcloud with `docker-compose up -d`
83+
3. run `docker compose build --pull` to pull the most recent base images and build the custom dockerfiles
84+
4. start nextcloud with `docker compose up -d`
8585

8686

8787
If you want to update your installation to a newer version of nextcloud, repeat the steps 3 and 4.
@@ -97,13 +97,13 @@ This combination of the [nginxproxy/nginx-proxy](https://github.com/nginx-proxy/
9797

9898
To use this example complete the following steps:
9999

100-
1. open `docker-compose.yml`
100+
1. open `compose.yaml`
101101
1. insert your nextcloud domain behind `VIRTUAL_HOST=`and `LETSENCRYPT_HOST=`
102102
2. enter a valid email behind `LETSENCRYPT_EMAIL=`
103103
3. if you use mariadb or mysql choose a root password for the database behind `MYSQL_ROOT_PASSWORD=`
104104
2. choose a password for the database user nextcloud in `db.env` behind `MYSQL_PASSWORD=` (for mariadb/mysql) or `POSTGRES_PASSWORD=` (for postgres)
105-
3. run `docker-compose build --pull` to pull the most recent base images and build the custom dockerfiles
106-
4. start nextcloud with `docker-compose up -d`
105+
3. run `docker compose build --pull` to pull the most recent base images and build the custom dockerfiles
106+
4. start nextcloud with `docker compose up -d`
107107

108108

109109
If you want to update your installation to a newer version of nextcloud, repeat the steps 3 and 4.

.examples/docker-compose/insecure/mariadb/apache/docker-compose.yml renamed to .examples/docker-compose/insecure/mariadb/apache/compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
db:
53
image: mariadb:10.6

.examples/docker-compose/insecure/mariadb/fpm/docker-compose.yml renamed to .examples/docker-compose/insecure/mariadb/fpm/compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
db:
53
image: mariadb:10.6

.examples/docker-compose/insecure/mariadb/fpm/web/nginx.conf

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ events {
1212
http {
1313
include mime.types;
1414
default_type application/octet-stream;
15+
types {
16+
text/javascript mjs;
17+
}
1518

1619
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
1720
'$status $body_bytes_sent "$http_referer" '
@@ -30,7 +33,7 @@ http {
3033
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
3134
map $arg_v $asset_immutable {
3235
"" "";
33-
default "immutable";
36+
default ", immutable";
3437
}
3538

3639
#gzip on;
@@ -162,24 +165,16 @@ http {
162165
fastcgi_max_temp_file_size 0;
163166
}
164167

165-
# Javascript mimetype fixes for nginx
166-
# Note: The block below should be removed, and the js|mjs section should be
167-
# added to the block below this one. This is a temporary fix until Nginx
168-
# upstream fixes the js mime-type
169-
location ~* \.(?:js|mjs)$ {
170-
types {
171-
text/javascript js mjs;
172-
}
173-
default_type "text/javascript";
174-
try_files $uri /index.php$request_uri;
175-
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
176-
access_log off;
177-
}
178-
179168
# Serve static files
180-
location ~ \.(?:css|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
169+
location ~ \.(?:css|svg|js|mjs|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
181170
try_files $uri /index.php$request_uri;
182-
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
171+
add_header Cache-Control "public, max-age=15778463$asset_immutable";
172+
add_header Referrer-Policy "no-referrer" always;
173+
add_header X-Content-Type-Options "nosniff" always;
174+
add_header X-Frame-Options "SAMEORIGIN" always;
175+
add_header X-Permitted-Cross-Domain-Policies "none" always;
176+
add_header X-Robots-Tag "noindex, nofollow" always;
177+
add_header X-XSS-Protection "1; mode=block" always;
183178
access_log off; # Optional: Don't log access to assets
184179

185180
location ~ \.wasm$ {

.examples/docker-compose/insecure/postgres/apache/docker-compose.yml renamed to .examples/docker-compose/insecure/postgres/apache/compose.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
db:
53
image: postgres:alpine
@@ -41,4 +39,4 @@ services:
4139

4240
volumes:
4341
db:
44-
nextcloud:
42+
nextcloud:

.examples/docker-compose/insecure/postgres/fpm/docker-compose.yml renamed to .examples/docker-compose/insecure/postgres/fpm/compose.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
version: '3'
2-
31
services:
42
db:
53
image: postgres:alpine
64
restart: always
75
volumes:
8-
- db:/var/lib/postgresql/data:z
6+
- db:/var/lib/postgresql/data:Z
97
env_file:
108
- db.env
119

.examples/docker-compose/insecure/postgres/fpm/web/nginx.conf

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ events {
1212
http {
1313
include mime.types;
1414
default_type application/octet-stream;
15+
types {
16+
text/javascript mjs;
17+
}
1518

1619
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
1720
'$status $body_bytes_sent "$http_referer" '
@@ -30,7 +33,7 @@ http {
3033
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
3134
map $arg_v $asset_immutable {
3235
"" "";
33-
default "immutable";
36+
default ", immutable";
3437
}
3538

3639
#gzip on;
@@ -162,23 +165,16 @@ http {
162165
fastcgi_max_temp_file_size 0;
163166
}
164167

165-
# Javascript mimetype fixes for nginx
166-
# Note: The block below should be removed, and the js|mjs section should be
167-
# added to the block below this one. This is a temporary fix until Nginx
168-
# upstream fixes the js mime-type
169-
location ~* \.(?:js|mjs)$ {
170-
types {
171-
text/javascript js mjs;
172-
}
173-
try_files $uri /index.php$request_uri;
174-
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
175-
access_log off;
176-
}
177-
178168
# Serve static files
179-
location ~ \.(?:css|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
169+
location ~ \.(?:css|svg|js|mjs|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
180170
try_files $uri /index.php$request_uri;
181-
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
171+
add_header Cache-Control "public, max-age=15778463$asset_immutable";
172+
add_header Referrer-Policy "no-referrer" always;
173+
add_header X-Content-Type-Options "nosniff" always;
174+
add_header X-Frame-Options "SAMEORIGIN" always;
175+
add_header X-Permitted-Cross-Domain-Policies "none" always;
176+
add_header X-Robots-Tag "noindex, nofollow" always;
177+
add_header X-XSS-Protection "1; mode=block" always;
182178
access_log off; # Optional: Don't log access to assets
183179

184180
location ~ \.wasm$ {

.examples/docker-compose/with-nginx-proxy/mariadb/apache/docker-compose.yml renamed to .examples/docker-compose/with-nginx-proxy/mariadb/apache/compose.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
db:
53
image: mariadb:10.6
@@ -34,6 +32,10 @@ services:
3432
depends_on:
3533
- db
3634
- redis
35+
# Added proxy container dependency below.
36+
# It is unclear on when or why it happens, but sometimes NC manages to start before the proxy
37+
# and it breaks for whatever weird reason resulting in the need of manual proxy container restart.
38+
- proxy
3739
networks:
3840
- proxy-tier
3941
- default
@@ -55,18 +57,21 @@ services:
5557
- 80:80
5658
- 443:443
5759
labels:
58-
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
60+
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
5961
volumes:
60-
- certs:/etc/nginx/certs:z,ro
62+
- certs:/etc/nginx/certs:ro,z
6163
- vhost.d:/etc/nginx/vhost.d:z
6264
- html:/usr/share/nginx/html:z
65+
- dhparam:/etc/nginx/dhparam:z
6366
- /var/run/docker.sock:/tmp/docker.sock:z,ro
6467
networks:
6568
- proxy-tier
6669

6770
letsencrypt-companion:
6871
image: nginxproxy/acme-companion
6972
restart: always
73+
environment:
74+
- DEFAULT_EMAIL=
7075
volumes:
7176
- certs:/etc/nginx/certs:z
7277
- acme:/etc/acme.sh:z
@@ -100,6 +105,7 @@ volumes:
100105
acme:
101106
vhost.d:
102107
html:
108+
dhparam:
103109

104110
networks:
105111
proxy-tier:

.examples/docker-compose/with-nginx-proxy/mariadb/fpm/docker-compose.yml renamed to .examples/docker-compose/with-nginx-proxy/mariadb/fpm/compose.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
db:
53
image: mariadb:10.6
@@ -31,6 +29,7 @@ services:
3129
depends_on:
3230
- db
3331
- redis
32+
- proxy
3433

3534
web:
3635
build: ./web
@@ -64,7 +63,7 @@ services:
6463
- 80:80
6564
- 443:443
6665
labels:
67-
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
66+
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
6867
volumes:
6968
- certs:/etc/nginx/certs:z,ro
7069
- vhost.d:/etc/nginx/vhost.d:z
@@ -76,6 +75,8 @@ services:
7675
letsencrypt-companion:
7776
image: nginxproxy/acme-companion
7877
restart: always
78+
environment:
79+
- DEFAULT_EMAIL=
7980
volumes:
8081
- certs:/etc/nginx/certs:z
8182
- acme:/etc/acme.sh:z

.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ events {
1212
http {
1313
include mime.types;
1414
default_type application/octet-stream;
15+
types {
16+
text/javascript mjs;
17+
}
1518

1619
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
1720
'$status $body_bytes_sent "$http_referer" '
@@ -30,7 +33,7 @@ http {
3033
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
3134
map $arg_v $asset_immutable {
3235
"" "";
33-
default "immutable";
36+
default ", immutable";
3437
}
3538

3639
#gzip on;
@@ -162,23 +165,16 @@ http {
162165
fastcgi_max_temp_file_size 0;
163166
}
164167

165-
# Javascript mimetype fixes for nginx
166-
# Note: The block below should be removed, and the js|mjs section should be
167-
# added to the block below this one. This is a temporary fix until Nginx
168-
# upstream fixes the js mime-type
169-
location ~* \.(?:js|mjs)$ {
170-
types {
171-
text/javascript js mjs;
172-
}
173-
try_files $uri /index.php$request_uri;
174-
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
175-
access_log off;
176-
}
177-
178168
# Serve static files
179-
location ~ \.(?:css|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
169+
location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
180170
try_files $uri /index.php$request_uri;
181-
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
171+
add_header Cache-Control "public, max-age=15778463$asset_immutable";
172+
add_header Referrer-Policy "no-referrer" always;
173+
add_header X-Content-Type-Options "nosniff" always;
174+
add_header X-Frame-Options "SAMEORIGIN" always;
175+
add_header X-Permitted-Cross-Domain-Policies "none" always;
176+
add_header X-Robots-Tag "noindex, nofollow" always;
177+
add_header X-XSS-Protection "1; mode=block" always;
182178
access_log off; # Optional: Don't log access to assets
183179

184180
location ~ \.wasm$ {

0 commit comments

Comments
 (0)