Skip to content

Commit

Permalink
migration: kubernetes cloud migration from AWS-EKS to GCP-GKE
Browse files Browse the repository at this point in the history
migration: kubernetes cloud migration from AWS-EKS to GCP-GKE
  • Loading branch information
ghkdqhrbals authored Feb 27, 2024
2 parents a70a843 + 8b6f760 commit 32ba7da
Show file tree
Hide file tree
Showing 49 changed files with 254 additions and 198 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,15 @@ jobs:
cd k8s/onlychat/deployment
sh write_image_to_deploy.sh ${{ secrets.ECR_URL }} ap-northeast-2 ${{ needs.pushNewTag.outputs.NEW_VERSION }}
cd ..
kubectl apply -f ./configmap/
kubectl apply -f ./hpa/
kubectl apply -f ./eks/
kubectl apply -f redis.yaml
kubectl apply -f ./volume/
kubectl apply -f ./namespace/
kubectl apply -f ./service/
kubectl apply -f ./deployment/
/bin/bash deployment/scripts/deploy-scheduler.sh
# kubectl apply -f ./deployment/

- name: Record end time
run: echo "END_TIME=$(date +%s)" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-alert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: ${{ github.event.pull_request.number }},
issue_number: '${{ github.event.pull_request.number }}',
owner: 'ghkdqhrbals',
repo: 'spring-chatting-server',
body: '✅ Build & Test workflow succeed ✅\n- [Show details](https://github.com/ghkdqhrbals/spring-chatting-server/actions/runs/${{ github.run_id }})'
Expand All @@ -34,7 +34,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: ${{ github.event.pull_request.number }},
issue_number: '${{ github.event.pull_request.number }}',
owner: 'ghkdqhrbals',
repo: 'spring-chatting-server',
body: '❌ Build & Test workflow failed ❌\n- [Show details](https://github.com/ghkdqhrbals/spring-chatting-server/actions/runs/${{ github.run_id }})'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/redis
.gradle
**/build/
**/Dockerfile
2 changes: 1 addition & 1 deletion apigateway-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ WORKDIR /null
COPY /build/libs/apigateway-service.jar /null/app.jar
ENTRYPOINT java -jar app.jar

LABEL version=""
LABEL version="unspecified"
2 changes: 1 addition & 1 deletion config-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ WORKDIR /null
COPY /build/libs/config-service.jar /null/app.jar
ENTRYPOINT java -jar app.jar

LABEL version=""
LABEL version="unspecified"
2 changes: 1 addition & 1 deletion customer-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ WORKDIR /null
COPY /build/libs/customer-service.jar /null/app.jar
ENTRYPOINT java -jar app.jar

LABEL version=""
LABEL version="unspecified"
2 changes: 1 addition & 1 deletion discovery/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ WORKDIR /null
COPY /build/libs/discovery.jar /null/app.jar
ENTRYPOINT java -jar app.jar

