diff --git a/Jenkinsfile b/Jenkinsfile index 9637c02..18b7637 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -167,9 +167,11 @@ spec: kubectl -n ${APP_NS} rollout status deploy/sayit-helpdesk-session-redis --timeout=120s fi + kubectl -n ${APP_NS} patch deploy ${DEPLOY} --type=strategic -p '{"spec":{"strategy":{"type":"RollingUpdate","rollingUpdate":{"maxUnavailable":0,"maxSurge":1}},"template":{"spec":{"containers":[{"name":"'${DEPLOY}'","startupProbe":{"httpGet":{"path":"/health.do","port":8080,"scheme":"HTTP"},"periodSeconds":5,"timeoutSeconds":2,"failureThreshold":36},"readinessProbe":{"httpGet":{"path":"/health.do","port":8080,"scheme":"HTTP"},"initialDelaySeconds":10,"periodSeconds":5,"timeoutSeconds":2,"failureThreshold":3},"livenessProbe":{"httpGet":{"path":"/health.do","port":8080,"scheme":"HTTP"},"initialDelaySeconds":30,"periodSeconds":10,"timeoutSeconds":1,"failureThreshold":3}}]}}}}' + if [ "${TARGET_ENV}" = "dev" ]; then kubectl -n ${APP_NS} patch deploy ${DEPLOY} --type=strategic -p '{"spec":{"template":{"spec":{"containers":[{"name":"'${DEPLOY}'","env":[{"name":"SPRING_PROFILES_ACTIVE","value":"redis-session"}],"volumeMounts":[{"name":"heapdumps","mountPath":"/heapdumps"}]}],"volumes":[{"name":"heapdumps","nfs":{"server":"192.168.0.120","path":"/volume2/NFS/helpdesk-dev/heapdumps"}}]}}}}' - elif [ "${TARGET_ENV}" = "prod" ]; then + elif [ "${TARGET_ENV}" = "stage" ] || [ "${TARGET_ENV}" = "prod" ]; then kubectl -n ${APP_NS} patch deploy ${DEPLOY} --type=strategic -p '{"spec":{"template":{"spec":{"containers":[{"name":"'${DEPLOY}'","env":[{"name":"SPRING_PROFILES_ACTIVE","value":"redis-session"}]}]}}}}' fi diff --git a/k8s/stage/session-redis.yaml b/k8s/stage/session-redis.yaml new file mode 100644 index 0000000..fb199eb --- /dev/null +++ b/k8s/stage/session-redis.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sayit-helpdesk-session-redis + namespace: sayit-helpdesk-stage + labels: + app: sayit-helpdesk-session-redis +spec: + replicas: 1 + selector: + matchLabels: + app: sayit-helpdesk-session-redis + template: + metadata: + labels: + app: sayit-helpdesk-session-redis + spec: + containers: + - name: redis + image: redis:7.2-alpine + imagePullPolicy: IfNotPresent + args: + - redis-server + - --save + - "" + - --appendonly + - "no" + ports: + - name: redis + containerPort: 6379 + readinessProbe: + tcpSocket: + port: redis + initialDelaySeconds: 3 + periodSeconds: 5 + timeoutSeconds: 2 + failureThreshold: 3 + livenessProbe: + tcpSocket: + port: redis + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 2 + failureThreshold: 3 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 500m + memory: 256Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: sayit-helpdesk-session-redis + namespace: sayit-helpdesk-stage + labels: + app: sayit-helpdesk-session-redis +spec: + type: ClusterIP + selector: + app: sayit-helpdesk-session-redis + ports: + - name: redis + port: 6379 + targetPort: redis diff --git a/src/main/resources/egovframework/egovProps/globals-stage.properties b/src/main/resources/egovframework/egovProps/globals-stage.properties index 39c0282..293d946 100644 --- a/src/main/resources/egovframework/egovProps/globals-stage.properties +++ b/src/main/resources/egovframework/egovProps/globals-stage.properties @@ -147,7 +147,7 @@ ldap.username =uid=admin,ou=system ldap.password =secret # Spring Session Redis -Session.Redis.Enabled=false +Session.Redis.Enabled=true Session.Redis.Host=sayit-helpdesk-session-redis Session.Redis.Port=6379 Session.Redis.Database=0