mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
Optimized docker nextcloud for backup
This commit is contained in:
parent
3ed6e3b49d
commit
e09d5022db
@ -71,3 +71,5 @@ To use occ run:
|
||||
- https://help.nextcloud.com/t/update-to-22-failed-with-database-error-updated/120682
|
||||
- https://help.nextcloud.com/t/nc-update-to-21-0-0-beta1-exception-database-error/101124/4
|
||||
- https://wolfgang.gassler.org/reset-password-mariadb-mysql-docker/
|
||||
- https://unix.stackexchange.com/questions/478855/ansible-docker-container-and-depends-on
|
||||
- https://github.com/gdiepen/docker-convenience-scripts
|
||||
|
5
roles/docker-nextcloud/handlers/main.yml
Normal file
5
roles/docker-nextcloud/handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: recreate nextcloud
|
||||
command:
|
||||
cmd: docker-compose -p nextcloud up -d --force-recreate
|
||||
chdir: /usr/local/bin/nextcloud/
|
@ -6,6 +6,7 @@
|
||||
template: src=templates/nextcloud.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
|
||||
notify: restart nginx
|
||||
|
||||
# @todo rename
|
||||
- name: "create /usr/local/bin/docker-nextcloud/"
|
||||
file:
|
||||
path: "/usr/local/bin/docker-nextcloud"
|
||||
@ -16,59 +17,13 @@
|
||||
template: src=templates/nginx.conf.j2 dest=/usr/local/bin/docker-nextcloud/nginx.conf
|
||||
notify: restart nginx
|
||||
|
||||
- name: "setup nextcloud"
|
||||
docker_compose:
|
||||
project_name: nextcloud
|
||||
definition:
|
||||
application:
|
||||
image: "nextcloud:{{nextcloud_version}}-fpm-alpine"
|
||||
restart: always
|
||||
log_driver: journald
|
||||
links:
|
||||
- database
|
||||
volumes:
|
||||
- nextcloud-data:/var/www/html
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 120
|
||||
DOCKER_CLIENT_TIMEOUT: 120
|
||||
MYSQL_DATABASE: "nextcloud"
|
||||
MYSQL_USER: "nextcloud"
|
||||
MYSQL_PASSWORD: "{{nextcloud_database_password}}"
|
||||
MYSQL_HOST: database:3306
|
||||
database:
|
||||
log_driver: journald
|
||||
image: mariadb
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 120
|
||||
DOCKER_CLIENT_TIMEOUT: 120
|
||||
MYSQL_DATABASE: "nextcloud"
|
||||
MYSQL_USER: "nextcloud"
|
||||
MYSQL_PASSWORD: "{{nextcloud_database_password}}"
|
||||
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
|
||||
volumes:
|
||||
- nextcloud-database:/var/lib/mysql
|
||||
restart: always
|
||||
web:
|
||||
image: nginx:alpine
|
||||
log_driver: journald
|
||||
restart: always
|
||||
ports:
|
||||
- "127.0.0.1:{{http_port}}:80"
|
||||
links:
|
||||
- application
|
||||
volumes:
|
||||
- /usr/local/bin/docker-nextcloud/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
volumes_from:
|
||||
- application
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: always
|
||||
cron:
|
||||
image: "nextcloud:{{nextcloud_version}}-fpm-alpine"
|
||||
restart: always
|
||||
volumes:
|
||||
- nextcloud-data:/var/www/html
|
||||
entrypoint: /cron.sh
|
||||
# depends_on:
|
||||
# - database
|
||||
# - redis
|
||||
# @todo rename
|
||||
- name: "create /usr/local/bin/nextcloud/"
|
||||
file:
|
||||
path: "/usr/local/bin/nextcloud"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: add docker-compose.yml
|
||||
template: src=docker-compose.yml.j2 dest=/usr/local/bin/nextcloud/docker-compose.yml
|
||||
notify: recreate nextcloud
|
||||
|
66
roles/docker-nextcloud/templates/docker-compose.yml.j2
Normal file
66
roles/docker-nextcloud/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,66 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
application:
|
||||
image: "nextcloud:{{nextcloud_version}}-fpm-alpine"
|
||||
restart: always
|
||||
logging:
|
||||
driver: journald
|
||||
depends_on:
|
||||
- database
|
||||
volumes:
|
||||
- data:/var/www/html
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 120
|
||||
DOCKER_CLIENT_TIMEOUT: 120
|
||||
MYSQL_DATABASE: "nextcloud"
|
||||
MYSQL_USER: "nextcloud"
|
||||
MYSQL_PASSWORD: "{{nextcloud_database_password}}"
|
||||
MYSQL_HOST: database:3306
|
||||
database:
|
||||
logging:
|
||||
driver: journald
|
||||
image: mariadb
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 120
|
||||
DOCKER_CLIENT_TIMEOUT: 120
|
||||
MYSQL_DATABASE: "nextcloud"
|
||||
MYSQL_USER: "nextcloud"
|
||||
MYSQL_PASSWORD: "{{nextcloud_database_password}}"
|
||||
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
|
||||
volumes:
|
||||
- database:/var/lib/mysql
|
||||
restart: always
|
||||
web:
|
||||
image: nginx:alpine
|
||||
logging:
|
||||
driver: journald
|
||||
restart: always
|
||||
ports:
|
||||
- "127.0.0.1:{{http_port}}:80"
|
||||
depends_on:
|
||||
- application
|
||||
volumes:
|
||||
- /usr/local/bin/docker-nextcloud/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
volumes_from:
|
||||
- application
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: always
|
||||
cron:
|
||||
image: "nextcloud:{{nextcloud_version}}-fpm-alpine"
|
||||
restart: always
|
||||
logging:
|
||||
driver: journald
|
||||
volumes:
|
||||
- data:/var/www/html
|
||||
entrypoint: /cron.sh
|
||||
depends_on:
|
||||
- database
|
||||
- redis
|
||||
volumes:
|
||||
database:
|
||||
data:
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
Loading…
Reference in New Issue
Block a user