mirror of
https://github.com/won-ktds/smarketing-backend.git
synced 2025-12-06 07:06:24 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
3a4ba5554e
81
Jenkinsfile
vendored
81
Jenkinsfile
vendored
@ -1,81 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
|
|
||||||
environment {
|
|
||||||
ACR_LOGIN_SERVER = 'acrsmarketing17567.azurecr.io'
|
|
||||||
IMAGE_NAME = 'member'
|
|
||||||
MANIFEST_REPO = 'https://github.com/won-ktds/smarketing-manifest.git'
|
|
||||||
MANIFEST_PATH = 'member/deployment.yaml'
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('Checkout') {
|
|
||||||
steps {
|
|
||||||
checkout scm
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
dir('member') {
|
|
||||||
sh './gradlew clean build -x test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Test') {
|
|
||||||
steps {
|
|
||||||
dir('member') {
|
|
||||||
sh './gradlew test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build Docker Image') {
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
def imageTag = "${BUILD_NUMBER}-${env.GIT_COMMIT.substring(0,8)}"
|
|
||||||
def fullImageName = "${ACR_LOGIN_SERVER}/${IMAGE_NAME}:${imageTag}"
|
|
||||||
|
|
||||||
dir('member') {
|
|
||||||
sh "docker build -t ${fullImageName} ."
|
|
||||||
}
|
|
||||||
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'acr-credentials', usernameVariable: 'ACR_USERNAME', passwordVariable: 'ACR_PASSWORD')]) {
|
|
||||||
sh "docker login ${ACR_LOGIN_SERVER} -u ${ACR_USERNAME} -p ${ACR_PASSWORD}"
|
|
||||||
sh "docker push ${fullImageName}"
|
|
||||||
}
|
|
||||||
|
|
||||||
env.IMAGE_TAG = imageTag
|
|
||||||
env.FULL_IMAGE_NAME = fullImageName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Update Manifest') {
|
|
||||||
steps {
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'github-credentials', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_TOKEN')]) {
|
|
||||||
sh '''
|
|
||||||
git clone https://${GIT_TOKEN}@github.com/won-ktds/smarketing-manifest.git manifest-repo
|
|
||||||
cd manifest-repo
|
|
||||||
|
|
||||||
# Update image tag in deployment.yaml
|
|
||||||
sed -i "s|image: .*|image: ${FULL_IMAGE_NAME}|g" ${MANIFEST_PATH}
|
|
||||||
|
|
||||||
git config user.email "jenkins@smarketing.com"
|
|
||||||
git config user.name "Jenkins"
|
|
||||||
git add .
|
|
||||||
git commit -m "Update ${IMAGE_NAME} image to ${IMAGE_TAG}"
|
|
||||||
git push origin main
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
always {
|
|
||||||
cleanWs()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
157
smarketing-java/deployment/Jenkinsfile
vendored
Normal file
157
smarketing-java/deployment/Jenkinsfile
vendored
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
def PIPELINE_ID = "${env.BUILD_NUMBER}"
|
||||||
|
|
||||||
|
def getImageTag() {
|
||||||
|
def dateFormat = new java.text.SimpleDateFormat('yyyyMMddHHmmss')
|
||||||
|
def currentDate = new Date()
|
||||||
|
return dateFormat.format(currentDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
podTemplate(
|
||||||
|
label: "${PIPELINE_ID}",
|
||||||
|
serviceAccount: 'jenkins',
|
||||||
|
containers: [
|
||||||
|
containerTemplate(name: 'podman', image: "mgoltzsche/podman", ttyEnabled: true, command: 'cat', privileged: true),
|
||||||
|
containerTemplate(name: 'gradle',
|
||||||
|
image: 'gradle:jdk17',
|
||||||
|
ttyEnabled: true,
|
||||||
|
command: 'cat',
|
||||||
|
envVars: [
|
||||||
|
envVar(key: 'DOCKER_HOST', value: 'unix:///run/podman/podman.sock'),
|
||||||
|
envVar(key: 'TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE', value: '/run/podman/podman.sock'),
|
||||||
|
envVar(key: 'TESTCONTAINERS_RYUK_DISABLED', value: 'true')
|
||||||
|
]),
|
||||||
|
containerTemplate(name: 'azure-cli', image: 'hiondal/azure-kubectl:latest', command: 'cat', ttyEnabled: true),
|
||||||
|
containerTemplate(name: 'envsubst', image: "hiondal/envsubst", command: 'sleep', args: '1h')
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
emptyDirVolume(mountPath: '/home/gradle/.gradle', memory: false),
|
||||||
|
emptyDirVolume(mountPath: '/root/.azure', memory: false),
|
||||||
|
emptyDirVolume(mountPath: '/run/podman', memory: false)
|
||||||
|
]
|
||||||
|
) {
|
||||||
|
node(PIPELINE_ID) {
|
||||||
|
def props
|
||||||
|
def imageTag = getImageTag()
|
||||||
|
def manifest = "deploy.yaml"
|
||||||
|
def namespace
|
||||||
|
def services = ['member', 'store', 'marketing-content', 'ai-recommend']
|
||||||
|
|
||||||
|
stage("Get Source") {
|
||||||
|
checkout scm
|
||||||
|
props = readProperties file: "deployment/deploy_env_vars"
|
||||||
|
namespace = "${props.namespace}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Code Analysis & Quality Gate') {
|
||||||
|
container('gradle') {
|
||||||
|
sh "./gradlew clean build -x test"
|
||||||
|
|
||||||
|
// SonarQube 분석
|
||||||
|
withSonarQubeEnv('SonarQube Server') {
|
||||||
|
sh """
|
||||||
|
./gradlew sonarqube \\
|
||||||
|
-Dsonar.projectKey=smarketing-backend-member-kros235 \\
|
||||||
|
-Dsonar.host.url=\$SONAR_HOST_URL \\
|
||||||
|
-Dsonar.login=\$SONAR_AUTH_TOKEN
|
||||||
|
|
||||||
|
./gradlew sonarqube \\
|
||||||
|
-Dsonar.projectKey=smarketing-backend-store-kros235 \\
|
||||||
|
-Dsonar.host.url=\$SONAR_HOST_URL \\
|
||||||
|
-Dsonar.login=\$SONAR_AUTH_TOKEN
|
||||||
|
|
||||||
|
./gradlew sonarqube \\
|
||||||
|
-Dsonar.projectKey=smarketing-backend-marketing-content-kros235 \\
|
||||||
|
-Dsonar.host.url=\$SONAR_HOST_URL \\
|
||||||
|
-Dsonar.login=\$SONAR_AUTH_TOKEN
|
||||||
|
|
||||||
|
./gradlew sonarqube \\
|
||||||
|
-Dsonar.projectKey=smarketing-backend-ai-recommend-kros235 \\
|
||||||
|
-Dsonar.host.url=\$SONAR_HOST_URL \\
|
||||||
|
-Dsonar.login=\$SONAR_AUTH_TOKEN
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quality Gate 확인
|
||||||
|
timeout(time: 5, unit: 'MINUTES') {
|
||||||
|
waitForQualityGate abortPipeline: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build Application') {
|
||||||
|
container('gradle') {
|
||||||
|
sh """
|
||||||
|
./gradlew :member:clean :member:build -x test
|
||||||
|
./gradlew :store:clean :store:build -x test
|
||||||
|
./gradlew :marketing-content:clean :marketing-content:build -x test
|
||||||
|
./gradlew :ai-recommend:clean :ai-recommend:build -x test
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build & Push Images') {
|
||||||
|
container('podman') {
|
||||||
|
services.each { service ->
|
||||||
|
script {
|
||||||
|
// mysub 서비스 특별 처리 (요구사항에 없지만 참고용 주석)
|
||||||
|
// def buildDir = service == 'mysub' ? 'mysub-infra' : service
|
||||||
|
def buildDir = service
|
||||||
|
def jarFile = "${service}.jar"
|
||||||
|
|
||||||
|
sh """
|
||||||
|
podman build \\
|
||||||
|
--build-arg BUILD_LIB_DIR="${buildDir}/build/libs" \\
|
||||||
|
--build-arg ARTIFACTORY_FILE="${jarFile}" \\
|
||||||
|
-f deployment/container/Dockerfile \\
|
||||||
|
-t ${props.registry}/${props.image_org}/${service}:${imageTag} .
|
||||||
|
|
||||||
|
podman push ${props.registry}/${props.image_org}/${service}:${imageTag}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Generate & Apply Manifest') {
|
||||||
|
container('envsubst') {
|
||||||
|
sh """
|
||||||
|
export namespace=${namespace}
|
||||||
|
export allowed_origins=${props.allowed_origins}
|
||||||
|
export jwt_secret_key=${props.jwt_secret_key}
|
||||||
|
export postgres_user=${props.postgres_user}
|
||||||
|
export postgres_password=${props.postgres_password}
|
||||||
|
export replicas=${props.replicas}
|
||||||
|
export resources_requests_cpu=${props.resources_requests_cpu}
|
||||||
|
export resources_requests_memory=${props.resources_requests_memory}
|
||||||
|
export resources_limits_cpu=${props.resources_limits_cpu}
|
||||||
|
export resources_limits_memory=${props.resources_limits_memory}
|
||||||
|
|
||||||
|
# 이미지 경로 환경변수 설정
|
||||||
|
export member_image_path=${props.registry}/${props.image_org}/member:${imageTag}
|
||||||
|
export store_image_path=${props.registry}/${props.image_org}/store:${imageTag}
|
||||||
|
export marketing_content_image_path=${props.registry}/${props.image_org}/marketing-content:${imageTag}
|
||||||
|
export ai_recommend_image_path=${props.registry}/${props.image_org}/ai-recommend:${imageTag}
|
||||||
|
|
||||||
|
# manifest 생성
|
||||||
|
envsubst < deployment/${manifest}.template > deployment/${manifest}
|
||||||
|
|
||||||
|
echo "=== Generated Manifest File ==="
|
||||||
|
cat deployment/${manifest}
|
||||||
|
echo "==============================="
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
container('azure-cli') {
|
||||||
|
sh """
|
||||||
|
kubectl apply -f deployment/${manifest}
|
||||||
|
|
||||||
|
echo "Waiting for deployments to be ready..."
|
||||||
|
kubectl -n ${namespace} wait --for=condition=available deployment/member --timeout=300s
|
||||||
|
kubectl -n ${namespace} wait --for=condition=available deployment/store --timeout=300s
|
||||||
|
kubectl -n ${namespace} wait --for=condition=available deployment/marketing-content --timeout=300s
|
||||||
|
kubectl -n ${namespace} wait --for=condition=available deployment/ai-recommend --timeout=300s
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
475
smarketing-java/deployment/deploy.yaml.template
Normal file
475
smarketing-java/deployment/deploy.yaml.template
Normal file
@ -0,0 +1,475 @@
|
|||||||
|
# ConfigMap
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: common-config
|
||||||
|
namespace: ${namespace}
|
||||||
|
data:
|
||||||
|
ALLOWED_ORIGINS: ${allowed_origins}
|
||||||
|
JPA_DDL_AUTO: update
|
||||||
|
JPA_SHOW_SQL: 'true'
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: member-config
|
||||||
|
namespace: ${namespace}
|
||||||
|
data:
|
||||||
|
POSTGRES_DB: member
|
||||||
|
POSTGRES_HOST: member-postgresql
|
||||||
|
POSTGRES_PORT: '5432'
|
||||||
|
SERVER_PORT: '8081'
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: store-config
|
||||||
|
namespace: ${namespace}
|
||||||
|
data:
|
||||||
|
POSTGRES_DB: store
|
||||||
|
POSTGRES_HOST: store-postgresql
|
||||||
|
POSTGRES_PORT: '5432'
|
||||||
|
SERVER_PORT: '8082'
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: marketing-content-config
|
||||||
|
namespace: ${namespace}
|
||||||
|
data:
|
||||||
|
POSTGRES_DB: marketing_content
|
||||||
|
POSTGRES_HOST: marketing-content-postgresql
|
||||||
|
POSTGRES_PORT: '5432'
|
||||||
|
SERVER_PORT: '8083'
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: ai-recommend-config
|
||||||
|
namespace: ${namespace}
|
||||||
|
data:
|
||||||
|
POSTGRES_DB: ai_recommend
|
||||||
|
POSTGRES_HOST: ai-recommend-postgresql
|
||||||
|
POSTGRES_PORT: '5432'
|
||||||
|
SERVER_PORT: '8084'
|
||||||
|
|
||||||
|
---
|
||||||
|
# Secrets
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: common-secret
|
||||||
|
namespace: ${namespace}
|
||||||
|
stringData:
|
||||||
|
JWT_SECRET_KEY: ${jwt_secret_key}
|
||||||
|
type: Opaque
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: member-secret
|
||||||
|
namespace: ${namespace}
|
||||||
|
stringData:
|
||||||
|
JWT_ACCESS_TOKEN_VALIDITY: '3600000'
|
||||||
|
JWT_REFRESH_TOKEN_VALIDITY: '86400000'
|
||||||
|
POSTGRES_PASSWORD: ${postgres_password}
|
||||||
|
POSTGRES_USER: ${postgres_user}
|
||||||
|
type: Opaque
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: store-secret
|
||||||
|
namespace: ${namespace}
|
||||||
|
stringData:
|
||||||
|
POSTGRES_PASSWORD: ${postgres_password}
|
||||||
|
POSTGRES_USER: ${postgres_user}
|
||||||
|
type: Opaque
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: marketing-content-secret
|
||||||
|
namespace: ${namespace}
|
||||||
|
stringData:
|
||||||
|
POSTGRES_PASSWORD: ${postgres_password}
|
||||||
|
POSTGRES_USER: ${postgres_user}
|
||||||
|
type: Opaque
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: ai-recommend-secret
|
||||||
|
namespace: ${namespace}
|
||||||
|
stringData:
|
||||||
|
POSTGRES_PASSWORD: ${postgres_password}
|
||||||
|
POSTGRES_USER: ${postgres_user}
|
||||||
|
type: Opaque
|
||||||
|
|
||||||
|
---
|
||||||
|
# Deployments
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: member
|
||||||
|
namespace: ${namespace}
|
||||||
|
labels:
|
||||||
|
app: member
|
||||||
|
spec:
|
||||||
|
replicas: ${replicas}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: member
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: member
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: acr-secret
|
||||||
|
containers:
|
||||||
|
- name: member
|
||||||
|
image: ${member_image_path}
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 8081
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: ${resources_requests_cpu}
|
||||||
|
memory: ${resources_requests_memory}
|
||||||
|
limits:
|
||||||
|
cpu: ${resources_limits_cpu}
|
||||||
|
memory: ${resources_limits_memory}
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: common-config
|
||||||
|
- configMapRef:
|
||||||
|
name: member-config
|
||||||
|
- secretRef:
|
||||||
|
name: common-secret
|
||||||
|
- secretRef:
|
||||||
|
name: member-secret
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "nc -z member-postgresql 5432"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8081
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
periodSeconds: 30
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8081
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 5
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: store
|
||||||
|
namespace: ${namespace}
|
||||||
|
labels:
|
||||||
|
app: store
|
||||||
|
spec:
|
||||||
|
replicas: ${replicas}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: store
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: store
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: acr-secret
|
||||||
|
containers:
|
||||||
|
- name: store
|
||||||
|
image: ${store_image_path}
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 8082
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: ${resources_requests_cpu}
|
||||||
|
memory: ${resources_requests_memory}
|
||||||
|
limits:
|
||||||
|
cpu: ${resources_limits_cpu}
|
||||||
|
memory: ${resources_limits_memory}
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: common-config
|
||||||
|
- configMapRef:
|
||||||
|
name: store-config
|
||||||
|
- secretRef:
|
||||||
|
name: common-secret
|
||||||
|
- secretRef:
|
||||||
|
name: store-secret
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "nc -z store-postgresql 5432"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8082
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
periodSeconds: 30
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8082
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 5
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: marketing-content
|
||||||
|
namespace: ${namespace}
|
||||||
|
labels:
|
||||||
|
app: marketing-content
|
||||||
|
spec:
|
||||||
|
replicas: ${replicas}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: marketing-content
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: marketing-content
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: acr-secret
|
||||||
|
containers:
|
||||||
|
- name: marketing-content
|
||||||
|
image: ${marketing_content_image_path}
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 8083
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: ${resources_requests_cpu}
|
||||||
|
memory: ${resources_requests_memory}
|
||||||
|
limits:
|
||||||
|
cpu: ${resources_limits_cpu}
|
||||||
|
memory: ${resources_limits_memory}
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: common-config
|
||||||
|
- configMapRef:
|
||||||
|
name: marketing-content-config
|
||||||
|
- secretRef:
|
||||||
|
name: common-secret
|
||||||
|
- secretRef:
|
||||||
|
name: marketing-content-secret
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "nc -z marketing-content-postgresql 5432"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8083
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
periodSeconds: 30
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8083
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 5
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: ai-recommend
|
||||||
|
namespace: ${namespace}
|
||||||
|
labels:
|
||||||
|
app: ai-recommend
|
||||||
|
spec:
|
||||||
|
replicas: ${replicas}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: ai-recommend
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: ai-recommend
|
||||||
|
spec:
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: acr-secret
|
||||||
|
containers:
|
||||||
|
- name: ai-recommend
|
||||||
|
image: ${ai_recommend_image_path}
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 8084
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: ${resources_requests_cpu}
|
||||||
|
memory: ${resources_requests_memory}
|
||||||
|
limits:
|
||||||
|
cpu: ${resources_limits_cpu}
|
||||||
|
memory: ${resources_limits_memory}
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: common-config
|
||||||
|
- configMapRef:
|
||||||
|
name: ai-recommend-config
|
||||||
|
- secretRef:
|
||||||
|
name: common-secret
|
||||||
|
- secretRef:
|
||||||
|
name: ai-recommend-secret
|
||||||
|
startupProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "nc -z ai-recommend-postgresql 5432"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
failureThreshold: 10
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8084
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
periodSeconds: 30
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /actuator/health
|
||||||
|
port: 8084
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 5
|
||||||
|
|
||||||
|
---
|
||||||
|
# Services
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: member
|
||||||
|
namespace: ${namespace}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: member
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8081
|
||||||
|
type: ClusterIP
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: store
|
||||||
|
namespace: ${namespace}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: store
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8082
|
||||||
|
type: ClusterIP
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: marketing-content
|
||||||
|
namespace: ${namespace}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: marketing-content
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8083
|
||||||
|
type: ClusterIP
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: ai-recommend
|
||||||
|
namespace: ${namespace}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: ai-recommend
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8084
|
||||||
|
type: ClusterIP
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: smarketing-backend
|
||||||
|
namespace: ${namespace}
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: nginx
|
||||||
|
spec:
|
||||||
|
ingressClassName: nginx
|
||||||
|
rules:
|
||||||
|
- http:
|
||||||
|
paths:
|
||||||
|
- path: /api/auth
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: member
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- path: /api/store
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: store
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- path: /api/content
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: marketing-content
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
- path: /api/recommend
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: ai-recommend
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
23
smarketing-java/deployment/deploy_env_vars
Normal file
23
smarketing-java/deployment/deploy_env_vars
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Team Settings
|
||||||
|
teamid=kros235
|
||||||
|
root_project=smarketing-backend
|
||||||
|
namespace=smarketing
|
||||||
|
|
||||||
|
# Container Registry Settings
|
||||||
|
registry=unicorncr.azurecr.io
|
||||||
|
image_org=smarketing
|
||||||
|
|
||||||
|
# Application Settings
|
||||||
|
replicas=1
|
||||||
|
allowed_origins=http://20.249.171.38
|
||||||
|
|
||||||
|
# Security Settings
|
||||||
|
jwt_secret_key=8O2HQ13etL2BWZvYOiWsJ5uWFoLi6NBUG8divYVoCgtHVvlk3dqRksMl16toztDUeBTSIuOOPvHIrYq11G2BwQ
|
||||||
|
postgres_user=admin
|
||||||
|
postgres_password=Hi5Jessica!
|
||||||
|
|
||||||
|
# Resource Settings
|
||||||
|
resources_requests_cpu=256m
|
||||||
|
resources_requests_memory=256Mi
|
||||||
|
resources_limits_cpu=1024m
|
||||||
|
resources_limits_memory=1024Mi
|
||||||
Loading…
x
Reference in New Issue
Block a user