Skip to content

Adding a proxy in front of web #126

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions apps/web/base/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: caddy-config
data:
Caddyfile: |
{
admin :2019
metrics
}
:80 {
reverse_proxy localhost:5001
}
22 changes: 20 additions & 2 deletions apps/web/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ spec:
- name: web
image: metacpan/metacpan-web:latest
imagePullPolicy: Always
command: [ "/uwsgi.sh" ]
args: [ "--http-socket", ":5001" ]
command: ["/uwsgi.sh"]
args: ["--http-socket", ":5001", "--workers", "10"]
ports:
- containerPort: 5001
resources:
Expand All @@ -37,7 +37,25 @@ spec:
- name: metacpan-web-local
mountPath: /app/metacpan_web_local.conf
subPath: metacpan_web_local.conf
- name: caddy
image: caddy:latest
ports:
- containerPort: 2019
- containerPort: 80
volumeMounts:
- name: caddy-config
mountPath: /etc/caddy
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "200m"
volumes:
- name: metacpan-web-local
secret:
secretName: metacpan-web-local
- name: caddy-config
configMap:
name: caddy-config
2 changes: 2 additions & 0 deletions apps/web/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ kind: Kustomization
resources:
- ./deployment.yaml
- ./service.yaml
- ./configmap.yaml
- ./servicemonitor.yaml
20 changes: 19 additions & 1 deletion apps/web/base/service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
ports:
- port: 80
targetPort: 5001
targetPort: 80
selector:
app: web
---
apiVersion: v1
kind: Service
metadata:
name: web-metrics
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/name: web-metrics
app.kubernetes.io/part-of: web
spec:
ports:
- name: metrics
port: 2019
targetPort: 2019
protocol: TCP
selector:
app: web
17 changes: 17 additions & 0 deletions apps/web/base/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: http-metrics
namespace: apps--web
labels:
app: web
spec:
selector:
matchLabels:
app.kubernetes.io/name: web-metrics
namespaceSelector:
matchNames:
- apps--web
endpoints:
- port: metrics
interval: 15s