Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLAP-383 릴리즈 쿠버네티스로 배포하도록 수정 #498

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions .github/workflows/release-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,32 @@ jobs:
docker build -t ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} -t ${{ secrets.DOCKER_REPO }}:latest .
docker push ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }}
docker push ${{ secrets.DOCKER_REPO }}:latest

- name: Update Kubernetes Deployment
run: |
envsubst < ./taskflow.yaml
env:
IMAGE_TAG: ${{ env.IMAGE_TAG }}
# deploy
- name: Transport taskflow.yaml to kubectl server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.KUBE_HOST }}
username: ${{ secrets.KUBE_HOST_USERNAME }}
key: ${{ secrets.KUBE_HOST_KEY }}
port: ${{ secrets.KUBE_HOST_PORT }}
overwrite: true
source: ./taskflow.yaml
target: ~/taskflow-back.yaml

- name: Deploy
uses: appleboy/ssh-action@master
id: deploy
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_HOST_USERNAME }}
key: ${{ secrets.DEV_HOST_KEY }}
port: ${{ secrets.DEV_HOST_PORT }}
host: ${{ secrets.KUBE_HOST }}
username: ${{ secrets.KUBE_HOST_USERNAME }}
key: ${{ secrets.KUBE_HOST_KEY }}
port: ${{ secrets.KUBE_HOST_PORT }}
script: |
docker rm -f taskflow
docker image rm ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} -f
docker run --name taskflow -d -p 9090:9090 \
--env-file /home/ubuntu/.env \
${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} \
--restart on-failure
kubectl apply --filename taskflow-back.yaml


2 changes: 1 addition & 1 deletion src/main/resources/mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spring:
properties:
hibernate:
default_batch_fetch_size: 100
format_sql: true
# format_sql: true
show_sql: true

datasource:
Expand Down
55 changes: 55 additions & 0 deletions taskflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Service
metadata:
name: taskflow-back
annotations:
service.beta.kubernetes.io/openstack-internal-load-balancer: 'false'
spec:
selector:
app: taskflow-back
ports:
- protocol: TCP
port: 9090
targetPort: 9090
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: taskflow-back
labels:
app: taskflow-back
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: taskflow-back
template:
metadata:
labels:
app: taskflow-back
spec:
containers:
- name: taskflow
image: clap.kr-central-2.kcr.dev/taskflow/taskflow-server:${IMAGE_TAG}
imagePullPolicy: Always
command: [ "java", "-jar", "app.jar" ]
args: [ "--spring.profiles.active=dev" ]
env:
- name: TZ
value: "Asia/Seoul"
envFrom:
- secretRef:
name: taskflow-back
ports:
- containerPort: 9090
restartPolicy: Always
nodeSelector:
label: "back"
imagePullSecrets:
- name: kc-cr-secret
Loading