feat(blog): add staging and production CI/CD

This commit is contained in:
dahyeon committed 2026-11-17 18:47:40 +09:00
1 parent ca3817f8da
commit b44398719c
25 files changed
+1219 -2

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
# blog
- staging: `blog-staging` / `blog.dahyeon.us`
- prod: `blog-prod` / `rabbitmaus.com`
- 이미지: `registry.dahyeon.us/dahyeon/blog` (`linux/arm64`)
- Secret: `harbor-registry`(이미지 pull), `blog-secrets`(Infisical)
- 상태 확인: `/healthz`
브랜치 push → Tekton → GitOps 갱신 → Argo CD 자동 Sync.
[CI 설정](../../ci/blog/README.md)
+81
View File
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog
labels:
app.kubernetes.io/component: app
spec:
replicas: 0
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app.kubernetes.io/name: blog
app.kubernetes.io/component: app
template:
metadata:
labels:
app.kubernetes.io/name: blog
app.kubernetes.io/component: app
spec:
serviceAccountName: blog
automountServiceAccountToken: false
nodeSelector:
kubernetes.io/arch: arm64
imagePullSecrets:
- name: harbor-registry
terminationGracePeriodSeconds: 60
securityContext:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
fsGroup: 65532
seccompProfile:
type: RuntimeDefault
containers:
- name: app
image: registry.dahyeon.us/dahyeon/blog
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
envFrom:
- configMapRef:
name: blog-config
- secretRef:
name: blog-secrets
ports:
- name: http
containerPort: 3000
protocol: TCP
startupProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 5
failureThreshold: 24
livenessProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 15
timeoutSeconds: 3
readinessProbe:
httpGet:
path: /healthz
port: http
periodSeconds: 10
timeoutSeconds: 3
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "2"
memory: 1Gi
+13
View File
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- services.yaml
- serviceaccount.yaml
- poddisruptionbudget.yaml
labels:
- includeSelectors: true
pairs:
app.kubernetes.io/name: blog
app.kubernetes.io/part-of: blog
app.kubernetes.io/managed-by: kustomize
+10
View File
@@ -0,0 +1,10 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: blog
spec:
minAvailable: 1
selector:
matchLabels:
app.kubernetes.io/name: blog
app.kubernetes.io/component: app
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: blog
automountServiceAccountToken: false
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: blog
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: blog
app.kubernetes.io/component: app
ports:
- name: http
port: 3000
targetPort: http
protocol: TCP
+11
View File
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: blog-config
data:
LEPTOS_ENV: PROD
LEPTOS_OUTPUT_NAME: blog
LEPTOS_SITE_ADDR: 0.0.0.0:3000
LEPTOS_SITE_ROOT: /app/site
LEPTOS_SITE_PKG_DIR: pkg
BLOG_PUBLIC_ORIGIN: https://rabbitmaus.com
@@ -0,0 +1,9 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog
spec:
template:
metadata:
labels:
app.kubernetes.io/environment: prod
@@ -0,0 +1,31 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalStaticSecret
metadata:
name: blog-secrets
spec:
infisicalAuthRef:
name: infisical-auth
namespace: infisical
syncOptions:
refreshInterval: 60s
instantUpdates: false
sources:
- projectId: eb73ed07-2fc4-48ca-927b-cf3692b97cf6
environmentSlug: prod
secretPath: /
recursive: false
targets:
- name: blog-secrets
namespace: blog-prod
kind: Secret
creationPolicy: Owner
secretType: Opaque
template:
engineVersion: v1
data:
MONGODB_CONNECTION_STRING: "{{ .MONGODB_CONNECTION_STRING.Value }}"
MONGODB_DATABASE: "{{ .MONGODB_DATABASE.Value }}"
MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS: "{{ .MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS.Value }}"
MICROSOFT_ENTRAID_CLIENT_ID: "{{ .MICROSOFT_ENTRAID_CLIENT_ID.Value }}"
MICROSOFT_ENTRAID_CLIENT_SECRET: "{{ .MICROSOFT_ENTRAID_CLIENT_SECRET.Value }}"
MICROSOFT_ENTRAID_TENANT_ID: "{{ .MICROSOFT_ENTRAID_TENANT_ID.Value }}"
+24
View File
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: blog
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
haproxy.org/ssl-redirect: 'false'
spec:
ingressClassName: haproxy
tls:
- hosts:
- rabbitmaus.com
secretName: blog-prod-tls
rules:
- host: rabbitmaus.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: blog
port:
number: 3000
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: blog-prod
resources:
- ../../base
- configmap.yaml
- infisical-secret.yaml
- ingress.yaml
images:
- name: registry.dahyeon.us/dahyeon/blog
newName: registry.dahyeon.us/dahyeon/blog
# Bootstrap sentinel, not a published image. The first successful CI run
# writes a real digest and changes replicas from 0 to 1 in the same commit.
digest: sha256:0000000000000000000000000000000000000000000000000000000000000000
replicas:
- name: blog
count: 0
patches:
- path: deployment-patch.yaml
+11
View File
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: blog-config
data:
LEPTOS_ENV: PROD
LEPTOS_OUTPUT_NAME: blog
LEPTOS_SITE_ADDR: 0.0.0.0:3000
LEPTOS_SITE_ROOT: /app/site
LEPTOS_SITE_PKG_DIR: pkg
BLOG_PUBLIC_ORIGIN: https://blog.dahyeon.us
@@ -0,0 +1,9 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog
spec:
template:
metadata:
labels:
app.kubernetes.io/environment: staging
@@ -0,0 +1,31 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalStaticSecret
metadata:
name: blog-secrets
spec:
infisicalAuthRef:
name: infisical-auth
namespace: infisical
syncOptions:
refreshInterval: 60s
instantUpdates: false
sources:
- projectId: eb73ed07-2fc4-48ca-927b-cf3692b97cf6
environmentSlug: staging
secretPath: /
recursive: false
targets:
- name: blog-secrets
namespace: blog-staging
kind: Secret
creationPolicy: Owner
secretType: Opaque
template:
engineVersion: v1
data:
MONGODB_CONNECTION_STRING: "{{ .MONGODB_CONNECTION_STRING.Value }}"
MONGODB_DATABASE: "{{ .MONGODB_DATABASE.Value }}"
MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS: "{{ .MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS.Value }}"
MICROSOFT_ENTRAID_CLIENT_ID: "{{ .MICROSOFT_ENTRAID_CLIENT_ID.Value }}"
MICROSOFT_ENTRAID_CLIENT_SECRET: "{{ .MICROSOFT_ENTRAID_CLIENT_SECRET.Value }}"
MICROSOFT_ENTRAID_TENANT_ID: "{{ .MICROSOFT_ENTRAID_TENANT_ID.Value }}"
+24
View File
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: blog
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
haproxy.org/ssl-redirect: 'false'
spec:
ingressClassName: haproxy
tls:
- hosts:
- blog.dahyeon.us
secretName: blog-staging-tls
rules:
- host: blog.dahyeon.us
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: blog
port:
number: 3000
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: blog-staging
resources:
- ../../base
- configmap.yaml
- infisical-secret.yaml
- ingress.yaml
images:
- name: registry.dahyeon.us/dahyeon/blog
newName: registry.dahyeon.us/dahyeon/blog
# Bootstrap sentinel, not a published image. The first successful CI run
# writes a real digest and changes replicas from 0 to 1 in the same commit.
digest: sha256:0000000000000000000000000000000000000000000000000000000000000000
replicas:
- name: blog
count: 0
patches:
- path: deployment-patch.yaml