diff --git a/.gitignore b/.gitignore index a7e86767..82bd9cce 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ # AdminJS 관련 디렉토리 .adminjs + +# deployment secret +deployment/**/secret.yaml \ No newline at end of file diff --git a/app.js b/app.js index f8c24842..d36429c9 100644 --- a/app.js +++ b/app.js @@ -52,6 +52,8 @@ eventConfig && require("./src/lottery").lotteryRouter ); +app.use("/hc", require("./src/routes/hc")); + // [Middleware] 모든 API 요청에 대하여 origin 검증 app.use(require("./src/middlewares/originValidator")); diff --git a/deployment/README.md b/deployment/README.md new file mode 100644 index 00000000..8047597c --- /dev/null +++ b/deployment/README.md @@ -0,0 +1,32 @@ +# Deployment Resource Definitions for Taxi Backend Service + +### directories +``` +├── README.md +├── base +│ ├── kustomization.yaml +│ ├── redis +│ │ ├── deployment.yaml +│ │ └── service.yaml +│ └── server +│ ├── configmap.yaml +│ ├── deployment.yaml +│ ├── ingress.yaml +│ ├── sealed-secret.yaml +│ ├── secret-template.yaml +│ ├── secret.yaml +│ └── service.yaml +└── overlays + └── dev + └── kustomization.yaml +``` + +*under base folder* +- shared resource definitions for all environments + +*under overlay folder* +- environment specific settings +- you can add more environments + +### Using kubeseal +[Document Notion Link](https://www.notion.so/sparcs/K8S-Sealed-Secret-kubeseal-c3e315e429c442bebf8998b048404e17) [sparcs only] \ No newline at end of file diff --git a/deployment/base/kustomization.yaml b/deployment/base/kustomization.yaml new file mode 100644 index 00000000..161cdbd0 --- /dev/null +++ b/deployment/base/kustomization.yaml @@ -0,0 +1,12 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./server/deployment.yaml +- ./server/configmap.yaml +- ./server/service.yaml +- ./server/ingress.yaml +- ./server/sealed-secret.yaml +- ./redis/deployment.yaml +- ./redis/service.yaml +- ./og-generator/deployment.yaml +- ./og-generator/service.yaml \ No newline at end of file diff --git a/deployment/base/og-generator/deployment.yaml b/deployment/base/og-generator/deployment.yaml new file mode 100644 index 00000000..e920e188 --- /dev/null +++ b/deployment/base/og-generator/deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: taxi-og-generator + labels: + app: taxi-og-generator +spec: + replicas: 1 + selector: + matchLabels: + app: taxi-og-generator + template: + metadata: + labels: + app: taxi-og-generator + spec: + containers: + - name: taxi-og-generator + image: 666583083672.dkr.ecr.ap-northeast-2.amazonaws.com/taxi-og-generator:latest + ports: + - containerPort: 80 + name: og-gen-port + env: + - name: API_ROOM_INFO + valueFrom: + configMapKeyRef: + name: taxi-env + key: API_ROOM_INFO + - name: FRONT_URL + valueFrom: + configMapKeyRef: + name: taxi-env + key: FRONT_URL \ No newline at end of file diff --git a/deployment/base/og-generator/service.yaml b/deployment/base/og-generator/service.yaml new file mode 100644 index 00000000..4f0cd2ec --- /dev/null +++ b/deployment/base/og-generator/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: og-gen-service +spec: + selector: + app: taxi-og-generator + ports: + - name: og-gen-port + protocol: TCP + port: 80 + targetPort: og-gen-port diff --git a/deployment/base/redis/deployment.yaml b/deployment/base/redis/deployment.yaml new file mode 100644 index 00000000..f69c3f58 --- /dev/null +++ b/deployment/base/redis/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: taxi-redis + labels: + app: taxi-redis +spec: + replicas: 1 + selector: + matchLabels: + app: taxi-redis + template: + metadata: + labels: + app: taxi-redis + spec: + containers: + - name: taxi-redis + image: redis:7.0.4-alpine + ports: + - containerPort: 6379 + name: taxi-redis-port \ No newline at end of file diff --git a/deployment/base/redis/service.yaml b/deployment/base/redis/service.yaml new file mode 100644 index 00000000..d1bbbbfb --- /dev/null +++ b/deployment/base/redis/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: taxi-redis-service +spec: + selector: + app: taxi-redis + ports: + - name: taxi-redis-service-port + protocol: TCP + port: 6379 + targetPort: taxi-redis-port diff --git a/deployment/base/server/configmap.yaml b/deployment/base/server/configmap.yaml new file mode 100644 index 00000000..6b06de06 --- /dev/null +++ b/deployment/base/server/configmap.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: taxi-env +data: + SPARCSSSO_CLIENT_ID: "Taxi" + AWS_ACCESS_KEY_ID: "AKIAZWM3SVKMBOCGSY2F" + AWS_S3_BUCKET_NAME: "sparcs-taxi-prod" + TEST_ACCOUNTS: "[\"suwon@sparcs.org\",\"otl-android-test@sparcs.org\"]" + REDIS_PATH: "redis://taxi-redis-service:6379" + API_ROOM_INFO: "http://taxi-svc/rooms/publicInfo?id={}" + FRONT_URL: "https://taxi-staging.sparcs.org" \ No newline at end of file diff --git a/deployment/base/server/deployment.yaml b/deployment/base/server/deployment.yaml new file mode 100644 index 00000000..471e9588 --- /dev/null +++ b/deployment/base/server/deployment.yaml @@ -0,0 +1,55 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: taxi-server + labels: + app: taxi-server +spec: + replicas: 2 + selector: + matchLabels: + app: taxi-server + template: + metadata: + labels: + app: taxi-server + spec: + containers: + - name: taxi-server + image: 666583083672.dkr.ecr.ap-northeast-2.amazonaws.com/taxi-back:deploy + ports: + - containerPort: 80 + envFrom: + - secretRef: + name: taxi-secret + env: + - name: SPARCSSSO_CLIENT_ID + valueFrom: + configMapKeyRef: + name: taxi-env + key: SPARCSSSO_CLIENT_ID + - name: TEST_ACCOUNTS + valueFrom: + configMapKeyRef: + name: taxi-env + key: TEST_ACCOUNTS + - name: AWS_ACCESS_KEY_ID + valueFrom: + configMapKeyRef: + name: taxi-env + key: AWS_ACCESS_KEY_ID + - name: AWS_S3_BUCKET_NAME + valueFrom: + configMapKeyRef: + name: taxi-env + key: AWS_S3_BUCKET_NAME + - name: REDIS_PATH + valueFrom: + configMapKeyRef: + name: taxi-env + key: REDIS_PATH + - name: DB_PATH + valueFrom: + secretKeyRef: + name: taxi-mongodb-admin-taxi + key: connectionString.standardSrv diff --git a/deployment/base/server/ingress.yaml b/deployment/base/server/ingress.yaml new file mode 100644 index 00000000..b11ed1c4 --- /dev/null +++ b/deployment/base/server/ingress.yaml @@ -0,0 +1,35 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + alb.ingress.kubernetes.io/backend-protocol: HTTP + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' + alb.ingress.kubernetes.io/ssl-redirect: '443' + alb.ingress.kubernetes.io/scheme: internet-facing + alb.ingress.kubernetes.io/healthcheck-path: /api/hc + alb.ingress.kubernetes.io/target-type: 'instance' + alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:ap-northeast-2:666583083672:certificate/2f5020e0-01dd-43dd-aa7e-0699015d6b89 + alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-2016-08 + alb.ingress.kubernetes.io/group.name: "sparcs-prod-external" + name: taxi-ingress + namespace: taxi + finalizers: + - ingress.k8s.aws/resources + labels: + app: taxi-ingress +spec: + ingressClassName: alb + rules: + - host: taxi-staging.sparcs.org + http: + paths: + - path: / + backend: + service: + name: taxi-svc + port: + number: 80 + pathType: Prefix + tls: + - hosts: + - taxi-staging.sparcs.org diff --git a/deployment/base/server/sealed-secret.yaml b/deployment/base/server/sealed-secret.yaml new file mode 100644 index 00000000..ab57d348 --- /dev/null +++ b/deployment/base/server/sealed-secret.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: bitnami.com/v1alpha1 +kind: SealedSecret +metadata: + creationTimestamp: null + name: taxi-secret + namespace: taxi +spec: + encryptedData: + AWS_SECRET_ACCESS_KEY: AgBPReCL3Gy0pIUAJu+X2LAnbDRvtuNeYIp3InIQwp6Wo4rlO4WGS+xEVlAL0LMJu55wPAVDlDg87AIB0jW769Yu8gFQRBCfxcGl/EN6tZC6L4LoMjyMScCJ8zpfsFqWjR3v4qXPT/C90M+W5g+bf+Iaea9C1pUKEqTDlq0aUR0MSuW5GXLu5XGmwxwA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3h1uGCVfm7RU2jrE/4xM7 + template: + metadata: + creationTimestamp: null + name: taxi-secret + namespace: taxi + type: Opaque diff --git a/deployment/base/server/secret-template.yaml b/deployment/base/server/secret-template.yaml new file mode 100644 index 00000000..13303aff --- /dev/null +++ b/deployment/base/server/secret-template.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: zabo-secret + namespace: zabo +type: Opaque +data: + SSO_SECRET: base64encodedvalue + AWS_SECRET_ACCESS_KEY: base64encodedvalue + SESSION_SECRET: base64encodedvalue + JWT_SECRET: base64encodedvalue + SLACK_WEBHOOK_URL: base64encodedvalue + AWS_S3_DUMP_BUCKET_SECRET_ACCESS_KEY: base64encodedvalue \ No newline at end of file diff --git a/deployment/base/server/service.yaml b/deployment/base/server/service.yaml new file mode 100644 index 00000000..5eac6a69 --- /dev/null +++ b/deployment/base/server/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: taxi-svc +spec: + type: NodePort + selector: + app: taxi-server + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/deployment/overlays/dev/kustomization.yaml b/deployment/overlays/dev/kustomization.yaml new file mode 100644 index 00000000..876199e2 --- /dev/null +++ b/deployment/overlays/dev/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +images: +- name: 666583083672.dkr.ecr.ap-northeast-2.amazonaws.com/taxi-back + newTag: deploy +resources: +- ../../base \ No newline at end of file diff --git a/src/routes/docs/hc.js b/src/routes/docs/hc.js new file mode 100644 index 00000000..23add41f --- /dev/null +++ b/src/routes/docs/hc.js @@ -0,0 +1,26 @@ +const tag = "hc"; +const apiPrefix = "/hc"; + +const hcDocs = {}; +hcDocs[`${apiPrefix}`] = { + get: { + tags: [tag], + summary: "서버 상태 확인", + description: "서버 상태 확인", + responses: { + 200: { + description: "서버 상태 확인", + content: { + "application/json": { + schema: { + type: "string", + example: "OK", + }, + }, + }, + }, + }, + }, +}; + +module.exports = hcDocs; diff --git a/src/routes/docs/swaggerDocs.js b/src/routes/docs/swaggerDocs.js index 84f4e040..225ad7a9 100644 --- a/src/routes/docs/swaggerDocs.js +++ b/src/routes/docs/swaggerDocs.js @@ -4,6 +4,7 @@ const logininfoDocs = require("./logininfo"); const locationsDocs = require("./locations"); const authDocs = require("./auth"); const usersDocs = require("./users"); +const hcDocs = require("./hc"); const { port, nodeEnv } = require("../../../loadenv"); const serverList = [ @@ -56,6 +57,10 @@ const swaggerDocs = { name: "users", description: "유저 계정 정보 수정 및 조회", }, + { + name: "hc", + description: "서버 상태 확인", + }, ], consumes: ["application/json"], produces: ["application/json"], @@ -65,6 +70,7 @@ const swaggerDocs = { ...locationsDocs, ...usersDocs, ...authDocs, + ...hcDocs, }, components: { schemas: { diff --git a/src/routes/hc.js b/src/routes/hc.js new file mode 100644 index 00000000..cd2c641e --- /dev/null +++ b/src/routes/hc.js @@ -0,0 +1,8 @@ +const express = require("express"); + +const router = express.Router(); +const healthCheckHandlers = require("../services/hc"); + +router.get("/", healthCheckHandlers.healthCheckHandler); + +module.exports = router; diff --git a/src/services/hc.js b/src/services/hc.js new file mode 100644 index 00000000..0f6225c7 --- /dev/null +++ b/src/services/hc.js @@ -0,0 +1,7 @@ +const healthCheckHandler = (_, res) => { + res.status(200).send("OK"); +}; + +module.exports = { + healthCheckHandler, +};