Add basic nextcloud deployment
Uses php-fpm image and is served through a simple caddy server. Automatically deploys by default and can be automatically deployed with smtp e-mail sending and s3 primary object storage optionally if desired. Utilizes some necessary hackery for container ordering and startup so startup is relatively slow (takes around 2-5 minutes at least) but once running should be stable and uninterrupted. Implements health-checks for all involved containers. Switch apache for php-fpm image
This commit is contained in:
parent
f2d85471b2
commit
f2e709590b
13 changed files with 532 additions and 0 deletions
53
roles/nextcloud/handlers/main.yml
Normal file
53
roles/nextcloud/handlers/main.yml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
## Register reverse proxy
|
||||
- name: Ensure upstream directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ nextcloud_upstream_file_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
become: yes
|
||||
listen: "update nextcloud upstream"
|
||||
|
||||
- name: Update upstream template
|
||||
ansible.builtin.template:
|
||||
src: upstream.json.j2
|
||||
dest: "{{ nextcloud_upstream_file_dir }}/upstream.json"
|
||||
become: yes
|
||||
listen: "update nextcloud upstream"
|
||||
|
||||
# figure out if upstream id exists
|
||||
- name: check {{ stack_name }} upstream
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl localhost:2019/id/{{ stack_name }}_upstream/
|
||||
changed_when: False
|
||||
register: result
|
||||
become: yes
|
||||
listen: "update nextcloud upstream"
|
||||
|
||||
# upstream already exists, patch it
|
||||
- name: remove old {{ stack_name }} upstream
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl -X DELETE localhost:2019/id/{{ stack_name }}_upstream/
|
||||
become: yes
|
||||
when: (result.stdout | from_json)['error'] is not defined
|
||||
listen: "update nextcloud upstream"
|
||||
|
||||
# upstream has to be created
|
||||
- name: add {{ stack_name }} upstream
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl -X POST -H "Content-Type: application/json" -d @{{ nextcloud_upstream_file_dir }}/upstream.json localhost:2019/config/apps/http/servers/{{ (nextcloud_use_https == True) | ternary(caddy_https_server_name, caddy_http_server_name) }}/routes/0/
|
||||
become: yes
|
||||
listen: "update nextcloud upstream"
|
||||
|
||||
- name: Ensure upstream directory is gone again
|
||||
ansible.builtin.file:
|
||||
path: "{{ nextcloud_upstream_file_dir }}"
|
||||
state: absent
|
||||
become: yes
|
||||
listen: "update nextcloud upstream"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue