badges: add wsgi for web frontend

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
This commit is contained in:
Ryan Lercho 2024-04-04 13:33:33 +10:00
parent b7644425db
commit 39ebdac18d
3 changed files with 27 additions and 3 deletions

View file

@ -30,11 +30,14 @@ spec:
containers:
- name: frontend
image: tahrir:latest
command: ["poetry"]
args: ["run", "gunicorn", "--paste", "/etc/badges/tahrir.ini", "-b", "0.0.0.0:8080", "-w", "4", "--log-level", "DEBUG", "-k", "gthread", "--threads", "2", "--preload", "--log-file=-"]
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: GUNICORN_CMD_ARGS
value: "--bind=0.0.0.0:8080"
- name: APP_MODULE
value: "deploy.wsgi"
volumeMounts:
- name: etc-badges
mountPath: "/etc/badges"
@ -42,6 +45,9 @@ spec:
- name: rules
mountPath: "/var/lib/badges"
readOnly: true
- name: wsgi-script-volume
mountPath: "/opt/app-root/src/deploy"
readOnly: true
- name: ipa-config-volume
mountPath: /etc/ipa
readOnly: true
@ -95,6 +101,9 @@ spec:
- name: rules
persistentVolumeClaim:
claimName: rules
- name: wsgi-script-volume
configMap:
name: wsgi-script
- name: ipa-config-volume
configMap:
name: ipa-client-config

View file

@ -19,3 +19,13 @@ items:
{{ load_file('checkout-rules-repo.sh') | indent(6) }}
tahrir.ini: |-
{{ load_file('tahrir.ini') | indent(6) }}
- apiVersion: v1
kind: ConfigMap
metadata:
name: wsgi-script
labels:
app: tahrir
data:
wsgi.py: |-
{{ load_file('wsgi.py') | indent(6) }}
__init__.py: ""

View file

@ -0,0 +1,5 @@
from pyramid.paster import get_app, setup_logging
ini_path = '/etc/badges/tahrir.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')