Commit 5768e3db authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixes to helm deployment.

parent a365f8a8
......@@ -223,8 +223,8 @@ def apply(config, key, value) -> None:
child_config[child_key] = value
def load_config(config_file: str = os.environ.get('NOMAD_CONFIG', 'nomad.yml')) -> None:
# load yml and override defaults
def load_config(config_file: str = os.environ.get('NOMAD_CONFIG', 'nomad.yaml')) -> None:
# load yaml and override defaults
if os.path.exists(config_file):
with open(config_file, 'r') as stream:
try:
......@@ -257,7 +257,7 @@ def load_config(config_file: str = os.environ.get('NOMAD_CONFIG', 'nomad.yml'))
adapt(globals(), config_data)
# load env and override yml and defaults
# load env and override yaml and defaults
kwargs = {
key[len('NOMAD_'):].lower(): value
for key, value in os.environ.items()
......
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "nomad.fullname" . }}-api-gunicorn-log-config
labels:
app.kubernetes.io/name: {{ include "nomad.name" . }}-api-gunicorn-log-config
helm.sh/chart: {{ include "nomad.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
gunicorn.log.conf: |
[loggers]
keys=root, gunicorn.error, gunicorn.access
[handlers]
keys=console, access, error
[formatters]
keys=generic
[logger_root]
level=INFO
handlers=console
[logger_gunicorn.error]
level=INFO
handlers=error
qualname=gunicorn.error
[logger_gunicorn.access]
level=INFO
handlers=access
qualname=gunicorn.access
[handler_console]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_access]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_error]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[formatter_generic]
format=%(asctime)s [%(process)d] [%(levelname)s] %(message)s
datefmt=%Y-%m-%d %H:%M:%S
class=logging.Formatter
---
apiVersion: apps/v1
kind: Deployment
metadata:
......@@ -23,22 +77,26 @@ spec:
- name: {{ include "nomad.name" . }}-api
image: "{{ .Values.images.nomad.name }}:{{ .Values.images.nomad.tag }}"
volumeMounts:
- mountPath: /app
- mountPath: /app/nomad.yaml
name: nomad-conf
subPath: nomad.yaml
- mountPath: /app/gunicorn.log.conf
name: gunicorn-log-conf
subPath: gunicorn.log.conf
- mountPath: /app/.volumes/fs/public
name: public-volume
- mountPath: /app/.volumes/fs/staging
name: staging-volume
- mountPath: /nomad
name: nomad-volume
env:
env:
- name: NOMAD_SERVICE
value: "api"
- name: NOMAD_CONSOLE_LOGLEVEL
value: "{{ .Values.api.console_loglevel }}"
- name: NOMAD_LOGSTASH_LEVEL
value: "{{ .Values.api.logstash_loglevel }}"
command: ["python", "-m", "gunicorn.app.wsgiapp", "--timeout", "3600", "--log-config", "ops/gunicorn.log.conf", "-w", "{{ .Values.api.worker }}", "-b 0.0.0.0:8000", "nomad.api:app"]
command: ["python", "-m", "gunicorn.app.wsgiapp", "--timeout", "3600", "--log-config", "gunicorn.log.conf", "-w", "{{ .Values.api.worker }}", "-b 0.0.0.0:8000", "nomad.api:app"]
livenessProbe:
httpGet:
path: "{{ .Values.proxy.external.path }}/api/alive"
......@@ -57,12 +115,12 @@ spec:
- name: {{ .Values.images.secret }}
imagePullPolicy: always
volumes:
- name: gunicorn-log-conf
configMap:
name: {{ include "nomad.fullname" . }}-api-gunicorn-log-config
- name: nomad-conf
configMap:
name: {{ include "nomad.fullname" . }}-configmap
items:
- key: nomad.yml
path: nomad.yml
- name: public-volume
hostPath:
path: {{ .Values.volumes.public }}
......
......@@ -8,9 +8,7 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
nomad.yml: /
service: api
api_host:
nomad.yaml: |
release: "{{ .Release.Name }}"
fs:
tmp: "{{ .Values.volumes.tmp }}"
......@@ -19,8 +17,6 @@ data:
enabled: true
host: "{{ .Values.logstash.host }}"
tcpport: "{{ .Values.logstash.port }}"
level: info
console_log_level: debug
services:
api_host: "{{ .Values.proxy.external.host }}"
api_port: "{{ .Values.proxy.external.port }}"
......@@ -50,4 +46,4 @@ data:
user: "{{ .Values.mail.user }}"
password: "{{ .Values.mail.password }}"
from_address: "{{ .Values.mail.from }}"
celery_routing: "{{ .Values.worker.routing }}"
\ No newline at end of file
celery_routing: "{{ .Values.worker.routing }}"
......@@ -28,8 +28,9 @@ spec:
requests:
memory: "{{ .Values.worker.memrequest }}Gi"
volumeMounts:
- mountPath: /app
- mountPath: /app/nomad.yaml
name: nomad-conf
subPath: nomad.yaml
- mountPath: /app/.volumes/fs/public
name: public-volume
- mountPath: /app/.volumes/fs/staging
......@@ -69,9 +70,6 @@ spec:
- name: nomad-conf
configMap:
name: {{ include "nomad.fullname" . }}-configmap
items:
- key: nomad.yml
path: nomad.yml
- name: public-volume
hostPath:
path: {{ .Values.volumes.public }}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment