Init
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
.git
|
||||
.gradle
|
||||
.idea
|
||||
**/build
|
||||
out
|
||||
*.iml
|
||||
@@ -0,0 +1,3 @@
|
||||
/gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
HELP.md
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
*.tmp
|
||||
*.log
|
||||
*.gz
|
||||
*.zip
|
||||
*.patch
|
||||
.gradle-local/
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Kotlin ###
|
||||
.kotlin
|
||||
|
||||
### Local env ###
|
||||
.env
|
||||
/.env.example
|
||||
/pcp.zip
|
||||
/promt/Промт1.txt
|
||||
/pcp_zip.zip
|
||||
/pcp-chatgpt-context*.zip
|
||||
/deploy/local-bundle/build/
|
||||
/deploy/local-bundle/pcp-local-bundle-*.tar.gz
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes:
|
||||
- services/pcp-ballistics-service/**/*
|
||||
- services/pcp-srpring-boot-admin-server/**/*
|
||||
- services/spring-cloud-config-server/**/*
|
||||
- services/pcp-complex-mission-service/**/*
|
||||
- services/tle-monitoring-service/**/*
|
||||
- services/pcp-mission-planing-service/**/*
|
||||
- services/pcp-request-service/**/*
|
||||
- services/pcp-stations-service/**/*
|
||||
- services/pcp-satellite-catalog-service/**/*
|
||||
- services/slots-service/**/*
|
||||
- services/pcp-ui-service/**/*
|
||||
- services/pcp-coverage-scheme-service/**/*
|
||||
- services/pcp-tgu-service/**/*
|
||||
- services/pcp-dynamic-plan-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- gradle.properties
|
||||
- gradle/**/*
|
||||
- .gitlab-ci.yml
|
||||
- .gitlab/ci/**/*
|
||||
- helm/pcp-ballistics-service/**/*
|
||||
- helm/pcp-spring-boot-admin-server/**/*
|
||||
- helm/spring-cloud-config-server/**/*
|
||||
- helm/pcp-complex-mission-service/**/*
|
||||
- helm/tle-monitoring-service/**/*
|
||||
- helm/pcp-mission-planing-service/**/*
|
||||
- helm/pcp-request-service/**/*
|
||||
- helm/pcp-stations-service/**/*
|
||||
- helm/pcp-satellite-catalog-service/**/*
|
||||
- helm/slots-service/**/*
|
||||
- helm/pcp-ui-service/**/*
|
||||
- helm/pcp-coverage-scheme-service/**/*
|
||||
- helm/pcp-tgu-service/**/*
|
||||
- helm/pcp-dynamic-plan-service/**/*
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
||||
changes:
|
||||
- .gitlab-ci.yml
|
||||
- .gitlab/ci/**/*
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "dev"'
|
||||
changes:
|
||||
- services/pcp-ballistics-service/**/*
|
||||
- services/pcp-srpring-boot-admin-server/**/*
|
||||
- services/spring-cloud-config-server/**/*
|
||||
- services/pcp-complex-mission-service/**/*
|
||||
- services/tle-monitoring-service/**/*
|
||||
- services/pcp-mission-planing-service/**/*
|
||||
- services/pcp-request-service/**/*
|
||||
- services/pcp-stations-service/**/*
|
||||
- services/pcp-satellite-catalog-service/**/*
|
||||
- services/slots-service/**/*
|
||||
- services/pcp-ui-service/**/*
|
||||
- services/pcp-coverage-scheme-service/**/*
|
||||
- services/pcp-tgu-service/**/*
|
||||
- services/pcp-dynamic-plan-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- gradle.properties
|
||||
- gradle/**/*
|
||||
- .gitlab-ci.yml
|
||||
- .gitlab/ci/**/*
|
||||
- helm/pcp-ballistics-service/**/*
|
||||
- helm/pcp-spring-boot-admin-server/**/*
|
||||
- helm/spring-cloud-config-server/**/*
|
||||
- helm/pcp-complex-mission-service/**/*
|
||||
- helm/tle-monitoring-service/**/*
|
||||
- helm/pcp-mission-planing-service/**/*
|
||||
- helm/pcp-request-service/**/*
|
||||
- helm/pcp-stations-service/**/*
|
||||
- helm/pcp-satellite-catalog-service/**/*
|
||||
- helm/slots-service/**/*
|
||||
- helm/pcp-ui-service/**/*
|
||||
- helm/pcp-coverage-scheme-service/**/*
|
||||
- helm/pcp-tgu-service/**/*
|
||||
- helm/pcp-dynamic-plan-service/**/*
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "master"'
|
||||
changes:
|
||||
- services/pcp-ballistics-service/**/*
|
||||
- services/pcp-srpring-boot-admin-server/**/*
|
||||
- services/spring-cloud-config-server/**/*
|
||||
- services/pcp-complex-mission-service/**/*
|
||||
- services/tle-monitoring-service/**/*
|
||||
- services/pcp-mission-planing-service/**/*
|
||||
- services/pcp-request-service/**/*
|
||||
- services/pcp-stations-service/**/*
|
||||
- services/pcp-satellite-catalog-service/**/*
|
||||
- services/slots-service/**/*
|
||||
- services/pcp-ui-service/**/*
|
||||
- services/pcp-coverage-scheme-service/**/*
|
||||
- services/pcp-tgu-service/**/*
|
||||
- services/pcp-dynamic-plan-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- gradle.properties
|
||||
- gradle/**/*
|
||||
- .gitlab-ci.yml
|
||||
- .gitlab/ci/**/*
|
||||
- helm/pcp-ballistics-service/**/*
|
||||
- helm/pcp-spring-boot-admin-server/**/*
|
||||
- helm/spring-cloud-config-server/**/*
|
||||
- helm/pcp-complex-mission-service/**/*
|
||||
- helm/tle-monitoring-service/**/*
|
||||
- helm/pcp-mission-planing-service/**/*
|
||||
- helm/pcp-request-service/**/*
|
||||
- helm/pcp-stations-service/**/*
|
||||
- helm/pcp-satellite-catalog-service/**/*
|
||||
- helm/slots-service/**/*
|
||||
- helm/pcp-ui-service/**/*
|
||||
- helm/pcp-coverage-scheme-service/**/*
|
||||
- helm/pcp-tgu-service/**/*
|
||||
- helm/pcp-dynamic-plan-service/**/*
|
||||
- when: never
|
||||
|
||||
default:
|
||||
tags:
|
||||
- nstart
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
- package
|
||||
- deploy
|
||||
|
||||
ci:config:
|
||||
stage: test
|
||||
image: alpine:3.20
|
||||
rules:
|
||||
- changes:
|
||||
- .gitlab-ci.yml
|
||||
- .gitlab/ci/**/*
|
||||
- when: never
|
||||
script:
|
||||
- echo "GitLab CI configuration changed"
|
||||
|
||||
include:
|
||||
- local: .gitlab/ci/pcp-ballistics-service.yml
|
||||
- local: .gitlab/ci/pcp-spring-boot-admin-server.yml
|
||||
- local: .gitlab/ci/spring-cloud-config-server.yml
|
||||
- local: .gitlab/ci/pcp-complex-mission-service-tle.yml
|
||||
- local: .gitlab/ci/pcp-mission-planing-service.yml
|
||||
- local: .gitlab/ci/pcp-request-service.yml
|
||||
- local: .gitlab/ci/pcp-stations-service.yml
|
||||
- local: .gitlab/ci/pcp-satellite-catalog-service.yml
|
||||
- local: .gitlab/ci/slots-service.yml
|
||||
- local: .gitlab/ci/pcp-ui-service.yml
|
||||
- local: .gitlab/ci/pcp-coverage-scheme-service.yml
|
||||
- local: .gitlab/ci/pcp-tgu-service.yml
|
||||
- local: .gitlab/ci/pcp-dynamic-plan-service.yml
|
||||
@@ -0,0 +1,267 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
BALLISTICS_SERVICE_DIR: "services/pcp-ballistics-service"
|
||||
|
||||
# При необходимости переопредели путь к chart через CI/CD variable
|
||||
BALLISTICS_HELM_CHART_DIR: "helm/pcp-ballistics-service"
|
||||
|
||||
# Имя релиза в k8s
|
||||
BALLISTICS_HELM_RELEASE: "pcp-ballistics-service"
|
||||
|
||||
# Полный путь до image во внутреннем registry
|
||||
BALLISTICS_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-ballistics-service"
|
||||
|
||||
# Окружения / namespace
|
||||
BALLISTICS_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
BALLISTICS_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
|
||||
BALLISTICS_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
.ballistics:changes: &ballistics_changes
|
||||
- services/pcp-ballistics-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-ballistics-service.*
|
||||
- helm/pcp-ballistics-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.ballistics:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *ballistics_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *ballistics_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *ballistics_changes
|
||||
- when: never
|
||||
|
||||
.ballistics:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *ballistics_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *ballistics_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *ballistics_changes
|
||||
- when: never
|
||||
|
||||
.ballistics:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *ballistics_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.ballistics:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *ballistics_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.ballistics:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-ballistics-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.ballistics:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.ballistics:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
ballistics:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
services:
|
||||
- name: repo.nstart.cloud/postgis/postgis:16-3.4
|
||||
alias: postgres
|
||||
variables:
|
||||
POSTGRES_DB: "pcp_ballistics"
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
SPRING_DATASOURCE_URL: "jdbc:postgresql://postgres:5432/pcp_ballistics"
|
||||
SPRING_DATASOURCE_USERNAME: "postgres"
|
||||
SPRING_DATASOURCE_PASSWORD: "password"
|
||||
extends:
|
||||
- .ballistics:rules:test
|
||||
- .ballistics:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-ballistics-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-ballistics-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-ballistics-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
ballistics:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .ballistics:rules:build-and-image
|
||||
- .ballistics:gradle-cache
|
||||
needs:
|
||||
- job: ballistics:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-ballistics-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-ballistics-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
ballistics:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .ballistics:rules:build-and-image
|
||||
- .ballistics:docker-build
|
||||
needs:
|
||||
- job: ballistics:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "BALLISTICS_IMAGE_REPOSITORY=$BALLISTICS_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$BALLISTICS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$BALLISTICS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$BALLISTICS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$BALLISTICS_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$BALLISTICS_IMAGE_REPOSITORY:$BALLISTICS_IMAGE_TAG" docker-context
|
||||
- docker push "$BALLISTICS_IMAGE_REPOSITORY:$BALLISTICS_IMAGE_TAG"
|
||||
- printf "BALLISTICS_IMAGE=%s\n" "$BALLISTICS_IMAGE_REPOSITORY:$BALLISTICS_IMAGE_TAG" > ballistics-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: ballistics-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
ballistics:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .ballistics:rules:deploy-dev
|
||||
- .ballistics:helm-deploy
|
||||
needs:
|
||||
- job: ballistics:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-ballistics-service
|
||||
resource_group: pcp-ballistics-service-dev
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${BALLISTICS_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${BALLISTICS_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$BALLISTICS_HELM_RELEASE"
|
||||
"$BALLISTICS_HELM_CHART_DIR"
|
||||
--namespace "$BALLISTICS_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$BALLISTICS_HELM_CHART_DIR/values.yaml"
|
||||
-f "$BALLISTICS_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
ballistics:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .ballistics:rules:deploy-master
|
||||
- .ballistics:helm-deploy
|
||||
needs:
|
||||
- job: ballistics:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-ballistics-service
|
||||
resource_group: pcp-ballistics-service-master
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${BALLISTICS_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${BALLISTICS_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$BALLISTICS_HELM_RELEASE"
|
||||
"$BALLISTICS_HELM_CHART_DIR"
|
||||
--namespace "$BALLISTICS_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$BALLISTICS_HELM_CHART_DIR/values.yaml"
|
||||
-f "$BALLISTICS_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,471 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
COMPLEX_MISSION_SERVICE_DIR: "services/pcp-complex-mission-service"
|
||||
COMPLEX_MISSION_SERVICE_HELM_CHART_DIR: "helm/pcp-complex-mission-service"
|
||||
COMPLEX_MISSION_SERVICE_HELM_RELEASE: "pcp-complex-mission-service"
|
||||
COMPLEX_MISSION_SERVICE_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-complex-mission-service"
|
||||
COMPLEX_MISSION_SERVICE_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
COMPLEX_MISSION_SERVICE_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
COMPLEX_MISSION_SERVICE_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
TLE_MONITORING_SERVICE_DIR: "services/tle-monitoring-service"
|
||||
TLE_MONITORING_HELM_CHART_DIR: "helm/tle-monitoring-service"
|
||||
TLE_MONITORING_HELM_RELEASE: "tle-monitoring-service"
|
||||
TLE_MONITORING_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/tle-monitoring-service"
|
||||
TLE_MONITORING_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
TLE_MONITORING_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
TLE_MONITORING_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.complex_mission_service_changes: &complex_mission_service_changes
|
||||
- services/pcp-complex-mission-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-complex-mission-service-tle.yml
|
||||
- helm/pcp-complex-mission-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.tle_monitoring_changes: &tle_monitoring_changes
|
||||
- services/tle-monitoring-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-complex-mission-service-tle.yml
|
||||
- helm/tle-monitoring-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.complex-mission-service:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *complex_mission_service_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *complex_mission_service_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *complex_mission_service_changes
|
||||
- when: never
|
||||
|
||||
.complex-mission-service:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *complex_mission_service_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *complex_mission_service_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *complex_mission_service_changes
|
||||
- when: never
|
||||
|
||||
.complex-mission-service:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *complex_mission_service_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.complex-mission-service:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *complex_mission_service_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.tle-monitoring:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *tle_monitoring_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *tle_monitoring_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *tle_monitoring_changes
|
||||
- when: never
|
||||
|
||||
.tle-monitoring:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *tle_monitoring_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *tle_monitoring_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *tle_monitoring_changes
|
||||
- when: never
|
||||
|
||||
.tle-monitoring:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *tle_monitoring_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.tle-monitoring:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *tle_monitoring_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.pcp-gradle-cache:
|
||||
cache:
|
||||
key: "gradle-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.pcp-docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.pcp-helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube ~/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config ~/.kube/config
|
||||
|
||||
complex-mission-service:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .complex-mission-service:rules:test
|
||||
- .pcp-gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-complex-mission-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-complex-mission-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-complex-mission-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
complex-mission-service:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .complex-mission-service:rules:build-and-image
|
||||
- .pcp-gradle-cache
|
||||
needs:
|
||||
- job: complex-mission-service:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-complex-mission-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-complex-mission-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
complex-mission-service:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .complex-mission-service:rules:build-and-image
|
||||
- .pcp-docker-build
|
||||
needs:
|
||||
- job: complex-mission-service:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "COMPLEX_MISSION_SERVICE_IMAGE_REPOSITORY=$COMPLEX_MISSION_SERVICE_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$COMPLEX_MISSION_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$COMPLEX_MISSION_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$COMPLEX_MISSION_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$COMPLEX_MISSION_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$COMPLEX_MISSION_SERVICE_IMAGE_REPOSITORY:$COMPLEX_MISSION_SERVICE_IMAGE_TAG" docker-context
|
||||
- docker push "$COMPLEX_MISSION_SERVICE_IMAGE_REPOSITORY:$COMPLEX_MISSION_SERVICE_IMAGE_TAG"
|
||||
- printf "COMPLEX_MISSION_SERVICE_IMAGE=%s\n" "$COMPLEX_MISSION_SERVICE_IMAGE_REPOSITORY:$COMPLEX_MISSION_SERVICE_IMAGE_TAG" > complex-mission-service-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: complex-mission-service-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
complex-mission-service:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .complex-mission-service:rules:deploy-dev
|
||||
- .pcp-helm-deploy
|
||||
needs:
|
||||
- job: complex-mission-service:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-complex-mission-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${COMPLEX_MISSION_SERVICE_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${COMPLEX_MISSION_SERVICE_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$COMPLEX_MISSION_SERVICE_HELM_RELEASE"
|
||||
"$COMPLEX_MISSION_SERVICE_HELM_CHART_DIR"
|
||||
--namespace "$COMPLEX_MISSION_SERVICE_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$COMPLEX_MISSION_SERVICE_HELM_CHART_DIR/values.yaml"
|
||||
-f "$COMPLEX_MISSION_SERVICE_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
complex-mission-service:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .complex-mission-service:rules:deploy-master
|
||||
- .pcp-helm-deploy
|
||||
needs:
|
||||
- job: complex-mission-service:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-complex-mission-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${COMPLEX_MISSION_SERVICE_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${COMPLEX_MISSION_SERVICE_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$COMPLEX_MISSION_SERVICE_HELM_RELEASE"
|
||||
"$COMPLEX_MISSION_SERVICE_HELM_CHART_DIR"
|
||||
--namespace "$COMPLEX_MISSION_SERVICE_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$COMPLEX_MISSION_SERVICE_HELM_CHART_DIR/values.yaml"
|
||||
-f "$COMPLEX_MISSION_SERVICE_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
|
||||
tle-monitoring:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
services:
|
||||
- name: repo.nstart.cloud/postgis/postgis:16-3.4
|
||||
alias: postgres
|
||||
variables:
|
||||
POSTGRES_DB: "pcp_tle"
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
SPRING_DATASOURCE_URL: "jdbc:postgresql://postgres:5432/pcp_tle"
|
||||
SPRING_DATASOURCE_USERNAME: "postgres"
|
||||
SPRING_DATASOURCE_PASSWORD: "password"
|
||||
SPRING_TASK_SCHEDULING_ENABLED: "false"
|
||||
extends:
|
||||
- .tle-monitoring:rules:test
|
||||
- .pcp-gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:tle-monitoring-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/tle-monitoring-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/tle-monitoring-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
tle-monitoring:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .tle-monitoring:rules:build-and-image
|
||||
- .pcp-gradle-cache
|
||||
needs:
|
||||
- job: tle-monitoring:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:tle-monitoring-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/tle-monitoring-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
tle-monitoring:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .tle-monitoring:rules:build-and-image
|
||||
- .pcp-docker-build
|
||||
needs:
|
||||
- job: tle-monitoring:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "TLE_MONITORING_IMAGE_REPOSITORY=$TLE_MONITORING_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$TLE_MONITORING_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$TLE_MONITORING_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$TLE_MONITORING_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$TLE_MONITORING_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$TLE_MONITORING_IMAGE_REPOSITORY:$TLE_MONITORING_IMAGE_TAG" docker-context
|
||||
- docker push "$TLE_MONITORING_IMAGE_REPOSITORY:$TLE_MONITORING_IMAGE_TAG"
|
||||
- printf "TLE_MONITORING_IMAGE=%s\n" "$TLE_MONITORING_IMAGE_REPOSITORY:$TLE_MONITORING_IMAGE_TAG" > tle-monitoring-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: tle-monitoring-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
tle-monitoring:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .tle-monitoring:rules:deploy-dev
|
||||
- .pcp-helm-deploy
|
||||
needs:
|
||||
- job: tle-monitoring:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/tle-monitoring-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${TLE_MONITORING_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${TLE_MONITORING_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$TLE_MONITORING_HELM_RELEASE"
|
||||
"$TLE_MONITORING_HELM_CHART_DIR"
|
||||
--namespace "$TLE_MONITORING_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 15m
|
||||
-f "$TLE_MONITORING_HELM_CHART_DIR/values.yaml"
|
||||
-f "$TLE_MONITORING_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
tle-monitoring:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .tle-monitoring:rules:deploy-master
|
||||
- .pcp-helm-deploy
|
||||
needs:
|
||||
- job: tle-monitoring:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/tle-monitoring-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${TLE_MONITORING_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${TLE_MONITORING_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$TLE_MONITORING_HELM_RELEASE"
|
||||
"$TLE_MONITORING_HELM_CHART_DIR"
|
||||
--namespace "$TLE_MONITORING_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 15m
|
||||
-f "$TLE_MONITORING_HELM_CHART_DIR/values.yaml"
|
||||
-f "$TLE_MONITORING_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,244 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
COVERAGE_SCHEME_SERVICE_DIR: "services/pcp-coverage-scheme-service"
|
||||
COVERAGE_SCHEME_HELM_CHART_DIR: "helm/pcp-coverage-scheme-service"
|
||||
COVERAGE_SCHEME_HELM_RELEASE: "pcp-coverage-scheme-service"
|
||||
COVERAGE_SCHEME_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-coverage-scheme-service"
|
||||
COVERAGE_SCHEME_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
COVERAGE_SCHEME_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
COVERAGE_SCHEME_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.coverage_scheme_changes: &coverage_scheme_changes
|
||||
- services/pcp-coverage-scheme-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- gradle.properties
|
||||
- .gitlab/ci/pcp-coverage-scheme-service.yml
|
||||
- helm/pcp-coverage-scheme-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.coverage_scheme:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *coverage_scheme_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *coverage_scheme_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *coverage_scheme_changes
|
||||
- when: never
|
||||
|
||||
.coverage_scheme:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *coverage_scheme_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *coverage_scheme_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *coverage_scheme_changes
|
||||
- when: never
|
||||
|
||||
.coverage_scheme:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *coverage_scheme_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.coverage_scheme:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *coverage_scheme_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.coverage_scheme:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-coverage-scheme-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.coverage_scheme:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.coverage_scheme:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
coverage-scheme:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .coverage_scheme:rules:test
|
||||
- .coverage_scheme:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-coverage-scheme-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-coverage-scheme-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-coverage-scheme-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
coverage-scheme:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .coverage_scheme:rules:build-and-image
|
||||
- .coverage_scheme:gradle-cache
|
||||
needs:
|
||||
- job: coverage-scheme:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-coverage-scheme-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-coverage-scheme-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
coverage-scheme:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .coverage_scheme:rules:build-and-image
|
||||
- .coverage_scheme:docker-build
|
||||
needs:
|
||||
- job: coverage-scheme:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "COVERAGE_SCHEME_IMAGE_REPOSITORY=$COVERAGE_SCHEME_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$COVERAGE_SCHEME_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$COVERAGE_SCHEME_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$COVERAGE_SCHEME_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$COVERAGE_SCHEME_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$COVERAGE_SCHEME_IMAGE_REPOSITORY:$COVERAGE_SCHEME_IMAGE_TAG" docker-context
|
||||
- docker push "$COVERAGE_SCHEME_IMAGE_REPOSITORY:$COVERAGE_SCHEME_IMAGE_TAG"
|
||||
- printf "COVERAGE_SCHEME_IMAGE=%s\n" "$COVERAGE_SCHEME_IMAGE_REPOSITORY:$COVERAGE_SCHEME_IMAGE_TAG" > coverage-scheme-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: coverage-scheme-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
coverage-scheme:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .coverage_scheme:rules:deploy-dev
|
||||
- .coverage_scheme:helm-deploy
|
||||
needs:
|
||||
- job: coverage-scheme:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-coverage-scheme-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${COVERAGE_SCHEME_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${COVERAGE_SCHEME_IMAGE##*:}"'
|
||||
- >
|
||||
helm upgrade --install "$COVERAGE_SCHEME_HELM_RELEASE"
|
||||
"$COVERAGE_SCHEME_HELM_CHART_DIR"
|
||||
--namespace "$COVERAGE_SCHEME_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$COVERAGE_SCHEME_HELM_CHART_DIR/values.yaml"
|
||||
-f "$COVERAGE_SCHEME_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
coverage-scheme:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .coverage_scheme:rules:deploy-master
|
||||
- .coverage_scheme:helm-deploy
|
||||
needs:
|
||||
- job: coverage-scheme:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-coverage-scheme-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${COVERAGE_SCHEME_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${COVERAGE_SCHEME_IMAGE##*:}"'
|
||||
- >
|
||||
helm upgrade --install "$COVERAGE_SCHEME_HELM_RELEASE"
|
||||
"$COVERAGE_SCHEME_HELM_CHART_DIR"
|
||||
--namespace "$COVERAGE_SCHEME_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$COVERAGE_SCHEME_HELM_CHART_DIR/values.yaml"
|
||||
-f "$COVERAGE_SCHEME_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,247 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
DYNAMIC_PLAN_SERVICE_DIR: "services/pcp-dynamic-plan-service"
|
||||
DYNAMIC_PLAN_HELM_CHART_DIR: "helm/pcp-dynamic-plan-service"
|
||||
DYNAMIC_PLAN_HELM_RELEASE: "pcp-dynamic-plan-service"
|
||||
DYNAMIC_PLAN_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-dynamic-plan-service"
|
||||
DYNAMIC_PLAN_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
DYNAMIC_PLAN_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
DYNAMIC_PLAN_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.dynamic_plan_changes: &dynamic_plan_changes
|
||||
- services/pcp-dynamic-plan-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- gradle.properties
|
||||
- .gitlab/ci/pcp-dynamic-plan-service.yml
|
||||
- helm/pcp-dynamic-plan-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.dynamic_plan:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *dynamic_plan_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *dynamic_plan_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *dynamic_plan_changes
|
||||
- when: never
|
||||
|
||||
.dynamic_plan:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *dynamic_plan_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *dynamic_plan_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *dynamic_plan_changes
|
||||
- when: never
|
||||
|
||||
.dynamic_plan:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *dynamic_plan_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.dynamic_plan:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *dynamic_plan_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.dynamic_plan:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-dynamic-plan-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.dynamic_plan:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.dynamic_plan:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
dynamic-plan:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .dynamic_plan:rules:test
|
||||
- .dynamic_plan:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-dynamic-plan-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-dynamic-plan-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-dynamic-plan-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
dynamic-plan:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .dynamic_plan:rules:build-and-image
|
||||
- .dynamic_plan:gradle-cache
|
||||
needs:
|
||||
- job: dynamic-plan:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-dynamic-plan-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-dynamic-plan-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
dynamic-plan:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .dynamic_plan:rules:build-and-image
|
||||
- .dynamic_plan:docker-build
|
||||
needs:
|
||||
- job: dynamic-plan:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "DYNAMIC_PLAN_IMAGE_REPOSITORY=$DYNAMIC_PLAN_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$DYNAMIC_PLAN_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$DYNAMIC_PLAN_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$DYNAMIC_PLAN_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$DYNAMIC_PLAN_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$DYNAMIC_PLAN_IMAGE_REPOSITORY:$DYNAMIC_PLAN_IMAGE_TAG" docker-context
|
||||
- docker push "$DYNAMIC_PLAN_IMAGE_REPOSITORY:$DYNAMIC_PLAN_IMAGE_TAG"
|
||||
- printf "DYNAMIC_PLAN_IMAGE=%s\n" "$DYNAMIC_PLAN_IMAGE_REPOSITORY:$DYNAMIC_PLAN_IMAGE_TAG" > dynamic-plan-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: dynamic-plan-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
dynamic-plan:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .dynamic_plan:rules:deploy-dev
|
||||
- .dynamic_plan:helm-deploy
|
||||
needs:
|
||||
- job: dynamic-plan:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-dynamic-plan-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${DYNAMIC_PLAN_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${DYNAMIC_PLAN_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$DYNAMIC_PLAN_HELM_RELEASE"
|
||||
"$DYNAMIC_PLAN_HELM_CHART_DIR"
|
||||
--namespace "$DYNAMIC_PLAN_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$DYNAMIC_PLAN_HELM_CHART_DIR/values.yaml"
|
||||
-f "$DYNAMIC_PLAN_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
dynamic-plan:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .dynamic_plan:rules:deploy-master
|
||||
- .dynamic_plan:helm-deploy
|
||||
needs:
|
||||
- job: dynamic-plan:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-dynamic-plan-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${DYNAMIC_PLAN_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${DYNAMIC_PLAN_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$DYNAMIC_PLAN_HELM_RELEASE"
|
||||
"$DYNAMIC_PLAN_HELM_CHART_DIR"
|
||||
--namespace "$DYNAMIC_PLAN_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$DYNAMIC_PLAN_HELM_CHART_DIR/values.yaml"
|
||||
-f "$DYNAMIC_PLAN_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,246 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
MISSION_PLANING_SERVICE_DIR: "services/pcp-mission-planing-service"
|
||||
MISSION_PLANING_HELM_CHART_DIR: "helm/pcp-mission-planing-service"
|
||||
MISSION_PLANING_HELM_RELEASE: "pcp-mission-planing-service"
|
||||
MISSION_PLANING_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-mission-planing-service"
|
||||
MISSION_PLANING_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
MISSION_PLANING_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
MISSION_PLANING_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.mission_planing_changes: &mission_planing_changes
|
||||
- services/pcp-mission-planing-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-mission-planing-service.yml
|
||||
- helm/pcp-mission-planing-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.mission-planing:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *mission_planing_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *mission_planing_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *mission_planing_changes
|
||||
- when: never
|
||||
|
||||
.mission-planing:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *mission_planing_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *mission_planing_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *mission_planing_changes
|
||||
- when: never
|
||||
|
||||
.mission-planing:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *mission_planing_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.mission-planing:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *mission_planing_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.mission-planing:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-mission-planing-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.mission-planing:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.mission-planing:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
mission-planing:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .mission-planing:rules:test
|
||||
- .mission-planing:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-mission-planing-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-mission-planing-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-mission-planing-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
mission-planing:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .mission-planing:rules:build-and-image
|
||||
- .mission-planing:gradle-cache
|
||||
needs:
|
||||
- job: mission-planing:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-mission-planing-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-mission-planing-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
mission-planing:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .mission-planing:rules:build-and-image
|
||||
- .mission-planing:docker-build
|
||||
needs:
|
||||
- job: mission-planing:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "MISSION_PLANING_IMAGE_REPOSITORY=$MISSION_PLANING_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$MISSION_PLANING_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$MISSION_PLANING_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$MISSION_PLANING_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$MISSION_PLANING_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$MISSION_PLANING_IMAGE_REPOSITORY:$MISSION_PLANING_IMAGE_TAG" docker-context
|
||||
- docker push "$MISSION_PLANING_IMAGE_REPOSITORY:$MISSION_PLANING_IMAGE_TAG"
|
||||
- printf "MISSION_PLANING_IMAGE=%s\n" "$MISSION_PLANING_IMAGE_REPOSITORY:$MISSION_PLANING_IMAGE_TAG" > mission-planing-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: mission-planing-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
mission-planing:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .mission-planing:rules:deploy-dev
|
||||
- .mission-planing:helm-deploy
|
||||
needs:
|
||||
- job: mission-planing:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-mission-planing-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${MISSION_PLANING_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${MISSION_PLANING_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$MISSION_PLANING_HELM_RELEASE"
|
||||
"$MISSION_PLANING_HELM_CHART_DIR"
|
||||
--namespace "$MISSION_PLANING_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$MISSION_PLANING_HELM_CHART_DIR/values.yaml"
|
||||
-f "$MISSION_PLANING_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
mission-planing:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .mission-planing:rules:deploy-master
|
||||
- .mission-planing:helm-deploy
|
||||
needs:
|
||||
- job: mission-planing:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-mission-planing-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${MISSION_PLANING_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${MISSION_PLANING_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$MISSION_PLANING_HELM_RELEASE"
|
||||
"$MISSION_PLANING_HELM_CHART_DIR"
|
||||
--namespace "$MISSION_PLANING_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$MISSION_PLANING_HELM_CHART_DIR/values.yaml"
|
||||
-f "$MISSION_PLANING_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,245 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
REQUEST_SERVICE_DIR: "services/pcp-request-service"
|
||||
REQUEST_HELM_CHART_DIR: "helm/pcp-request-service"
|
||||
REQUEST_HELM_RELEASE: "pcp-request-service"
|
||||
REQUEST_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-request-service"
|
||||
REQUEST_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
REQUEST_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
REQUEST_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.request_changes: &request_changes
|
||||
- services/pcp-request-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-request-service.yml
|
||||
- helm/pcp-request-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.request:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *request_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *request_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *request_changes
|
||||
- when: never
|
||||
|
||||
.request:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *request_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *request_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *request_changes
|
||||
- when: never
|
||||
|
||||
.request:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *request_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.request:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *request_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.request:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-request-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.request:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.request:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
request:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .request:rules:test
|
||||
- .request:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-request-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-request-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-request-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
request:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .request:rules:build-and-image
|
||||
- .request:gradle-cache
|
||||
needs:
|
||||
- job: request:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-request-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-request-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
request:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .request:rules:build-and-image
|
||||
- .request:docker-build
|
||||
needs:
|
||||
- job: request:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "REQUEST_IMAGE_REPOSITORY=$REQUEST_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$REQUEST_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$REQUEST_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$REQUEST_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$REQUEST_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$REQUEST_IMAGE_REPOSITORY:$REQUEST_IMAGE_TAG" docker-context
|
||||
- docker push "$REQUEST_IMAGE_REPOSITORY:$REQUEST_IMAGE_TAG"
|
||||
- printf "REQUEST_IMAGE=%s\n" "$REQUEST_IMAGE_REPOSITORY:$REQUEST_IMAGE_TAG" > request-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: request-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
request:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .request:rules:deploy-dev
|
||||
- .request:helm-deploy
|
||||
needs:
|
||||
- job: request:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-request-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${REQUEST_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${REQUEST_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$REQUEST_HELM_RELEASE"
|
||||
"$REQUEST_HELM_CHART_DIR"
|
||||
--namespace "$REQUEST_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 15m
|
||||
-f "$REQUEST_HELM_CHART_DIR/values.yaml"
|
||||
-f "$REQUEST_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
request:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .request:rules:deploy-master
|
||||
- .request:helm-deploy
|
||||
needs:
|
||||
- job: request:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-request-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${REQUEST_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${REQUEST_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$REQUEST_HELM_RELEASE"
|
||||
"$REQUEST_HELM_CHART_DIR"
|
||||
--namespace "$REQUEST_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 15m
|
||||
-f "$REQUEST_HELM_CHART_DIR/values.yaml"
|
||||
-f "$REQUEST_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,245 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
SATELLITE_CATALOG_SERVICE_DIR: "services/pcp-satellite-catalog-service"
|
||||
SATELLITE_CATALOG_HELM_CHART_DIR: "helm/pcp-satellite-catalog-service"
|
||||
SATELLITE_CATALOG_HELM_RELEASE: "pcp-satellite-catalog-service"
|
||||
SATELLITE_CATALOG_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-satellite-catalog-service"
|
||||
SATELLITE_CATALOG_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
SATELLITE_CATALOG_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
SATELLITE_CATALOG_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.satellite_catalog_changes: &satellite_catalog_changes
|
||||
- services/pcp-satellite-catalog-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-satellite-catalog-service.*
|
||||
- helm/pcp-satellite-catalog-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.satellite-catalog:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *satellite_catalog_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *satellite_catalog_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *satellite_catalog_changes
|
||||
- when: never
|
||||
|
||||
.satellite-catalog:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *satellite_catalog_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *satellite_catalog_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *satellite_catalog_changes
|
||||
- when: never
|
||||
|
||||
.satellite-catalog:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *satellite_catalog_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.satellite-catalog:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *satellite_catalog_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.satellite-catalog:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-satellite-catalog-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.satellite-catalog:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.satellite-catalog:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
satellite-catalog:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .satellite-catalog:rules:test
|
||||
- .satellite-catalog:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-satellite-catalog-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-satellite-catalog-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-satellite-catalog-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
satellite-catalog:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .satellite-catalog:rules:build-and-image
|
||||
- .satellite-catalog:gradle-cache
|
||||
needs:
|
||||
- job: satellite-catalog:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-satellite-catalog-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-satellite-catalog-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
satellite-catalog:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .satellite-catalog:rules:build-and-image
|
||||
- .satellite-catalog:docker-build
|
||||
needs:
|
||||
- job: satellite-catalog:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "SATELLITE_CATALOG_IMAGE_REPOSITORY=$SATELLITE_CATALOG_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$SATELLITE_CATALOG_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$SATELLITE_CATALOG_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$SATELLITE_CATALOG_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$SATELLITE_CATALOG_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$SATELLITE_CATALOG_IMAGE_REPOSITORY:$SATELLITE_CATALOG_IMAGE_TAG" docker-context
|
||||
- docker push "$SATELLITE_CATALOG_IMAGE_REPOSITORY:$SATELLITE_CATALOG_IMAGE_TAG"
|
||||
- printf "SATELLITE_CATALOG_IMAGE=%s\n" "$SATELLITE_CATALOG_IMAGE_REPOSITORY:$SATELLITE_CATALOG_IMAGE_TAG" > satellite-catalog-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: satellite-catalog-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
satellite-catalog:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .satellite-catalog:rules:deploy-dev
|
||||
- .satellite-catalog:helm-deploy
|
||||
needs:
|
||||
- job: satellite-catalog:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-satellite-catalog-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${SATELLITE_CATALOG_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${SATELLITE_CATALOG_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$SATELLITE_CATALOG_HELM_RELEASE"
|
||||
"$SATELLITE_CATALOG_HELM_CHART_DIR"
|
||||
--namespace "$SATELLITE_CATALOG_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$SATELLITE_CATALOG_HELM_CHART_DIR/values.yaml"
|
||||
-f "$SATELLITE_CATALOG_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
satellite-catalog:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .satellite-catalog:rules:deploy-master
|
||||
- .satellite-catalog:helm-deploy
|
||||
needs:
|
||||
- job: satellite-catalog:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-satellite-catalog-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${SATELLITE_CATALOG_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${SATELLITE_CATALOG_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$SATELLITE_CATALOG_HELM_RELEASE"
|
||||
"$SATELLITE_CATALOG_HELM_CHART_DIR"
|
||||
--namespace "$SATELLITE_CATALOG_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$SATELLITE_CATALOG_HELM_CHART_DIR/values.yaml"
|
||||
-f "$SATELLITE_CATALOG_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,191 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
SPRING_BOOT_ADMIN_SERVICE_DIR: "services/pcp-srpring-boot-admin-server"
|
||||
SPRING_BOOT_ADMIN_HELM_CHART_DIR: "helm/pcp-spring-boot-admin-server"
|
||||
SPRING_BOOT_ADMIN_HELM_RELEASE: "pcp-spring-boot-admin-server"
|
||||
SPRING_BOOT_ADMIN_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-spring-boot-admin-server"
|
||||
SPRING_BOOT_ADMIN_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
SPRING_BOOT_ADMIN_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
|
||||
.spring_boot_admin_changes: &spring_boot_admin_changes
|
||||
- services/pcp-srpring-boot-admin-server/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-spring-boot-admin-server.yml
|
||||
- helm/pcp-spring-boot-admin-server/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.spring-boot-admin:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *spring_boot_admin_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *spring_boot_admin_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *spring_boot_admin_changes
|
||||
- when: never
|
||||
|
||||
.spring-boot-admin:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *spring_boot_admin_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *spring_boot_admin_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *spring_boot_admin_changes
|
||||
- when: never
|
||||
|
||||
.spring-boot-admin:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *spring_boot_admin_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.spring-boot-admin:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-spring-boot-admin-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.spring-boot-admin:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.spring-boot-admin:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
spring-boot-admin:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .spring-boot-admin:rules:test
|
||||
- .spring-boot-admin:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-srpring-boot-admin-server:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-srpring-boot-admin-server/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-srpring-boot-admin-server/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
spring-boot-admin:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .spring-boot-admin:rules:build-and-image
|
||||
- .spring-boot-admin:gradle-cache
|
||||
needs:
|
||||
- job: spring-boot-admin:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-srpring-boot-admin-server:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-srpring-boot-admin-server/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
spring-boot-admin:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .spring-boot-admin:rules:build-and-image
|
||||
- .spring-boot-admin:docker-build
|
||||
needs:
|
||||
- job: spring-boot-admin:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "SPRING_BOOT_ADMIN_IMAGE_REPOSITORY=$SPRING_BOOT_ADMIN_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$SPRING_BOOT_ADMIN_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$SPRING_BOOT_ADMIN_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$SPRING_BOOT_ADMIN_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$SPRING_BOOT_ADMIN_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$SPRING_BOOT_ADMIN_IMAGE_REPOSITORY:$SPRING_BOOT_ADMIN_IMAGE_TAG" docker-context
|
||||
- docker push "$SPRING_BOOT_ADMIN_IMAGE_REPOSITORY:$SPRING_BOOT_ADMIN_IMAGE_TAG"
|
||||
- printf "SPRING_BOOT_ADMIN_IMAGE=%s\n" "$SPRING_BOOT_ADMIN_IMAGE_REPOSITORY:$SPRING_BOOT_ADMIN_IMAGE_TAG" > spring-boot-admin-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: spring-boot-admin-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
spring-boot-admin:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .spring-boot-admin:rules:deploy-dev
|
||||
- .spring-boot-admin:helm-deploy
|
||||
needs:
|
||||
- job: spring-boot-admin:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-spring-boot-admin-server
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${SPRING_BOOT_ADMIN_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${SPRING_BOOT_ADMIN_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$SPRING_BOOT_ADMIN_HELM_RELEASE"
|
||||
"$SPRING_BOOT_ADMIN_HELM_CHART_DIR"
|
||||
--namespace "$SPRING_BOOT_ADMIN_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--values "$SPRING_BOOT_ADMIN_HELM_CHART_DIR/values.yaml"
|
||||
--values "$SPRING_BOOT_ADMIN_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set-string image.repository="$IMAGE_REPOSITORY"
|
||||
--set-string image.tag="$IMAGE_TAG"
|
||||
--set-string app.profile=dev
|
||||
--set-string app.configLabel=dev
|
||||
--atomic
|
||||
--wait
|
||||
--timeout 15m
|
||||
@@ -0,0 +1,245 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
STATIONS_SERVICE_DIR: "services/pcp-stations-service"
|
||||
STATIONS_HELM_CHART_DIR: "helm/pcp-stations-service"
|
||||
STATIONS_HELM_RELEASE: "pcp-stations-service"
|
||||
STATIONS_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-stations-service"
|
||||
STATIONS_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
STATIONS_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
STATIONS_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.stations_changes: &stations_changes
|
||||
- services/pcp-stations-service/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-stations-service.*
|
||||
- helm/pcp-stations-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.stations:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *stations_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *stations_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *stations_changes
|
||||
- when: never
|
||||
|
||||
.stations:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *stations_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *stations_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *stations_changes
|
||||
- when: never
|
||||
|
||||
.stations:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *stations_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.stations:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *stations_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.stations:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-stations-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.stations:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.stations:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
stations:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .stations:rules:test
|
||||
- .stations:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-stations-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-stations-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-stations-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
stations:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .stations:rules:build-and-image
|
||||
- .stations:gradle-cache
|
||||
needs:
|
||||
- job: stations:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-stations-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-stations-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
stations:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .stations:rules:build-and-image
|
||||
- .stations:docker-build
|
||||
needs:
|
||||
- job: stations:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "STATIONS_IMAGE_REPOSITORY=$STATIONS_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$STATIONS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$STATIONS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$STATIONS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$STATIONS_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$STATIONS_IMAGE_REPOSITORY:$STATIONS_IMAGE_TAG" docker-context
|
||||
- docker push "$STATIONS_IMAGE_REPOSITORY:$STATIONS_IMAGE_TAG"
|
||||
- printf "STATIONS_IMAGE=%s\n" "$STATIONS_IMAGE_REPOSITORY:$STATIONS_IMAGE_TAG" > stations-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: stations-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
stations:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .stations:rules:deploy-dev
|
||||
- .stations:helm-deploy
|
||||
needs:
|
||||
- job: stations:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-stations-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${STATIONS_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${STATIONS_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$STATIONS_HELM_RELEASE"
|
||||
"$STATIONS_HELM_CHART_DIR"
|
||||
--namespace "$STATIONS_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$STATIONS_HELM_CHART_DIR/values.yaml"
|
||||
-f "$STATIONS_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
stations:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .stations:rules:deploy-master
|
||||
- .stations:helm-deploy
|
||||
needs:
|
||||
- job: stations:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-stations-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${STATIONS_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${STATIONS_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$STATIONS_HELM_RELEASE"
|
||||
"$STATIONS_HELM_CHART_DIR"
|
||||
--namespace "$STATIONS_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$STATIONS_HELM_CHART_DIR/values.yaml"
|
||||
-f "$STATIONS_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,203 @@
|
||||
variables:
|
||||
TGU_SERVICE_DIR: "services/pcp-tgu-service"
|
||||
TGU_HELM_CHART_DIR: "helm/pcp-tgu-service"
|
||||
TGU_HELM_RELEASE: "pcp-tgu-service"
|
||||
TGU_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-tgu-service"
|
||||
TGU_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
TGU_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
TGU_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.tgu_changes: &tgu_changes
|
||||
- services/pcp-tgu-service/**/*
|
||||
# - libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-tgu-service.yml
|
||||
- helm/pcp-tgu-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.tgu:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *tgu_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *tgu_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *tgu_changes
|
||||
- when: never
|
||||
|
||||
.tgu:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *tgu_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *tgu_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *tgu_changes
|
||||
- when: never
|
||||
|
||||
.tgu:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *tgu_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.tgu:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *tgu_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.tgu:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-tgu-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.tgu:docker-build:
|
||||
image: docker:26
|
||||
services:
|
||||
- name: docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.tgu:helm-deploy:
|
||||
image:
|
||||
name: alpine/helm:3.16.4
|
||||
entrypoint: [""]
|
||||
before_script:
|
||||
- mkdir -p ~/.kube
|
||||
- helm version
|
||||
|
||||
tgu:test:
|
||||
stage: test
|
||||
image: eclipse-temurin:21-jdk
|
||||
extends:
|
||||
- .tgu:rules:test
|
||||
- .tgu:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-tgu-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-tgu-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-tgu-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
tgu:build:
|
||||
stage: build
|
||||
image: eclipse-temurin:21-jdk
|
||||
extends:
|
||||
- .tgu:rules:build-and-image
|
||||
- .tgu:gradle-cache
|
||||
needs:
|
||||
- job: tgu:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-tgu-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-tgu-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
tgu:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .tgu:rules:build-and-image
|
||||
- .tgu:docker-build
|
||||
needs:
|
||||
- job: tgu:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "TGU_IMAGE_REPOSITORY=$TGU_IMAGE_REPOSITORY"'
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$TGU_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$TGU_SERVICE_DIR"/build/libs/*.jar docker-context/build/libs/
|
||||
- docker build --file docker-context/Dockerfile --tag "$TGU_IMAGE_REPOSITORY:$TGU_IMAGE_TAG" docker-context
|
||||
- docker push "$TGU_IMAGE_REPOSITORY:$TGU_IMAGE_TAG"
|
||||
- printf "TGU_IMAGE=%s\n" "$TGU_IMAGE_REPOSITORY:$TGU_IMAGE_TAG" > tgu-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: tgu-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
tgu:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .tgu:rules:deploy-dev
|
||||
- .tgu:helm-deploy
|
||||
needs:
|
||||
- job: tgu:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-tgu-service
|
||||
script:
|
||||
- 'echo "$KUBE_CONFIG_DEV_B64" | base64 -d > ~/.kube/config'
|
||||
- chmod 600 ~/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${TGU_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${TGU_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$TGU_HELM_RELEASE"
|
||||
"$TGU_HELM_CHART_DIR"
|
||||
--namespace "$TGU_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$TGU_HELM_CHART_DIR/values.yaml"
|
||||
-f "$TGU_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
tgu:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .tgu:rules:deploy-master
|
||||
- .tgu:helm-deploy
|
||||
needs:
|
||||
- job: tgu:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-tgu-service
|
||||
script:
|
||||
- 'echo "$KUBE_CONFIG_MASTER_B64" | base64 -d > ~/.kube/config'
|
||||
- chmod 600 ~/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${TGU_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${TGU_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$TGU_HELM_RELEASE"
|
||||
"$TGU_HELM_CHART_DIR"
|
||||
--namespace "$TGU_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$TGU_HELM_CHART_DIR/values.yaml"
|
||||
-f "$TGU_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,246 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
UI_SERVICE_DIR: "services/pcp-ui-service"
|
||||
UI_HELM_CHART_DIR: "helm/pcp-ui-service"
|
||||
UI_HELM_RELEASE: "pcp-ui-service"
|
||||
UI_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-ui-service"
|
||||
UI_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
UI_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
UI_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.ui_changes: &ui_changes
|
||||
- services/pcp-ui-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/pcp-ui-service.yml
|
||||
- helm/pcp-ui-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.ui:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *ui_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *ui_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *ui_changes
|
||||
- when: never
|
||||
|
||||
.ui:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *ui_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *ui_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *ui_changes
|
||||
- when: never
|
||||
|
||||
.ui:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *ui_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.ui:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *ui_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.ui:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-ui-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.ui:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.ui:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
ui:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .ui:rules:test
|
||||
- .ui:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-ui-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/pcp-ui-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/pcp-ui-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
ui:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .ui:rules:build-and-image
|
||||
- .ui:gradle-cache
|
||||
needs:
|
||||
- job: ui:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:pcp-ui-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/pcp-ui-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
ui:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .ui:rules:build-and-image
|
||||
- .ui:docker-build
|
||||
needs:
|
||||
- job: ui:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "UI_IMAGE_REPOSITORY=$UI_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$UI_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$UI_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$UI_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$UI_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$UI_IMAGE_REPOSITORY:$UI_IMAGE_TAG" docker-context
|
||||
- docker push "$UI_IMAGE_REPOSITORY:$UI_IMAGE_TAG"
|
||||
- printf "UI_IMAGE=%s\n" "$UI_IMAGE_REPOSITORY:$UI_IMAGE_TAG" > ui-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: ui-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
ui:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .ui:rules:deploy-dev
|
||||
- .ui:helm-deploy
|
||||
needs:
|
||||
- job: ui:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-ui-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${UI_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${UI_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$UI_HELM_RELEASE"
|
||||
"$UI_HELM_CHART_DIR"
|
||||
--namespace "$UI_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$UI_HELM_CHART_DIR/values.yaml"
|
||||
-f "$UI_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
ui:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .ui:rules:deploy-master
|
||||
- .ui:helm-deploy
|
||||
needs:
|
||||
- job: ui:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-ui-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${UI_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${UI_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$UI_HELM_RELEASE"
|
||||
"$UI_HELM_CHART_DIR"
|
||||
--namespace "$UI_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 10m
|
||||
-f "$UI_HELM_CHART_DIR/values.yaml"
|
||||
-f "$UI_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,256 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
SLOTS_SERVICE_DIR: "services/slots-service"
|
||||
SLOTS_HELM_CHART_DIR: "helm/slots-service"
|
||||
SLOTS_HELM_RELEASE: "slots-service"
|
||||
SLOTS_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/slots-service"
|
||||
SLOTS_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
SLOTS_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
SLOTS_K8S_NAMESPACE_MASTER: "pcp-master"
|
||||
|
||||
.slots_changes: &slots_changes
|
||||
- services/slots-service/**/*
|
||||
- libs/ballistics-lib/**/*
|
||||
- libs/pcp-types-lib/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/slots-service.yml
|
||||
- helm/slots-service/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.slots:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *slots_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *slots_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *slots_changes
|
||||
- when: never
|
||||
|
||||
.slots:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *slots_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *slots_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *slots_changes
|
||||
- when: never
|
||||
|
||||
.slots:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *slots_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.slots:rules:deploy-master:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *slots_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.slots:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-slots-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.slots:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.slots:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
slots:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
services:
|
||||
- name: repo.nstart.cloud/postgis/postgis:16-3.4
|
||||
alias: postgres
|
||||
variables:
|
||||
POSTGRES_DB: "pcp_slots"
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
SPRING_DATASOURCE_URL: "jdbc:postgresql://postgres:5432/pcp_slots"
|
||||
SPRING_DATASOURCE_USERNAME: "postgres"
|
||||
SPRING_DATASOURCE_PASSWORD: "password"
|
||||
extends:
|
||||
- .slots:rules:test
|
||||
- .slots:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:slots-service:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/slots-service/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/slots-service/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
slots:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .slots:rules:build-and-image
|
||||
- .slots:gradle-cache
|
||||
needs:
|
||||
- job: slots:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:slots-service:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/slots-service/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
slots:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .slots:rules:build-and-image
|
||||
- .slots:docker-build
|
||||
needs:
|
||||
- job: slots:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "SLOTS_IMAGE_REPOSITORY=$SLOTS_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$SLOTS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$SLOTS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$SLOTS_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$SLOTS_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$SLOTS_IMAGE_REPOSITORY:$SLOTS_IMAGE_TAG" docker-context
|
||||
- docker push "$SLOTS_IMAGE_REPOSITORY:$SLOTS_IMAGE_TAG"
|
||||
- printf "SLOTS_IMAGE=%s\n" "$SLOTS_IMAGE_REPOSITORY:$SLOTS_IMAGE_TAG" > slots-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: slots-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
slots:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .slots:rules:deploy-dev
|
||||
- .slots:helm-deploy
|
||||
needs:
|
||||
- job: slots:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/pcp-slots-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${SLOTS_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${SLOTS_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$SLOTS_HELM_RELEASE"
|
||||
"$SLOTS_HELM_CHART_DIR"
|
||||
--namespace "$SLOTS_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 30m
|
||||
-f "$SLOTS_HELM_CHART_DIR/values.yaml"
|
||||
-f "$SLOTS_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=dev
|
||||
--set app.configLabel=dev
|
||||
|
||||
slots:deploy:master:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .slots:rules:deploy-master
|
||||
- .slots:helm-deploy
|
||||
needs:
|
||||
- job: slots:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: master/pcp-slots-service
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_MASTER:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_MASTER_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_MASTER_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_MASTER_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_MASTER_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_MASTER_B64 is not valid base64. Set KUBE_CONFIG_MASTER to raw kubeconfig or KUBE_CONFIG_MASTER_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_MASTER or KUBE_CONFIG_MASTER_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- 'export IMAGE_REPOSITORY="${SLOTS_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${SLOTS_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$SLOTS_HELM_RELEASE"
|
||||
"$SLOTS_HELM_CHART_DIR"
|
||||
--namespace "$SLOTS_K8S_NAMESPACE_MASTER"
|
||||
--create-namespace
|
||||
--wait
|
||||
--atomic
|
||||
--timeout 30m
|
||||
-f "$SLOTS_HELM_CHART_DIR/values.yaml"
|
||||
-f "$SLOTS_HELM_CHART_DIR/values-master.yaml"
|
||||
--set image.repository="$IMAGE_REPOSITORY"
|
||||
--set image.tag="$IMAGE_TAG"
|
||||
--set app.profile=master
|
||||
--set app.configLabel=master
|
||||
@@ -0,0 +1,214 @@
|
||||
variables:
|
||||
GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle"
|
||||
|
||||
CONFIG_SERVER_SERVICE_DIR: "services/spring-cloud-config-server"
|
||||
CONFIG_SERVER_HELM_CHART_DIR: "helm/spring-cloud-config-server"
|
||||
CONFIG_SERVER_HELM_RELEASE: "spring-cloud-config-server"
|
||||
CONFIG_SERVER_IMAGE_REPOSITORY: "$INTERNAL_REGISTRY/pcp-cloud-config-server"
|
||||
CONFIG_SERVER_IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
|
||||
CONFIG_SERVER_K8S_NAMESPACE_DEV: "pcp-dev"
|
||||
CONFIG_SERVER_GIT_SECRET_NAME: "spring-cloud-config-server-git"
|
||||
CONFIG_GIT_URI: "https://git.nstart.cloud/emelianov.an/pcp.git"
|
||||
CONFIG_GIT_USERNAME: "gitlab+deploy-token-1"
|
||||
CONFIG_GIT_DEFAULT_LABEL: "master"
|
||||
CONFIG_GIT_SEARCH_PATHS: "config-repo"
|
||||
CONFIG_GIT_SKIP_SSL_VALIDATION: "true"
|
||||
|
||||
.config_server_changes: &config_server_changes
|
||||
- services/spring-cloud-config-server/**/*
|
||||
- build.gradle.kts
|
||||
- settings.gradle.kts
|
||||
- .gitlab/ci/spring-cloud-config-server.yml
|
||||
- helm/spring-cloud-config-server/**/*
|
||||
- deploy/**/*
|
||||
|
||||
.config-server:rules:build-and-image:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *config_server_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *config_server_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *config_server_changes
|
||||
- when: never
|
||||
|
||||
.config-server:rules:test:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *config_server_changes
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *config_server_changes
|
||||
when: manual
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
changes: *config_server_changes
|
||||
- when: never
|
||||
|
||||
.config-server:rules:deploy-dev:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "dev"'
|
||||
changes: *config_server_changes
|
||||
when: manual
|
||||
- when: never
|
||||
|
||||
.config-server:gradle-cache:
|
||||
cache:
|
||||
key: "gradle-config-server-$CI_DEFAULT_BRANCH"
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
policy: pull-push
|
||||
|
||||
.config-server:docker-build:
|
||||
image: repo.nstart.cloud/library/docker:26
|
||||
services:
|
||||
- name: repo.nstart.cloud/library/docker:26-dind
|
||||
alias: docker
|
||||
command: ["--tls=false", "--insecure-registry=registry.k8s.265.nstart.local"]
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_BUILDKIT: "1"
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
|
||||
.config-server:helm-deploy:
|
||||
image: repo.nstart.cloud/dtzar/helm-kubectl:3.14.0
|
||||
before_script:
|
||||
- mkdir -p /root/.kube
|
||||
- helm version
|
||||
after_script:
|
||||
- rm -f /root/.kube/config
|
||||
|
||||
config-server:test:
|
||||
stage: test
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .config-server:rules:test
|
||||
- .config-server:gradle-cache
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:spring-cloud-config-server:test
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- services/spring-cloud-config-server/build/test-results/test/*.xml
|
||||
paths:
|
||||
- services/spring-cloud-config-server/build/reports/tests/
|
||||
expire_in: 7 days
|
||||
|
||||
config-server:build:
|
||||
stage: build
|
||||
image: repo.nstart.cloud/library/gradle:jdk17-ubi10
|
||||
extends:
|
||||
- .config-server:rules:build-and-image
|
||||
- .config-server:gradle-cache
|
||||
needs:
|
||||
- job: config-server:test
|
||||
artifacts: true
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
script:
|
||||
- ./gradlew --no-daemon :services:spring-cloud-config-server:bootJar
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- services/spring-cloud-config-server/build/libs/*.jar
|
||||
expire_in: 7 days
|
||||
|
||||
config-server:package:
|
||||
stage: package
|
||||
extends:
|
||||
- .config-server:rules:build-and-image
|
||||
- .config-server:docker-build
|
||||
needs:
|
||||
- job: config-server:build
|
||||
artifacts: true
|
||||
script:
|
||||
- 'echo "CONFIG_SERVER_IMAGE_REPOSITORY=$CONFIG_SERVER_IMAGE_REPOSITORY"'
|
||||
- |
|
||||
JAR_COUNT="$(find "$CONFIG_SERVER_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l)"
|
||||
|
||||
if [ "$JAR_COUNT" -ne 1 ]; then
|
||||
echo "Expected exactly one executable jar, found: $JAR_COUNT"
|
||||
find "$CONFIG_SERVER_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' -print || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAR_FILE="$(find "$CONFIG_SERVER_SERVICE_DIR/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1)"
|
||||
- rm -rf docker-context
|
||||
- mkdir -p docker-context/build/libs
|
||||
- cp "$CONFIG_SERVER_SERVICE_DIR/Dockerfile" docker-context/Dockerfile
|
||||
- cp "$JAR_FILE" docker-context/build/libs/app.jar
|
||||
- find docker-context -maxdepth 4 -type f -print -exec ls -la {} \;
|
||||
- docker build --file docker-context/Dockerfile --tag "$CONFIG_SERVER_IMAGE_REPOSITORY:$CONFIG_SERVER_IMAGE_TAG" docker-context
|
||||
- docker push "$CONFIG_SERVER_IMAGE_REPOSITORY:$CONFIG_SERVER_IMAGE_TAG"
|
||||
- printf "CONFIG_SERVER_IMAGE=%s\n" "$CONFIG_SERVER_IMAGE_REPOSITORY:$CONFIG_SERVER_IMAGE_TAG" > config-server-image.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: config-server-image.env
|
||||
expire_in: 7 days
|
||||
|
||||
config-server:deploy:dev:
|
||||
stage: deploy
|
||||
extends:
|
||||
- .config-server:rules:deploy-dev
|
||||
- .config-server:helm-deploy
|
||||
needs:
|
||||
- job: config-server:package
|
||||
artifacts: true
|
||||
environment:
|
||||
name: dev/spring-cloud-config-server
|
||||
script:
|
||||
- |
|
||||
if [ -n "${KUBE_CONFIG_DEV:-}" ]; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV" > /root/.kube/config
|
||||
elif [ -n "${KUBE_CONFIG_DEV_B64:-}" ]; then
|
||||
if printf '%s' "$KUBE_CONFIG_DEV_B64" | grep -qE '(^apiVersion:|^kind: Config|^clusters:)'; then
|
||||
printf '%s' "$KUBE_CONFIG_DEV_B64" > /root/.kube/config
|
||||
elif ! printf '%s' "$KUBE_CONFIG_DEV_B64" | base64 -d > /root/.kube/config; then
|
||||
echo "KUBE_CONFIG_DEV_B64 is not valid base64. Set KUBE_CONFIG_DEV to raw kubeconfig or KUBE_CONFIG_DEV_B64 to base64 kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "KUBE_CONFIG_DEV or KUBE_CONFIG_DEV_B64 must be set."
|
||||
exit 1
|
||||
fi
|
||||
- chmod 600 /root/.kube/config
|
||||
- export KUBECONFIG=/root/.kube/config
|
||||
- |
|
||||
if [ -z "${CONFIG_GIT_TOKEN:-}" ]; then
|
||||
echo "CONFIG_GIT_TOKEN must be set as a GitLab CI/CD variable."
|
||||
exit 1
|
||||
fi
|
||||
- kubectl create namespace "$CONFIG_SERVER_K8S_NAMESPACE_DEV" --dry-run=client -o yaml | kubectl apply -f -
|
||||
- >
|
||||
kubectl create secret generic "$CONFIG_SERVER_GIT_SECRET_NAME"
|
||||
--namespace "$CONFIG_SERVER_K8S_NAMESPACE_DEV"
|
||||
--from-literal=token="$CONFIG_GIT_TOKEN"
|
||||
--dry-run=client
|
||||
-o yaml
|
||||
| kubectl apply -f -
|
||||
- 'export IMAGE_REPOSITORY="${CONFIG_SERVER_IMAGE%:*}"'
|
||||
- 'export IMAGE_TAG="${CONFIG_SERVER_IMAGE##*:}"'
|
||||
- 'echo "Deploy image: $IMAGE_REPOSITORY:$IMAGE_TAG"'
|
||||
- >
|
||||
helm upgrade --install "$CONFIG_SERVER_HELM_RELEASE"
|
||||
"$CONFIG_SERVER_HELM_CHART_DIR"
|
||||
--namespace "$CONFIG_SERVER_K8S_NAMESPACE_DEV"
|
||||
--create-namespace
|
||||
--values "$CONFIG_SERVER_HELM_CHART_DIR/values.yaml"
|
||||
--values "$CONFIG_SERVER_HELM_CHART_DIR/values-dev.yaml"
|
||||
--set-string image.repository="$IMAGE_REPOSITORY"
|
||||
--set-string image.tag="$IMAGE_TAG"
|
||||
--set-string app.configGitUri="$CONFIG_GIT_URI"
|
||||
--set-string app.configGitUsername="$CONFIG_GIT_USERNAME"
|
||||
--set-string app.configGitDefaultLabel="$CONFIG_GIT_DEFAULT_LABEL"
|
||||
--set-string app.configGitSearchPaths="$CONFIG_GIT_SEARCH_PATHS"
|
||||
--set-string app.configGitSkipSslValidation="$CONFIG_GIT_SKIP_SSL_VALIDATION"
|
||||
--set-string gitTokenSecret.name="$CONFIG_SERVER_GIT_SECRET_NAME"
|
||||
--atomic
|
||||
--wait
|
||||
--timeout 15m
|
||||
@@ -0,0 +1,273 @@
|
||||
# AGENTS.md
|
||||
|
||||
## Назначение
|
||||
|
||||
Этот документ задаёт правила работы агента и базовые инженерные правила для изменений в репозитории.
|
||||
|
||||
Цель агента:
|
||||
- вносить минимальные, безопасные и ревьюопригодные изменения;
|
||||
- сохранять архитектурные границы;
|
||||
- не ломать существующие контракты без явного запроса;
|
||||
- следовать уже используемым в репозитории паттернам и стилю.
|
||||
|
||||
Этот документ **не** является полным платформенным стандартом для BPM/Kafka. Такие правила вынесены в `docs/standards/PLATFORM_STANDARD.md`.
|
||||
|
||||
---
|
||||
|
||||
## Дополнительные обязательные документы
|
||||
|
||||
При работе в этом репозитории:
|
||||
|
||||
- Для изменений, связанных с BPM / Zeebe / Camunda / Kafka / retries / DLQ / compensation / schema evolution, перед изменением кода прочитай `docs/standards/PLATFORM_STANDARD.md`.
|
||||
- Перед завершением нетривиальных изменений проверь `docs/standards/CHECKLIST.md`.
|
||||
- Если задача затрагивает только обычный Kotlin/Spring-код без BPM/Kafka-аспектов, достаточно следовать правилам этого `AGENTS.md`.
|
||||
|
||||
---
|
||||
|
||||
## Обязательный стиль работы
|
||||
|
||||
Перед внесением изменений:
|
||||
|
||||
1. Найди похожую реализацию в том же модуле, сервисе или соседнем слое.
|
||||
2. Следуй уже принятому стилю проекта и существующей структуре.
|
||||
3. Прочитай полный execution path до редактирования кода.
|
||||
4. Держи решение в правильном архитектурном слое.
|
||||
5. Сделай минимальное изменение, которое полностью решает задачу.
|
||||
6. Обнови или добавь тесты для изменённого поведения.
|
||||
|
||||
Для нетривиальных задач:
|
||||
|
||||
1. Кратко определи затронутые модули и файлы.
|
||||
2. Явно зафиксируй ключевые допущения, если есть неоднозначность.
|
||||
3. Предпочитай самый безопасный и наименее сложный вариант вместо редизайна.
|
||||
|
||||
Если требования неоднозначны:
|
||||
- не придумывай редизайн;
|
||||
- сохраняй текущее поведение, если нет явного запроса на его изменение;
|
||||
- явно фиксируй допущения;
|
||||
- предпочитай production safety «красивым» решениям.
|
||||
|
||||
---
|
||||
|
||||
## Предпочтение в дизайне решения
|
||||
|
||||
По умолчанию предпочитай самое простое и понятное решение, которое корректно удовлетворяет текущим требованиям.
|
||||
|
||||
Более сложная архитектура, абстракции, дополнительные слои или более общие конструкции допустимы только тогда, когда более простое решение заметно ухудшит хотя бы одно из следующего:
|
||||
- корректность;
|
||||
- понятность и поддерживаемость;
|
||||
- границы ответственности;
|
||||
- тестируемость;
|
||||
- надёжность;
|
||||
- интеграцию с существующей архитектурой.
|
||||
|
||||
Не усложняй решение как подготовку к возможным будущим требованиям.
|
||||
Если есть несколько рабочих вариантов, выбирай наименее сложный, который не ухудшает качество решения.
|
||||
|
||||
---
|
||||
|
||||
## Базовые предположения по стеку
|
||||
|
||||
- Язык: Kotlin
|
||||
- Framework: Spring Boot
|
||||
- Возможные интеграции:
|
||||
- REST
|
||||
- Kafka
|
||||
- BPM / Zeebe / Camunda 8
|
||||
- database persistence
|
||||
- external HTTP/gRPC APIs
|
||||
|
||||
Следуй реальной структуре и библиотекам, уже используемым в репозитории.
|
||||
Не вводи новый стиль, если в проекте уже есть устоявшийся.
|
||||
|
||||
---
|
||||
|
||||
## Архитектурные границы
|
||||
|
||||
### Ключевой принцип
|
||||
|
||||
Сервис владеет доменным состоянием и бизнес-правилами.
|
||||
|
||||
### Владение по слоям
|
||||
|
||||
- `controller/api` -> только transport
|
||||
- `application/service/use case` -> orchestration внутри границы сервиса
|
||||
- `domain` -> бизнес-правила, инварианты, решения
|
||||
- `repository/adapter/client` -> только persistence и внешняя коммуникация
|
||||
|
||||
### Где нельзя размещать бизнес-логику
|
||||
|
||||
Нельзя размещать доменную бизнес-логику в:
|
||||
- controllers
|
||||
- repository implementations
|
||||
- Kafka listeners / consumers
|
||||
- Zeebe workers
|
||||
- external client adapters
|
||||
- BPMN process definitions
|
||||
|
||||
---
|
||||
|
||||
## Правила Kotlin
|
||||
|
||||
- Предпочитай явный и читаемый код.
|
||||
- Делай функции небольшими и отражающими намерение.
|
||||
- Предпочитай `val` вместо `var`, если мутация не нужна.
|
||||
- Избегай чрезмерно «умных» chain/scope-function конструкций, если они ухудшают читаемость.
|
||||
- Используй понятные имена; не вводи аббревиатуры без необходимости.
|
||||
- Не вводи DSL-подобный или чрезмерно функциональный стиль, если он не доминирует в проекте.
|
||||
- Сохраняй текущий подход проекта к null-safety.
|
||||
- Не заменяй явные ошибки на `null`-driven control flow.
|
||||
- Предпочитай прямой и понятный код вместо «умных», слишком универсальных или академичных решений.
|
||||
|
||||
### Правило комментариев для Kotlin/Spring кода
|
||||
|
||||
Комментарии обязательны там, где они реально помогают сопровождению кода:
|
||||
|
||||
- для публичных функций и публичных контрактов, если их назначение неочевидно из сигнатуры;
|
||||
- для сложных бизнес-правил, инвариантов и ограничений;
|
||||
- для retry / compensation / idempotency / transactional логики;
|
||||
- для неочевидных решений, важных допущений и edge cases;
|
||||
- для переменных и локальных вычислений только тогда, когда без комментария намерение неясно.
|
||||
|
||||
Не нужно комментировать каждую переменную или каждую функцию механически.
|
||||
Комментарии должны объяснять цель и reasoning, а не пересказывать синтаксис.
|
||||
|
||||
Плохой комментарий:
|
||||
- `// increment counter`
|
||||
|
||||
Хороший комментарий:
|
||||
- `// Хранит количество уже выполненных попыток доставки для этой операции, чтобы retry-логика могла определить, нужно ли повторить обработку или отправить сообщение в DLQ.`
|
||||
|
||||
---
|
||||
|
||||
## Правила Spring Boot
|
||||
|
||||
- Контроллеры должны оставаться тонкими.
|
||||
- Контроллеры должны только:
|
||||
- принимать и валидировать вход;
|
||||
- маппить transport-модели;
|
||||
- вызывать application/service layer;
|
||||
- возвращать response.
|
||||
- Бизнес-правила не должны жить в контроллерах.
|
||||
- Репозитории не должны содержать бизнес-решения.
|
||||
- Transaction boundaries должны находиться в service/application layer, если модуль уже не использует другой устоявшийся паттерн.
|
||||
- Не выполняй долгий remote I/O внутри DB-транзакций без явной необходимости текущего дизайна.
|
||||
- Переиспользуй существующий стиль Spring-конфигурации, properties, beans, mappers и utilities.
|
||||
|
||||
---
|
||||
|
||||
## Правила API и error handling
|
||||
|
||||
- Сохраняй публичные REST/gRPC контракты, если явно не запрошено иное.
|
||||
- Переиспользуй существующий response/error format.
|
||||
- Переиспользуй текущий validation style.
|
||||
- Держи backward compatibility в фокусе.
|
||||
- Если контракт меняется, обнови тесты и nearby examples/docs.
|
||||
|
||||
- Не используй broad `try/catch`, скрывающий ошибки.
|
||||
- Не проглатывай исключения.
|
||||
- Не делай silent downgrade ошибок в дефолтные значения.
|
||||
- Следуй существующему exception mapping pattern.
|
||||
- Держи error handling явным и удобным для дебага.
|
||||
- Избегай дублирующих шумных логов для одного и того же failure path.
|
||||
|
||||
---
|
||||
|
||||
## Правила observability
|
||||
|
||||
Для важных бизнес-флоу сохраняй или улучшай:
|
||||
- structured logging;
|
||||
- metrics;
|
||||
- tracing/correlation;
|
||||
- operation identifiers.
|
||||
|
||||
Если меняется Kafka/BPM/external integration logic:
|
||||
- сохрани или добавь correlation identifiers;
|
||||
- сохрани или добавь `operation_id`, где это релевантно;
|
||||
- логируй достаточно для дебага retries, duplicates и compensations;
|
||||
- никогда не логируй секреты или sensitive payloads.
|
||||
|
||||
---
|
||||
|
||||
## Правила тестирования
|
||||
|
||||
Всегда обновляй тесты, если меняется поведение.
|
||||
|
||||
Добавляй или обновляй unit tests, если меняются:
|
||||
- business rules;
|
||||
- branching logic;
|
||||
- validation;
|
||||
- idempotency behavior;
|
||||
- retry/compensation behavior.
|
||||
|
||||
Добавляй или обновляй integration tests, если меняются:
|
||||
- Spring wiring;
|
||||
- controller behavior;
|
||||
- persistence behavior;
|
||||
- Kafka behavior;
|
||||
- Zeebe worker behavior;
|
||||
- transaction behavior;
|
||||
- external integration behavior.
|
||||
|
||||
Каждое bug fix-изменение по возможности должно сопровождаться regression test.
|
||||
|
||||
---
|
||||
|
||||
## Validation commands
|
||||
|
||||
Сначала предпочитай самый маленький релевантный прогон, потом более широкий.
|
||||
|
||||
Типичные команды:
|
||||
- `./gradlew test`
|
||||
- `./gradlew ktlintCheck`
|
||||
- `./gradlew build`
|
||||
|
||||
Если в репозитории есть module-specific команды, используй их, когда это уместно.
|
||||
|
||||
Если команда не была запущена:
|
||||
- точно укажи, какая именно команда не запускалась;
|
||||
- объясни почему;
|
||||
- опиши остаточный риск.
|
||||
|
||||
---
|
||||
|
||||
## Правила контроля scope
|
||||
|
||||
Держи изменения узко ограниченными.
|
||||
|
||||
Не делай:
|
||||
- переименование файлов / классов / пакетов без явной необходимости;
|
||||
- перенос кода между модулями без сильной архитектурной причины;
|
||||
- переформатирование несвязанных файлов;
|
||||
- «попутную уборку» соседнего кода без необходимости для задачи;
|
||||
- введение абстракций «на будущее».
|
||||
|
||||
Предпочитай:
|
||||
- локальные изменения;
|
||||
- существующие абстракции;
|
||||
- явные, простые, сопровождаемые решения.
|
||||
|
||||
---
|
||||
|
||||
## Обязательный формат финального ответа
|
||||
|
||||
В конце задачи всегда предоставляй:
|
||||
|
||||
1. `Changed files`
|
||||
- список изменённых файлов
|
||||
|
||||
2. `What changed`
|
||||
- краткое summary реализации
|
||||
|
||||
3. `Architecture compliance`
|
||||
- объясни, почему решение соблюдает layer boundaries
|
||||
- если участвует BPM или messaging, кратко укажи, как соблюдены платформенные требования из `docs/standards/PLATFORM_STANDARD.md`
|
||||
|
||||
4. `Validation`
|
||||
- какие команды запускались
|
||||
- результаты
|
||||
|
||||
5. `Risks / assumptions`
|
||||
- что не было полностью проверено
|
||||
- compatibility considerations
|
||||
- edge cases
|
||||
@@ -1,4 +1,4 @@
|
||||
# observatio-terrae
|
||||
# pcp
|
||||
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin https://git.nstart.cloud/2-6/2-6-4/missionis/observatio-terrae.git
|
||||
git remote add origin https://git.nstart.local/emelianov.an/pcp.git
|
||||
git branch -M master
|
||||
git push -uf origin master
|
||||
```
|
||||
|
||||
## Integrate with your tools
|
||||
|
||||
* [Set up project integrations](https://git.nstart.cloud/2-6/2-6-4/missionis/observatio-terrae/-/settings/integrations)
|
||||
* [Set up project integrations](https://git.nstart.local/emelianov.an/pcp/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") apply false
|
||||
kotlin("plugin.spring") apply false
|
||||
kotlin("plugin.jpa") apply false
|
||||
kotlin("plugin.lombok") apply false
|
||||
id("org.springframework.boot") apply false
|
||||
id("io.spring.dependency-management") apply false
|
||||
id("org.sonarqube") apply false
|
||||
}
|
||||
|
||||
|
||||
allprojects {
|
||||
group = "space.nstart.pcp"
|
||||
ext.set("kotlinVersion", "2.2.20")
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://repo.nstart.cloud/repository/maven-proxy/")
|
||||
}
|
||||
// mavenCentral()
|
||||
// mavenLocal()
|
||||
// gradlePluginPortal()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven("https://repo.osgeo.org/repository/release/")
|
||||
}
|
||||
filter {
|
||||
includeGroup("org.geotools")
|
||||
includeGroup("org.geotools.ogc")
|
||||
includeGroup("javax.media")
|
||||
includeGroup("it.geosolutions.jgridshift")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
plugins.withId("java") {
|
||||
extensions.configure<JavaPluginExtension> {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of((property("versions.java") as String).toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("org.springframework.boot") {
|
||||
if (
|
||||
path != ":services:pcp-srpring-boot-admin-server" &&
|
||||
path != ":services:spring-cloud-config-server"
|
||||
) {
|
||||
dependencies.add(
|
||||
"implementation",
|
||||
"de.codecentric:spring-boot-admin-starter-client:${property("versions.spring.boot.admin")}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
# Dynamic Slots Change Log
|
||||
|
||||
1. pcp-ballistics-service
|
||||
- Ужесточены уровни логирования для production/runtime окружения.
|
||||
- Отключены подробные SQL/JDBC/Flyway/Spring Web логи, чтобы уменьшить шум в логах сервиса.
|
||||
|
||||
2. pcp-dynamic-plan-service
|
||||
- Добавлена история запусков расчета динамического плана с возможностью получать список запусков и отдельный запуск.
|
||||
- Добавлено восстановление незавершенных расчетов после рестарта сервиса: зависшие `PENDING` и `RUNNING` запуски переводятся в `FAILED`.
|
||||
- Добавлены режимы расчета `FULL` и `GREEDY`.
|
||||
- Добавлен выбор направления витка для расчета: оба, восходящий или нисходящий.
|
||||
- Добавлен флаг фильтрации маршрутов по уже покрытой территории.
|
||||
- Добавлено сохранение построенных интервалов расчета и API для их получения.
|
||||
- Расширен результат расчета метаданными: режим расчета, режим витка, флаг фильтрации, время последнего маршрута и процент покрытия территории.
|
||||
- Добавлена greedy-логика выбора маршрутов с учетом ограничений КА, суточной загрузки, загрузки по виткам и конфликтов по времени.
|
||||
- Добавлена диагностика причин, по которым интервалы не удалось закрыть маршрутом.
|
||||
- Добавлен параллельный расчет параметров наблюдения по чанкам с настройками размера чанка и parallelism.
|
||||
- Добавлены debug API для расчета параметров наблюдения, проверки greedy-математики и построения маршрутов по сохраненным параметрам наблюдения.
|
||||
- Добавлена возможность сохранять debug-результаты параметров наблюдения во временную директорию.
|
||||
- Generated debug-артефакты `obsParams` исключены из git.
|
||||
- Добавлены миграции БД для новых параметров запуска и хранения интервалов.
|
||||
- Обновлены unit/controller tests для новых сценариев расчета, истории запусков, интервалов и debug-функций.
|
||||
|
||||
3. pcp-ui-service
|
||||
- Добавлен просмотр истории запусков динамического плана.
|
||||
- Добавлено открытие ранее выполненного запуска и просмотр его результата.
|
||||
- Добавлены UI-контролы для выбора режима расчета, направления витка и фильтрации по покрытой территории.
|
||||
- Интервал расчета в UI переведен на выбор дат с автоматическим построением границ дня.
|
||||
- В результат расчета добавлено отображение режима, направления витка, фильтра покрытия, последнего маршрута и процента покрытия территории.
|
||||
- Добавлены действия для отображения и скрытия результата расчета на карте.
|
||||
- Добавлен слой карты для отображения интервалов и маршрутов dynamic plan в Cesium.
|
||||
- Обновлен экран карты, чтобы он подключал и инициализировал слой dynamic plan.
|
||||
- Обновлены стили страницы dynamic plan под историю запусков, новые параметры расчета и map controls.
|
||||
- Обновлены тесты UI-контроллера под новые endpoints и поведение.
|
||||
|
||||
4. spring-cloud-config-server
|
||||
- Отключена регистрация config-server в Spring Boot Admin.
|
||||
@@ -0,0 +1,25 @@
|
||||
# config-repo
|
||||
|
||||
Файлы в этом подпроекте предназначены для `spring-cloud-config-server`.
|
||||
|
||||
Ожидаемый сценарий:
|
||||
|
||||
- этот каталог хранится в GitLab-репозитории с конфигами
|
||||
- `spring-cloud-config-server` читает его через `CONFIG_GIT_URI`
|
||||
- сервисы запрашивают конфиги по имени `spring.application.name`
|
||||
|
||||
Для `tle-monitoring-service` используются файлы:
|
||||
|
||||
- `tle-monitoring-service.yaml`
|
||||
|
||||
Пример запроса к Config Server:
|
||||
|
||||
`GET /tle-monitoring-service/local`
|
||||
|
||||
Архитектурные договоренности:
|
||||
|
||||
- `pcp-request-service` является единственным owner request/grid-домена.
|
||||
- `pcp.services.request` должен использоваться как основной runtime endpoint для requests/cells/grid.
|
||||
- `pcp.services.earth-grid` сохранен только как legacy alias и должен резолвиться в `pcp.services.request`.
|
||||
- lifecycle booked slots должен идти Kafka-first; legacy HTTP `/api/slots/booking/process` не считается рабочим основным путем.
|
||||
- `pcp.services.admin` указывает на `pcp-srpring-boot-admin-server`; сервисы PCP должны регистрироваться в нем через Spring Boot Admin client.
|
||||
@@ -0,0 +1,60 @@
|
||||
# TODO before merge request: вернуть старые адреса окружения.
|
||||
# pcp.infra.postgres.host: 192.168.100.160
|
||||
pcp:
|
||||
infra:
|
||||
postgres:
|
||||
host: 192.168.100.160
|
||||
port: 35400
|
||||
kafka:
|
||||
host: 192.168.100.160
|
||||
port: 19092
|
||||
|
||||
network:
|
||||
host: 192.168.100.160
|
||||
|
||||
ports:
|
||||
config: 38888
|
||||
admin: 38889
|
||||
route-processing: 8080
|
||||
request: 8080
|
||||
ballistics: 8080
|
||||
complex-mission-service: 8080
|
||||
stations: 8080
|
||||
slots: 8080
|
||||
mission: 8080
|
||||
ui: 8080
|
||||
tgu: 8080
|
||||
tle-monitoring: 8080
|
||||
complex-mission-flow: 8080
|
||||
coverage-scheme: 8080
|
||||
satellite-catalog: 8080
|
||||
dynamic-plan: 8080
|
||||
|
||||
services:
|
||||
config: http://${pcp.network.host}:${pcp.ports.config}
|
||||
admin: http://${pcp.network.host}:${pcp.ports.admin}
|
||||
route-processing: http://${pcp.network.host}:${pcp.ports.route-processing}
|
||||
request: http://pcp-request-service:${pcp.ports.request}
|
||||
earth-grid: ${pcp.services.request}
|
||||
ballistics: http://pcp-ballistics-service:${pcp.ports.ballistics}
|
||||
complex-mission-service: http://pcp-complex-mission-service:${pcp.ports.complex-mission-service}
|
||||
stations: http://pcp-stations-service:${pcp.ports.stations}
|
||||
slots: http://pcp-slots-service:${pcp.ports.slots}
|
||||
mission: http://pcp-mission-planing-service:${pcp.ports.mission}
|
||||
ui: http://${pcp.network.host}:${pcp.ports.ui}
|
||||
tgu: http://${pcp.network.host}:${pcp.ports.tgu}
|
||||
tle-monitoring: http://tle-monitoring-service:${pcp.ports.tle-monitoring}
|
||||
coverage-scheme: http://pcp-coverage-scheme-service:${pcp.ports.coverage-scheme}
|
||||
satellite-catalog: http://pcp-satellite-catalog-service:${pcp.ports.satellite-catalog}
|
||||
dynamic-plan: http://pcp-dynamic-plan-service:${pcp.ports.dynamic-plan}
|
||||
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
enabled: true
|
||||
url:
|
||||
- ${pcp.services.admin}
|
||||
auto-registration: true
|
||||
auto-deregistration: true
|
||||
register-once: true
|
||||
@@ -0,0 +1,75 @@
|
||||
pcp:
|
||||
infra:
|
||||
postgres:
|
||||
host: postgres
|
||||
port: 5432
|
||||
kafka:
|
||||
host: kafka
|
||||
port: 9092
|
||||
|
||||
network:
|
||||
host: localhost
|
||||
|
||||
ports:
|
||||
config: 8888
|
||||
admin: 7000
|
||||
route-processing: 7004
|
||||
request: 7005
|
||||
ballistics: 7003
|
||||
complex-mission-service: 7002
|
||||
stations: 7009
|
||||
slots: 7006
|
||||
mission: 7010
|
||||
ui: 7008
|
||||
tgu: 7011
|
||||
tle-monitoring: 7001
|
||||
complex-mission-flow: 7007
|
||||
coverage-scheme: 7012
|
||||
satellite-catalog: 7013
|
||||
dynamic-plan: 7014
|
||||
|
||||
services:
|
||||
config: http://spring-cloud-config-server:${pcp.ports.config}
|
||||
admin: http://pcp-srpring-boot-admin-server:${pcp.ports.admin}
|
||||
route-processing: http://pcp-route-processing-service:${pcp.ports.route-processing}
|
||||
request: http://pcp-request-service:${pcp.ports.request}
|
||||
earth-grid: ${pcp.services.request}
|
||||
ballistics: http://pcp-ballistics-service:${pcp.ports.ballistics}
|
||||
complex-mission-service: http://pcp-complex-mission-service:${pcp.ports.complex-mission-service}
|
||||
stations: http://pcp-stations-service:${pcp.ports.stations}
|
||||
slots: http://slots-service:${pcp.ports.slots}
|
||||
mission: http://pcp-mission-planing-service:${pcp.ports.mission}
|
||||
ui: http://pcp-ui-service:${pcp.ports.ui}
|
||||
tgu: http://pcp-tgu-service:${pcp.ports.tgu}
|
||||
tle-monitoring: http://tle-monitoring-service:${pcp.ports.tle-monitoring}
|
||||
coverage-scheme: http://pcp-coverage-scheme-service:${pcp.ports.coverage-scheme}
|
||||
satellite-catalog: http://pcp-satellite-catalog-service:${pcp.ports.satellite-catalog}
|
||||
dynamic-plan: http://pcp-dynamic-plan-service:${pcp.ports.dynamic-plan}
|
||||
|
||||
spring:
|
||||
kafka:
|
||||
admin:
|
||||
auto-create: true
|
||||
listener:
|
||||
missing-topics-fatal: false
|
||||
|
||||
camunda:
|
||||
client:
|
||||
enabled: ${CAMUNDA_CLIENT_ENABLED:false}
|
||||
grpc-address: http://localhost:26500
|
||||
auth:
|
||||
method: none
|
||||
prefer-rest-over-grpc: false
|
||||
|
||||
planning:
|
||||
external-update-enabled: false
|
||||
|
||||
classifier:
|
||||
platforms-url: http://pcp-satellite-catalog-service:${pcp.ports.satellite-catalog}
|
||||
|
||||
tle:
|
||||
polling:
|
||||
enabled: ${TLE_POLLING_ENABLED:false}
|
||||
|
||||
settings:
|
||||
ic-service: http://pcp-satellite-catalog-service:${pcp.ports.satellite-catalog}
|
||||
@@ -0,0 +1,62 @@
|
||||
# Local profile defaults are intentionally overridable because developer machines
|
||||
# and local Docker deployments use different network names.
|
||||
pcp:
|
||||
infra:
|
||||
postgres:
|
||||
host: ${PCP_POSTGRES_HOST:localhost}
|
||||
port: ${PCP_POSTGRES_PORT:5432}
|
||||
kafka:
|
||||
host: ${PCP_KAFKA_HOST:localhost}
|
||||
port: ${PCP_KAFKA_PORT:29092}
|
||||
|
||||
|
||||
|
||||
network:
|
||||
host: ${PCP_NETWORK_HOST:localhost}
|
||||
|
||||
ports:
|
||||
config: 38888
|
||||
admin: 7000
|
||||
route-processing: 7004
|
||||
request: 7005
|
||||
ballistics: 7003
|
||||
complex-mission-service: 7002
|
||||
stations: 7009
|
||||
slots: 7006
|
||||
mission: 7010
|
||||
ui: 7008
|
||||
tgu: 7011
|
||||
tle-monitoring: 7001
|
||||
complex-mission-flow: 7007
|
||||
coverage-scheme: 7012
|
||||
satellite-catalog: 7013
|
||||
dynamic-plan: 7014
|
||||
|
||||
services:
|
||||
config: http://${pcp.network.host}:${pcp.ports.config}
|
||||
admin: http://${pcp.network.host}:${pcp.ports.admin}
|
||||
route-processing: http://${pcp.network.host}:${pcp.ports.route-processing}
|
||||
request: http://${pcp.network.host}:${pcp.ports.request}
|
||||
earth-grid: ${pcp.services.request}
|
||||
ballistics: http://${pcp.network.host}:${pcp.ports.ballistics}
|
||||
complex-mission-service: http://${pcp.network.host}:${pcp.ports.complex-mission-service}
|
||||
stations: http://${pcp.network.host}:${pcp.ports.stations}
|
||||
slots: http://${pcp.network.host}:${pcp.ports.slots}
|
||||
mission: http://${pcp.network.host}:${pcp.ports.mission}
|
||||
ui: http://${pcp.network.host}:${pcp.ports.ui}
|
||||
tgu: http://${pcp.network.host}:${pcp.ports.tgu}
|
||||
tle-monitoring: http://${pcp.network.host}:${pcp.ports.tle-monitoring}
|
||||
coverage-scheme: http://${pcp.network.host}:${pcp.ports.coverage-scheme}
|
||||
satellite-catalog: http://${pcp.network.host}:${pcp.ports.satellite-catalog}
|
||||
dynamic-plan: http://${pcp.network.host}:${pcp.ports.dynamic-plan}
|
||||
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
enabled: true
|
||||
url:
|
||||
- ${pcp.services.admin}
|
||||
auto-registration: true
|
||||
auto-deregistration: true
|
||||
register-once: true
|
||||
@@ -0,0 +1 @@
|
||||
description = "Configuration repository for Spring Cloud Config Server"
|
||||
@@ -0,0 +1,57 @@
|
||||
server:
|
||||
port: 38080
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
probes:
|
||||
enabled: true
|
||||
show-details: always
|
||||
|
||||
meteo:
|
||||
s3:
|
||||
endpoint: http://minio:9999
|
||||
region: us-east-1
|
||||
access-key: ${METEO_S3_ACCESS_KEY}
|
||||
secret-key: ${METEO_S3_SECRET_KEY}
|
||||
bucket: meteo
|
||||
object-prefix: gfs
|
||||
path-style-access-enabled: true
|
||||
|
||||
cloud:
|
||||
layer:
|
||||
layer-id: tcdc
|
||||
title: TCDC — Total Cloud Cover
|
||||
description: Отображение общей облачности из GFS, загруженной сервисом meteodownloader
|
||||
source-parameter: TCDC
|
||||
unit: "%"
|
||||
min-value: 0.0
|
||||
max-value: 100.0
|
||||
|
||||
render:
|
||||
derived-prefix: gfs-derived/tcdc
|
||||
catalog-prefix: gfs-derived/tcdc-catalog
|
||||
frame-file-name: frame.json
|
||||
pmtiles-file-name: frame.pmtiles
|
||||
pmtiles-content-type: application/vnd.pmtiles
|
||||
tile-format: png
|
||||
tile-content-type: image/png
|
||||
tile-size: 256
|
||||
min-zoom: 0
|
||||
native-max-zoom: 6
|
||||
display-max-zoom: 12
|
||||
chunk-render-parallelism: 8
|
||||
render-chunk-tile-count: 32
|
||||
max-in-flight-render-chunks: 20
|
||||
frame-render-parallelism: 2
|
||||
render-missing-on-startup: false
|
||||
startup-render-limit: 4
|
||||
catalog-cache-seconds: 30
|
||||
temp-dir: ./meteo-render-temp
|
||||
render-version: v5-pmtiles-direct-leaflet
|
||||
single-instance-mode: true
|
||||
keep-latest-runs: 1
|
||||
@@ -0,0 +1,129 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.ballistics}
|
||||
service-path: /swagger/ui
|
||||
management-base-url: ${pcp.services.ballistics}
|
||||
health-url: ${pcp.services.ballistics}/actuator/health
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp-ballistics-service
|
||||
auto-offset-reset: earliest
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_ballistics
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
settings:
|
||||
calculation-interval: 7
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
admin:
|
||||
auto-create: ${SPRING_KAFKA_ADMIN_AUTO_CREATE:false}
|
||||
consumer:
|
||||
group-id: pcp-ballistics-service
|
||||
auto-offset-reset: earliest
|
||||
listener:
|
||||
auto-startup: ${SPRING_KAFKA_LISTENER_AUTO_STARTUP:false}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_ballistics
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
settings:
|
||||
calculation-interval: 28
|
||||
ic-service: http://${pcp.network.host}:9080
|
||||
|
||||
server:
|
||||
port: 7003
|
||||
@@ -0,0 +1,141 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.complex-mission-service}
|
||||
service-path: /swagger/ui
|
||||
management-base-url: ${pcp.services.complex-mission-service}
|
||||
health-url: ${pcp.services.complex-mission-service}/actuator/health
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
complex-plan:
|
||||
batch-chunk-size: 100
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_satellites
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
consumer:
|
||||
group-id: pcp-complex-mission-service
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.complex-mission-service:7002}
|
||||
|
||||
settings:
|
||||
calculation-interval: 3
|
||||
ballistics-service: ${pcp.services.ballistics}
|
||||
request-service: ${pcp.services.request}
|
||||
earth-grid-service: ${pcp.services.request}
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
stations-service: ${pcp.services.stations}
|
||||
slots-service: ${pcp.services.slots}
|
||||
coverage-scheme-service: ${pcp.services.coverage-scheme}
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_satellites
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
consumer:
|
||||
group-id: pcp-complex-mission-service
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
settings:
|
||||
calculation-interval: 3
|
||||
ballistics-service: ${pcp.services.ballistics}
|
||||
request-service: ${pcp.services.request}
|
||||
earth-grid-service: ${pcp.services.request}
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
stations-service: ${pcp.services.stations}
|
||||
slots-service: ${pcp.services.slots}
|
||||
coverage-scheme-service: ${pcp.services.coverage-scheme}
|
||||
@@ -0,0 +1,72 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.coverage-scheme}
|
||||
service-path: /swagger/ui
|
||||
management-base-url: ${pcp.services.coverage-scheme}
|
||||
health-url: ${pcp.services.coverage-scheme}/actuator/health
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
coverage-scheme:
|
||||
ballistics-service-url: ${pcp.services.ballistics}
|
||||
complex-mission-service-url: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service-url: ${pcp.services.satellite-catalog}
|
||||
default-roll-step-degrees: 5.0
|
||||
default-minimum-technology-overlap: 0.05
|
||||
default-allow-partial-coverage: true
|
||||
boundary-touch-buffer: 0.05
|
||||
continuity-gap-tolerance: 0.000001
|
||||
default-orientation-tolerance-degrees: 15.0
|
||||
max-roll-samples-per-window: 7
|
||||
flight-line-padding-seconds: 120
|
||||
web-client-response-timeout-seconds: 30
|
||||
web-client-in-memory-size-mb: 20
|
||||
fallback-swath-width-degrees: 1.0
|
||||
fallback-shift-per-roll-degree: 0.02
|
||||
default-minimum-time-between-modes-seconds: 0
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.coverage-scheme:7012}
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
@@ -0,0 +1,117 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.dynamic-plan}
|
||||
service-path: /swagger/ui
|
||||
management-base-url: ${pcp.services.dynamic-plan}
|
||||
health-url: ${pcp.services.dynamic-plan}/actuator/health
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
complex-plan:
|
||||
request-service-url: ${pcp.services.request}
|
||||
request-selection-path: /v1/requests
|
||||
ballistics-service-url: ${pcp.services.ballistics}
|
||||
satellite-catalog-service-url: ${pcp.services.satellite-catalog}
|
||||
report-dir: ${java.io.tmpdir}/pcp-dynamic-plan-service/reports
|
||||
interval-coverage-check-enabled: false
|
||||
geo-layers:
|
||||
enabled: false
|
||||
output-dir: ${java.io.tmpdir}/pcp-dynamic-plan-service/geo-layers
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_complex_plan
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration/pcp-complex-plan
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
consumer:
|
||||
group-id: pcp-dynamic-plan-service
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.dynamic-plan:7014}
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_complex_plan
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration/pcp-complex-plan
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
consumer:
|
||||
group-id: pcp-dynamic-plan-service
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
@@ -0,0 +1,157 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.mission}
|
||||
service-path: /swagger/ui
|
||||
management-base-url: ${pcp.services.mission}
|
||||
health-url: ${pcp.services.mission}/actuator/health
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
consumer:
|
||||
group-id: pcp-mission-planing-service
|
||||
auto-offset-reset: earliest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
enable-auto-commit: false
|
||||
listener:
|
||||
missing-topics-fatal: false
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_missions
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
camunda:
|
||||
client:
|
||||
mode: self-managed
|
||||
grpc-address: http://camunda.k8s.265.nstart.local:30901
|
||||
auth:
|
||||
method: none
|
||||
prefer-rest-over-grpc: false
|
||||
server:
|
||||
port: ${pcp.ports.mission:7010}
|
||||
|
||||
settings:
|
||||
ballistics-service: ${pcp.services.ballistics}
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
stations-service: ${pcp.services.stations}
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
booked-slots: pcp.slots.status.v1
|
||||
mode-status-changed: pcp.route.in.v1
|
||||
satellites: pcp.satellites
|
||||
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
consumer:
|
||||
group-id: pcp-mission-planing-service
|
||||
auto-offset-reset: earliest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
enable-auto-commit: false
|
||||
listener:
|
||||
missing-topics-fatal: false
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_missions
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
camunda:
|
||||
client:
|
||||
mode: self-managed
|
||||
grpc-address: http://camunda.k8s.265.nstart.local:30901
|
||||
auth:
|
||||
method: none
|
||||
prefer-rest-over-grpc: false
|
||||
server:
|
||||
port: ${pcp.ports.mission:8080}
|
||||
|
||||
settings:
|
||||
ballistics-service: ${pcp.services.ballistics}
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
stations-service: ${pcp.services.stations}
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
booked-slots: pcp.slots.status.v1
|
||||
mode-status-changed: pcp.route.in.v1
|
||||
satellites: pcp.satellites
|
||||
@@ -0,0 +1,68 @@
|
||||
server:
|
||||
port: ${pcp.ports.request:7005}
|
||||
|
||||
pcp:
|
||||
outbox:
|
||||
request-completed-topic: pcp.request.completed.v1
|
||||
publish-batch-size: 50
|
||||
publish-fixed-delay-ms: 5000
|
||||
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.request}
|
||||
management-base-url: ${pcp.services.request}
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_requests
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp-request-service
|
||||
auto-offset-reset: latest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger/ui
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
org.hibernate.SQL: WARN
|
||||
org.springframework.kafka: INFO
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
request: pcp.request.in.v1
|
||||
route: pcp.route.georeference.v1
|
||||
request:
|
||||
cleanup-retention-days: 30
|
||||
cleanup-cron: "0 0 3 * * *"
|
||||
grid:
|
||||
enabled: true
|
||||
@@ -0,0 +1,57 @@
|
||||
server:
|
||||
port: ${pcp.ports.route-processing:7004}
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger/ui
|
||||
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.route-processing}
|
||||
management-base-url: ${pcp.services.route-processing}
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_route_processing
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp-route-processing-service
|
||||
auto-offset-reset: earliest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
enable-auto-commit: false
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
listener:
|
||||
missing-topics-fatal: false
|
||||
ack-mode: manual_immediate
|
||||
|
||||
app:
|
||||
route-passport:
|
||||
consumer:
|
||||
retry:
|
||||
max-attempts: 3
|
||||
backoff-ms: 1000
|
||||
max-backoff-ms: 30000
|
||||
kafka:
|
||||
topics:
|
||||
input: pcp.request.survey-georeference.v1
|
||||
input-dlq: pcp.request.survey-georeference-dlq.v1
|
||||
processed-route: pcp.route.in.v1
|
||||
route-georeference: pcp.route.georeference.v1
|
||||
@@ -0,0 +1,106 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.satellite-catalog}
|
||||
management-base-url: ${pcp.services.satellite-catalog}
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_satellite_catalog
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.satellite-catalog:7013}
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: "${SPRING_DATASOURCE_URL}"
|
||||
username: "${SPRING_DATASOURCE_USERNAME}"
|
||||
password: "${SPRING_DATASOURCE_PASSWORD}"
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
@@ -0,0 +1,21 @@
|
||||
server:
|
||||
port: ${pcp.ports.admin:38889}
|
||||
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
enabled: false
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,env,metrics
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
logging:
|
||||
level:
|
||||
de.codecentric.boot.admin: INFO
|
||||
@@ -0,0 +1,90 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.stations}
|
||||
management-base-url: ${pcp.services.stations}
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_stations
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
server:
|
||||
port: ${pcp.ports.stations:7009}
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_stations
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
server:
|
||||
port: ${pcp.ports.stations:8080}
|
||||
@@ -0,0 +1,117 @@
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.tgu}
|
||||
management-base-url: ${pcp.services.tgu}
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
|
||||
camunda:
|
||||
client:
|
||||
mode: self-managed
|
||||
grpc-address: http://camunda.k8s.265.nstart.local:30901
|
||||
auth:
|
||||
method: none
|
||||
prefer-rest-over-grpc: false
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics
|
||||
|
||||
planning:
|
||||
notification-before-start-minutes: 263
|
||||
target-plan-duration-minutes: 180
|
||||
target-plan-duration-delta-minutes: 60
|
||||
external-update-enabled: true
|
||||
external-points-lookahead-days: 3
|
||||
in-memory-history-days: 14
|
||||
external-update-fixed-delay-ms: 600000
|
||||
notification-check-fixed-delay-ms: 30000
|
||||
|
||||
topics:
|
||||
spacecraft-points-update: pcp.tgu.kpp-update.v1
|
||||
|
||||
classifier:
|
||||
platforms-url: http://nsi-classifier-api.k8s.265.nstart.local/classifiers/platforms
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: ${DB_URL:jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_tgu}
|
||||
username: ${DB_USERNAME:postgres}
|
||||
password: ${DB_PASSWORD:password}
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp-tgu-service
|
||||
auto-offset-reset: earliest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
|
||||
properties:
|
||||
spring.json.trusted.packages: "*"
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
|
||||
|
||||
external-api:
|
||||
base-url: ${pcp.services.ballistics}
|
||||
server:
|
||||
port: ${pcp.ports.tgu:7011}
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: ${DB_URL:jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_tgu}
|
||||
username: ${DB_USERNAME:postgres}
|
||||
password: ${DB_PASSWORD:password}
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp-tgu-service
|
||||
auto-offset-reset: earliest
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
|
||||
properties:
|
||||
spring.json.trusted.packages: "*"
|
||||
producer:
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
|
||||
admin:
|
||||
auto-create: true
|
||||
|
||||
external-api:
|
||||
base-url: ${pcp.services.ballistics}
|
||||
server:
|
||||
port: ${pcp.ports.tgu:8080}
|
||||
@@ -0,0 +1,45 @@
|
||||
server:
|
||||
port: ${pcp.ports.ui:7008}
|
||||
shutdown: graceful
|
||||
ssl:
|
||||
enabled: false
|
||||
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
thymeleaf.reactive.max-chunk-size: 8192
|
||||
jackson:
|
||||
serialization-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.ui}
|
||||
management-base-url: ${pcp.services.ui}
|
||||
health-url: ${pcp.services.ui}/actuator/health
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath:/static/
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
settings:
|
||||
calculation-interval: 3
|
||||
request-service: ${pcp.services.request}
|
||||
earth-grid-service: ${pcp.services.request}
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
dynamic-plan-service: ${pcp.services.dynamic-plan}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
ballistics-service: ${pcp.services.ballistics}
|
||||
stations-service: ${pcp.services.stations}
|
||||
slots-service: ${pcp.services.slots}
|
||||
mission-service: ${pcp.services.mission}
|
||||
coverage-scheme-service: ${pcp.services.coverage-scheme}
|
||||
@@ -0,0 +1,157 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.slots}
|
||||
service-path: /swagger/ui
|
||||
management-base-url: ${pcp.services.slots}
|
||||
health-url: ${pcp.services.slots}/actuator/health
|
||||
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_slots
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
|
||||
settings:
|
||||
request-service: ${pcp.services.request}
|
||||
earth-grid-service: ${pcp.services.request}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
booked-slots: pcp.slots.status.v1
|
||||
satellites: pcp.satellites
|
||||
|
||||
pcp:
|
||||
booked-slots:
|
||||
timeout-check-interval: 1h
|
||||
timeout-threshold: 1h
|
||||
slot-service:
|
||||
calc:
|
||||
parallelism: 8
|
||||
chunk-duration-seconds: 86400
|
||||
flush-threshold: 40000
|
||||
stream-batch-size: 2000
|
||||
source-margin-seconds: 120
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.slots:7006}
|
||||
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_slots
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
|
||||
settings:
|
||||
request-service: ${pcp.services.request}
|
||||
earth-grid-service: ${pcp.services.request}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
booked-slots: pcp.slots.status.v1
|
||||
satellites: pcp.satellites
|
||||
|
||||
pcp:
|
||||
booked-slots:
|
||||
timeout-check-interval: 1h
|
||||
timeout-threshold: 1h
|
||||
slot-service:
|
||||
calc:
|
||||
parallelism: 4
|
||||
chunk-duration-seconds: 86400
|
||||
flush-threshold: 20000
|
||||
stream-batch-size: 2000
|
||||
source-margin-seconds: 120
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.slots:8080}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
spring:
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
enabled: true
|
||||
url:
|
||||
- ${pcp.services.admin}
|
||||
auto-registration: true
|
||||
auto-deregistration: true
|
||||
register-once: true
|
||||
instance:
|
||||
service-base-url: ${pcp.services.config}
|
||||
management-base-url: ${pcp.services.config}
|
||||
cloud:
|
||||
config:
|
||||
server:
|
||||
git:
|
||||
uri: ${CONFIG_GIT_URI:}
|
||||
default-label: ${CONFIG_GIT_DEFAULT_LABEL:main}
|
||||
search-paths: ${CONFIG_GIT_SEARCH_PATHS:config-repo}
|
||||
clone-on-start: ${CONFIG_GIT_CLONE_ON_START:false}
|
||||
force-pull: ${CONFIG_GIT_FORCE_PULL:true}
|
||||
timeout: ${CONFIG_GIT_TIMEOUT:10}
|
||||
username: ${CONFIG_GIT_USERNAME:oauth2}
|
||||
password: ${CONFIG_GIT_TOKEN:}
|
||||
skipSslValidation: ${CONFIG_GIT_SKIP_SSL_VALIDATION:false}
|
||||
|
||||
server:
|
||||
port: ${SERVER_PORT:8888}
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,env,refresh
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
logging:
|
||||
level:
|
||||
org.springframework.cloud.config.server: INFO
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: test
|
||||
cloud:
|
||||
config:
|
||||
server:
|
||||
git:
|
||||
uri: https://gitlab.example.invalid/group/config-repo.git
|
||||
clone-on-start: false
|
||||
@@ -0,0 +1,127 @@
|
||||
spring:
|
||||
lifecycle.timeout-per-shutdown-phase: 40s
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
instance:
|
||||
service-base-url: ${pcp.services.tle-monitoring}
|
||||
management-base-url: ${pcp.services.tle-monitoring}
|
||||
codec:
|
||||
max-in-memory-size: 20MB
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
layout: BaseLayout
|
||||
path: /swagger/ui
|
||||
api-docs:
|
||||
enabled: true
|
||||
path: /api-docs
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
|
||||
tle:
|
||||
polling:
|
||||
enabled: false
|
||||
timeout-seconds: 10800
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
info:
|
||||
enabled: true
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: dev
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp
|
||||
auto-offset-reset: earliest
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_tle
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
settings:
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
---
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: local
|
||||
kafka:
|
||||
bootstrap-servers: ${pcp.infra.kafka.host}:${pcp.infra.kafka.port}
|
||||
consumer:
|
||||
group-id: pcp
|
||||
auto-offset-reset: earliest
|
||||
template:
|
||||
default-topic: pcp.tle
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${pcp.infra.postgres.host}:${pcp.infra.postgres.port}/pcp_tle
|
||||
username: postgres
|
||||
password: password
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
jdbc:
|
||||
lob:
|
||||
non_contextual_creation: true
|
||||
flyway:
|
||||
enabled: true
|
||||
baseline-on-migrate: true
|
||||
locations: classpath:db/migration
|
||||
|
||||
app:
|
||||
kafka:
|
||||
topics:
|
||||
satellites: pcp.satellites
|
||||
|
||||
settings:
|
||||
complex-mission-service: ${pcp.services.complex-mission-service}
|
||||
satellite-catalog-service: ${pcp.services.satellite-catalog}
|
||||
|
||||
server:
|
||||
port: ${pcp.ports.tle-monitoring:7001}
|
||||
@@ -0,0 +1,29 @@
|
||||
COMPOSE_PROJECT_NAME=pcp-local
|
||||
|
||||
PCP_IMAGE_TAG=local
|
||||
|
||||
POSTGRES_IMAGE=postgis/postgis:16-3.4
|
||||
KAFKA_IMAGE=apache/kafka:3.7.2
|
||||
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=password
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
KAFKA_PORT=29092
|
||||
CONFIG_SERVER_PORT=38888
|
||||
|
||||
PCP_ADMIN_PORT=7000
|
||||
PCP_TLE_MONITORING_PORT=7001
|
||||
PCP_COMPLEX_MISSION_PORT=7002
|
||||
PCP_BALLISTICS_PORT=7003
|
||||
PCP_REQUEST_PORT=7005
|
||||
PCP_SLOTS_PORT=7006
|
||||
PCP_UI_PORT=7008
|
||||
PCP_STATIONS_PORT=7009
|
||||
PCP_MISSION_PORT=7010
|
||||
PCP_TGU_PORT=7011
|
||||
PCP_COVERAGE_SCHEME_PORT=7012
|
||||
PCP_SATELLITE_CATALOG_PORT=7013
|
||||
PCP_DYNAMIC_PLAN_PORT=7014
|
||||
|
||||
CONFIG_REPO_DIR=./config-repo
|
||||
@@ -0,0 +1,192 @@
|
||||
# PCP local Docker bundle
|
||||
|
||||
Локальный bundle предназначен для запуска PCP на машине с Docker без GitLab Config Repo, Kubernetes и Helm.
|
||||
|
||||
## Состав
|
||||
|
||||
- `docker-compose.yml` - локальная схема запуска.
|
||||
- `.env.example` - пример параметров запуска.
|
||||
- `.env` - создаётся сборочным скриптом в итоговом архиве.
|
||||
- `config-repo/` - локальный Spring Cloud Config repository.
|
||||
- `images/` - Docker images, сохранённые через `docker save`.
|
||||
- `scripts/import-images.sh` - импорт Docker images и запуск базовых сервисов.
|
||||
- `scripts/init-db.sh` - создание баз данных в одном Postgres контейнере.
|
||||
- `scripts/start.sh` - запуск инфраструктуры, config-server и приложений.
|
||||
- `scripts/stop.sh` - остановка compose stack.
|
||||
- `scripts/status.sh` - статус контейнеров.
|
||||
|
||||
## Сборка архива
|
||||
|
||||
Из корня репозитория:
|
||||
|
||||
```bash
|
||||
./deploy/local-bundle/build-local-bundle.sh
|
||||
```
|
||||
|
||||
Можно задать версию:
|
||||
|
||||
```bash
|
||||
LOCAL_BUNDLE_VERSION=1.0.0-local ./deploy/local-bundle/build-local-bundle.sh
|
||||
```
|
||||
|
||||
Результат будет создан в:
|
||||
|
||||
```bash
|
||||
deploy/local-bundle/build/pcp-local-bundle-<version>.tar.gz
|
||||
```
|
||||
|
||||
Скрипт сборки:
|
||||
|
||||
- собирает `bootJar` для разворачиваемых сервисов;
|
||||
- собирает Docker images сервисов;
|
||||
- сохраняет PCP service images в один `images/pcp-services.tar`;
|
||||
- по умолчанию не сохраняет публичные infra images, чтобы не раздувать архив;
|
||||
- копирует `docker-compose.yml`, `config-repo`, scripts и документацию;
|
||||
- формирует итоговый `tar.gz`.
|
||||
|
||||
Публичные images `postgis/postgis` и `apache/kafka` будут скачаны на целевой машине командой `docker compose up`, если их нет локально.
|
||||
|
||||
Если нужен полностью offline bundle, включите сохранение infra images:
|
||||
|
||||
```bash
|
||||
INCLUDE_INFRA_IMAGES=true ./deploy/local-bundle/build-local-bundle.sh
|
||||
```
|
||||
|
||||
По умолчанию сборка `bootJar` выполняется последовательно, чтобы не упираться в heap Kotlin compiler daemon на локальной машине. Параметры можно переопределить:
|
||||
|
||||
```bash
|
||||
GRADLE_MAX_WORKERS=1 \
|
||||
GRADLE_JVMARGS="-Xmx2g -Dfile.encoding=UTF-8" \
|
||||
KOTLIN_DAEMON_JVMARGS="-Xmx3g -XX:MaxMetaspaceSize=768m" \
|
||||
./deploy/local-bundle/build-local-bundle.sh
|
||||
```
|
||||
|
||||
## Запуск на локальной машине
|
||||
|
||||
Распаковать архив:
|
||||
|
||||
```bash
|
||||
tar -xzf pcp-local-bundle-<version>.tar.gz
|
||||
cd pcp-local-bundle-<version>
|
||||
```
|
||||
|
||||
Проверить `.env` и при необходимости изменить порты.
|
||||
|
||||
Импортировать images:
|
||||
|
||||
```bash
|
||||
./scripts/import-images.sh
|
||||
```
|
||||
|
||||
Создать базы данных:
|
||||
|
||||
```bash
|
||||
./scripts/init-db.sh
|
||||
```
|
||||
|
||||
Запустить приложение:
|
||||
|
||||
```bash
|
||||
./scripts/start.sh
|
||||
```
|
||||
|
||||
`start.sh` также запускает `init-db.sh`, если не задано `SKIP_DB_INIT=true`.
|
||||
|
||||
## Остановка и статус
|
||||
|
||||
```bash
|
||||
./scripts/status.sh
|
||||
./scripts/stop.sh
|
||||
```
|
||||
|
||||
Чтобы удалить volumes с данными Postgres/Kafka:
|
||||
|
||||
```bash
|
||||
./scripts/stop.sh -v
|
||||
```
|
||||
|
||||
## Открытые порты
|
||||
|
||||
- Config Server: `http://localhost:38888`
|
||||
- Spring Boot Admin: `http://localhost:7000`
|
||||
- TLE Monitoring: `http://localhost:7001`
|
||||
- Complex Mission: `http://localhost:7002`
|
||||
- Ballistics: `http://localhost:7003`
|
||||
- Request Service: `http://localhost:7005`
|
||||
- Slots Service: `http://localhost:7006`
|
||||
- UI: `http://localhost:7008`
|
||||
- Stations: `http://localhost:7009`
|
||||
- Mission Planning: `http://localhost:7010`
|
||||
- TGU: `http://localhost:7011`
|
||||
- Coverage Scheme: `http://localhost:7012`
|
||||
- Satellite Catalog: `http://localhost:7013`
|
||||
- Dynamic Plan: `http://localhost:7014`
|
||||
- Postgres: `localhost:5432`
|
||||
- Kafka external listener: `localhost:29092`
|
||||
|
||||
## Проверка готовности
|
||||
|
||||
Config Server:
|
||||
|
||||
```bash
|
||||
curl http://localhost:38888/actuator/health
|
||||
curl http://localhost:38888/pcp-ui-service/local,docker-local
|
||||
```
|
||||
|
||||
UI:
|
||||
|
||||
```bash
|
||||
curl http://localhost:7008/actuator/health
|
||||
```
|
||||
|
||||
Статус контейнеров:
|
||||
|
||||
```bash
|
||||
./scripts/status.sh
|
||||
```
|
||||
|
||||
## Config Server
|
||||
|
||||
В локальном сценарии `spring-cloud-config-server` запускается с:
|
||||
|
||||
```text
|
||||
SPRING_PROFILES_ACTIVE=local
|
||||
CONFIG_NATIVE_SEARCH_LOCATIONS=file:/config-repo
|
||||
```
|
||||
|
||||
`CONFIG_GIT_URI`, GitLab token и `git clone` не используются.
|
||||
|
||||
Сервисы запускаются с профилями:
|
||||
|
||||
```text
|
||||
SPRING_PROFILES_ACTIVE=local,docker-local
|
||||
SPRING_CLOUD_CONFIG_PROFILE=local,docker-local
|
||||
SPRING_CLOUD_CONFIG_LABEL=
|
||||
```
|
||||
|
||||
Профиль `local` сохраняет существующие service-specific настройки, а `docker-local` переопределяет IP-адреса на Docker Compose DNS names:
|
||||
|
||||
- `postgres`
|
||||
- `kafka`
|
||||
- `pcp-ballistics-service`
|
||||
- `slots-service`
|
||||
- остальные service names из `docker-compose.yml`
|
||||
|
||||
## Базы данных
|
||||
|
||||
`scripts/init-db.sh` создаёт только пустые базы данных:
|
||||
|
||||
- `pcp_ballistics`
|
||||
- `pcp_requests`
|
||||
- `pcp_missions`
|
||||
- `pcp_slots`
|
||||
- `pcp_complex_plan`
|
||||
- `pcp_satellite_catalog`
|
||||
- `pcp_stations`
|
||||
- `pcp_tgu`
|
||||
- `pcp_tle`
|
||||
- `pcp_satellites`
|
||||
|
||||
Таблицы, схемы и seed data вручную не создаются. Схемы создаются существующими Flyway migrations внутри сервисов при старте приложений.
|
||||
|
||||
`pcp_satellites` добавлена дополнительно, потому что текущий `config-repo/pcp-complex-mission-service.yaml` использует эту БД для `pcp-complex-mission-service`.
|
||||
Executable
+170
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
repo_root="$(cd "$script_dir/../.." && pwd)"
|
||||
|
||||
version="${LOCAL_BUNDLE_VERSION:-${1:-}}"
|
||||
if [[ -z "$version" ]]; then
|
||||
if git -C "$repo_root" rev-parse --short HEAD >/dev/null 2>&1; then
|
||||
version="$(git -C "$repo_root" rev-parse --short HEAD)"
|
||||
else
|
||||
version="$(date +%Y%m%d%H%M%S)"
|
||||
fi
|
||||
fi
|
||||
|
||||
bundle_name="pcp-local-bundle-$version"
|
||||
build_dir="$script_dir/build"
|
||||
dist_dir="$build_dir/$bundle_name"
|
||||
docker_contexts_dir="$build_dir/docker-contexts"
|
||||
archive_path="$build_dir/$bundle_name.tar.gz"
|
||||
|
||||
service_names=(
|
||||
spring-cloud-config-server
|
||||
pcp-srpring-boot-admin-server
|
||||
pcp-satellite-catalog-service
|
||||
pcp-ballistics-service
|
||||
pcp-request-service
|
||||
slots-service
|
||||
pcp-complex-mission-service
|
||||
pcp-mission-planing-service
|
||||
pcp-coverage-scheme-service
|
||||
pcp-dynamic-plan-service
|
||||
pcp-stations-service
|
||||
pcp-ui-service
|
||||
tle-monitoring-service
|
||||
pcp-tgu-service
|
||||
)
|
||||
|
||||
gradle_max_workers="${GRADLE_MAX_WORKERS:-1}"
|
||||
gradle_jvmargs="${GRADLE_JVMARGS:--Xmx2g -Dfile.encoding=UTF-8}"
|
||||
kotlin_daemon_jvmargs="${KOTLIN_DAEMON_JVMARGS:--Xmx3g -XX:MaxMetaspaceSize=768m}"
|
||||
include_infra_images="${INCLUDE_INFRA_IMAGES:-false}"
|
||||
|
||||
gradle_common_args=(
|
||||
"--no-parallel"
|
||||
"--max-workers=$gradle_max_workers"
|
||||
"-Dorg.gradle.jvmargs=$gradle_jvmargs"
|
||||
"-Pkotlin.daemon.jvmargs=$kotlin_daemon_jvmargs"
|
||||
)
|
||||
|
||||
infra_images=(
|
||||
"${POSTGRES_IMAGE:-postgis/postgis:16-3.4}"
|
||||
"${KAFKA_IMAGE:-apache/kafka:3.7.2}"
|
||||
)
|
||||
|
||||
sanitize_image_name() {
|
||||
printf '%s' "$1" | sed 's#[/:@]#-#g'
|
||||
}
|
||||
|
||||
copy_single_boot_jar() {
|
||||
local service_name="$1"
|
||||
local context_dir="$2"
|
||||
local jar_count
|
||||
local jar_file
|
||||
|
||||
jar_count="$(
|
||||
find "$repo_root/services/$service_name/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | wc -l
|
||||
)"
|
||||
|
||||
if [[ "$jar_count" != "1" ]]; then
|
||||
echo "Expected exactly one bootJar for $service_name, found $jar_count:" >&2
|
||||
find "$repo_root/services/$service_name/build/libs" -maxdepth 1 -type f -name '*.jar' -print >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jar_file="$(
|
||||
find "$repo_root/services/$service_name/build/libs" -maxdepth 1 -type f -name '*.jar' ! -name '*-plain.jar' | head -n 1
|
||||
)"
|
||||
|
||||
mkdir -p "$context_dir/build/libs"
|
||||
cp "$repo_root/services/$service_name/Dockerfile" "$context_dir/Dockerfile"
|
||||
cp "$jar_file" "$context_dir/build/libs/app.jar"
|
||||
}
|
||||
|
||||
copy_config_repo() {
|
||||
local target_dir="$1"
|
||||
local source_file
|
||||
|
||||
mkdir -p "$target_dir"
|
||||
(
|
||||
cd "$repo_root/config-repo"
|
||||
find . -type f \
|
||||
! -path './build/*' \
|
||||
! -path './.gradle/*' \
|
||||
! -name '*.log' \
|
||||
! -name '*.tmp' \
|
||||
-print0
|
||||
) | while IFS= read -r -d '' source_file; do
|
||||
mkdir -p "$target_dir/$(dirname "$source_file")"
|
||||
cp "$repo_root/config-repo/$source_file" "$target_dir/$source_file"
|
||||
done
|
||||
}
|
||||
|
||||
require_command() {
|
||||
local command_name="$1"
|
||||
if ! command -v "$command_name" >/dev/null 2>&1; then
|
||||
echo "$command_name is required." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
require_command docker
|
||||
require_command tar
|
||||
|
||||
echo "Building bootJar artifacts..."
|
||||
echo "Gradle max workers: $gradle_max_workers"
|
||||
echo "Gradle JVM args: $gradle_jvmargs"
|
||||
echo "Kotlin daemon JVM args: $kotlin_daemon_jvmargs"
|
||||
for service_name in "${service_names[@]}"; do
|
||||
echo "Building bootJar for $service_name..."
|
||||
"$repo_root/gradlew" "${gradle_common_args[@]}" ":services:$service_name:bootJar"
|
||||
done
|
||||
|
||||
rm -rf "$dist_dir" "$docker_contexts_dir" "$archive_path"
|
||||
mkdir -p "$dist_dir/images" "$docker_contexts_dir"
|
||||
|
||||
echo "Building service Docker images..."
|
||||
service_images=()
|
||||
for service_name in "${service_names[@]}"; do
|
||||
image_name="pcp/$service_name:$version"
|
||||
context_dir="$docker_contexts_dir/$service_name"
|
||||
|
||||
copy_single_boot_jar "$service_name" "$context_dir"
|
||||
docker build --file "$context_dir/Dockerfile" --tag "$image_name" "$context_dir"
|
||||
service_images+=("$image_name")
|
||||
done
|
||||
|
||||
echo "Saving service Docker images into one archive..."
|
||||
docker save --output "$dist_dir/images/pcp-services.tar" "${service_images[@]}"
|
||||
|
||||
if [[ "$include_infra_images" == "true" ]]; then
|
||||
echo "Pulling and saving infrastructure images..."
|
||||
for image_name in "${infra_images[@]}"; do
|
||||
image_file="$(sanitize_image_name "$image_name").tar"
|
||||
docker pull "$image_name"
|
||||
docker save --output "$dist_dir/images/$image_file" "$image_name"
|
||||
done
|
||||
else
|
||||
echo "Skipping public infrastructure images. They will be pulled by docker compose on the target machine."
|
||||
printf '%s\n' "${infra_images[@]}" > "$dist_dir/images/public-images.txt"
|
||||
fi
|
||||
|
||||
echo "Preparing bundle files..."
|
||||
cp "$script_dir/docker-compose.yml" "$dist_dir/docker-compose.yml"
|
||||
cp "$script_dir/.env.example" "$dist_dir/.env.example"
|
||||
cp "$script_dir/.env.example" "$dist_dir/.env"
|
||||
sed -i "s/^PCP_IMAGE_TAG=.*/PCP_IMAGE_TAG=$version/" "$dist_dir/.env"
|
||||
cp "$script_dir/README-local.md" "$dist_dir/README-local.md"
|
||||
cp -R "$script_dir/scripts" "$dist_dir/scripts"
|
||||
copy_config_repo "$dist_dir/config-repo"
|
||||
|
||||
find "$dist_dir/scripts" -type f -name '*.sh' -exec chmod +x {} +
|
||||
|
||||
echo "Creating archive..."
|
||||
tar -C "$build_dir" -czf "$archive_path" "$bundle_name"
|
||||
|
||||
echo "Local bundle created: $archive_path"
|
||||
echo "Bundle version: $version"
|
||||
echo "To use: tar -xzf $archive_path && cd $bundle_name"
|
||||
@@ -0,0 +1,187 @@
|
||||
name: ${COMPOSE_PROJECT_NAME:-pcp-local}
|
||||
|
||||
x-pcp-service-env: &pcp-service-env
|
||||
CONFIG_SERVER_URI: http://spring-cloud-config-server:8888
|
||||
CONFIG_SERVER_FAIL_FAST: "true"
|
||||
SPRING_PROFILES_ACTIVE: local,docker-local
|
||||
SPRING_CLOUD_CONFIG_PROFILE: local,docker-local
|
||||
SPRING_CLOUD_CONFIG_LABEL: ""
|
||||
SPRING_KAFKA_ADMIN_AUTO_CREATE: "true"
|
||||
SPRING_KAFKA_LISTENER_AUTO_STARTUP: "true"
|
||||
|
||||
x-pcp-service-common: &pcp-service-common
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
spring-cloud-config-server:
|
||||
condition: service_started
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: ${POSTGRES_IMAGE:-postgis/postgis:16-3.4}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- "${POSTGRES_PORT:-5432}:5432"
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d postgres"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
|
||||
kafka:
|
||||
image: ${KAFKA_IMAGE:-apache/kafka:3.7.2}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
KAFKA_NODE_ID: "1"
|
||||
KAFKA_PROCESS_ROLES: broker,controller
|
||||
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
|
||||
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:29092
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,EXTERNAL://localhost:${KAFKA_PORT:-29092}
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT
|
||||
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
||||
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "1"
|
||||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: "1"
|
||||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: "1"
|
||||
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: "0"
|
||||
KAFKA_LOG_DIRS: /var/lib/kafka/data
|
||||
ports:
|
||||
- "${KAFKA_PORT:-29092}:29092"
|
||||
volumes:
|
||||
- kafka-data:/var/lib/kafka/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server kafka:9092 --list >/dev/null 2>&1"]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 30
|
||||
|
||||
spring-cloud-config-server:
|
||||
image: pcp/spring-cloud-config-server:${PCP_IMAGE_TAG:-local}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
kafka:
|
||||
condition: service_started
|
||||
environment:
|
||||
SPRING_PROFILES_ACTIVE: local
|
||||
CONFIG_NATIVE_SEARCH_LOCATIONS: file:/config-repo
|
||||
SERVER_PORT: 8888
|
||||
ports:
|
||||
- "${CONFIG_SERVER_PORT:-38888}:8888"
|
||||
volumes:
|
||||
- ${CONFIG_REPO_DIR:-./config-repo}:/config-repo:ro
|
||||
|
||||
pcp-srpring-boot-admin-server:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-srpring-boot-admin-server:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_ADMIN_PORT:-7000}:7000"
|
||||
|
||||
tle-monitoring-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/tle-monitoring-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_TLE_MONITORING_PORT:-7001}:7001"
|
||||
|
||||
pcp-complex-mission-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-complex-mission-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_COMPLEX_MISSION_PORT:-7002}:7002"
|
||||
|
||||
pcp-ballistics-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-ballistics-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_BALLISTICS_PORT:-7003}:7003"
|
||||
|
||||
pcp-request-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-request-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_REQUEST_PORT:-7005}:7005"
|
||||
|
||||
slots-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/slots-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_SLOTS_PORT:-7006}:7006"
|
||||
|
||||
pcp-ui-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-ui-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_UI_PORT:-7008}:7008"
|
||||
|
||||
pcp-stations-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-stations-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_STATIONS_PORT:-7009}:7009"
|
||||
|
||||
pcp-mission-planing-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-mission-planing-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_MISSION_PORT:-7010}:7010"
|
||||
|
||||
pcp-tgu-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-tgu-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_TGU_PORT:-7011}:7011"
|
||||
|
||||
pcp-coverage-scheme-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-coverage-scheme-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_COVERAGE_SCHEME_PORT:-7012}:7012"
|
||||
|
||||
pcp-satellite-catalog-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-satellite-catalog-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_SATELLITE_CATALOG_PORT:-7013}:7013"
|
||||
|
||||
pcp-dynamic-plan-service:
|
||||
<<: *pcp-service-common
|
||||
image: pcp/pcp-dynamic-plan-service:${PCP_IMAGE_TAG:-local}
|
||||
environment:
|
||||
<<: *pcp-service-env
|
||||
ports:
|
||||
- "${PCP_DYNAMIC_PLAN_PORT:-7014}:7014"
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
kafka-data:
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bundle_dir="$(cd "$script_dir/.." && pwd)"
|
||||
images_dir="$bundle_dir/images"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose "$@"
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
docker-compose "$@"
|
||||
else
|
||||
echo "docker compose or docker-compose is required." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_env_file() {
|
||||
if [[ ! -f "$bundle_dir/.env" && -f "$bundle_dir/.env.example" ]]; then
|
||||
cp "$bundle_dir/.env.example" "$bundle_dir/.env"
|
||||
echo "Created .env from .env.example"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_env_file
|
||||
|
||||
if [[ ! -d "$images_dir" ]]; then
|
||||
echo "Images directory not found: $images_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shopt -s nullglob
|
||||
image_archives=("$images_dir"/*.tar)
|
||||
if (( ${#image_archives[@]} == 0 )); then
|
||||
echo "No Docker image archives found in $images_dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for image_archive in "${image_archives[@]}"; do
|
||||
echo "Loading image: $(basename "$image_archive")"
|
||||
docker load -i "$image_archive"
|
||||
done
|
||||
|
||||
if [[ -f "$images_dir/public-images.txt" ]]; then
|
||||
echo "Public images are not bundled and will be pulled by docker compose if missing:"
|
||||
sed 's/^/ - /' "$images_dir/public-images.txt"
|
||||
fi
|
||||
|
||||
cd "$bundle_dir"
|
||||
echo "Starting postgres, kafka and spring-cloud-config-server..."
|
||||
compose up -d postgres kafka spring-cloud-config-server
|
||||
|
||||
echo "Images imported and base services requested."
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bundle_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose "$@"
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
docker-compose "$@"
|
||||
else
|
||||
echo "docker compose or docker-compose is required." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_env_file() {
|
||||
if [[ ! -f "$bundle_dir/.env" && -f "$bundle_dir/.env.example" ]]; then
|
||||
cp "$bundle_dir/.env.example" "$bundle_dir/.env"
|
||||
echo "Created .env from .env.example"
|
||||
fi
|
||||
}
|
||||
|
||||
load_env() {
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source "$bundle_dir/.env"
|
||||
set +a
|
||||
}
|
||||
|
||||
wait_for_postgres() {
|
||||
local attempt
|
||||
for attempt in {1..60}; do
|
||||
if compose exec -T postgres pg_isready -U "${POSTGRES_USER:-postgres}" -d postgres >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "Postgres is not ready after 120 seconds." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
create_database_if_missing() {
|
||||
local db_name="$1"
|
||||
local exists
|
||||
|
||||
exists="$(
|
||||
compose exec -T postgres psql -U "${POSTGRES_USER:-postgres}" -d postgres -tAc \
|
||||
"SELECT 1 FROM pg_database WHERE datname = '$db_name'" | tr -d '[:space:]'
|
||||
)"
|
||||
|
||||
if [[ "$exists" == "1" ]]; then
|
||||
echo "Database already exists: $db_name"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Creating database: $db_name"
|
||||
compose exec -T postgres createdb -U "${POSTGRES_USER:-postgres}" "$db_name"
|
||||
}
|
||||
|
||||
databases=(
|
||||
pcp_ballistics
|
||||
pcp_requests
|
||||
pcp_missions
|
||||
pcp_slots
|
||||
pcp_complex_plan
|
||||
pcp_satellite_catalog
|
||||
pcp_stations
|
||||
pcp_tgu
|
||||
pcp_tle
|
||||
pcp_satellites
|
||||
)
|
||||
|
||||
ensure_env_file
|
||||
load_env
|
||||
|
||||
cd "$bundle_dir"
|
||||
compose up -d postgres
|
||||
wait_for_postgres
|
||||
|
||||
for db_name in "${databases[@]}"; do
|
||||
create_database_if_missing "$db_name"
|
||||
done
|
||||
|
||||
echo "Database initialization completed. Tables are left to service Flyway migrations."
|
||||
echo "No schema objects or seed data were created by this script."
|
||||
Executable
+112
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bundle_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose "$@"
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
docker-compose "$@"
|
||||
else
|
||||
echo "docker compose or docker-compose is required." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_env_file() {
|
||||
if [[ ! -f "$bundle_dir/.env" && -f "$bundle_dir/.env.example" ]]; then
|
||||
cp "$bundle_dir/.env.example" "$bundle_dir/.env"
|
||||
echo "Created .env from .env.example"
|
||||
fi
|
||||
}
|
||||
|
||||
load_env() {
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source "$bundle_dir/.env"
|
||||
set +a
|
||||
}
|
||||
|
||||
http_get() {
|
||||
local url="$1"
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsS "$url" >/dev/null
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -q -O /dev/null "$url"
|
||||
else
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_http() {
|
||||
local name="$1"
|
||||
local url="$2"
|
||||
local attempt
|
||||
|
||||
for attempt in {1..90}; do
|
||||
if http_get "$url"; then
|
||||
echo "$name is ready: $url"
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "$name is not ready after 180 seconds: $url" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
wait_for_kafka() {
|
||||
local attempt
|
||||
for attempt in {1..60}; do
|
||||
if compose exec -T kafka kafka-topics.sh --bootstrap-server kafka:9092 --list >/dev/null 2>&1; then
|
||||
echo "Kafka is ready."
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "Kafka is not ready after 120 seconds." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
app_services=(
|
||||
pcp-srpring-boot-admin-server
|
||||
pcp-satellite-catalog-service
|
||||
pcp-ballistics-service
|
||||
pcp-request-service
|
||||
slots-service
|
||||
pcp-complex-mission-service
|
||||
pcp-mission-planing-service
|
||||
pcp-coverage-scheme-service
|
||||
pcp-dynamic-plan-service
|
||||
pcp-stations-service
|
||||
pcp-ui-service
|
||||
tle-monitoring-service
|
||||
pcp-tgu-service
|
||||
)
|
||||
|
||||
ensure_env_file
|
||||
load_env
|
||||
|
||||
cd "$bundle_dir"
|
||||
|
||||
echo "Starting infrastructure..."
|
||||
compose up -d postgres kafka
|
||||
wait_for_kafka
|
||||
|
||||
if [[ "${SKIP_DB_INIT:-false}" != "true" ]]; then
|
||||
"$script_dir/init-db.sh"
|
||||
fi
|
||||
|
||||
echo "Starting spring-cloud-config-server..."
|
||||
compose up -d spring-cloud-config-server
|
||||
wait_for_http "spring-cloud-config-server" "http://localhost:${CONFIG_SERVER_PORT:-38888}/actuator/health"
|
||||
|
||||
echo "Starting application services..."
|
||||
compose up -d "${app_services[@]}"
|
||||
|
||||
echo "Application startup requested."
|
||||
compose ps
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bundle_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose "$@"
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
docker-compose "$@"
|
||||
else
|
||||
echo "docker compose or docker-compose is required." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
cd "$bundle_dir"
|
||||
compose ps
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bundle_dir="$(cd "$script_dir/.." && pwd)"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
docker compose "$@"
|
||||
elif command -v docker-compose >/dev/null 2>&1; then
|
||||
docker-compose "$@"
|
||||
else
|
||||
echo "docker compose or docker-compose is required." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
cd "$bundle_dir"
|
||||
compose down "$@"
|
||||
@@ -0,0 +1,136 @@
|
||||
# GitLab CI/CD for `pcp-ballistics-service`
|
||||
|
||||
This document describes the pilot GitLab CI/CD setup for `pcp-ballistics-service`.
|
||||
It is intentionally scoped to one service so the same structure can be reused later for other services in this monorepo.
|
||||
|
||||
## Pipeline behavior
|
||||
|
||||
The root pipeline is defined in [.gitlab-ci.yml](/home/emelianovan/WORK/Kotlin/pcp/.gitlab-ci.yml) and includes the service-specific jobs from [.gitlab/ci/pcp-ballistics-service.yml](/home/emelianovan/WORK/Kotlin/pcp/.gitlab/ci/pcp-ballistics-service.yml).
|
||||
|
||||
Pipeline creation is limited by `workflow: rules`:
|
||||
|
||||
- merge request: create a pipeline only when `pcp-ballistics-service` or its dependencies changed
|
||||
- push to `dev`: create a pipeline only when `pcp-ballistics-service` or its dependencies changed
|
||||
- push to `master`: create a pipeline only when `pcp-ballistics-service` or its dependencies changed
|
||||
|
||||
No deploy jobs are created for merge requests.
|
||||
|
||||
## Jobs
|
||||
|
||||
The pilot flow has four stages:
|
||||
|
||||
1. `ballistics:test`
|
||||
Runs `:services:pcp-ballistics-service:test` outside Docker.
|
||||
Publishes JUnit and HTML/JaCoCo reports.
|
||||
|
||||
2. `ballistics:build`
|
||||
Runs `:services:pcp-ballistics-service:bootJar` outside Docker.
|
||||
Publishes `build/libs/*.jar` as an artifact.
|
||||
|
||||
3. `ballistics:image`
|
||||
Builds and pushes the Docker image with Kaniko using the jar artifact from the previous stage.
|
||||
Tags:
|
||||
- `${CI_COMMIT_SHORT_SHA}`
|
||||
- `${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}`
|
||||
|
||||
4. deploy jobs
|
||||
- `ballistics:deploy:dev`
|
||||
- `ballistics:deploy:master`
|
||||
|
||||
Both are manual and use Helm:
|
||||
`helm upgrade --install --wait --atomic --timeout`.
|
||||
|
||||
## Branch behavior
|
||||
|
||||
### `dev`
|
||||
|
||||
Push to `dev`:
|
||||
|
||||
- runs test, build and image jobs
|
||||
- exposes a manual deploy button to the `dev` environment
|
||||
|
||||
### `master`
|
||||
|
||||
Push to `master`:
|
||||
|
||||
- runs test, build and image jobs
|
||||
- exposes a manual deploy button to the `master` environment
|
||||
|
||||
### merge request
|
||||
|
||||
Merge request pipeline:
|
||||
|
||||
- runs test and build only
|
||||
- does not create deploy jobs
|
||||
|
||||
## `rules:changes` scope
|
||||
|
||||
The pilot dependency map for `pcp-ballistics-service` includes:
|
||||
|
||||
- `services/pcp-ballistics-service/**/*`
|
||||
- `libs/pcp-types-lib/**/*`
|
||||
- `libs/ballistics-lib/**/*`
|
||||
- `config-repo/pcp-ballistics-service.yaml`
|
||||
- `config-repo/application*.yaml`
|
||||
- Gradle root files and wrapper
|
||||
- CI files
|
||||
- `charts/pcp-ballistics-service/**/*`
|
||||
|
||||
This is the pattern to reuse later for other services: service directory + direct shared libraries + service config + CI/Helm files.
|
||||
|
||||
## Helm deploy model
|
||||
|
||||
The chart lives in [charts/pcp-ballistics-service](/home/emelianovan/WORK/Kotlin/pcp/charts/pcp-ballistics-service).
|
||||
|
||||
The deployment model is kubeconfig-based, not GitLab Agent-based.
|
||||
This keeps the pilot setup simple and practical. A later migration to GitLab Agent is still possible because deploy logic is already isolated in dedicated jobs.
|
||||
|
||||
## Required GitLab CI/CD variables
|
||||
|
||||
Registry auth uses standard GitLab registry variables:
|
||||
|
||||
- `CI_REGISTRY`
|
||||
- `CI_REGISTRY_USER`
|
||||
- `CI_REGISTRY_PASSWORD`
|
||||
|
||||
Deploy jobs require:
|
||||
|
||||
- `BALLISTICS_KUBE_CONFIG_DEV`
|
||||
- `BALLISTICS_KUBE_NAMESPACE_DEV`
|
||||
- `BALLISTICS_CONFIG_SERVER_URI_DEV`
|
||||
- `BALLISTICS_KUBE_CONTEXT_DEV` optional
|
||||
- `BALLISTICS_CONFIG_LABEL_DEV` optional, defaults to `master`
|
||||
- `BALLISTICS_SPRING_PROFILE_DEV` optional, defaults to `dev`
|
||||
|
||||
- `BALLISTICS_KUBE_CONFIG_MASTER`
|
||||
- `BALLISTICS_KUBE_NAMESPACE_MASTER`
|
||||
- `BALLISTICS_CONFIG_SERVER_URI_MASTER`
|
||||
- `BALLISTICS_KUBE_CONTEXT_MASTER` optional
|
||||
- `BALLISTICS_CONFIG_LABEL_MASTER` optional, defaults to `master`
|
||||
- `BALLISTICS_SPRING_PROFILE_MASTER` optional, defaults to `dev`
|
||||
|
||||
`BALLISTICS_KUBE_CONFIG_*` must contain base64-encoded kubeconfig content.
|
||||
|
||||
## Config server and Vault
|
||||
|
||||
Runtime secrets are not duplicated in GitLab CI.
|
||||
|
||||
The Helm chart only passes bootstrap parameters needed by Spring Cloud Config:
|
||||
|
||||
- `CONFIG_SERVER_URI`
|
||||
- `SPRING_PROFILES_ACTIVE`
|
||||
- `SPRING_CLOUD_CONFIG_LABEL`
|
||||
- `CONFIG_SERVER_FAIL_FAST`
|
||||
|
||||
`pcp-ballistics-service` continues to obtain runtime configuration and secrets through `spring-cloud-config-server` and Vault at runtime.
|
||||
|
||||
## How to scale this to other services
|
||||
|
||||
To onboard another service later:
|
||||
|
||||
1. create a dedicated `.gitlab/ci/<service>.yml`
|
||||
2. define that service's `rules:changes`
|
||||
3. add a dedicated Helm chart
|
||||
4. keep the same stage structure:
|
||||
`test -> build -> image -> manual deploy`
|
||||
5. keep config-service/Vault integration at runtime, without copying secrets into GitLab
|
||||
@@ -0,0 +1,103 @@
|
||||
# CHECKLIST.md
|
||||
|
||||
## Назначение
|
||||
|
||||
Этот документ содержит краткие checklists для review/merge, Definition of Done, обязательных тестов и validation.
|
||||
|
||||
Пункты ниже применяются по принципу **where relevant**:
|
||||
- для обычных Kotlin/Spring-изменений достаточно общего checklist;
|
||||
- для изменений в BPM / Zeebe / Camunda / Kafka / retries / DLQ / compensation / schema evolution дополнительно применяются профильные пункты;
|
||||
- для критичных процессов глубина проверок и тестов должна быть пропорциональна риску изменения.
|
||||
|
||||
---
|
||||
|
||||
## Review checklist
|
||||
|
||||
### Для всех нетривиальных изменений
|
||||
|
||||
Перед merge необходимо подтвердить:
|
||||
- запрошенное поведение реализовано;
|
||||
- решение осталось в корректной архитектурной границе;
|
||||
- существующие публичные контракты не сломаны без явного запроса;
|
||||
- добавлены или обновлены релевантные тесты;
|
||||
- не внесено несвязанных правок;
|
||||
- validation выполнен по правилам `AGENTS.md`, либо пропуски явно объяснены.
|
||||
|
||||
### Дополнительно для BPM / Kafka / Zeebe / external integration изменений
|
||||
|
||||
Перед merge необходимо подтвердить, где это релевантно:
|
||||
- business key определён и используется консистентно;
|
||||
- operation id принимается от вызывающей стороны и используется для dedup;
|
||||
- ошибки классифицированы семантически;
|
||||
- side effects идемпотентны или явно компенсируются;
|
||||
- доменные события публикуются через Outbox;
|
||||
- logs / metrics / traces содержат обязательные поля корреляции;
|
||||
- тесты покрывают duplicate delivery и retry behavior;
|
||||
- изменения деплоя и конфигурации трассируемы в VCS.
|
||||
|
||||
---
|
||||
|
||||
## Definition of Done
|
||||
|
||||
Задача считается завершённой только если одновременно выполнено всё ниже, где это релевантно:
|
||||
|
||||
### Общее
|
||||
1. Запрошенное поведение реализовано.
|
||||
2. Решение осталось в корректной архитектурной границе.
|
||||
3. Нужные тесты добавлены или обновлены.
|
||||
4. Нужный validation выполнен, либо невозможность запуска объяснена.
|
||||
5. Не внесено несвязанных правок.
|
||||
|
||||
### Для BPM / Kafka / Zeebe / external integration
|
||||
6. BPM остаётся только оркестратором, если BPM участвует.
|
||||
7. Доменные правила остаются внутри сервисной границы.
|
||||
8. Flows остаются безопасными при at-least-once delivery.
|
||||
9. Идемпотентность обеспечена.
|
||||
10. `operation_id` сохранён или добавлен, где это требуется контрактом.
|
||||
11. Outbox сохранён или использован, где операция меняет состояние и публикует события.
|
||||
12. Retries ограничены и управляемы.
|
||||
13. DLQ handling сохранён для критичных consumers.
|
||||
14. Versioning / backward compatibility сохранены.
|
||||
15. Observability сохранена или улучшена.
|
||||
|
||||
---
|
||||
|
||||
## Обязательные тесты для значимых изменений
|
||||
|
||||
### Базовый минимум
|
||||
Как минимум покрывать, где применимо:
|
||||
- happy path;
|
||||
- изменённые ветки branching / validation logic;
|
||||
- regression scenario для bug fix.
|
||||
|
||||
### Дополнительно для BPM / Kafka / Zeebe / external integration
|
||||
Покрывать, где применимо:
|
||||
- retryable failure с последующим успехом;
|
||||
- исчерпание retries;
|
||||
- ветку business error;
|
||||
- обработку timeout;
|
||||
- сценарий compensation;
|
||||
- duplicate delivery / duplicate event handling;
|
||||
- contract compatibility;
|
||||
- schema compatibility.
|
||||
|
||||
### Для критичных процессов и high-risk изменений
|
||||
Покрывать пропорционально риску изменения через automated tests и/или явный resilience test plan:
|
||||
- перезапуск воркера во время выполнения;
|
||||
- временную недоступность БД;
|
||||
- временную недоступность внешней зависимости;
|
||||
- разрыв связности Kafka / BPM;
|
||||
- сценарий load / lag recovery.
|
||||
|
||||
---
|
||||
|
||||
## Validation
|
||||
|
||||
Следуй разделу `Validation commands` из `AGENTS.md`.
|
||||
|
||||
Если для изменения есть module-specific команды, используй минимальный релевантный прогон, а затем более широкий, когда это необходимо.
|
||||
|
||||
Если какая-либо команда не была запущена:
|
||||
- точно укажи, какая именно команда не запускалась;
|
||||
- объясни почему;
|
||||
- опиши остаточный риск.
|
||||
@@ -0,0 +1,303 @@
|
||||
# PLATFORM_STANDARD.md
|
||||
|
||||
## Назначение
|
||||
|
||||
Этот документ задаёт платформенные требования для сервисов, работающих в BPM / Kafka / Zeebe-среде.
|
||||
|
||||
Документ определяет:
|
||||
- архитектурные инварианты;
|
||||
- требования к идемпотентности и надёжности;
|
||||
- правила BPM / Kafka интеграции;
|
||||
- требования к observability, compatibility, retry / DLQ, compensation и rollout safety.
|
||||
|
||||
Это **внутренний платформенный стандарт**. Некоторые правила ниже являются осознанной инженерной политикой команды и не должны трактоваться как универсальная истина для всей отрасли.
|
||||
|
||||
---
|
||||
|
||||
## Архитектурные инварианты
|
||||
|
||||
- BPM — только оркестратор процесса.
|
||||
- Доменное состояние и бизнес-правила принадлежат сервису, а не BPM.
|
||||
- BPM не должен использоваться как master data store для доменных данных.
|
||||
- BPM может хранить только идентификаторы, ссылки и технические метаданные, необходимые для оркестрации.
|
||||
- Везде предполагается at-least-once доставка. Повторная доставка — норма, а не исключение.
|
||||
- Exactly-once не предполагается; корректность достигается через идемпотентность, dedup, Outbox и управляемые retries.
|
||||
- Каждый обработчик обязан быть идемпотентным.
|
||||
|
||||
---
|
||||
|
||||
## Правила использования BPM
|
||||
|
||||
- BPM использовать только для операторских / регламентных процессов и long-running orchestration.
|
||||
- Не использовать BPM для высокочастотных near-real-time streaming-потоков.
|
||||
- Каждый BPM service task должен представлять ровно одну атомарную доменную операцию.
|
||||
- Логика ожидания, таймаутов, ретраев, эскалаций и компенсаций должна моделироваться явно в BPM, а не быть скрыта внутри сервиса.
|
||||
- BPMN flow не должен становиться местом владения бизнес-логикой.
|
||||
|
||||
---
|
||||
|
||||
## Camunda 8 / Zeebe
|
||||
|
||||
### Граница интеграции
|
||||
|
||||
- BPM-to-service-task интеграция должна идти через Zeebe gRPC Job Worker.
|
||||
- Для нашей платформы использование REST connector для service task считается **не рекомендуемым и по умолчанию запрещённым**, если нет отдельного архитектурного согласования.
|
||||
- Нельзя изменять `jobType`, пока существуют активные инстансы процесса.
|
||||
|
||||
### Обязательные поля корреляции
|
||||
|
||||
Каждый service task обязан принимать / обрабатывать:
|
||||
- `businessKey`
|
||||
- `operationId`
|
||||
- `correlationId`
|
||||
- `processInstanceKey`
|
||||
- `traceId` или `traceparent`
|
||||
|
||||
### Контракт воркера
|
||||
|
||||
Для каждого Zeebe worker:
|
||||
- читать входные данные только из process / job variables;
|
||||
- валидировать обязательные поля корреляции до начала обработки;
|
||||
- проверять dedup store по `operationId` до выполнения side effects;
|
||||
- возвращать семантические результаты:
|
||||
- `SUCCESS` -> `CompleteJob`
|
||||
- `RETRYABLE_ERROR` -> `FailJob` с retry / backoff
|
||||
- `BUSINESS_ERROR` -> `ThrowError`
|
||||
- `FATAL_ERROR` -> ветка инцидента или обработка через исчерпание retries
|
||||
- никогда не генерировать `operationId` внутри сервиса для входящих оркестрируемых вызовов;
|
||||
- вызывать `CompleteJob` только после commit доменной транзакции.
|
||||
|
||||
---
|
||||
|
||||
## Идемпотентность
|
||||
|
||||
Все операции, вызываемые из BPM, и все Kafka consumers обязаны быть идемпотентными.
|
||||
|
||||
Обязательные правила:
|
||||
- `operationId` должен приходить от вызывающей стороны / оркестратора;
|
||||
- dedup storage должен обеспечивать atomic check-and-write semantics;
|
||||
- dedup storage должен защищать от race conditions;
|
||||
- повторный вызов с тем же `operationId` должен возвращать тот же семантический результат и не должен повторять side effects;
|
||||
- для записей dedup должен быть документирован TTL в соответствии с бизнес-окном возможного повтора;
|
||||
- non-atomic реализация идемпотентности запрещена.
|
||||
|
||||
Дополнительное обязательное правило:
|
||||
- повторный вызов с тем же `operationId`, но с другим `businessKey` или семантически иным payload / параметрами, считается конфликтом контракта, а не валидным retry; такой случай должен приводить к явной ошибке / инциденту и быть достаточно залогирован для расследования.
|
||||
|
||||
Рекомендуемая реализация:
|
||||
- таблица в доменной БД, например `idempotency_keys(operation_id, business_key, status, result_hash, created_at)`.
|
||||
|
||||
---
|
||||
|
||||
## Порядок транзакции и публикации событий
|
||||
|
||||
Когда операция изменяет доменное состояние и публикует события:
|
||||
|
||||
1. Выполнить доменную операцию.
|
||||
2. Записать событие(я) в outbox в рамках той же транзакции.
|
||||
3. Сделать commit транзакции.
|
||||
4. Только после этого подтверждать BPM (`CompleteJob`) или внешний success.
|
||||
|
||||
Публикация событий вне Outbox запрещена.
|
||||
|
||||
Это правило одинаково применяется к:
|
||||
- синхронным сервисным операциям;
|
||||
- Zeebe workers;
|
||||
- Kafka consumers, которые меняют состояние и публикуют новые события.
|
||||
|
||||
---
|
||||
|
||||
## Process variables
|
||||
|
||||
- Process variables должны быть минимальными.
|
||||
- Хранить только ID, ссылки, routing data и небольшие технические метаданные.
|
||||
- Не хранить файлы, большие JSON payload, большие массивы в process variables.
|
||||
- Большие payload должны храниться в доменной БД или object storage; в process variables должны храниться только ссылки.
|
||||
- Process variables должны быть версионированы и документированы.
|
||||
- Для long-running процессов изменения набора или формы variables должны оставаться совместимыми с уже запущенными инстансами, либо сопровождаться явной migration strategy.
|
||||
- Для нашей платформы безопасным внутренним ориентиром считается бюджет **50–100 KB на один process instance**. Это не технический максимум платформы, а engineering guardrail для управляемости и надёжности процессов.
|
||||
|
||||
---
|
||||
|
||||
## Семантика результатов
|
||||
|
||||
Каждая операция должна возвращать семантическую классификацию результата, а не только transport status codes.
|
||||
|
||||
Допустимые классы результатов:
|
||||
- `SUCCESS`
|
||||
- `RETRYABLE_ERROR`
|
||||
- `BUSINESS_ERROR`
|
||||
- `FATAL_ERROR`
|
||||
|
||||
Каждая long-running операция должна иметь:
|
||||
- явно заданный SLA / timeout;
|
||||
- async processing model, где это нужно;
|
||||
- status lookup по `operationId`;
|
||||
- определённое поведение cancel, если отмена поддерживается.
|
||||
|
||||
---
|
||||
|
||||
## Kafka / event-driven
|
||||
|
||||
### Базовые правила
|
||||
|
||||
- Базовое предположение по доставке — at-least-once.
|
||||
- Consumers должны быть идемпотентными по `event_id` и / или `operation_id`.
|
||||
- Нельзя размещать бизнес-логику напрямую в consumer / listener классах.
|
||||
- Consumers / listeners должны делегировать в application / domain services.
|
||||
- Сохранять текущую retry / DLQ-стратегию, если явно не запрошено её изменение.
|
||||
|
||||
### Семантика `event_id` и `operation_id`
|
||||
|
||||
- `event_id` используется для dedup повторной доставки **одного и того же опубликованного события**.
|
||||
- `operation_id` используется для dedup повторного выполнения **одной и той же бизнес-операции**, если этот идентификатор протягивается через события и обработчики.
|
||||
- Если в сообщении присутствуют оба идентификатора, обработчик обязан явно понимать и документировать, какой из них используется для какой семантики dedup.
|
||||
|
||||
### Контракты событий
|
||||
|
||||
Требования ниже относятся прежде всего к **domain events**. Для технических, retry, DLQ, compacted state и других служебных топиков может использоваться отдельная документированная конвенция.
|
||||
|
||||
Для domain events:
|
||||
- именование топиков должно следовать шаблону `<domain>.<entity>.<event>.v<major>`;
|
||||
- partition key должен сохранять порядок событий по одной сущности через `business_key`;
|
||||
- каждое событие должно содержать как минимум:
|
||||
- `event_id`
|
||||
- `event_type`
|
||||
- `event_version`
|
||||
- `occurred_at`
|
||||
- `producer`
|
||||
- `business_key`
|
||||
- `correlation_id`
|
||||
- `trace_id`, если доступен
|
||||
- `process_instance_id`, если применимо
|
||||
- предпочтительны Avro / Protobuf со Schema Registry;
|
||||
- строго валидируемая JSON Schema допустима только если это согласовано платформой.
|
||||
|
||||
### Что нельзя менять без явного запроса
|
||||
|
||||
- topic names
|
||||
- event schema
|
||||
- key semantics
|
||||
- partition assumptions
|
||||
- serialization format
|
||||
- retry topology
|
||||
- DLQ routing rules
|
||||
|
||||
---
|
||||
|
||||
## Schema evolution и совместимость
|
||||
|
||||
- Breaking changes требуют новой major-версии.
|
||||
- Добавление optional fields с default значениями допустимо.
|
||||
- Удаление или переименование полей требует новой major-версии.
|
||||
- По умолчанию consumers должны оставаться совместимыми как минимум с текущей схемой и согласованной политикой совместимости платформы. Если для конкретного домена зафиксировано правило поддержки текущей и предыдущей minor-версии, оно должно быть явно указано в контракте этого домена.
|
||||
|
||||
Для BPM, messaging и public APIs:
|
||||
- сохранять backward compatibility, если явно не запрошен breaking change;
|
||||
- учитывать rolling deployment compatibility;
|
||||
- учитывать coexistence старых и новых consumers;
|
||||
- избегать изменений, требующих lockstep deployment, если это явно не запрошено.
|
||||
|
||||
---
|
||||
|
||||
## Retry / DLQ
|
||||
|
||||
Retries должны быть управляемыми и конечными.
|
||||
|
||||
Рекомендуемая политика:
|
||||
- `RETRYABLE_ERROR`: ограниченные retries с exponential backoff и jitter
|
||||
- `BUSINESS_ERROR`: никаких слепых retries; отправка в operator handling / parking lot / DLQ
|
||||
- `FATAL_ERROR`: никаких слепых retries; создание инцидента и маршрутизация в DLQ, где применимо
|
||||
|
||||
Обязательные правила:
|
||||
- бесконечные retries запрещены;
|
||||
- отключение DLQ для критичных consumer flows запрещено;
|
||||
- replay из DLQ без установленной причины запрещён;
|
||||
- Zeebe retries и Kafka retries должны рассматриваться как два независимых контура управления.
|
||||
|
||||
---
|
||||
|
||||
## Compensation
|
||||
|
||||
Если операция имеет side effects, должно быть явно определено одно из следующего:
|
||||
- compensating operation;
|
||||
- явное указание, что компенсация невозможна;
|
||||
- ветка operator / manual remediation.
|
||||
|
||||
Компенсация должна быть:
|
||||
- идемпотентной;
|
||||
- детерминированной;
|
||||
- семантически классифицированной;
|
||||
- залогированной с `businessKey`, `operationId`, причиной и результатом.
|
||||
|
||||
---
|
||||
|
||||
## Observability
|
||||
|
||||
Структурированные JSON-логи обязательны.
|
||||
|
||||
Каждый log / event / span должен содержать, где применимо:
|
||||
- `correlation_id`
|
||||
- `trace_id`
|
||||
- `process_instance_id`
|
||||
- `business_key`
|
||||
- `operation_id`
|
||||
- `service_name`
|
||||
- `env`
|
||||
|
||||
Обязательная телеметрия:
|
||||
- latency (`p50/p95/p99`)
|
||||
- error rate по семантическим классам
|
||||
- retry rate / attempts histogram
|
||||
- active process instances / stuck instances
|
||||
- consumer lag / DLQ rate
|
||||
- compensation rate
|
||||
|
||||
Трассировка:
|
||||
- OpenTelemetry обязателен
|
||||
- каждый шаг процесса должен создавать span
|
||||
- span attributes должны содержать `process_instance_id`, `business_key`, `operation_id`, `step_name`
|
||||
|
||||
Если меняется Kafka / BPM / external integration logic:
|
||||
- сохранить или добавить correlation identifiers;
|
||||
- сохранить или добавить `operation_id`, где это релевантно;
|
||||
- логировать достаточно для дебага retries, duplicates и compensations;
|
||||
- никогда не логировать секреты или sensitive payloads.
|
||||
|
||||
---
|
||||
|
||||
## Backpressure и runtime load
|
||||
|
||||
- Воркеры должны явно ограничивать `maxJobsActive` и concurrency.
|
||||
- Нельзя использовать рост timeout или retry как механизм масштабирования.
|
||||
- Backpressure должен управляться через масштабирование воркеров и управление пропускной способностью.
|
||||
- Предположения о throughput воркеров должны быть документированы.
|
||||
- CPU / RAM saturation должна наблюдаться и иметь алерты.
|
||||
|
||||
---
|
||||
|
||||
## Безопасность и аудит
|
||||
|
||||
- Сервисы должны поддерживать JWT / OAuth2 там, где это применимо.
|
||||
- Административные операции должны быть защищены role-based или attribute-based access control.
|
||||
- Секреты нельзя хранить в репозитории.
|
||||
- Административные действия, такие как retry / cancel / compensate / migrate, должны быть аудитируемыми.
|
||||
|
||||
---
|
||||
|
||||
## CI / CD и production safety
|
||||
|
||||
Минимально обязательные гейты **для изменений, где это релевантно**:
|
||||
- unit tests
|
||||
- coverage threshold
|
||||
- static analysis
|
||||
- API compatibility checks
|
||||
- schema compatibility checks
|
||||
- BPM + worker integration tests
|
||||
- resilience tests для поведения timeout / retry / DLQ
|
||||
|
||||
Правила деплоя:
|
||||
- деплой BPMN только через pipeline;
|
||||
- деплой воркеров только через pipeline;
|
||||
- ручной деплой BPMN в production запрещён;
|
||||
- критичные изменения retry / timeout / jobType не должны вноситься только через UI без трассируемости в VCS.
|
||||
@@ -0,0 +1,38 @@
|
||||
# VERSION: 0.0.3
|
||||
|
||||
### Versions ###
|
||||
versions.java=17
|
||||
# plugins
|
||||
versions_kotlin=2.2.20
|
||||
versions_spring_boot=4.0.2
|
||||
versions_spring_dependency=1.1.7
|
||||
versions_docker_remote_api=9.4.0
|
||||
versions_sonarqube=5.1.0.4882
|
||||
versions_buildtools=0.9.28
|
||||
# libraries
|
||||
versions.spring.cloud=2025.1.1
|
||||
versions.testcontainers=1.18.1
|
||||
versions.otel=1.12.1
|
||||
versions.lombok=1.18.36
|
||||
versions.hibernate.spatial=6.5.1.Final
|
||||
versions.camunda=8.4.15
|
||||
versions.open-api=3.0.1
|
||||
versions.spring.boot.admin=4.0.1
|
||||
|
||||
# without spring
|
||||
versions.jackson_databind=2.18.2
|
||||
versions.logback=1.5.13
|
||||
versions.slf4j=2.0.16
|
||||
versions.junit=5.11.4
|
||||
versions.mockito=5.14.2
|
||||
|
||||
|
||||
versions.classgraph=4.8.168
|
||||
|
||||
### Dependencies ###
|
||||
dep.spring.actuator=org.springframework.boot:spring-boot-starter-actuator
|
||||
dep.lombok=org.projectlombok:lombok:${versions.lombok}
|
||||
|
||||
### Settings ###
|
||||
sonar.qualitygate.wait=true
|
||||
sonar.host.url=https://qube.nstest.local
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
networkTimeout=60000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: pcp-ballistics-service
|
||||
description: Pilot Helm chart for deploying pcp-ballistics-service from GitLab CI/CD.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- define "pcp-ballistics-service.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-ballistics-service.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- include "pcp-ballistics-service.name" . | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-ballistics-service.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "pcp-ballistics-service.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-ballistics-service.serviceBaseUrl" -}}
|
||||
{{- if .Values.app.serviceBaseUrl -}}
|
||||
{{- .Values.app.serviceBaseUrl -}}
|
||||
{{- else if and .Values.ingress.enabled .Values.ingress.host -}}
|
||||
{{- $scheme := .Values.app.serviceBaseUrlScheme | default (ternary "https" "http" (gt (len .Values.ingress.tls) 0)) -}}
|
||||
{{- printf "%s://%s" $scheme .Values.ingress.host -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-ballistics-service.managementBaseUrl" -}}
|
||||
{{- if .Values.app.managementBaseUrl -}}
|
||||
{{- .Values.app.managementBaseUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "http://%s:%v" (include "pcp-ballistics-service.fullname" .) .Values.service.port -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-ballistics-service.healthUrl" -}}
|
||||
{{- if .Values.app.healthUrl -}}
|
||||
{{- .Values.app.healthUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/actuator/health" (include "pcp-ballistics-service.managementBaseUrl" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,89 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "pcp-ballistics-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-ballistics-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "pcp-ballistics-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "pcp-ballistics-service.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range . }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "pcp-ballistics-service.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: {{ .Values.app.profile | quote }}
|
||||
- name: CONFIG_SERVER_URI
|
||||
value: {{ .Values.app.configServerUri | quote }}
|
||||
- name: SPRING_CLOUD_CONFIG_LABEL
|
||||
value: {{ .Values.app.configLabel | quote }}
|
||||
- name: CONFIG_SERVER_FAIL_FAST
|
||||
value: {{ .Values.app.configServerFailFast | quote }}
|
||||
{{- if .Values.app.adminClientUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_URL
|
||||
value: {{ .Values.app.adminClientUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $serviceBaseUrl := include "pcp-ballistics-service.serviceBaseUrl" . }}
|
||||
{{- if $serviceBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_BASE_URL
|
||||
value: {{ $serviceBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.app.servicePath }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_PATH
|
||||
value: {{ .Values.app.servicePath | quote }}
|
||||
{{- end }}
|
||||
{{- $managementBaseUrl := include "pcp-ballistics-service.managementBaseUrl" . }}
|
||||
{{- if $managementBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_MANAGEMENT_BASE_URL
|
||||
value: {{ $managementBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $healthUrl := include "pcp-ballistics-service.healthUrl" . }}
|
||||
{{- if $healthUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_HEALTH_URL
|
||||
value: {{ $healthUrl | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 40
|
||||
periodSeconds: 20
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "pcp-ballistics-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-ballistics-service.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ .Values.ingress.path | quote }}
|
||||
pathType: {{ .Values.ingress.pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "pcp-ballistics-service.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.service.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "pcp-ballistics-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-ballistics-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "pcp-ballistics-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,11 @@
|
||||
app:
|
||||
profile: dev
|
||||
configLabel: dev
|
||||
adminClientUrl: "http://pcp-spring-boot-admin-server:38889"
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-ballistics-service.dev.k8s.264.nstart.cloud
|
||||
@@ -0,0 +1,10 @@
|
||||
app:
|
||||
profile: master
|
||||
configLabel: master
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-ballistics-service.master.k8s.264.nstart.cloud
|
||||
@@ -0,0 +1,48 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: registry.example.com/pcp/pcp-ballistics-service
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: []
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
app:
|
||||
profile: master
|
||||
configServerUri: "http://spring-cloud-config-server:38888"
|
||||
configServerFailFast: "true"
|
||||
configLabel: master
|
||||
adminClientUrl: ""
|
||||
serviceBaseUrl: ""
|
||||
serviceBaseUrlScheme: ""
|
||||
servicePath: "/swagger/ui"
|
||||
managementBaseUrl: ""
|
||||
healthUrl: ""
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
host: ""
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
extraEnv: []
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "250m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: "4Gi"
|
||||
|
||||
podAnnotations: {}
|
||||
podLabels: {}
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: pcp-complex-mission-service
|
||||
description: Helm chart for deploying pcp-complex-mission-service from GitLab CI/CD.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- define "pcp-complex-mission-service.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-complex-mission-service.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- include "pcp-complex-mission-service.name" . | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-complex-mission-service.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "pcp-complex-mission-service.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-complex-mission-service.serviceBaseUrl" -}}
|
||||
{{- if .Values.app.serviceBaseUrl -}}
|
||||
{{- .Values.app.serviceBaseUrl -}}
|
||||
{{- else if and .Values.ingress.enabled .Values.ingress.host -}}
|
||||
{{- $scheme := .Values.app.serviceBaseUrlScheme | default (ternary "https" "http" (gt (len .Values.ingress.tls) 0)) -}}
|
||||
{{- printf "%s://%s" $scheme .Values.ingress.host -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-complex-mission-service.managementBaseUrl" -}}
|
||||
{{- if .Values.app.managementBaseUrl -}}
|
||||
{{- .Values.app.managementBaseUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "http://%s:%v" (include "pcp-complex-mission-service.fullname" .) .Values.service.port -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-complex-mission-service.healthUrl" -}}
|
||||
{{- if .Values.app.healthUrl -}}
|
||||
{{- .Values.app.healthUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/actuator/health" (include "pcp-complex-mission-service.managementBaseUrl" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,89 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "pcp-complex-mission-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-complex-mission-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "pcp-complex-mission-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "pcp-complex-mission-service.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range . }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "pcp-complex-mission-service.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: {{ .Values.app.profile | quote }}
|
||||
- name: CONFIG_SERVER_URI
|
||||
value: {{ .Values.app.configServerUri | quote }}
|
||||
- name: SPRING_CLOUD_CONFIG_LABEL
|
||||
value: {{ .Values.app.configLabel | quote }}
|
||||
- name: CONFIG_SERVER_FAIL_FAST
|
||||
value: {{ .Values.app.configServerFailFast | quote }}
|
||||
{{- if .Values.app.adminClientUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_URL
|
||||
value: {{ .Values.app.adminClientUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $serviceBaseUrl := include "pcp-complex-mission-service.serviceBaseUrl" . }}
|
||||
{{- if $serviceBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_BASE_URL
|
||||
value: {{ $serviceBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.app.servicePath }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_PATH
|
||||
value: {{ .Values.app.servicePath | quote }}
|
||||
{{- end }}
|
||||
{{- $managementBaseUrl := include "pcp-complex-mission-service.managementBaseUrl" . }}
|
||||
{{- if $managementBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_MANAGEMENT_BASE_URL
|
||||
value: {{ $managementBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $healthUrl := include "pcp-complex-mission-service.healthUrl" . }}
|
||||
{{- if $healthUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_HEALTH_URL
|
||||
value: {{ $healthUrl | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 40
|
||||
periodSeconds: 20
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "pcp-complex-mission-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-complex-mission-service.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ .Values.ingress.path | quote }}
|
||||
pathType: {{ .Values.ingress.pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "pcp-complex-mission-service.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.service.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "pcp-complex-mission-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-complex-mission-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "pcp-complex-mission-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,11 @@
|
||||
app:
|
||||
profile: dev
|
||||
configLabel: dev
|
||||
adminClientUrl: "http://pcp-spring-boot-admin-server:38889"
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-complex-mission-service.dev.k8s.264.nstart.cloud
|
||||
@@ -0,0 +1,10 @@
|
||||
app:
|
||||
profile: master
|
||||
configLabel: master
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-complex-mission-service.master.k8s.264.nstart.cloud
|
||||
@@ -0,0 +1,48 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: registry.example.com/pcp/pcp-complex-mission-service
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: []
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
app:
|
||||
profile: master
|
||||
configServerUri: "http://spring-cloud-config-server:38888"
|
||||
configServerFailFast: "true"
|
||||
configLabel: master
|
||||
adminClientUrl: ""
|
||||
serviceBaseUrl: ""
|
||||
serviceBaseUrlScheme: ""
|
||||
servicePath: "/swagger/ui"
|
||||
managementBaseUrl: ""
|
||||
healthUrl: ""
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
host: ""
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
extraEnv: []
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
memory: "2Gi"
|
||||
limits:
|
||||
cpu: "4"
|
||||
memory: "4Gi"
|
||||
|
||||
podAnnotations: {}
|
||||
podLabels: {}
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: pcp-coverage-scheme-service
|
||||
description: Helm chart for deploying pcp-coverage-scheme-service from GitLab CI/CD.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- define "pcp-coverage-scheme-service.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-coverage-scheme-service.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- include "pcp-coverage-scheme-service.name" . | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-coverage-scheme-service.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "pcp-coverage-scheme-service.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-coverage-scheme-service.serviceBaseUrl" -}}
|
||||
{{- if .Values.app.serviceBaseUrl -}}
|
||||
{{- .Values.app.serviceBaseUrl -}}
|
||||
{{- else if and .Values.ingress.enabled .Values.ingress.host -}}
|
||||
{{- $scheme := .Values.app.serviceBaseUrlScheme | default (ternary "https" "http" (gt (len .Values.ingress.tls) 0)) -}}
|
||||
{{- printf "%s://%s" $scheme .Values.ingress.host -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-coverage-scheme-service.managementBaseUrl" -}}
|
||||
{{- if .Values.app.managementBaseUrl -}}
|
||||
{{- .Values.app.managementBaseUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "http://%s:%v" (include "pcp-coverage-scheme-service.fullname" .) .Values.service.port -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-coverage-scheme-service.healthUrl" -}}
|
||||
{{- if .Values.app.healthUrl -}}
|
||||
{{- .Values.app.healthUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/actuator/health" (include "pcp-coverage-scheme-service.managementBaseUrl" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,85 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "pcp-coverage-scheme-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-coverage-scheme-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "pcp-coverage-scheme-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "pcp-coverage-scheme-service.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range . }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "pcp-coverage-scheme-service.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: {{ .Values.app.profile | quote }}
|
||||
- name: CONFIG_SERVER_URI
|
||||
value: {{ .Values.app.configServerUri | quote }}
|
||||
- name: SPRING_CLOUD_CONFIG_LABEL
|
||||
value: {{ .Values.app.configLabel | quote }}
|
||||
- name: CONFIG_SERVER_FAIL_FAST
|
||||
value: {{ .Values.app.configServerFailFast | quote }}
|
||||
{{- if .Values.app.adminClientUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_URL
|
||||
value: {{ .Values.app.adminClientUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $serviceBaseUrl := include "pcp-coverage-scheme-service.serviceBaseUrl" . }}
|
||||
{{- if $serviceBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_BASE_URL
|
||||
value: {{ $serviceBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $managementBaseUrl := include "pcp-coverage-scheme-service.managementBaseUrl" . }}
|
||||
{{- if $managementBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_MANAGEMENT_BASE_URL
|
||||
value: {{ $managementBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $healthUrl := include "pcp-coverage-scheme-service.healthUrl" . }}
|
||||
{{- if $healthUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_HEALTH_URL
|
||||
value: {{ $healthUrl | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 40
|
||||
periodSeconds: 20
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "pcp-coverage-scheme-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-coverage-scheme-service.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ .Values.ingress.path | quote }}
|
||||
pathType: {{ .Values.ingress.pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "pcp-coverage-scheme-service.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.service.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "pcp-coverage-scheme-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-coverage-scheme-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "pcp-coverage-scheme-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,15 @@
|
||||
app:
|
||||
profile: dev
|
||||
configLabel: dev
|
||||
adminClientUrl: "http://pcp-spring-boot-admin-server:38889"
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-coverage-scheme-service.dev.k8s.264.nstart.cloud
|
||||
|
||||
extraEnv:
|
||||
- name: SERVER_PORT
|
||||
value: "8080"
|
||||
@@ -0,0 +1,14 @@
|
||||
app:
|
||||
profile: master
|
||||
configLabel: master
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-coverage-scheme-service.master.k8s.264.nstart.cloud
|
||||
|
||||
extraEnv:
|
||||
- name: SERVER_PORT
|
||||
value: "8080"
|
||||
@@ -0,0 +1,47 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: registry.example.com/pcp/pcp-coverage-scheme-service
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: []
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
app:
|
||||
profile: master
|
||||
configServerUri: "http://spring-cloud-config-server:38888"
|
||||
configServerFailFast: "true"
|
||||
configLabel: master
|
||||
adminClientUrl: ""
|
||||
serviceBaseUrl: ""
|
||||
serviceBaseUrlScheme: ""
|
||||
managementBaseUrl: ""
|
||||
healthUrl: ""
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
host: ""
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
extraEnv: []
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: "2Gi"
|
||||
|
||||
podAnnotations: {}
|
||||
podLabels: {}
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: pcp-dynamic-plan-service
|
||||
description: Helm chart for deploying pcp-dynamic-plan-service from GitLab CI/CD.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- define "pcp-dynamic-plan-service.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-dynamic-plan-service.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- include "pcp-dynamic-plan-service.name" . | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-dynamic-plan-service.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "pcp-dynamic-plan-service.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-dynamic-plan-service.serviceBaseUrl" -}}
|
||||
{{- if .Values.app.serviceBaseUrl -}}
|
||||
{{- .Values.app.serviceBaseUrl -}}
|
||||
{{- else if and .Values.ingress.enabled .Values.ingress.host -}}
|
||||
{{- $scheme := .Values.app.serviceBaseUrlScheme | default (ternary "https" "http" (gt (len .Values.ingress.tls) 0)) -}}
|
||||
{{- printf "%s://%s" $scheme .Values.ingress.host -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-dynamic-plan-service.managementBaseUrl" -}}
|
||||
{{- if .Values.app.managementBaseUrl -}}
|
||||
{{- .Values.app.managementBaseUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "http://%s:%v" (include "pcp-dynamic-plan-service.fullname" .) .Values.service.port -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-dynamic-plan-service.healthUrl" -}}
|
||||
{{- if .Values.app.healthUrl -}}
|
||||
{{- .Values.app.healthUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/actuator/health" (include "pcp-dynamic-plan-service.managementBaseUrl" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,89 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "pcp-dynamic-plan-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-dynamic-plan-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "pcp-dynamic-plan-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "pcp-dynamic-plan-service.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range . }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "pcp-dynamic-plan-service.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: {{ .Values.app.profile | quote }}
|
||||
- name: CONFIG_SERVER_URI
|
||||
value: {{ .Values.app.configServerUri | quote }}
|
||||
- name: SPRING_CLOUD_CONFIG_LABEL
|
||||
value: {{ .Values.app.configLabel | quote }}
|
||||
- name: CONFIG_SERVER_FAIL_FAST
|
||||
value: {{ .Values.app.configServerFailFast | quote }}
|
||||
{{- if .Values.app.adminClientUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_URL
|
||||
value: {{ .Values.app.adminClientUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $serviceBaseUrl := include "pcp-dynamic-plan-service.serviceBaseUrl" . }}
|
||||
{{- if $serviceBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_BASE_URL
|
||||
value: {{ $serviceBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.app.servicePath }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_PATH
|
||||
value: {{ .Values.app.servicePath | quote }}
|
||||
{{- end }}
|
||||
{{- $managementBaseUrl := include "pcp-dynamic-plan-service.managementBaseUrl" . }}
|
||||
{{- if $managementBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_MANAGEMENT_BASE_URL
|
||||
value: {{ $managementBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $healthUrl := include "pcp-dynamic-plan-service.healthUrl" . }}
|
||||
{{- if $healthUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_HEALTH_URL
|
||||
value: {{ $healthUrl | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 40
|
||||
periodSeconds: 20
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "pcp-dynamic-plan-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-dynamic-plan-service.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ .Values.ingress.path | quote }}
|
||||
pathType: {{ .Values.ingress.pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "pcp-dynamic-plan-service.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.service.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "pcp-dynamic-plan-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-dynamic-plan-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "pcp-dynamic-plan-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,11 @@
|
||||
app:
|
||||
profile: dev
|
||||
configLabel: dev
|
||||
adminClientUrl: "http://pcp-spring-boot-admin-server:38889"
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-dynamic-plan-service.dev.k8s.264.nstart.cloud
|
||||
@@ -0,0 +1,10 @@
|
||||
app:
|
||||
profile: master
|
||||
configLabel: master
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-dynamic-plan-service.master.k8s.264.nstart.cloud
|
||||
@@ -0,0 +1,48 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: registry.example.com/pcp/pcp-dynamic-plan-service
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: []
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
app:
|
||||
profile: master
|
||||
configServerUri: "http://spring-cloud-config-server:38888"
|
||||
configServerFailFast: "true"
|
||||
configLabel: master
|
||||
adminClientUrl: ""
|
||||
serviceBaseUrl: ""
|
||||
serviceBaseUrlScheme: ""
|
||||
servicePath: "/swagger/ui"
|
||||
managementBaseUrl: ""
|
||||
healthUrl: ""
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
host: ""
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
extraEnv: []
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "250m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: "4Gi"
|
||||
|
||||
podAnnotations: {}
|
||||
podLabels: {}
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: pcp-mission-planing-service
|
||||
description: Helm chart for deploying pcp-mission-planing-service from GitLab CI/CD.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
@@ -0,0 +1,43 @@
|
||||
{{- define "pcp-mission-planing-service.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-mission-planing-service.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- include "pcp-mission-planing-service.name" . | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-mission-planing-service.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "pcp-mission-planing-service.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-mission-planing-service.serviceBaseUrl" -}}
|
||||
{{- if .Values.app.serviceBaseUrl -}}
|
||||
{{- .Values.app.serviceBaseUrl -}}
|
||||
{{- else if and .Values.ingress.enabled .Values.ingress.host -}}
|
||||
{{- $scheme := .Values.app.serviceBaseUrlScheme | default (ternary "https" "http" (gt (len .Values.ingress.tls) 0)) -}}
|
||||
{{- printf "%s://%s" $scheme .Values.ingress.host -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-mission-planing-service.managementBaseUrl" -}}
|
||||
{{- if .Values.app.managementBaseUrl -}}
|
||||
{{- .Values.app.managementBaseUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "http://%s:%v" (include "pcp-mission-planing-service.fullname" .) .Values.service.port -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "pcp-mission-planing-service.healthUrl" -}}
|
||||
{{- if .Values.app.healthUrl -}}
|
||||
{{- .Values.app.healthUrl -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/actuator/health" (include "pcp-mission-planing-service.managementBaseUrl" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,89 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "pcp-mission-planing-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-mission-planing-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "pcp-mission-planing-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "pcp-mission-planing-service.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range . }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "pcp-mission-planing-service.name" . }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: {{ .Values.app.profile | quote }}
|
||||
- name: CONFIG_SERVER_URI
|
||||
value: {{ .Values.app.configServerUri | quote }}
|
||||
- name: SPRING_CLOUD_CONFIG_LABEL
|
||||
value: {{ .Values.app.configLabel | quote }}
|
||||
- name: CONFIG_SERVER_FAIL_FAST
|
||||
value: {{ .Values.app.configServerFailFast | quote }}
|
||||
{{- if .Values.app.adminClientUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_URL
|
||||
value: {{ .Values.app.adminClientUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $serviceBaseUrl := include "pcp-mission-planing-service.serviceBaseUrl" . }}
|
||||
{{- if $serviceBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_BASE_URL
|
||||
value: {{ $serviceBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.app.servicePath }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE_PATH
|
||||
value: {{ .Values.app.servicePath | quote }}
|
||||
{{- end }}
|
||||
{{- $managementBaseUrl := include "pcp-mission-planing-service.managementBaseUrl" . }}
|
||||
{{- if $managementBaseUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_MANAGEMENT_BASE_URL
|
||||
value: {{ $managementBaseUrl | quote }}
|
||||
{{- end }}
|
||||
{{- $healthUrl := include "pcp-mission-planing-service.healthUrl" . }}
|
||||
{{- if $healthUrl }}
|
||||
- name: SPRING_BOOT_ADMIN_CLIENT_INSTANCE_HEALTH_URL
|
||||
value: {{ $healthUrl | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 40
|
||||
periodSeconds: 20
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "pcp-mission-planing-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-mission-planing-service.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ .Values.ingress.path | quote }}
|
||||
pathType: {{ .Values.ingress.pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "pcp-mission-planing-service.fullname" . }}
|
||||
port:
|
||||
number: {{ .Values.service.port }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "pcp-mission-planing-service.fullname" . }}
|
||||
labels:
|
||||
{{- include "pcp-mission-planing-service.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "pcp-mission-planing-service.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,15 @@
|
||||
app:
|
||||
profile: dev
|
||||
configLabel: dev
|
||||
adminClientUrl: "http://pcp-spring-boot-admin-server:38889"
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-mission-planing-service.dev.k8s.264.nstart.cloud
|
||||
|
||||
extraEnv:
|
||||
- name: SERVER_PORT
|
||||
value: "8080"
|
||||
@@ -0,0 +1,14 @@
|
||||
app:
|
||||
profile: master
|
||||
configLabel: master
|
||||
|
||||
service:
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
host: pcp-mission-planing-service.master.k8s.264.nstart.cloud
|
||||
|
||||
extraEnv:
|
||||
- name: SERVER_PORT
|
||||
value: "8080"
|
||||
@@ -0,0 +1,48 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: registry.example.com/pcp/pcp-mission-planing-service
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
pullSecrets: []
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
app:
|
||||
profile: master
|
||||
configServerUri: "http://spring-cloud-config-server:38888"
|
||||
configServerFailFast: "true"
|
||||
configLabel: master
|
||||
adminClientUrl: ""
|
||||
serviceBaseUrl: ""
|
||||
serviceBaseUrlScheme: ""
|
||||
servicePath: "/swagger/ui"
|
||||
managementBaseUrl: ""
|
||||
healthUrl: ""
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
annotations: {}
|
||||
host: ""
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls: []
|
||||
|
||||
extraEnv: []
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: "500m"
|
||||
memory: "1Gi"
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: "2Gi"
|
||||
|
||||
podAnnotations: {}
|
||||
podLabels: {}
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: pcp-request-service
|
||||
description: Helm chart for deploying pcp-request-service from GitLab CI/CD.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user