Skip to content

Commit

Permalink
chore(deploy): prod
Browse files Browse the repository at this point in the history
  • Loading branch information
incubator4 committed Jan 1, 2024
1 parent 172d1ec commit 8b8135c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 216 deletions.
86 changes: 0 additions & 86 deletions deploy/prod/cm.yaml

This file was deleted.

77 changes: 2 additions & 75 deletions deploy/prod/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ spec:
prometheus.io/scrape: "true"
spec:
enableServiceLinks: false
tolerations:
- key: "rss3.io/usage"
operator: "Equal"
value: "csb-others"
effect: "NoSchedule"
initContainers:
- image: $IMAGE_TAG_RELEASE
- image: rss3/xlog
envFrom:
- secretRef:
name: xlog
Expand All @@ -40,7 +35,7 @@ spec:
command: ["/bin/sh", "-c"]
args: ["npm install -g prisma; npm run prisma:migrate:deploy"]
containers:
- image: $IMAGE_TAG_RELEASE
- image: rss3/xlog
imagePullPolicy: Always
name: xlog
envFrom:
Expand Down Expand Up @@ -74,71 +69,3 @@ spec:
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: xlog-caddy
namespace: crossbell
spec:
replicas: 3
selector:
matchLabels:
app: xlog-caddy
template:
metadata:
labels:
app: xlog-caddy
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
spec:
containers:
- name: caddy
image: kindjeff/caddy-tlsredis-docker
imagePullPolicy: Always
command: ["caddy", "run", "-config", "/app/Caddyfile"]
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
envFrom:
- secretRef:
name: xlog-caddy
ports:
- containerPort: 80
name: http
- containerPort: 443
name: https
volumeMounts:
- name: caddyfile
mountPath: /app
- name: caddy-validator
image: python
command: ["/bin/sh", "-c"]
args: ["pip install flask requests; flask --app=app run"]
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 100m
memory: 128Mi
ports:
- containerPort: 5000
name: http
volumeMounts:
- name: validator
mountPath: /app.py
subPath: app.py
volumes:
- name: caddyfile
configMap:
name: xlog-caddy
- name: validator
configMap:
name: xlog-caddy-validator
22 changes: 1 addition & 21 deletions deploy/prod/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: xlog
namespace: crossbell
spec:
maxReplicas: 11
maxReplicas: 14
minReplicas: 7
scaleTargetRef:
apiVersion: apps/v1
Expand All @@ -17,23 +17,3 @@ spec:
target:
type: Utilization
averageUtilization: 300
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: xlog-caddy
namespace: crossbell
spec:
maxReplicas: 20
minReplicas: 3
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: xlog-caddy
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 300
8 changes: 8 additions & 0 deletions deploy/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deploy.yaml
- secret.yaml
- svc.yaml
- hpa
16 changes: 16 additions & 0 deletions deploy/prod/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Remember to add it in env.production because it is the nextjs project
apiVersion: v1
stringData:
REDIS_URL: <REDIS_URL>
DATABASE_URL: <DATABASE_URL>
SIMPLEHASH_API_KEY: <SIMPLEHASH_API_KEY>
OPENAI_API_KEY: <OPENAI_API_KEY>
ANONYMOUS_ACCOUNT_PRIVATEKEY: <ANONYMOUS_ACCOUNT_PRIVATEKEY>
PORTFOLIO_GITHUB_TOKEN: <PORTFOLIO_GITHUB_TOKEN>
kind: Secret
metadata:
name: xlog
namespace: crossbell
annotations:
avp.kubernetes.io/path: "kv/data/crossbell/xlog"
type: Opaque
27 changes: 0 additions & 27 deletions deploy/prod/secrets.yaml

This file was deleted.

10 changes: 3 additions & 7 deletions deploy/prod/svc.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: xlog-lb
name: xlog-internal
namespace: crossbell
spec:
type: LoadBalancer
type: ClusterIP
selector:
app: xlog
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
- name: https
protocol: TCP
port: 443
targetPort: 443
targetPort: 3000

0 comments on commit 8b8135c

Please sign in to comment.