From f343b26fe939688c8c8952bfd816f133fd348809 Mon Sep 17 00:00:00 2001 From: Mike Holloway Date: Thu, 4 Dec 2025 19:13:49 -0500 Subject: [PATCH] Using postgres fpm example from official git repo --- templates/docker-compose.yml.j2 | 109 ++++++++++++++++++++++---------- 1 file changed, 77 insertions(+), 32 deletions(-) diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 8f138fc..10fbf82 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -1,57 +1,102 @@ -version: '3.6' - services: - nextcloud: - image: nextcloud:stable-fpm + db: + image: postgres:alpine + restart: always + hostname: database + environment: + POSTGRES_DB: "nextcloud" + volumes: + - db:/var/lib/postgresql/data:Z + env_file: + - db.env + + redis: + image: redis:alpine + restart: always + + app: + image: nextcloud:fpm-alpine restart: always ports: - 9000:9000 env_file: - .webserver.env environment: - VIRTUAL_PROTO: "fastcgi" VIRTUAL_HOST: "{{ inventory_hostname | default('ansible_undefined_fact') }}" - VIRTUAL_ROOT: "/var/www/html/" - LETSENCRYPT_HOST: "{{ inventory_hostname | default('ansible_undefined_fact') }}" NEXTCLOUD_ADMIN_USER: "admin" POSTGRES_DB: "nextcloud" POSTGRES_USER: "postgres" POSTGRES_HOST: "database" NEXTCLOUD_TRUSTED_DOMAINS: "{{ inventory_hostname | default('ansible_undefined_fact') }}" - hostname: webserver - networks: - default: - aliases: - - "test-eqit.lan" volumes: - - ~/webroot:/var/www/html - - database: - image: postgres:latest - restart: always - hostname: database - env_file: - - .db.env + - ~/webroot:/var/www/html + # NOTE: The `volumes` config of the `cron` and `app` containers must match environment: - POSTGRES_DB: "nextcloud" - networks: - default: - aliases: - "nextcloud-db.lan" + - POSTGRES_HOST=db + - REDIS_HOST=redis + env_file: + - db.env + depends_on: + - db + - redis + - proxy - nginx-proxy: + # Note: Nginx is an external service. You can find more information about the configuration here: + # https://hub.docker.com/_/nginx/ + web: + image: nginx:alpine-slim + restart: always + volumes: + # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html + - ./web/nginx.conf:/etc/nginx/nginx.conf:ro + # NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing) + - ~/webroot:/var/www/html:z,ro + environment: + - VIRTUAL_HOST= + - LETSENCRYPT_HOST= + - LETSENCRYPT_EMAIL= + depends_on: + - app + networks: + - proxy-tier + - default + + cron: + image: nextcloud:fpm-alpine + restart: always + volumes: + - ~/webroot:/var/www/html + # NOTE: The `volumes` config of the `cron` and `app` containers must match + entrypoint: /cron.sh + depends_on: + - db + - redis + + # Note: Nginx-proxy is an external service. You can find more information about the configuration here: + # Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences. + # https://hub.docker.com/r/nginxproxy/nginx-proxy + proxy: + image: nginxproxy/nginx-proxy:alpine restart: unless-stopped ports: - 8080:8080 - 4443:4443 - image: nginxproxy/nginx-proxy:1.9-alpine - hostname: nginxproxy environment: HTTP_PORT: 8080 HTTPS_PORT: 4443 + labels: + - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" volumes: - - /run/user/1000/podman/podman.sock:/tmp/docker.sock:ro - - /home/nextcloud/nginx/certs:/etc/nginx/certs - - /home/nextcloud/nginx/challenges:/usr/share/nginx/html - - /home/nextcloud/nginx/vhost.d:/etc/nginx/vhost.d + - /home/{{ user.name }}/nginx/vhost.d:/etc/nginx/vhost.d + - /home/{{ user.name }}/nginx/certs:/etc/nginx/certs + - /run/user/1000/podman/podman.sock:/tmp/docker.sock:z,ro + networks: + - proxy-tier + + +volumes: + db: + +networks: + proxy-tier: