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

release / dev 서버 분리 작업 #171

Merged
merged 20 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c540da0
feat(k8s/): release/dev 분리
jjaegii Sep 13, 2024
9ea1053
feat(build-push.yml): argoCD GitOps를 위한 분리 작업
jjaegii Sep 13, 2024
8b5bec5
feat(build-push.yml): argoCD GitOps를 위한 분리 작업
jjaegii Sep 13, 2024
4f50dfd
fix(build-push.yml): sed 에러 수정
jjaegii Sep 13, 2024
759967a
fix(build-push.yml): push 에러 수정
jjaegii Sep 13, 2024
b17c3d2
fix(build-push.yml): push 에러 수정
jjaegii Sep 13, 2024
d31e132
fix(build-push.yml): push 에러 수정
jjaegii Sep 13, 2024
557a10d
Update deployment with image tag d31e132d1c70b700add7e07b114d334b0226…
github-actions[bot] Sep 13, 2024
53f48e5
fix(k8s/deployment.yaml): 이미지 태그 변경
jjaegii Sep 13, 2024
89dc988
delete(build-push.yml): github manifest에 push 삭제
jjaegii Sep 13, 2024
ee3857c
fix(k8s/deployment.yaml): 이미지 태그 변경
jjaegii Sep 13, 2024
9f00d5d
feat(k8s/): release 네임스페이스 설정
jjaegii Sep 13, 2024
1d05c73
feat(k8s/release): namespace 변경
jjaegii Sep 13, 2024
6042d53
feat(k8s/release): replicaset 변경
jjaegii Sep 13, 2024
6a80bd9
feat(k8s/release): ingress 변경
jjaegii Sep 13, 2024
0a6c4b8
feat(k8s/release): ingress 변경
jjaegii Sep 13, 2024
f4e7f0c
feat(build-push.yml): argoCD GitOps를 위한 분리 작업
jjaegii Sep 13, 2024
b81b757
feat(k8s/dev): dev 설정파일추가
jjaegii Sep 13, 2024
80384ab
fix(src/main/resources/application.properties): redirect-uri 경변경
jjaegii Sep 13, 2024
1eeaddd
feat(build-push.yml): argoCD GitOps를 위한 분리 작업
jjaegii Sep 13, 2024
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
98 changes: 0 additions & 98 deletions .github/workflows/build-push-deploy.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Deploy to Docker Hub

on:
push:
branches: [ "release", "dev" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build --daemon --parallel

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- name: Set Docker repository
run: |
if [[ "${{ github.ref }}" == "refs/heads/release" ]]; then
echo "DOCKER_REPO=yeseulhong/grass-diary-release" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "DOCKER_REPO=yeseulhong/grass-diary-dev" >> $GITHUB_ENV
fi

- name: Build and Push Docker Image
run: |
docker buildx create --use
docker buildx build --platform linux/arm64,linux/amd64 -t ${{ env.DOCKER_REPO }}:latest --push .
5 changes: 3 additions & 2 deletions k8s/deployment.yaml → k8s/dev/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-boot-app
namespace: grass-diary-backend-dev
spec:
replicas: 1
replicas: 2
selector:
matchLabels:
app: spring-boot-app
Expand All @@ -14,7 +15,7 @@ spec:
spec:
containers:
- name: spring-boot-app
image: yeseulhong/grass-diary:${IMAGE_TAG}
image: yeseulhong/grass-diary-release:latest
ports:
- containerPort: 8080
env:
Expand Down
23 changes: 23 additions & 0 deletions k8s/dev/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dev-ingress
namespace: grass-diary-backend-dev
annotations:
kubernetes.io/ingress.class: nginx
spec:
tls:
- hosts:
- dev.chzzk-diary-server.shop
secretName: dev-tls-secret
rules:
- host: dev.chzzk-diary-server.shop
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: spring-boot-app-svc
port:
number: 80
1 change: 1 addition & 0 deletions k8s/service.yaml → k8s/dev/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: spring-boot-app-svc
namespace: grass-diary-backend-dev
spec:
selector:
app: spring-boot-app
Expand Down
24 changes: 0 additions & 24 deletions k8s/ingress.yaml

This file was deleted.

72 changes: 72 additions & 0 deletions k8s/release/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-boot-app
namespace: grass-diary-backend-release
spec:
replicas: 2
selector:
matchLabels:
app: spring-boot-app
template:
metadata:
labels:
app: spring-boot-app
spec:
containers:
- name: spring-boot-app
image: yeseulhong/grass-diary-release:latest
ports:
- containerPort: 8080
env:
- name: GOOGLE_CLIENT_ID
valueFrom:
secretKeyRef:
name: google-secrets
key: GOOGLE_CLIENT_ID
- name: GOOGLE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: google-secrets
key: GOOGLE_CLIENT_SECRET
- name: JWT_ACCESS_SECRET_KEY
valueFrom:
secretKeyRef:
name: jwt-secrets
key: JWT_ACCESS_SECRET_KEY
- name: JWT_REFRESH_SECRET_KEY
valueFrom:
secretKeyRef:
name: jwt-secrets
key: JWT_REFRESH_SECRET_KEY
- name: DB_SERVER_URL
valueFrom:
secretKeyRef:
name: db-secrets
key: DB_SERVER_URL
- name: DB_USER_ID
valueFrom:
secretKeyRef:
name: db-secrets
key: DB_USER_ID
- name: DB_USER_PW
valueFrom:
secretKeyRef:
name: db-secrets
key: DB_USER_PW
- name: S3_ACCESS_PUBLIC_KEY
valueFrom:
secretKeyRef:
name: s3-secrets
key: S3_ACCESS_PUBLIC_KEY
- name: S3_ACCESS_SECRET_KEY
valueFrom:
secretKeyRef:
name: s3-secrets
key: S3_ACCESS_SECRET_KEY
- name: S3_BUCKET_NAME
valueFrom:
secretKeyRef:
name: s3-secrets
key: S3_BUCKET_NAME

23 changes: 23 additions & 0 deletions k8s/release/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: release-ingress
namespace: grass-diary-backend-release
annotations:
kubernetes.io/ingress.class: nginx
spec:
tls:
- hosts:
- release.chzzk-diary-server.shop
secretName: release-tls-secret
rules:
- host: release.chzzk-diary-server.shop
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: spring-boot-app-svc
port:
number: 80
13 changes: 13 additions & 0 deletions k8s/release/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: spring-boot-app-svc
namespace: grass-diary-backend-release
spec:
selector:
app: spring-boot-app
ports:
- protocol: TCP
port: 80
targetPort: 8080

2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spring.jpa.properties.hibernate.show_sql=true
spring.jpa.show-sql=true
oauth2.client.registration.google.client-id=${GOOGLE_CLIENT_ID}
oauth2.client.registration.google.client-secret=${GOOGLE_CLIENT_SECRET}
oauth2.client.registration.google.redirect-uri=http://localhost:8080/api/auth/code/google
oauth2.client.registration.google.redirect-uri=https://release.chzzk-diary-server.shop/api/auth/code/google
oauth2.client.registration.google.authorization-grant-type=code
oauth2.client.registration.google.scope=profile email
oauth2.client.provider.google.authorization-uri=https://accounts.google.com/o/oauth2/v2/auth
Expand Down
Loading