summaryrefslogtreecommitdiff
path: root/roles/apps/nextcloud/templates/pod-spec-with-mariadb.yml.j2
blob: a49bc3ea0e29b216cfb0e519a523006574d152ec (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
securityContext:
  allowPrivilegeEscalation: false
containers:
- name: nextcloud
{#  image: "nextcloud{% if 'custom_image' in item.value %}/{{ item.key }}{% endif %}:{{ item.value.version }}" #}
  image: "nextcloud/{{ item.key }}:{{ item.value.version }}"
  securityContext:
    runAsUser: {{ nextcloud_app_uid }}
    runAsGroup: {{ nextcloud_app_gid }}
  resources:
    limits:
      memory: "4Gi"
{% if 'new' in item.value and item.value.new %}
  env:
  - name: NEXTCLOUD_TRUSTED_DOMAINS
    value: "{{ item.value.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: "{{ item.value.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: {{ item.value.port }}
    hostIP: 127.0.0.1
- name: redis
  image: "redis:{{ item.value.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:{{ item.value.database.version }}"
  args:
  - --transaction-isolation=READ-COMMITTED
  - --log-bin=binlog
  - --binlog-format=ROW
{% for arg in (item.value.database.extra_args | default([])) %}
  - {{ arg }}
{% endfor %}
  securityContext:
    runAsUser: {{ nextcloud_db_uid }}
    runAsGroup: {{ nextcloud_db_gid }}
  resources:
    limits:
      memory: "2Gi"
{% if 'new' in item.value and item.value.new %}
  env:
  - name: MYSQL_RANDOM_ROOT_PASSWORD
    value: "true"
  - name: MYSQL_DATABASE
    value: nextcloud
  - name: MYSQL_USER
    value: nextcloud
  - name: MYSQL_PASSWORD
    value: "{{ item.value.database.password }}"
{% endif %}
  volumeMounts:
  - name: database
    mountPath: /var/lib/mysql
volumes:
- name: config
  hostPath:
    path: "{{ nextcloud_base_path }}/{{ item.key }}/config/"
    type: Directory
- name: nextcloud
  hostPath:
    path: "{{ nextcloud_base_path }}/{{ item.key }}/nextcloud"
    type: Directory
- name: redis
  hostPath:
    path: "{{ nextcloud_base_path }}/{{ item.key }}/redis"
    type: Directory
- name: database
  hostPath:
    path: "{{ nextcloud_base_path }}/{{ item.key }}/{{ item.value.database.type }}"
    type: Directory