From b103e6d49aade658ebeabe8c21ef172b8bd72202 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 2 Aug 2020 20:39:27 +0200 Subject: nextcloud: Adding cron timer. --- ansible/plays/malabaricus.yml | 67 ++++++++++++++++++++-- .../nginx/malabaricus/snippets/nextcloud.conf | 3 +- ansible/roles/minio-server/tasks/main.yml | 4 +- 3 files changed, 65 insertions(+), 9 deletions(-) (limited to 'ansible') diff --git a/ansible/plays/malabaricus.yml b/ansible/plays/malabaricus.yml index 6e6a9a4..7e54c76 100644 --- a/ansible/plays/malabaricus.yml +++ b/ansible/plays/malabaricus.yml @@ -1,15 +1,24 @@ - hosts: - malabaricus - tags: nextcloud become: yes vars: fpm_version: 7.3 handlers: + - name: systemctl daemon-reload + become: yes + systemd: + daemon_reload: yes + - name: systemctl restart fpm become: yes systemd: name: "php{{ fpm_version }}-fpm" state: restarted + - name: systemctl reload nextcloud-cron.timer + become: yes + systemd: + unit: nextcloud-cron.timer + state: reloaded roles: - minio-server - role: nginx @@ -23,13 +32,15 @@ - apt: name: - php-imagick - tags: packages - - file: + tags: packages,never + - tags: nextcloud + file: path: /var/www/html/nextcloud/occ mode: ug=rx,o= owner: www-data group: www-data - - copy: + - tags: nextcloud + copy: dest: '/etc/php/{{ fpm_version }}/fpm/conf.d/99-nextcloud.ini' content: | opcache.enable=1 @@ -40,9 +51,10 @@ opcache.save_comments=1 opcache.revalidate_freq=1 - max_execution_time = 300 + client_max_body_size 10G; notify: systemctl restart fpm - - lineinfile: + - tags: nextcloud + lineinfile: path: '/etc/php/{{ fpm_version }}/fpm/pool.d/www.conf' regexp: '^env\[{{ item.key }}\]' line: 'env[{{ item.key }}] = {{ item.value }}' @@ -54,4 +66,47 @@ TEMP: /tmp notify: systemctl restart fpm + - tags: nextcloud + register: service + copy: + dest: /etc/systemd/system/nextcloud-cron.service + content: | + [Unit] + Description=Nextcloud cron.php job + + [Service] + User=www-data + ExecStart=/usr/bin/php -f /var/www/html/nextcloud/cron.php + + - tags: nextcloud + register: timer + copy: + dest: /etc/systemd/system/nextcloud-cron.timer + content: | + [Unit] + Description=Run Nextcloud cron.php every 5 minutes + + [Timer] + OnBootSec=5min + OnUnitActiveSec=5min + Unit=nextcloud-cron.service + + [Install] + WantedBy=timers.target + + - name: systemctl daemon-reload + tags: nextcloud + when: timer.changed or service.changed + become: yes + systemd: + daemon_reload: yes + + - name: systemctl enable --now nextcloud-cron.timer + tags: nextcloud + become: yes + systemd: + unit: nextcloud-cron.timer + enabled: yes + state: started + # TODO: comply with warnings from https://malabaricus.trygvis.io/settings/admin/overview diff --git a/ansible/plays/templates/nginx/malabaricus/snippets/nextcloud.conf b/ansible/plays/templates/nginx/malabaricus/snippets/nextcloud.conf index 16c7d0b..c2a5b8c 100644 --- a/ansible/plays/templates/nginx/malabaricus/snippets/nextcloud.conf +++ b/ansible/plays/templates/nginx/malabaricus/snippets/nextcloud.conf @@ -24,8 +24,9 @@ location ~ ^/.well-known/acme-challenge { } # set max upload size -client_max_body_size 512M; +client_max_body_size 10G; fastcgi_buffers 64 4K; +fastcgi_read_timeout 3600; # Enable gzip but do not remove ETag headers gzip on; diff --git a/ansible/roles/minio-server/tasks/main.yml b/ansible/roles/minio-server/tasks/main.yml index b94b00a..76a84b7 100644 --- a/ansible/roles/minio-server/tasks/main.yml +++ b/ansible/roles/minio-server/tasks/main.yml @@ -66,6 +66,6 @@ become: yes systemd: service: minio - state: restarted - enabled: yes + state: stopped + enabled: no daemon_reload: yes -- cgit v1.2.3