Skip to content

Instantly share code, notes, and snippets.

@lfittl
Created March 22, 2024 17:53
Show Gist options
  • Save lfittl/dd8ba5174d3b18ff2bba12095a160bd0 to your computer and use it in GitHub Desktop.
Save lfittl/dd8ba5174d3b18ff2bba12095a160bd0 to your computer and use it in GitHub Desktop.
pganalyze Enterprise Server - Scale out architecture example (with separate web/worker deployment)
apiVersion: apps/v1
kind: Deployment
metadata:
name: pganalyze-web
namespace: default
labels:
app: pganalyze-web
spec:
replicas: 2
selector:
matchLabels:
app: pganalyze-web
strategy:
type: Recreate
template:
metadata:
labels:
app: pganalyze-web
spec:
containers:
- name: main
image: 'ACCOUNTID.dkr.ecr.REGION.amazonaws.com/pganalyze-enterprise:VERSION-slim'
command: ["web"]
resources:
limits:
memory: "2Gi"
ports:
- containerPort: 5000
envFrom:
- secretRef:
name: pganalyze-secret
env:
- name: AWS_S3_SNAPSHOTS_BUCKET
value: REPLACE_ME_BUCKETNAME-snapshots
- name: AWS_S3_LOGS_BUCKET
value: REPLACE_ME_BUCKETNAME-logs
- name: AWS_KMS_LOGS_CMK
value: arn:aws:kms:REPLACE_ME_REGION:REPLACE_ME_ACCOUNTID:key/REPLACE_ME_KEYID
- name: AWS_REGION
value: REPLACE_ME_REGION
- name: REDIS_URL
value: REPLACE_ME_REDIS_URL
- name: SECRET_KEY_BASE
value: REPLACE_ME_WITH_RANDOM_VALUE
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pganalyze-workers
namespace: default
labels:
app: pganalyze-workers
spec:
replicas: 2
selector:
matchLabels:
app: pganalyze-workers
strategy:
type: Recreate
template:
metadata:
labels:
app: pganalyze-workers
spec:
containers:
- name: main
image: 'ACCOUNTID.dkr.ecr.REGION.amazonaws.com/pganalyze-enterprise:VERSION-slim'
command: ["worker_all"]
resources:
limits:
memory: "2Gi"
envFrom:
- secretRef:
name: pganalyze-secret
env:
- name: AWS_S3_SNAPSHOTS_BUCKET
value: REPLACE_ME_BUCKETNAME-snapshots
- name: AWS_S3_LOGS_BUCKET
value: REPLACE_ME_BUCKETNAME-logs
- name: AWS_KMS_LOGS_CMK
value: arn:aws:kms:REPLACE_ME_REGION:REPLACE_ME_ACCOUNTID:key/REPLACE_ME_KEYID
- name: AWS_REGION
value: REPLACE_ME_REGION
- name: REDIS_URL
value: REPLACE_ME_REDIS_URL
- name: SECRET_KEY_BASE
value: REPLACE_ME_WITH_RANDOM_VALUE
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: default
name: pganalyze
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/inbound-cidrs: 0.0.0.0/0
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: pganalyze-service
servicePort: 80
---
apiVersion: v1
kind: Service
metadata:
name: pganalyze-service
namespace: default
labels:
app: pganalyze-web
spec:
type: NodePort
selector:
app: pganalyze-web
ports:
- protocol: TCP
port: 80
targetPort: 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment