11# Nextcloud AppAPI (HaRP) – Docker Compose Example
2- (FPM + Nginx + nginx-proxy-manager )
2+ (FPM + Nginx + nginx-proxy)
33
44> ** Warning**
55> This example is based on a working setup but differs from other examples. Review the differences carefully before adapting it to your environment.
66
77This document provides a minimal example of running the AppAPI container required for Nextcloud 32 or newer using Docker Compose.
88
9- The setup assumes:
10-
11- - ` nginx-proxy-manager ` as the external reverse proxy
12- - ` nginx ` + ` php-fpm ` (FPM variant of Nextcloud)
13- - A dedicated external proxy network
14-
15- This configuration differs from other examples because it uses a separate proxy network. Review the network definitions carefully before deploying.
16-
179This example must be significantly adapted if you intend to run Nextcloud with Apache.
1810
1911AppAPI requires Poetry. This example includes a modified Dockerfile that installs Poetry on top of the stable FPM image. It has been tested with:
@@ -63,9 +55,12 @@ This Dockerfile:
6355
6456``` yaml
6557services :
58+ # Note: PostgreSQL is an external service. You can find more information about the configuration here:
59+ # https://hub.docker.com/_/postgres
6660 db :
67- image : postgres:16-alpine
68- restart : unless-stopped
61+ image : postgres:18-alpine
62+ # Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server
63+ restart : always
6964 volumes :
7065 - db:/var/lib/postgresql/data:Z
7166 environment :
@@ -75,9 +70,9 @@ services:
7570
7671 app :
7772 build : ./
78- restart : unless-stopped
73+ restart : always
7974 volumes :
80- - nextcloud:/var/www/html
75+ - nextcloud:/var/www/html:Z
8176 - /var/run/docker.sock:/var/run/docker.sock
8277 networks :
8378 - default
@@ -92,34 +87,78 @@ services:
9287 - db
9388 - redis
9489
90+ # Note: Redis is an external service. You can find more information about the configuration here:
91+ # https://hub.docker.com/_/redis
9592 redis :
9693 image : redis:alpine
97- restart : unless-stopped
98-
94+ restart : always
95+
96+ # Note: Nginx is an external service. You can find more information about the configuration here:
97+ # https://hub.docker.com/_/nginx/
9998 web :
10099 image : nginx:alpine
101- restart : unless-stopped
100+ restart : always
102101 hostname : web
103102 volumes :
104- - nextcloud:/var/www/html:ro
103+ - nextcloud:/var/www/html:z, ro
105104 - ./nginx.conf:/etc/nginx/nginx.conf:ro # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
106- expose :
107- - 80
105+ environment :
106+ - VIRTUAL_HOST=
107+ - LETSENCRYPT_HOST=
108+ - LETSENCRYPT_EMAIL=
108109 depends_on :
109110 - app
110111 networks :
111112 - default
112- - proxy
113+ - proxy-tier
113114 - appapi
115+
116+ # Note: Nginx-proxy is an external service. You can find more information about the configuration here:
117+ # Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences.
118+ # https://hub.docker.com/r/nginxproxy/nginx-proxy
119+ proxy :
120+ build : ./proxy
121+ restart : always
122+ ports :
123+ - 80:80
124+ - 443:443
125+ labels :
126+ - " com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
127+ volumes :
128+ - certs:/etc/nginx/certs:z,ro
129+ - vhost.d:/etc/nginx/vhost.d:z
130+ - html:/usr/share/nginx/html:z
131+ - /var/run/docker.sock:/tmp/docker.sock:z,ro
132+ networks :
133+ - proxy-tier
134+
135+ # Note: Letsencrypt companion is an external service. You can find more information about the configuration here:
136+ # https://hub.docker.com/r/nginxproxy/acme-companion
137+ letsencrypt-companion :
138+ image : nginxproxy/acme-companion
139+ restart : always
140+ volumes :
141+ - certs:/etc/nginx/certs:z
142+ - acme:/etc/acme.sh:z
143+ - vhost.d:/etc/nginx/vhost.d:z
144+ - html:/usr/share/nginx/html:z
145+ - /var/run/docker.sock:/var/run/docker.sock:z,ro
146+ environment :
147+ - DEFAULT_EMAIL=
148+ networks :
149+ - proxy-tier
150+ depends_on :
151+ - proxy
114152
115153 cron :
116154 build : ./
117- restart : unless-stopped
155+ restart : always
118156 networks :
119157 - default
120158 - appapi
121159 volumes :
122- - nextcloud:/var/www/html
160+ - nextcloud:/var/www/html:z
161+ # NOTE: The `volumes` config of the `cron` and `app` containers must match
123162 entrypoint : /cron.sh
124163 depends_on :
125164 - db
@@ -132,18 +171,16 @@ services:
132171 privileged : true
133172 image : ghcr.io/nextcloud/nextcloud-appapi-harp:release
134173 networks :
135- - proxy
174+ - proxy-tier
136175 - appapi
137- restart : unless-stopped
176+ restart : always
138177 depends_on :
139178 - app
140- # env_file:
141- # - appapi.env
142179 environment :
143180 # NC_HAPROXY_PASSWORD needs to be at least 12 chars long. This variable exists for backward compatibility with the DSP image
144181 # ToDo: verify whether this variable is still required
145182 - NC_HAPROXY_PASSWORD=CHANGEME1234
146- # HP_SHARED_KEY needs to be at least 12 chars long.
183+ # HP_SHARED_KEY needs to be at least 12 chars long.
147184 - HP_SHARED_KEY=CHANGEME1234
148185 # NC_INSTANCE_URL must be the externally accessible URL of the Nextcloud instance
149186 - NC_INSTANCE_URL=https://external-nextcloud.url
@@ -153,14 +190,14 @@ services:
153190volumes :
154191 db :
155192 nextcloud :
193+ certs :
194+ acme :
195+ vhost.d :
196+ html :
156197
157198networks :
158- proxy : # This is an external network created for nginx-proxy-manager used by this setup. It must be edited to match your environment.
159- name : proxy-manager_proxy_network
160- external : true
161-
162- appapi : # This network is required in order for AppAPI to function correctly. Using "host" networking as in some examples may fail.
163- name : appapi_network
199+ proxy-tier :
200+ appapi :
164201` ` `
165202
166203---
0 commit comments