diff --git a/manifests/contextservice.yaml b/manifests/contextservice.yaml index b05c37b4972246e4a1f4697885d48fe8fe209ef1..6675c00aa5ea5de249caed3d78c04355b3463003 100644 --- a/manifests/contextservice.yaml +++ b/manifests/contextservice.yaml @@ -17,7 +17,7 @@ spec: image: context_service:develop imagePullPolicy: Never ports: - - containerPort: 7070 + - containerPort: 1010 env: - name: DB_ENGINE value: "redis" @@ -27,10 +27,10 @@ spec: value: "DEBUG" readinessProbe: exec: - command: ["/bin/grpc_health_probe", "-addr=:7070"] + command: ["/bin/grpc_health_probe", "-addr=:1010"] livenessProbe: exec: - command: ["/bin/grpc_health_probe", "-addr=:7070"] + command: ["/bin/grpc_health_probe", "-addr=:1010"] resources: requests: cpu: 250m @@ -49,5 +49,5 @@ spec: app: contextservice ports: - name: grpc - port: 7070 - targetPort: 7070 + port: 1010 + targetPort: 1010 diff --git a/manifests/deviceservice.yaml b/manifests/deviceservice.yaml index f8f82b1ff4f42ec2cf0902c47c02eec748647246..631ff0cb4115806b2064f434755d728e7e821cc7 100644 --- a/manifests/deviceservice.yaml +++ b/manifests/deviceservice.yaml @@ -17,7 +17,7 @@ spec: image: device:dockerfile imagePullPolicy: Never ports: - - containerPort: 7070 + - containerPort: 2020 env: - name: DB_ENGINE value: "redis" @@ -27,10 +27,10 @@ spec: value: "DEBUG" readinessProbe: exec: - command: ["/bin/grpc_health_probe", "-addr=:7070"] + command: ["/bin/grpc_health_probe", "-addr=:2020"] livenessProbe: exec: - command: ["/bin/grpc_health_probe", "-addr=:7070"] + command: ["/bin/grpc_health_probe", "-addr=:2020"] resources: requests: cpu: 250m @@ -49,5 +49,5 @@ spec: app: deviceservice ports: - name: grpc - port: 7070 - targetPort: 7070 + port: 2020 + targetPort: 2020 diff --git a/src/context/Config.py b/src/context/Config.py index 2f2114d6195e5979ad5db736748616091c087a04..4c53fa59bbb1c2bc27f21a55e77cc022fa1280af 100644 --- a/src/context/Config.py +++ b/src/context/Config.py @@ -1,10 +1,13 @@ import logging # gRPC settings -SERVICE_PORT = 7070 -MAX_WORKERS = 10 -GRACE_PERIOD = 60 -LOG_LEVEL = logging.WARNING +GRPC_SERVICE_PORT = 1010 +GRPC_MAX_WORKERS = 10 +GRPC_GRACE_PERIOD = 60 +GRPC_LOG_LEVEL = logging.WARNING + +# HTTP settings +HTTP_SERVICE_PORT = 8080 # Prometheus settings -METRICS_PORT = 8080 +METRICS_PORT = 9192 diff --git a/src/device/.gitlab-ci.yml b/src/device/.gitlab-ci.yml index 4a36939322e9bc774cd14fb0ade1c46947b71cdd..4311d9a982c831b0336a4955cffb21584cab1fa7 100644 --- a/src/device/.gitlab-ci.yml +++ b/src/device/.gitlab-ci.yml @@ -1,10 +1,10 @@ variables: - IMAGE_NAME: 'context' # name of the microservice - IMAGE_NAME_TEST: 'context-test' # name of the microservice + IMAGE_NAME: 'device' # name of the microservice + IMAGE_NAME_TEST: 'device-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) # build the Docker image -build context: +build device: stage: build script: - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/ @@ -14,7 +14,7 @@ build context: - .gitlab-ci.yml # tags the Docker image -tag context: +tag device: stage: build script: - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" @@ -24,7 +24,7 @@ tag context: - .gitlab-ci.yml # push the Docker image to the gitlab Docker registry -push context: +push device: stage: build before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY @@ -37,10 +37,10 @@ push context: # test if the Docker image can be pulled from the gitlab registry -test context pull: +test device pull: stage: test needs: - - push context + - push device before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: @@ -51,17 +51,17 @@ test context pull: - .gitlab-ci.yml # test if the Docker image can be executed -test context run: +test device run: stage: test needs: - - build context + - build device before_script: - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi script: - - docker run -d -p 1010:1010 --name context --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" + - docker run -d -p 1010:1010 --name device --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker ps > deploy_test_report.txt after_script: - - docker stop context + - docker stop device rules: - changes: - src/$IMAGE_NAME/** @@ -72,11 +72,11 @@ test context run: - deploy_test_report.txt expire_in: 1 day -# apply unit test to the context component -test context pytest: +# apply unit test to the device component +test device pytest: stage: test needs: - - build context + - build device script: - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ > pytest_report.txt rules: @@ -90,11 +90,11 @@ test context pytest: expire_in: 1 day # Deployment of the monitoring service in Kubernetes Cluster -deploy context: +deploy device: stage: deploy needs: - - build context - - test context run + - build device + - test device run script: - - kubectl apply -f "manisfests/contextservice.yaml" + - kubectl apply -f "manisfests/deviceservice.yaml" when: manual diff --git a/src/device/Config.py b/src/device/Config.py index 2f2114d6195e5979ad5db736748616091c087a04..438f831a8314325c0c7211f2e864f619ed783842 100644 --- a/src/device/Config.py +++ b/src/device/Config.py @@ -1,10 +1,10 @@ import logging # gRPC settings -SERVICE_PORT = 7070 -MAX_WORKERS = 10 -GRACE_PERIOD = 60 -LOG_LEVEL = logging.WARNING +GRPC_SERVICE_PORT = 2020 +GRPC_MAX_WORKERS = 10 +GRPC_GRACE_PERIOD = 60 +GRPC_LOG_LEVEL = logging.WARNING # Prometheus settings -METRICS_PORT = 8080 +METRICS_PORT = 9192