summaryrefslogtreecommitdiff
path: root/roles/apps/nextcloud/instance/templates/pod-spec-with-mariadb.yml.j2
blob: c1a4f2ea7bec11c8f488c696dfd3387793002d70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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].publish.hostnames | join(' ') }}"
  - 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
  - name: tls
    mountPath: /etc/ssl/publish
    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"
  env:
  - name: MARIADB_AUTO_UPGRADE
    value: "true"
  - name: MARIADB_DISABLE_UPGRADE_BACKUP
    value: "true"
{% if 'new' in nextcloud_instances[nextcloud_instance] and nextcloud_instances[nextcloud_instance].new %}
  - name: MARIADB_RANDOM_ROOT_PASSWORD
    value: "true"
  - name: MARIADB_DATABASE
    value: nextcloud
  - name: MARIADB_USER
    value: nextcloud
  - name: MARIADB_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: tls
  hostPath:
    path: "{{ nextcloud_instance_basepath }}/tls/"
    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