Loading manifests/contextservice.yaml +5 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ spec: image: context_service:develop imagePullPolicy: Never ports: - containerPort: 7070 - containerPort: 1010 env: - name: DB_ENGINE value: "redis" Loading @@ -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 Loading @@ -49,5 +49,5 @@ spec: app: contextservice ports: - name: grpc port: 7070 targetPort: 7070 port: 1010 targetPort: 1010 manifests/deviceservice.yaml +5 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ spec: image: device:dockerfile imagePullPolicy: Never ports: - containerPort: 7070 - containerPort: 2020 env: - name: DB_ENGINE value: "redis" Loading @@ -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 Loading @@ -49,5 +49,5 @@ spec: app: deviceservice ports: - name: grpc port: 7070 targetPort: 7070 port: 2020 targetPort: 2020 src/context/Config.py +8 −5 Original line number Diff line number Diff line 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 src/device/.gitlab-ci.yml +18 −18 Original line number Diff line number Diff line 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/ Loading @@ -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" Loading @@ -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 Loading @@ -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: Loading @@ -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/** Loading @@ -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: Loading @@ -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 src/device/Config.py +5 −5 Original line number Diff line number Diff line 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 Loading
manifests/contextservice.yaml +5 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ spec: image: context_service:develop imagePullPolicy: Never ports: - containerPort: 7070 - containerPort: 1010 env: - name: DB_ENGINE value: "redis" Loading @@ -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 Loading @@ -49,5 +49,5 @@ spec: app: contextservice ports: - name: grpc port: 7070 targetPort: 7070 port: 1010 targetPort: 1010
manifests/deviceservice.yaml +5 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ spec: image: device:dockerfile imagePullPolicy: Never ports: - containerPort: 7070 - containerPort: 2020 env: - name: DB_ENGINE value: "redis" Loading @@ -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 Loading @@ -49,5 +49,5 @@ spec: app: deviceservice ports: - name: grpc port: 7070 targetPort: 7070 port: 2020 targetPort: 2020
src/context/Config.py +8 −5 Original line number Diff line number Diff line 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
src/device/.gitlab-ci.yml +18 −18 Original line number Diff line number Diff line 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/ Loading @@ -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" Loading @@ -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 Loading @@ -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: Loading @@ -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/** Loading @@ -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: Loading @@ -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
src/device/Config.py +5 −5 Original line number Diff line number Diff line 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