This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
pi-ansible/roles/docker_services/tasks/services/nextcloud.yml

105 lines
3.1 KiB
YAML

# vim: ft=yaml.ansible
---
- name: Create Nextcloud volume directories
file:
name: "{{ services.nextcloud.volume }}/{{ dir.name }}"
owner: "{{ dir.owner | default('root') }}"
mode: "{{ dir.mode | default('u=rwx,g=rx,o=rx') }}"
state: directory
loop:
- name: apache2
- name: app
- name: postgres
owner: '70'
mode: u=rwx,go=
loop_control:
loop_var: dir
- name: Copy Apache2 config files
copy:
src: nextcloud/apache2/{{ file }}
dest: "{{ services.nextcloud.volume }}/apache2/{{ file }}"
owner: root
mode: u=rw,g=r,o=r
loop:
- apache2.conf
- remoteip.conf
loop_control:
loop_var: file
- name: Deploy Nextcloud with Docker Compose
docker_compose:
project_name: nextcloud
pull: true
definition:
version: '3.8'
services:
postgres:
image: postgres:{{ services.nextcloud.postgres_version }}
restart: always
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: "{{ secrets.nextcloud.postgres_pw }}"
volumes:
- "{{ services.nextcloud.volume }}/postgres:/var/lib/postgresql/data:rw"
redis:
image: redis:{{ services.nextcloud.redis_version }}
restart: always
command: redis-server --requirepass {{ secrets.nextcloud.redis_pw }}
tmpfs:
- /var/lib/redis
app:
image: nextcloud:{{ services.nextcloud.version }}
restart: always
environment:
POSTGRES_HOST: postgres
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: "{{ secrets.nextcloud.postgres_pw }}"
REDIS_HOST: redis
REDIS_HOST_PASSWORD: "{{ secrets.nextcloud.redis_pw }}"
MAIL_FROM_ADDRESS: noreply
MAIL_DOMAIN: "{{ services.nextcloud.domain }}"
SMTP_AUTHTYPE: PLAIN
SMTP_HOST: postfix
SMTP_PORT: 587
TRUSTED_PROXIES: 172.16.3.2
OVERWRITEHOST: "{{ services.nextcloud.domain }}"
OVERWRITEPROTOCOL: https
OVERWRITECLIURL: https://{{ services.nextcloud.domain }}
NEXTCLOUD_INIT_LOCK: 'true'
PHP_MEMORY_LIMIT: 2G
PHP_UPLOAD_LIMIT: 16G
networks:
default:
postfix:
services:
aliases:
- nextcloud
volumes:
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
- "{{ services.nextcloud.volume }}/apache2/apache2.conf:/etc/apache2/apache2.conf:ro"
- "{{ services.nextcloud.volume }}/apache2/remoteip.conf:/etc/apache2/conf-enabled/remoteip.conf:ro"
depends_on:
- postgres
- redis
cron:
image: nextcloud:{{ services.nextcloud.version }}
restart: always
entrypoint: /cron.sh
volumes:
- "{{ services.nextcloud.volume }}/app:/var/www/html:rw"
depends_on:
- app
networks:
postfix:
external: true
services:
external: true