This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
omni-ansible/resources/docker-compose/nextcloud.yaml.j2

145 lines
3.8 KiB
Django/Jinja

---
version: "{{ omni_compose_version | string }}"
x-server-env: &server-env
NEXTCLOUD_DATA_DIR: /data/
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: {{ omni_compose_app_secrets.nextcloud.admin_password }}
NEXTCLOUD_TRUSTED_DOMAINS: localhost {{ inventory_hostname }} {{ omni_compose_apps.nextcloud.published.host }}
MYSQL_DATABASE: nextcloud
MYSQL_USER: root
MYSQL_PASSWORD: {{ omni_compose_app_secrets.nextcloud.database_password }}
MYSQL_HOST: database
REDIS_HOST: cache
PHP_MEMORY_LIMIT: "12G"
PHP_UPLOAD_LIMIT: "6G"
PHP_INI_SCAN_DIR: /usr/local/etc/php/conf.d:/var/www/html/
networks:
nextcloud:
name: nextcloud
driver: overlay
ipam:
driver: default
config:
- subnet: {{ omni_compose_apps.nextcloud.networks.main }}
volumes:
database:
name: datastore{{ omni_compose_apps.nextcloud.datastore }}/database
driver: glusterfs
data:
name: datastore/{{ omni_compose_apps.nextcloud.datastore }}/userdata
driver: glusterfs
config:
name: datastore{{ omni_compose_apps.nextcloud.datastore }}/config
driver: glusterfs
proxy:
name: datastore{{ omni_compose_apps.nextcloud.datastore }}/proxy
driver: glusterfs
services:
database:
image: mariadb:{{ omni_compose_apps.nextcloud.versions.database | default(omni_compose_apps.nextcloud.versions.default) }}
hostname: nextcloud-database
networks:
- nextcloud
volumes:
- type: volume
source: database
target: /var/lib/mysql
read_only: false
- type: volume
source: proxy
target: /etc/mysql/conf.d
read_only: true
environment:
MYSQL_ROOT_PASSWORD: {{ omni_compose_app_secrets.nextcloud.database_password }}
MYSQL_DATABASE: nextcloud
deploy:
replicas: 1
cache:
image: redis:{{ omni_compose_apps.nextcloud.versions.cache | default(omni_compose_apps.nextcloud.versions.default) }}
hostname: nextcloud-cache
networks:
- nextcloud
deploy:
replicas: 1
proxy:
image: nginx:{{ omni_compose_apps.nextcloud.versions.proxy | default(omni_compose_apps.nextcloud.versions.default) }}
hostname: nextcloud-proxy
networks:
- nextcloud
depends_on:
- server
ports:
- published: {{ omni_compose_apps.nextcloud.published.ports.80 }}
target: 80
protocol: tcp
mode: ingress
volumes:
- type: volume
source: config
target: /usr/share/nginx/nextcloud
read_only: true
- type: volume
source: proxy
target: /etc/nginx/conf.d
read_only: true
deploy:
replicas: 1
server:
image: nextcloud:{{ omni_compose_apps.nextcloud.versions.server | default(omni_compose_apps.nextcloud.versions.default) }}
hostname: nextcloud-server
user: "{{ omni_compose_apps.nextcloud.account.uid }}"
networks:
- nextcloud
depends_on:
- database
- cache
volumes:
- type: volume
source: data
target: /data
read_only: false
- type: volume
source: config
target: /var/www/html
read_only: false
environment: *server-env
deploy:
replicas: 1
cron:
image: nextcloud:{{ omni_compose_apps.nextcloud.versions.server | default(omni_compose_apps.nextcloud.versions.default) }}
command: php /var/www/html/cron.php
hostname: nextcloud-cron
user: "{{ omni_compose_apps.nextcloud.account.uid }}"
networks:
- nextcloud
depends_on:
- database
- cache
volumes:
- type: volume
source: data
target: /data
read_only: false
- type: volume
source: config
target: /var/www/html
read_only: false
environment: *server-env
deploy:
replicas: 1
restart_policy:
condition: any
delay: "4m"