Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web/nginx: shared volume (pvc - persistent volume claim) #8

Merged
merged 2 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion invenio/templates/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ spec:
labels:
app: web
spec:
initContainers:
- name: web-init
image: {{ .Values.web.image }}
command: [
'/bin/bash',
'-c',
'cp -R {{ .Values.web.assets.location }}/. /tmp/invenio/assets/']
volumeMounts:
- name: "invenio-assets"
mountPath: "/tmp/invenio/assets/"
containers:
- name: web
image: {{ .Values.web.image }}
Expand Down Expand Up @@ -84,7 +94,7 @@ spec:
- -c
- "uwsgi_curl $(hostname):5000 /ping -H 'Host: {{ .Values.host }}'"
failureThreshold: 3
initialDelaySeconds: 15
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
Expand All @@ -102,6 +112,8 @@ spec:
volumeMounts:
- name: uwsgi-config
mountPath: '/opt/invenio/src/uwsgi'
- name: "invenio-assets"
mountPath: "{{ .Values.web.assets.location }}"
resources:
requests:
memory: 200Mi
Expand All @@ -112,6 +124,10 @@ spec:
configMap:
defaultMode: 420
name: uwsgi-config
- name: "invenio-assets"
persistentVolumeClaim:
claimName: "invenio-assets-claim"

---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
Expand Down
4 changes: 4 additions & 0 deletions invenio/templates/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ data:
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
uwsgi_ignore_headers Set-Cookie;
}
location /static {
alias /opt/invenio/var/instance/static/;
autoindex off;
}
}
---
apiVersion: v1
Expand Down
9 changes: 5 additions & 4 deletions invenio/templates/services/nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ spec:
mountPath: /var/cache/nginx
- name: var-log-nginx
mountPath: /var/log/nginx
- name: static
mountPath: /static
- name: "invenio-assets"
mountPath: "{{ .Values.web.assets.location }}"
readinessProbe:
httpGet:
path: /ping
Expand Down Expand Up @@ -89,8 +89,9 @@ spec:
emptyDir: {}
- name: var-log-nginx
emptyDir: {}
- name: static
emptyDir: {}
- name: "invenio-assets"
persistentVolumeClaim:
claimName: "invenio-assets-claim"

{{ if .Values.logstash.enabled }}
---
Expand Down
11 changes: 11 additions & 0 deletions invenio/templates/volumes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: "v1"
kind: "PersistentVolumeClaim"
metadata:
name: "invenio-assets-claim"
spec:
accessModes:
- "ReadWriteMany"
resources:
requests:
storage: "{{ .Values.volume.assets.size }}"
8 changes: 7 additions & 1 deletion invenio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ haproxy:
inside_cluster: true
maxconn: 100

volume:
assets:
size: 10Gi
nginx:
max_conns: 100
replicas: 2
assets:
location: /opt/invenio/var/instance/static

web:
image: your/invenio-image
Expand All @@ -20,7 +25,8 @@ web:
scaler_cpu_utilization: 65
max_web_replicas: 10
min_web_replicas: 2

assets:
location: /opt/invenio/var/instance/static

worker:
enabled: true
Expand Down