summaryrefslogtreecommitdiff
path: root/roles/apps/nextcloud/instance/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/apps/nextcloud/instance/templates')
-rw-r--r--roles/apps/nextcloud/instance/templates/apache-site.conf.j210
-rw-r--r--roles/apps/nextcloud/instance/templates/cron-.timer.j29
-rw-r--r--roles/apps/nextcloud/instance/templates/pod-spec-with-mariadb.yml.j2101
3 files changed, 120 insertions, 0 deletions
diff --git a/roles/apps/nextcloud/instance/templates/apache-site.conf.j2 b/roles/apps/nextcloud/instance/templates/apache-site.conf.j2
new file mode 100644
index 00000000..a52a7fc5
--- /dev/null
+++ b/roles/apps/nextcloud/instance/templates/apache-site.conf.j2
@@ -0,0 +1,10 @@
+<VirtualHost *:8080>
+ ServerAdmin webmaster@localhost
+ DocumentRoot /var/www/html
+
+ UseCanonicalName Off
+ UseCanonicalPhysicalPort Off
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+</VirtualHost>
diff --git a/roles/apps/nextcloud/instance/templates/cron-.timer.j2 b/roles/apps/nextcloud/instance/templates/cron-.timer.j2
new file mode 100644
index 00000000..eead0fd0
--- /dev/null
+++ b/roles/apps/nextcloud/instance/templates/cron-.timer.j2
@@ -0,0 +1,9 @@
+[Unit]
+Description=Nextcloud cron.php job timer for {{ nextcloud_instance }}
+
+[Timer]
+OnCalendar=*:{{ 5 | random(seed=nextcloud_instance) }}/5
+Unit=nextcloud-cron@{{ nextcloud_instance }}.service
+
+[Install]
+WantedBy=timers.target
diff --git a/roles/apps/nextcloud/instance/templates/pod-spec-with-mariadb.yml.j2 b/roles/apps/nextcloud/instance/templates/pod-spec-with-mariadb.yml.j2
new file mode 100644
index 00000000..b6c6137d
--- /dev/null
+++ b/roles/apps/nextcloud/instance/templates/pod-spec-with-mariadb.yml.j2
@@ -0,0 +1,101 @@
+securityContext:
+ allowPrivilegeEscalation: false
+containers:
+- name: nextcloud
+{# image: "nextcloud{% if 'custom_image' in nextcloud_instances[nextcloud_instance] %}/{{ nextcloud_instance }}{% endif %}:{{ nextcloud_instances[nextcloud_instance].version }}" #}
+ image: "nextcloud/{{ nextcloud_instance }}:{{ nextcloud_instances[nextcloud_instance].version }}"
+ securityContext:
+ runAsUser: {{ nextcloud_app_uid }}
+ runAsGroup: {{ nextcloud_app_gid }}
+ resources:
+ limits:
+ memory: "4Gi"
+{% if 'new' in nextcloud_instances[nextcloud_instance] and nextcloud_instances[nextcloud_instance].new %}
+ env:
+ - name: NEXTCLOUD_TRUSTED_DOMAINS
+ value: "{{ nextcloud_instances[nextcloud_instance].hostnames | join(' ') }}"
+ - name: OVERWRITEPROTOCOL
+ value: "https"
+ - name: MYSQL_HOST
+ value: 127.0.0.1
+ - name: MYSQL_DATABASE
+ value: nextcloud
+ - name: MYSQL_USER
+ value: nextcloud
+ - name: MYSQL_PASSWORD
+ value: "{{ nextcloud_instances[nextcloud_instance].database.password }}"
+{% endif %}
+ volumeMounts:
+ - name: nextcloud
+ mountPath: /var/www/html
+ - name: config
+ mountPath: /etc/apache2/sites-available/000-default.conf
+ subPath: apache-site.conf
+ readOnly: true
+ - name: config
+ mountPath: /etc/apache2/ports.conf
+ subPath: ports.conf
+ readOnly: true
+ ports:
+ - containerPort: 8080
+ hostPort: {{ nextcloud_instances[nextcloud_instance].port }}
+ hostIP: 127.0.0.1
+- name: redis
+ image: "redis:{{ nextcloud_instances[nextcloud_instance].redis.version }}"
+ args:
+ - --bind 127.0.0.1
+ securityContext:
+ runAsUser: {{ nextcloud_redis_uid }}
+ runAsGroup: {{ nextcloud_redis_gid }}
+ resources:
+ limits:
+ memory: "512Mi"
+ volumeMounts:
+ - name: redis
+ mountPath: /data
+- name: database
+ image: "mariadb:{{ nextcloud_instances[nextcloud_instance].database.version }}"
+ args:
+ - --transaction-isolation=READ-COMMITTED
+ - --log-bin=binlog
+ - --binlog-format=ROW
+{% for arg in (nextcloud_instances[nextcloud_instance].database.extra_args | default([])) %}
+ - {{ arg }}
+{% endfor %}
+ securityContext:
+ runAsUser: {{ nextcloud_db_uid }}
+ runAsGroup: {{ nextcloud_db_gid }}
+ resources:
+ limits:
+ memory: "2Gi"
+{% if 'new' in nextcloud_instances[nextcloud_instance] and nextcloud_instances[nextcloud_instance].new %}
+ env:
+ - name: MYSQL_RANDOM_ROOT_PASSWORD
+ value: "true"
+ - name: MYSQL_DATABASE
+ value: nextcloud
+ - name: MYSQL_USER
+ value: nextcloud
+ - name: MYSQL_PASSWORD
+ value: "{{ nextcloud_instances[nextcloud_instance].database.password }}"
+{% endif %}
+ volumeMounts:
+ - name: database
+ mountPath: /var/lib/mysql
+volumes:
+- name: config
+ hostPath:
+ path: "{{ nextcloud_instance_basepath }}/config/"
+ type: Directory
+- name: nextcloud
+ hostPath:
+ path: "{{ nextcloud_instance_basepath }}/nextcloud"
+ type: Directory
+- name: redis
+ hostPath:
+ path: "{{ nextcloud_instance_basepath }}/redis"
+ type: Directory
+- name: database
+ hostPath:
+ path: "{{ nextcloud_instance_basepath }}/{{ nextcloud_instances[nextcloud_instance].database.type }}"
+ type: Directory