Skip to content

Commit

Permalink
adding peregrine
Browse files Browse the repository at this point in the history
  • Loading branch information
EliseCastle23 committed Mar 13, 2024
1 parent 24ba83a commit 7e42cdb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
3 changes: 3 additions & 0 deletions gen3/bin/kube-setup-peregrine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ if [[ "$(g3kubectl get service peregrine-service -o json | jq -r .spec.type)" ==
fi

g3kubectl apply -f "${GEN3_HOME}/kube/services/peregrine/peregrine-service.yaml"
g3kubectl apply -f "${GEN3_HOME}/kube/services/peregrine/peregrine-nginx.conf"
g3kubectl apply -f "${GEN3_HOME}/kube/services/peregrine/peregrine-gunicorn.yaml"
g3kubectl apply -f "${GEN3_HOME}/kube/services/nginx-sidecar/nginx.conf"
gen3 roll peregrine-canary || true
g3kubectl apply -f "${GEN3_HOME}/kube/services/peregrine/peregrine-canary-service.yaml"

Expand Down
39 changes: 36 additions & 3 deletions kube/services/peregrine/peregrine-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ spec:
GEN3_PEREGRINE_VERSION
GEN3_DATE_LABEL
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -77,11 +81,20 @@ spec:
- name: ca-volume
secret:
secretName: "service-ca"
- name: wsgi-config
configMap:
name: peregrine-wsgi
- name: nginx-config
configMap:
name: peregrine-nginx-configmap
- name: nginx-main-config
configMap:
name: sidecar-nginx-main
containers:
- name: peregrine
GEN3_PEREGRINE_IMAGE
ports:
- containerPort: 80
- containerPort: 8000
- containerPort: 443
env:
- name: GEN3_UWSGI_TIMEOUT
Expand Down Expand Up @@ -180,6 +193,9 @@ spec:
readOnly: true
mountPath: "/usr/local/share/ca-certificates/cdis-ca.crt"
subPath: "ca.pem"
- name: "wsgi-config"
mountPath: "/peregrine/deployment/wsgi/gunicorn.conf.py"
subPath: gunicorn.conf.py
imagePullPolicy: Always
resources:
requests:
Expand All @@ -190,12 +206,29 @@ spec:
livenessProbe:
httpGet:
path: /_status?timeout=20
port: 80
port: 8000
# peregrine can take forever to initialize
initialDelaySeconds: 60
periodSeconds: 60
timeoutSeconds: 30
readinessProbe:
httpGet:
path: /_status?timeout=2
port: 80
port: 8000
- name: sidecar-nginx
image: quay.io/cdis/nginx-sidecar:nginx-sidecar-feat_nginx-sidecar
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
readinessProbe:
httpGet:
path: /_status
port: http
volumeMounts:
- name: "nginx-main-config"
mountPath: "/etc/nginx/nginx.conf"
subPath: "nginx.conf"
- name: "nginx-config"
mountPath: "/etc/nginx/conf.d/default.conf"
subPath: default.conf
13 changes: 13 additions & 0 deletions kube/services/peregrine/peregrine-gunicorn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: peregrine-wsgi
data:
gunicorn.conf.py: |
wsgi_app = "deployment.wsgi.wsgi:application"
bind = "0.0.0.0:8000"
workers = 1
user = 'gen3'
group = 'gen3'
timeout = 300
worker_class = "uvicorn.workers.UvicornWorker"
13 changes: 13 additions & 0 deletions kube/services/peregrine/peregrine-nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: peregrine-nginx-configmap
data:
default.conf: |
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8000; # Gunicorn binds to this address
}
}

0 comments on commit 7e42cdb

Please sign in to comment.