LABEL version=""
LABEL version="unspecified"
7 changes: 7 additions & 0 deletions k8s/onlychat/configmap/postgres-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-config
data:
postgresql.conf: |
max_connections = 100
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ spec:
labels:
app: chat-db
spec:
initContainers:
- name: init-data-dir
image: busybox
command: ["sh", "-c", "mkdir -p /var/lib/postgresql/production/data"]
volumeMounts:
- name: chat-vol
mountPath: /var/lib/postgresql/production/data
containers:
- args:
- -c
Expand Down Expand Up @@ -48,7 +55,7 @@ spec:
protocol: TCP
volumeMounts:
- name: chat-vol
mountPath: /var/lib/postgresql/data
mountPath: /var/lib/postgresql/production/data
- name: config-volume
mountPath: /etc/postgresql/conf.d
restartPolicy: Always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ spec:
labels:
app: customer-db
spec:
initContainers:
- name: init-data-dir
image: busybox
command: ["sh", "-c", "mkdir -p /var/lib/postgresql/production/data"]
volumeMounts:
- name: customer-vol
mountPath: /var/lib/postgresql/production/data
containers:
- args:
- -c
Expand Down Expand Up @@ -40,7 +47,7 @@ spec:
resources: {}
volumeMounts:
- name: customer-vol
mountPath: /var/lib/postgresql/data
mountPath: /var/lib/postgresql/production/data
restartPolicy: Always
volumes:
- name: customer-vol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ spec:
labels:
app: user-db
spec:
initContainers:
- name: init-data-dir
image: busybox
command: ["sh", "-c", "mkdir -p /var/lib/postgresql/production/data"]
volumeMounts:
- name: user-vol
mountPath: /var/lib/postgresql/production/data
containers:
- args:
- -c
Expand Down Expand Up @@ -39,7 +46,7 @@ spec:
protocol: TCP
volumeMounts:
- name: user-vol
mountPath: /var/lib/postgresql/data
mountPath: /var/lib/postgresql/production/data
restartPolicy: Always
volumes:
- name: user-vol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ spec:
labels:
app: pgadmin
spec:
initContainers:
- name: init-data-dir
image: busybox
command: ["sh", "-c", "mkdir -p /data/pgadmin"]
volumeMounts:
- name: pgadmin-vol
mountPath: /data/pgadmin
containers:
- name: pgadmin
image: dpage/pgadmin4
image: dpage/pgadmin4:latest
ports:
- containerPort: 80
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,28 @@ spec:
app: api-server-service
spec:
imagePullSecrets:
- name: ecr-cred
- name: ecr-secret
containers:
- image: main-service_api-server:latest
name: api-server
env:
- name: SERVER_PORT
value: "8000"
- name: SPRING_CLOUD_CONFIG_URI
value: "http://43.203.25.44:8888"
- name: token_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-expiration-time
- name: token_refresh_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-refresh-expiration-time
- name: spring_datasource_hikari_password
valueFrom:
secretKeyRef:
name: database-secret
key: chat-db-password
- name: SPRING_MAIN_web-application-type
value: "reactive"
- name: spring_rabbitmq_host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
app: discovery-server-service
spec:
imagePullSecrets:
- name: ecr-cred
- name: ecr-secret
containers:
- image: main-service_discovery-server:latest
name: discovery-server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
app: user-server-service
spec:
imagePullSecrets:
- name: ecr-cred
- name: ecr-secret
containers:
- env:
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
Expand All @@ -22,18 +22,8 @@ spec:
value: "kafka-service:9092"
- name: SERVER_PORT
value: "8010"
- name: SPRING_CLOUD_CONFIG_URI
value: "http://43.203.25.44:8888"
- name: SPRING_MAIN_web-application-type
value: "reactive"
- name: spring_rabbitmq_host
value: "43.203.25.44"
- name: spring_rabbitmq_port
value: "5672"
- name: spring_rabbitmq_username
value: "guest"
- name: spring_rabbitmq_password
value: "guest"
- name: eureka_client_service-url_defaultZone
value: http://discovery-server-service:8761/eureka
- name: server_undertow_no-request-timeout
Expand All @@ -50,21 +40,27 @@ spec:
secretKeyRef:
name: database-secret
key: user-db-username
# - name: token_secret
# valueFrom:
# secretKeyRef:
# name: token-secret
# key: secret
# - name: token_expiration_time
# valueFrom:
# configMapKeyRef:
# name: token-secret
# key: expiration_time
# - name: token_refresh_expiration_time
# valueFrom:
# configMapKeyRef:
# name: token-secret
# key: refresh_expiration_time
- name: token_secret
valueFrom:
secretKeyRef:
name: token-secret
key: token-priv-key-64bit
- name: token_refresh_expiration_time
- name: token_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-expiration-time
- name: token_refresh_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-refresh-expiration-time
- name: spring_datasource_hikari_password
valueFrom:
secretKeyRef:
name: database-secret
key: chat-db-password
- name: spring_datasource_url
value: "jdbc:postgresql://user-db:5435/user"
- name: spring_data_redis_host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
app: customer-server-service
spec:
imagePullSecrets:
- name: ecr-cred
- name: ecr-secret
containers:
- env:
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
Expand All @@ -25,8 +25,21 @@ spec:
value: "kafka-service:9092"
- name: SERVER_PORT
value: "8020"
- name: SPRING_CLOUD_CONFIG_URI
value: http://43.203.25.44:8888
- name: token_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-expiration-time
- name: token_refresh_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-refresh-expiration-time
- name: spring_datasource_hikari_password
valueFrom:
secretKeyRef:
name: database-secret
key: chat-db-password
- name: spring_rabbitmq_host
value: "43.203.25.44"
- name: spring_rabbitmq_port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ spec:
labels:
app: chatting-server-service
spec:
imagePullSecrets:
- name: ecr-secret
containers:
- env:
- name: SERVER_PORT
value: "8030"
- name: SPRING_CLOUD_CONFIG_URI
value: "http://43.203.25.44:8888"
- name: spring_kafka_bootstrap-servers
value: "kafka-service:9092"
- name: spring_autoconfigure_exclude
Expand All @@ -26,22 +26,27 @@ spec:
value: "redis-service"
- name: spring_data_redis_port
value: "6379"
- name: spring_rabbitmq_host
value: "43.203.25.44"
- name: spring_rabbitmq_port
value: "5672"
- name: spring_rabbitmq_username
value: "guest"
- name: spring_rabbitmq_password
value: "guest"
- name: eureka_client_service-url_defaultZone
value: http://discovery-server-service:8761/eureka
- name: spring_cloud_discovery_enabled
value: "false"
- name: spring_config_activate_on-profile
value: "prod"
- name: spring_datasource_hikari_maximum-pool-size
value: "150"
- name: token_secret
valueFrom:
secretKeyRef:
name: token-secret
key: token-priv-key-64bit
- name: token_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-expiration-time
- name: token_refresh_expiration_time
valueFrom:
secretKeyRef:
name: token-secret
key: token-refresh-expiration-time
- name: spring_datasource_hikari_password
valueFrom:
secretKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
app: front-server-service
spec:
imagePullSecrets:
- name: ecr-cred
- name: ecr-secret
containers:
- env:
- name: SERVER_PORT
Expand Down
Loading

0 comments on commit 32ba7da

Please sign in to comment.