feat(url-shortener): add deployment manifests and Tekton CI

This commit is contained in:
dahyeon committed 2026-11-04 04:56:48 +09:00
1 parent 176c214f86
commit d909a86b0e
24 files changed
+1432

No files matched your search

@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: url-shortener-config
data:
APP_ENV: prod
HOST: 0.0.0.0
PORT: "3000"
DEV_AUTH_ENABLED: "false"
APP_ORIGIN: https://urls.dahyeon.us
API_ORIGIN: https://urls-api.dahyeon.us
SHORT_ORIGIN: https://rabbitma.us
SESSION_HOURS: "8"
# Set during promotion; database ID must match deploy/cloudflare/prod.json in the source revision.
CLOUDFLARE_ACCOUNT_ID: ""
CLOUDFLARE_D1_DATABASE_ID: ""
PUBLISH_WAIT_MS: "1500"
JOB_POLL_MS: "1000"
STATS_INTERVAL_MS: "60000"
API_RATE_LIMIT: "300"
@@ -0,0 +1,9 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: url-shortener
spec:
template:
metadata:
labels:
app.kubernetes.io/environment: prod
@@ -0,0 +1,38 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalStaticSecret
metadata:
name: url-shortener-secrets
spec:
infisicalAuthRef:
name: infisical-auth
namespace: infisical
syncOptions:
refreshInterval: 60s
instantUpdates: false
sources:
- projectId: 01c4ebe5-8c73-475c-ba29-56709483b0f1
environmentSlug: prod
secretPath: /
recursive: false
targets:
- name: url-shortener-secrets
namespace: url-shortener-prod
kind: Secret
creationPolicy: Owner
secretType: Opaque
template:
engineVersion: v1
data:
MONGODB_CONNECTION_STRING: "{{ .MONGODB_CONNECTION_STRING.Value }}"
MICROSOFT_ENTRAID_TENANT_ID: "{{ .MICROSOFT_ENTRAID_TENANT_ID.Value }}"
MICROSOFT_ENTRAID_CLIENT_ID: "{{ .MICROSOFT_ENTRAID_CLIENT_ID.Value }}"
MICROSOFT_ENTRAID_CLIENT_SECRET: "{{ .MICROSOFT_ENTRAID_CLIENT_SECRET.Value }}"
MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS: "{{ .MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS.Value }}"
CLOUDFLARE_D1_API_TOKEN: "{{ .CLOUDFLARE_D1_API_TOKEN.Value }}"
INGEST_HMAC_SECRET: "{{ .INGEST_HMAC_SECRET.Value }}"
NEW_RELIC_LICENSE_KEY: "{{ .NEW_RELIC_LICENSE_KEY.Value }}"
MONGODB_DATABASE: "{{ .MONGODB_DATABASE.Value }}"
LOG_LEVEL: "{{ .LOG_LEVEL.Value }}"
NEW_RELIC_APP_NAME: "{{ .NEW_RELIC_APP_NAME.Value }}"
NEW_RELIC_ENABLED: "{{ .NEW_RELIC_ENABLED.Value }}"
NEW_RELIC_LOG_LEVEL: "{{ .NEW_RELIC_LOG_LEVEL.Value }}"
@@ -0,0 +1,44 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: url-shortener-api
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: haproxy
tls:
- hosts:
- urls-api.dahyeon.us
secretName: url-shortener-api-prod-tls
rules:
- host: urls-api.dahyeon.us
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: url-shortener
port:
number: 3000
- path: /auth
pathType: Prefix
backend:
service:
name: url-shortener
port:
number: 3000
- path: /service/v1
pathType: Prefix
backend:
service:
name: url-shortener
port:
number: 3000
- path: /ingest/v1/clicks
pathType: Exact
backend:
service:
name: url-shortener
port:
number: 3000
@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: url-shortener-prod
resources:
- ../../base
- configmap.yaml
- infisical-secret.yaml
- ingress.yaml
images:
- name: registry.dahyeon.us/dahyeon/url-shortener
newName: registry.dahyeon.us/dahyeon/url-shortener
newTag: bootstrap
replicas:
- name: url-shortener
count: 0
patches:
- path: deployment-patch.yaml
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: url-shortener-config
data:
APP_ENV: staging
HOST: 0.0.0.0
PORT: "3000"
DEV_AUTH_ENABLED: "false"
APP_ORIGIN: https://urls-staging.dahyeon.us
API_ORIGIN: https://urls-api-staging.dahyeon.us
SHORT_ORIGIN: https://staging.rabbitma.us
SESSION_HOURS: "8"
# Tekton copies these public identifiers from its Cloudflare account and the source D1 profile.
CLOUDFLARE_ACCOUNT_ID: ""
CLOUDFLARE_D1_DATABASE_ID: ""
PUBLISH_WAIT_MS: "1500"
JOB_POLL_MS: "1000"
STATS_INTERVAL_MS: "60000"
API_RATE_LIMIT: "300"
@@ -0,0 +1,9 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: url-shortener
spec:
template:
metadata:
labels:
app.kubernetes.io/environment: staging
@@ -0,0 +1,38 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalStaticSecret
metadata:
name: url-shortener-secrets
spec:
infisicalAuthRef:
name: infisical-auth
namespace: infisical
syncOptions:
refreshInterval: 60s
instantUpdates: false
sources:
- projectId: 01c4ebe5-8c73-475c-ba29-56709483b0f1
environmentSlug: staging
secretPath: /
recursive: false
targets:
- name: url-shortener-secrets
namespace: url-shortener-staging
kind: Secret
creationPolicy: Owner
secretType: Opaque
template:
engineVersion: v1
data:
MONGODB_CONNECTION_STRING: "{{ .MONGODB_CONNECTION_STRING.Value }}"
MICROSOFT_ENTRAID_TENANT_ID: "{{ .MICROSOFT_ENTRAID_TENANT_ID.Value }}"
MICROSOFT_ENTRAID_CLIENT_ID: "{{ .MICROSOFT_ENTRAID_CLIENT_ID.Value }}"
MICROSOFT_ENTRAID_CLIENT_SECRET: "{{ .MICROSOFT_ENTRAID_CLIENT_SECRET.Value }}"
MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS: "{{ .MICROSOFT_ENTRAID_BOOTSTRAP_ADMIN_OIDS.Value }}"
CLOUDFLARE_D1_API_TOKEN: "{{ .CLOUDFLARE_D1_API_TOKEN.Value }}"
INGEST_HMAC_SECRET: "{{ .INGEST_HMAC_SECRET.Value }}"
NEW_RELIC_LICENSE_KEY: "{{ .NEW_RELIC_LICENSE_KEY.Value }}"
MONGODB_DATABASE: "{{ .MONGODB_DATABASE.Value }}"
LOG_LEVEL: "{{ .LOG_LEVEL.Value }}"
NEW_RELIC_APP_NAME: "{{ .NEW_RELIC_APP_NAME.Value }}"
NEW_RELIC_ENABLED: "{{ .NEW_RELIC_ENABLED.Value }}"
NEW_RELIC_LOG_LEVEL: "{{ .NEW_RELIC_LOG_LEVEL.Value }}"
@@ -0,0 +1,44 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: url-shortener-api
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: haproxy
tls:
- hosts:
- urls-api-staging.dahyeon.us
secretName: url-shortener-api-staging-tls
rules:
- host: urls-api-staging.dahyeon.us
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: url-shortener
port:
number: 3000
- path: /auth
pathType: Prefix
backend:
service:
name: url-shortener
port:
number: 3000
- path: /service/v1
pathType: Prefix
backend:
service:
name: url-shortener
port:
number: 3000
- path: /ingest/v1/clicks
pathType: Exact
backend:
service:
name: url-shortener
port:
number: 3000
@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: url-shortener-staging
resources:
- ../../base
- configmap.yaml
- infisical-secret.yaml
- ingress.yaml
images:
- name: registry.dahyeon.us/dahyeon/url-shortener
newName: registry.dahyeon.us/dahyeon/url-shortener
newTag: bootstrap
replicas:
- name: url-shortener
count: 0
patches:
- path: deployment-patch.yaml