From 76806769802ae55eaaf1ac9aade9bd217c630b10 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 13 Apr 2023 16:10:45 +0200 Subject: [PATCH 01/23] initial seed for minio/docker-compose --- .../minio/docker-compose.yml | 75 +++++++++++++ .../high-availability/minio/nginx.conf | 106 ++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 sf-docker/special/high-availability/minio/docker-compose.yml create mode 100644 sf-docker/special/high-availability/minio/nginx.conf diff --git a/sf-docker/special/high-availability/minio/docker-compose.yml b/sf-docker/special/high-availability/minio/docker-compose.yml new file mode 100644 index 00000000..a6ebd250 --- /dev/null +++ b/sf-docker/special/high-availability/minio/docker-compose.yml @@ -0,0 +1,75 @@ +version: '3.7' + +# Settings and configurations that are common for all containers +x-minio-common: &minio-common + image: quay.io/minio/minio:RELEASE.2023-04-13T03-08-07Z + command: server --console-address ":9001" http://minio{1...4}/data{1...2} + expose: + - "9000" + - "9001" + # environment: + # MINIO_ROOT_USER: minioadmin + # MINIO_ROOT_PASSWORD: minioadmin + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + +# starts 4 docker containers running minio server instances. +# using nginx reverse proxy, load balancing, you can access +# it through port 9000. +services: + minio1: + <<: *minio-common + hostname: minio1 + volumes: + - data1-1:/data1 + - data1-2:/data2 + + minio2: + <<: *minio-common + hostname: minio2 + volumes: + - data2-1:/data1 + - data2-2:/data2 + + minio3: + <<: *minio-common + hostname: minio3 + volumes: + - data3-1:/data1 + - data3-2:/data2 + + minio4: + <<: *minio-common + hostname: minio4 + volumes: + - data4-1:/data1 + - data4-2:/data2 + + nginx: + image: nginx:1.19.2-alpine + hostname: nginx + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + ports: + - "9000:9000" + - "9001:9001" + depends_on: + - minio1 + - minio2 + - minio3 + - minio4 + +## By default this config uses default local driver, +## For custom volumes replace with volume driver configuration. +volumes: + data1-1: + data1-2: + data2-1: + data2-2: + data3-1: + data3-2: + data4-1: + data4-2: \ No newline at end of file diff --git a/sf-docker/special/high-availability/minio/nginx.conf b/sf-docker/special/high-availability/minio/nginx.conf new file mode 100644 index 00000000..e8dc198b --- /dev/null +++ b/sf-docker/special/high-availability/minio/nginx.conf @@ -0,0 +1,106 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 4096; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + + # include /etc/nginx/conf.d/*.conf; + + upstream minio { + server minio1:9000; + server minio2:9000; + server minio3:9000; + server minio4:9000; + } + + upstream console { + ip_hash; + server minio1:9001; + server minio2:9001; + server minio3:9001; + server minio4:9001; + } + + server { + listen 9000; + listen [::]:9000; + server_name localhost; + + # To allow special characters in headers + ignore_invalid_headers off; + # Allow any size file to be uploaded. + # Set to a value such as 1000m; to restrict file size to a specific value + client_max_body_size 0; + # To disable buffering + proxy_buffering off; + proxy_request_buffering off; + + location / { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_connect_timeout 300; + # Default is HTTP/1, keepalive is only enabled in HTTP/1.1 + proxy_http_version 1.1; + proxy_set_header Connection ""; + chunked_transfer_encoding off; + + proxy_pass http://minio; + } + } + + server { + listen 9001; + listen [::]:9001; + server_name localhost; + + # To allow special characters in headers + ignore_invalid_headers off; + # Allow any size file to be uploaded. + # Set to a value such as 1000m; to restrict file size to a specific value + client_max_body_size 0; + # To disable buffering + proxy_buffering off; + proxy_request_buffering off; + + location / { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-NginX-Proxy true; + + # This is necessary to pass the correct IP to be hashed + real_ip_header X-Real-IP; + + proxy_connect_timeout 300; + + # To support websocket + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + chunked_transfer_encoding off; + + proxy_pass http://console; + } + } +} \ No newline at end of file From 06a2a9b7dd16685c25debcacf24c2bfa5773e38c Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 20 Apr 2023 13:07:31 +0200 Subject: [PATCH 02/23] WIP --- .../special/high-availability/all-in-one/.env | 47 ++ .../high-availability/all-in-one/.env.sfac | 47 ++ .../all-in-one/.env.sfstation | 96 ++++ .../high-availability/all-in-one/README.md | 9 + .../all-in-one/docker-compose.yml | 525 ++++++++++++++++++ .../high-availability/all-in-one/run.sh | 86 +++ .../sf_dependencies/docker-compose.yml | 90 +++ .../sf_dependencies/etc_rmq/enabled_plugins | 1 + .../sf_dependencies/etc_rmq/rabbitmq.conf | 8 + 9 files changed, 909 insertions(+) create mode 100644 sf-docker/special/high-availability/all-in-one/.env create mode 100644 sf-docker/special/high-availability/all-in-one/.env.sfac create mode 100644 sf-docker/special/high-availability/all-in-one/.env.sfstation create mode 100644 sf-docker/special/high-availability/all-in-one/README.md create mode 100644 sf-docker/special/high-availability/all-in-one/docker-compose.yml create mode 100644 sf-docker/special/high-availability/all-in-one/run.sh create mode 100644 sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml create mode 100644 sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/enabled_plugins create mode 100644 sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf diff --git a/sf-docker/special/high-availability/all-in-one/.env b/sf-docker/special/high-availability/all-in-one/.env new file mode 100644 index 00000000..34a3d414 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/.env @@ -0,0 +1,47 @@ +# RMQ config +RabbitMQ__Hostname=rmq +RabbitMQ__Username=guest +RabbitMQ__Password=guest +RabbitMQ__VirtualHost=/ +RabbitMQ__Port=5672 +RabbitMQ__UseSsl=false + +# Database config +#Database__DbEngine=MsSql +#ConnectionStrings__CoreDbContext=Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;TrustServerCertificate=true; +Database__DbEngine=PgSql +ConnectionStrings__CoreDbContext=Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true; + +# S3 config +S3Bucket__Endpoint=http://sface-demolaptop-2d:9000 +S3Bucket__BucketName=inno-smartface +S3Bucket__AccessKey=minioadmin +S3Bucket__SecretKey=minioadmin + +# Set true when a Jaeger tracing is required +AppSettings__USE_JAEGER_APP_SETTINGS=false + +# Jaeger tracing endpoint. 'jaeger' is the name of included docker container. +# If targeting outside SmartFace docker, change to remote URL +JAEGER_AGENT_HOST=jaeger + +# API config - we use port 80 in docker and forward it as needed +Hosting__Host=http://0.0.0.0 +Hosting__Port=80 + +# we override the default generation of preview ports for camera in favor of static configuration +CameraDefaults__PreviewPort=30000 + +# Using NoSql database +NoSqlDataStorageDisabled=false + +# Using template for Gstreamer pipeline +GstPipelineTemplate=uridecodebin uri={0} source::latency=0 ! queue max-size-buffers=1 leaky=downstream ! nvvideoconvert ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink + +# Registry, must end with a forward slash `/` +REGISTRY=registry.gitlab.com/innovatrics/smartface/ + +# Version +SF_VERSION=v5_4.18.1 +AC_VERSION=v5_1.8.0 +SFS_VERSION=v5_1.15.0 diff --git a/sf-docker/special/high-availability/all-in-one/.env.sfac b/sf-docker/special/high-availability/all-in-one/.env.sfac new file mode 100644 index 00000000..f311821b --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/.env.sfac @@ -0,0 +1,47 @@ +FilterConfiguration__FaceOrderConfiguration__Enabled=false +FilterConfiguration__FaceOrderConfiguration__Order=1 + +FilterConfiguration__OpeningDebounceConfiguration__OpeningDebounceEnabled=true +FilterConfiguration__OpeningDebounceConfiguration__OpeningDebounceMs=4000 + +FilterConfiguration__BlockingDebounceConfiguration__BlockingDebounceEnabled=true +FilterConfiguration__BlockingDebounceConfiguration__BlockingDebounceMs=4000 + +FilterConfiguration__ExclusiveCameraConfiguration__Enabled=true +FilterConfiguration__ExclusiveCameraConfiguration__ExclusivityMs=5000 + +FilterConfiguration__NotIdentifiedPersonConfiguration__Enabled=true +FilterConfiguration__NotIdentifiedPersonConfiguration__RoamingLimitTimeMs=3000 + +FilterConfiguration__BlacklistsConfiguration__Enabled=true +FilterConfiguration__BlacklistsConfiguration__Blacklists__0=firt_black_list_id +FilterConfiguration__BlacklistsConfiguration__Blacklists__1=second_black_list_id +FilterConfiguration__BlacklistsConfiguration__Blacklists__2=third_black_list_id + +FilterConfiguration__FaceMaskConfiguration__Enabled=false +FilterConfiguration__FaceMaskConfiguration__DenyingDebounceMs=4000 + +FilterConfiguration__IntentionalAccessConfiguration__Enabled=false +FilterConfiguration__IntentionalAccessConfiguration__AlwaysOpenForFaceAreaPercentLargerThan=7 +FilterConfiguration__IntentionalAccessConfiguration__RequiredFaceApproachingRatePercent=0.4 + +FilterConfiguration__StreamGroupsConfiguration__Enabled=true +FilterConfiguration__StreamGroupsConfiguration__GroupOpeningDebounceMs=3000 + +FilterConfiguration__SpoofCheckConfiguration__Enabled=false +FilterConfiguration__SpoofCheckConfiguration__DenyingDebounceMs=4000 + +# Set true when a Jaeger tracing is required +AppSettings__0__Key=USE_JAEGER_APP_SETTINGS +AppSettings__0__Value=false + +AppSettings__1__Key=JAEGER_SAMPLER_TYPE +AppSettings__1__Value=const + +AppSettings__2__Key=JAEGER_SAMPLER_PARAM +AppSettings__2__Value=1 + +# Jaeger tracing endpoint. 'jaeger' is the name of included docker container. +# If targeting outside SmartFace docker, change to remote URL +AppSettings__3__Key=JAEGER_AGENT_HOST +AppSettings__3__Value=jaeger \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/.env.sfstation b/sf-docker/special/high-availability/all-in-one/.env.sfstation new file mode 100644 index 00000000..cf0d5ab5 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/.env.sfstation @@ -0,0 +1,96 @@ +# IP address, where SmartFace Station server will bind to +HOST=0.0.0.0 + +# Port number, where SmartFace Station server will bind to +PORT=8000 + +# Full addresses to SmartFace Server APIs +# CORE API example: http://[sf-server-host]:[port]/api/v1 +CORE_API_ROOT=http://SFApi:80/api/v1 + +# ODATA API example: http://[sf-server-host]:[port] +ODATA_API_ROOT=http://SFODataApi:80 + +# ZERO_MQ_HOST example: [sf-server-host] +ZERO_MQ_HOST=SFBase + +# Full address to SmartFace Server GraphQL APIs +GRAPHQL_ROOT=http://SFGraphQLApi:80/graphql + +# example: CAM_PREVIEW_HOST_[camera.serviceName]=[sf-camera-host] +CAM_PREVIEW_HOST_SFCAM1=SFCam1 +CAM_PREVIEW_HOST_SFCAM2=SFCam2 +CAM_PREVIEW_HOST_SFCAM3=SFCam3 +CAM_PREVIEW_HOST_SFCAM4=SFCam4 +CAM_PREVIEW_HOST_SFCAM5=SFCam5 + +# Address to Access Controller gRPC endpoint +# Example: [sf-server-host]:[port] +ACCESS_CONTROLLER_ADDRESS=SFAccessController:80 + +# Comma separated Watchlist IDs used as a global blacklists +BLACKLIST_WATCHLIST_IDS=abcdabcd-abcd-1234-abcd-abcdabcdacd + +# Whether to run with Keycloak authentication server or not +ENABLE_AUTHENTICATION=false + +# Full URL address to Keycloak's users management (if empty no url will be shown in webapp configuration) +KEYCLOAK_ADMIN_URL=http://keycloak-host:8080/auth/admin + +# In case of unauthorize access user will be redirected to provided URL (eg. keycloack login) +# If URL is not provided No access page will be shown +UNAUTHORIZE_ACCESS_REDIRECTION_URL=http://keycloak.login + +# Score to percentage conversion parameters +SCORE_CONVERSION_LOWER_LIMIT=20 +SCORE_CONVERSION_LOWER_LIMIT_PERCENTAGE=30 +SCORE_CONVERSION_UPPER_LIMIT=40 +SCORE_CONVERSION_UPPER_LIMIT_PERCENTAGE=90 + +# DOT camera parameters (HTTPS is required) +DOT_FACE_CAMERA_ENABLED=false +DOT_FACE_CAMERA_FACE_CENTER_LIMIT=0.2 +DOT_FACE_CAMERA_FACE_CONFIDENCE=0.06 + +# Wether to run with HTTPS authentication server or not +HTTPS_ENABLED=false +HTTPS_HOST_NAME= +HTTPS_KEY_FILE=server.key +HTTPS_CERT_FILE=server.cert + +# Setup for S3 / MinIO API +S3_ENDPOINT=http://127.0.0.1:9000 +S3_ACCESS_KEY=minioadmin +S3_SECRET_KEY=minioadmin +S3_REGION=eu-west-1 +S3_BUCKET=inno-smartface +# If we are using s3/minio over https this determine if certificate needs to be valid or not +# for http version of s3/minio needs to be set to false +S3_SKIP_SSL=false +# Presigned URL expiration in seconds +S3_URL_EXPIRATION=300 # 5 minutes +# Create bucket if it doesn't exist already +S3_PRECREATE_BUCKET=true + +# Add optional labels to watclist member (key is used in API requests, label is visual representation of key and used only in station frontend) +# WATCHLIST_MEMBER_KEY_0=date +# WATCHLIST_MEMBER_LABEL_0=Date of birth +# WATCHLIST_MEMBER_KEY_1=tax_number +# WATCHLIST_MEMBER_LABEL_1=Tax number +# WATCHLIST_MEMBER_KEY_2=phone +# WATCHLIST_MEMBER_LABEL_2=Phone number + +# Optional roles are used for locking specified part of frontend for given roles +# Claim name is "Group mapper name" specified in Keycloak or "cognito:groups" in Cognito +# ROLES_CLAIM_NAME=sf_roles +# ROLE_KEY_ADMIN=/admin +# ROLE_KEY_SECURITY_SUPERVISOR=/security_supervisor +# ROLE_KEY_SECURITY_OPERATOR=/security_operator +# ROLE_KEY_ACCESS_SUPERVISOR=/access_supervisor +# ROLE_KEY_ACCESS_OPERATOR=/access_operator +# ROLE_KEY_INVESTIGATION_SUPERVISOR=/investigation_supervisor +# ROLE_KEY_INVESTIGATION_OPERATOR=/investigation_operator +# ROLE_KEY_SECURITY_ADMIN=/security_admin +# ROLE_KEY_ACCESS_ADMIN=/access_admin +# ROLE_KEY_INVESTIGATION_ADMIN=/investigation_admin +# FORCED_ROLE_NAME_0=/admin diff --git a/sf-docker/special/high-availability/all-in-one/README.md b/sf-docker/special/high-availability/all-in-one/README.md new file mode 100644 index 00000000..05619de4 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/README.md @@ -0,0 +1,9 @@ +# SmartFace All-in-One + +## Deployment +1. Install `Docker` and `docker compose` on the host machine. +2. Login to container registry `docker login registry.gitlab.com -u -p `. The credentials are available in our [CRM portal](https://crm.innovatrics.com/). +3. Identify hardware id (hwid) for your machine with command `docker run registry.gitlab.com/innovatrics/smartface/license-manager:3.2.7`. This process work for native linux, for `WSL2` eg. linux containers on Windows you need special license for which you need to contact our sales. +4. Obtain license for your hwid from our CRM https://crm.innovatrics.com/client/products +5. Copy the license file `iengine.lic` to the root of this directory. +6. Run `run.sh` script. The run scripts contain comments which should clarify the steps needed to start everything \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/docker-compose.yml b/sf-docker/special/high-availability/all-in-one/docker-compose.yml new file mode 100644 index 00000000..92c423e8 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/docker-compose.yml @@ -0,0 +1,525 @@ +version: "3.4" +services: + sf-base: + image: ${REGISTRY}sf-base:${SF_VERSION} + container_name: SFBase + command: --serviceName SFBase + ports: + - 2406:2406 + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-group: + image: ${REGISTRY}sf-grouping:${SF_VERSION} + container_name: SFGroup + command: --serviceName SFGroup + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-cam-1: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam1 + command: --serviceName SFCam1 + ports: + - 30001:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-2: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam2 + command: --serviceName SFCam2 + ports: + - 30002:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-3: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam3 + command: --serviceName SFCam3 + ports: + - 30003:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-4: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam4 + command: --serviceName SFCam4 + ports: + - 30004:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-5: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam5 + command: --serviceName SFCam5 + ports: + - 30005:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-nx: + image: ${REGISTRY}sf-cam:${SF_VERSION} + # Guid needs to match ServiceInstallNames.NX_TEST_CAMERA_GUID + container_name: 53b4d78e-323f-4a0f-aa6d-99c464448b6d + command: --serviceName 53b4d78e-323f-4a0f-aa6d-99c464448b6d + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + api: + image: ${REGISTRY}sf-api:${SF_VERSION} + container_name: SFApi + ports: + # we forward the configured ports to default SF ports + - 8098:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + - CameraDefaults__PreviewPort + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-graphql-api: + image: ${REGISTRY}sf-graphql-api:${SF_VERSION} + container_name: SFGraphQLApi + ports: + # we forward the configured ports to default SF ports + - 8097:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - AppSettings__Log_RabbitMq_Enabled + + odata-api: + image: ${REGISTRY}sf-odata-api:${SF_VERSION} + container_name: SFODataApi + ports: + # we forward the configured ports to default SF ports + - 8099:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + detector: + image: ${REGISTRY}sf-detector:${SF_VERSION} + container_name: SFDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + pedestrian-detector: + image: ${REGISTRY}sf-pedestrian-detector:${SF_VERSION} + container_name: SFPedestrianDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + extractor: + image: ${REGISTRY}sf-extractor:${SF_VERSION} + container_name: SFExtractCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + matcher: + image: ${REGISTRY}sf-matcher:${SF_VERSION} + container_name: SFWatchlistMatcher + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + cpuset: "0" + + face-matcher: + image: ${REGISTRY}sf-face-matcher:${SF_VERSION} + container_name: SFFaceMatcher + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + liveness: + image: ${REGISTRY}sf-liveness:${SF_VERSION} + container_name: SFLiveness + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + video-aggregator: + image: ${REGISTRY}sf-video-aggregator:${SF_VERSION} + container_name: SFVideoDataAggregator + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + video-collector: + image: ${REGISTRY}sf-video-collector:${SF_VERSION} + container_name: SFVideoDataCollector + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + video-reader: + image: ${REGISTRY}sf-video-reader:${SF_VERSION} + container_name: SFVideoReader + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + body-parts-detector: + image: ${REGISTRY}sf-body-parts-detector:${SF_VERSION} + container_name: SFBodyPartsDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + edge-stream-processor: + image: ${REGISTRY}sf-edge-stream-processor:${SF_VERSION} + container_name: SFEdgeStreamProcessor + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__Log_RabbitMq_Enabled + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + access-controller: + image: ${REGISTRY}sf-access-controller:${AC_VERSION} + container_name: SFAccessController + ports: + # we forward the configured ports to default SF ports + - 5050:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMq__HostName=${RabbitMQ__Hostname} + - RabbitMq__UserName=${RabbitMQ__Username} + - RabbitMq__Password=${RabbitMQ__Password} + - RabbitMq__Port=${RabbitMQ__Port} + - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} + env_file: .env.sfac + + sf-station: + image: ${REGISTRY}sf-station:${SFS_VERSION} + container_name: SFStation + restart: unless-stopped + ports: + - 8000:8000 + env_file: .env.sfstation + +networks: + default: + external: + name: sf-network diff --git a/sf-docker/special/high-availability/all-in-one/run.sh b/sf-docker/special/high-availability/all-in-one/run.sh new file mode 100644 index 00000000..8195ea35 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/run.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +set -x +set -e + +if [ ! -f iengine.lic ]; then + echo "License file not found. Please make sure that the license file is present in the current directory." >&2 + exit 1 +fi + +COMPOSE_COMMAND="docker compose" + +set +e + +$COMPOSE_COMMAND version + +if [ $? -ne 0 ]; then + COMPOSE_COMMAND="docker-compose" + $COMPOSE_COMMAND version + if [ $? -ne 0 ]; then + echo "No compose command found. Please install docker compose" >&2 + exit 1 + fi +fi + +set -e +# sf-network is used so that sf-dependencies and sf containers can communicate +# this can fail if the network already exists, but we don't mind that +docker network create sf-network || true + +# start dependencies of SF - MsSql, RMQ and minio +$COMPOSE_COMMAND -f sf_dependencies/docker-compose.yml up -d + +# sleep to wait for the dependencies to start up +sleep 10 + +# load version and registry from .env +VERSION=$(grep -E ^SF_VERSION .env | cut -d '=' -f2 | cut -d$'\r' -f1) +REGISTRY=$(grep -E ^REGISTRY .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# we use the DB engine that will be used by SF to create and migrate the DB +# to switch DB engine, change the .env file +DB_ENGINE=$(grep -E ^Database__DbEngine .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# load RabbitMQ properties from .env +RMQ_HOST=$(grep -E ^RabbitMQ__Hostname .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_USER=$(grep -E ^RabbitMQ__Username .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PASS=$(grep -E ^RabbitMQ__Password .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_VHOST=$(grep -E ^RabbitMQ__VirtualHost .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PORT=$(grep -E ^RabbitMQ__Port .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_SSL=$(grep -E ^RabbitMQ__UseSsl .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +S3_ENDPOINT=$(grep -E ^S3Bucket__Endpoint .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_ACCESS=$(grep -E ^S3Bucket__AccessKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_SECRET=$(grep -E ^S3Bucket__SecretKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_BUCKET=$(grep -E ^S3Bucket__BucketName .env | cut -d '=' -f2 | cut -d$'\r' -f1) +# set correct hostname to sfstation env file +sed -i "s/S3_ENDPOINT=.*/S3_ENDPOINT=http:\/\/$(hostname):9000/g" .env.sfstation + +echo $VERSION +echo $REGISTRY + +# create mqtt user for rmq mqtt plugin +docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true +docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true +docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true + +if [[ "$DB_ENGINE" == "MsSql" ]]; then + # create SmartFace database in MsSql + docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Test1234 -Q "CREATE DATABASE SmartFace" || true + # run database migration to current version + docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} +elif [[ "$DB_ENGINE" == "PgSql" ]]; then + # create SmartFace database in PgSql + docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true + # run database migration to current version + docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} +else + echo "Unknown DB engine: ${DB_ENGINE}!" >&2 + exit 1 +fi + +docker run --rm --name s3-bucket-create --network sf-network ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" + +# finally start SF images +$COMPOSE_COMMAND up -d --force-recreate \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml new file mode 100644 index 00000000..b75a91b0 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml @@ -0,0 +1,90 @@ +version: '3' +services: + mssql: + image: "mcr.microsoft.com/mssql/server:2019-latest" + container_name: mssql + ports: + - "1433:1433" + environment: + - ACCEPT_EULA=Y + - SA_PASSWORD=Test1234 + restart: unless-stopped + volumes: + - mssqldata:/var/opt/mssql + #- /var/lib/smartface/mssql:/var/opt/mssql + + pgsql: + image: "postgres:14.3" + container_name: pgsql + ports: + - "5432:5432" + environment: + - POSTGRES_PASSWORD=Test1234 + restart: unless-stopped + volumes: + - pgsqldata:/var/lib/postgresql/data + #- /var/lib/smartface/pgsql:/var/lib/postgresql/data + + pgadmin: + image: "dpage/pgadmin4:6.10" + container_name: pgadmin + environment: + PGADMIN_DEFAULT_EMAIL: admin@admin.com + PGADMIN_DEFAULT_PASSWORD: Test1234 + ports: + - "7070:80" + + rabbitmq: + image: "rabbitmq:3.10.2-management" + container_name: rmq + ports: + - "15672:15672" + - "5672:5672" + - "1883:1883" + environment: + RABBITMQ_NODENAME: rabbit@rmq + RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf + RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins + volumes: + - ./etc_rmq/:/etc/rabbitmq/external + - rmqdata:/var/lib/rabbitmq + restart: unless-stopped + + minio: + image: "minio/minio:RELEASE.2022-06-02T02-11-04Z" + container_name: minio + command: server /data --console-address ":9001" + ports: + - "9000:9000" + - "9001:9001" + restart: unless-stopped + volumes: + - miniodata:/data + #- /var/lib/smartface/miniodata:/data + + # Jaeger tracikng is solely for debug purposes. No data is stored! + jaeger: + image: "jaegertracing/all-in-one:1.35.0" + container_name: jaeger + restart: unless-stopped + command: ["--memory.max-traces=5000"] + ports: + - "5778:5778" + - "16686:16686" + - "14268:14268" + - "14250:14250" + - "9411:9411" + - "5775:5775/udp" + - "6831:6831/udp" + - "6832:6832/udp" + +volumes: + mssqldata: + pgsqldata: + miniodata: + rmqdata: + +networks: + default: + external: + name: sf-network \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/enabled_plugins b/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/enabled_plugins new file mode 100644 index 00000000..e7e3e53c --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/enabled_plugins @@ -0,0 +1 @@ +[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus]. \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf new file mode 100644 index 00000000..020a9cc5 --- /dev/null +++ b/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf @@ -0,0 +1,8 @@ +## Consumer timeout +## If a message delivered to a consumer has not been acknowledge before this timer +## triggers the channel will be force closed by the broker. This ensure that +## faultly consumers that never ack will not hold on to messages indefinitely. +## 6 hours = 21600000 ms +consumer_timeout = 21600000 + +mqtt.allow_anonymous = false \ No newline at end of file From edc2145ed350c2050d2a746cc049233527e8d097 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 20 Apr 2023 13:10:07 +0200 Subject: [PATCH 03/23] WIP --- .../all-in-one/sf_dependencies/docker-compose.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml index b75a91b0..9f507edb 100644 --- a/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml @@ -50,18 +50,6 @@ services: - rmqdata:/var/lib/rabbitmq restart: unless-stopped - minio: - image: "minio/minio:RELEASE.2022-06-02T02-11-04Z" - container_name: minio - command: server /data --console-address ":9001" - ports: - - "9000:9000" - - "9001:9001" - restart: unless-stopped - volumes: - - miniodata:/data - #- /var/lib/smartface/miniodata:/data - # Jaeger tracikng is solely for debug purposes. No data is stored! jaeger: image: "jaegertracing/all-in-one:1.35.0" @@ -81,7 +69,6 @@ services: volumes: mssqldata: pgsqldata: - miniodata: rmqdata: networks: From f7dfbea29b0b68873b9ad1f4662b44e2b3957c14 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 20 Apr 2023 13:18:44 +0200 Subject: [PATCH 04/23] WIP --- sf-docker/special/high-availability/all-in-one/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf-docker/special/high-availability/all-in-one/.env b/sf-docker/special/high-availability/all-in-one/.env index 34a3d414..2117b0c6 100644 --- a/sf-docker/special/high-availability/all-in-one/.env +++ b/sf-docker/special/high-availability/all-in-one/.env @@ -13,7 +13,7 @@ Database__DbEngine=PgSql ConnectionStrings__CoreDbContext=Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true; # S3 config -S3Bucket__Endpoint=http://sface-demolaptop-2d:9000 +S3Bucket__Endpoint=http://minio-proxy:9000 S3Bucket__BucketName=inno-smartface S3Bucket__AccessKey=minioadmin S3Bucket__SecretKey=minioadmin From 4cf64bbcf4b17fec0c6e5982bc6c6377e893a98f Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 10:51:40 +0800 Subject: [PATCH 05/23] WIP --- .../sf_dependencies/docker-compose.yml | 77 --- .../{all-in-one => server1}/.env | 2 +- .../{all-in-one => server1}/.env.sfac | 0 .../{all-in-one => server1}/.env.sfstation | 0 .../{all-in-one => server1}/README.md | 0 .../docker-compose.yml | 0 .../{all-in-one => server1}/run.sh | 0 .../sf_dependencies/docker-compose.yml | 26 + .../sf_dependencies/etc_rmq/enabled_plugins | 0 .../sf_dependencies/etc_rmq/rabbitmq.conf | 7 +- .../special/high-availability/server2/.env | 47 ++ .../high-availability/server2/.env.sfac | 47 ++ .../high-availability/server2/.env.sfstation | 96 ++++ .../high-availability/server2/README.md | 9 + .../server2/docker-compose.yml | 525 ++++++++++++++++++ .../special/high-availability/server2/run.sh | 86 +++ .../sf_dependencies/docker-compose.yml | 26 + .../sf_dependencies/etc_rmq/enabled_plugins | 1 + .../sf_dependencies/etc_rmq/rabbitmq.conf | 13 + 19 files changed, 883 insertions(+), 79 deletions(-) delete mode 100644 sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml rename sf-docker/special/high-availability/{all-in-one => server1}/.env (98%) rename sf-docker/special/high-availability/{all-in-one => server1}/.env.sfac (100%) rename sf-docker/special/high-availability/{all-in-one => server1}/.env.sfstation (100%) rename sf-docker/special/high-availability/{all-in-one => server1}/README.md (100%) rename sf-docker/special/high-availability/{all-in-one => server1}/docker-compose.yml (100%) rename sf-docker/special/high-availability/{all-in-one => server1}/run.sh (100%) create mode 100644 sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml rename sf-docker/special/high-availability/{all-in-one => server1}/sf_dependencies/etc_rmq/enabled_plugins (100%) rename sf-docker/special/high-availability/{all-in-one => server1}/sf_dependencies/etc_rmq/rabbitmq.conf (53%) create mode 100644 sf-docker/special/high-availability/server2/.env create mode 100644 sf-docker/special/high-availability/server2/.env.sfac create mode 100644 sf-docker/special/high-availability/server2/.env.sfstation create mode 100644 sf-docker/special/high-availability/server2/README.md create mode 100644 sf-docker/special/high-availability/server2/docker-compose.yml create mode 100644 sf-docker/special/high-availability/server2/run.sh create mode 100644 sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml create mode 100644 sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins create mode 100644 sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml deleted file mode 100644 index 9f507edb..00000000 --- a/sf-docker/special/high-availability/all-in-one/sf_dependencies/docker-compose.yml +++ /dev/null @@ -1,77 +0,0 @@ -version: '3' -services: - mssql: - image: "mcr.microsoft.com/mssql/server:2019-latest" - container_name: mssql - ports: - - "1433:1433" - environment: - - ACCEPT_EULA=Y - - SA_PASSWORD=Test1234 - restart: unless-stopped - volumes: - - mssqldata:/var/opt/mssql - #- /var/lib/smartface/mssql:/var/opt/mssql - - pgsql: - image: "postgres:14.3" - container_name: pgsql - ports: - - "5432:5432" - environment: - - POSTGRES_PASSWORD=Test1234 - restart: unless-stopped - volumes: - - pgsqldata:/var/lib/postgresql/data - #- /var/lib/smartface/pgsql:/var/lib/postgresql/data - - pgadmin: - image: "dpage/pgadmin4:6.10" - container_name: pgadmin - environment: - PGADMIN_DEFAULT_EMAIL: admin@admin.com - PGADMIN_DEFAULT_PASSWORD: Test1234 - ports: - - "7070:80" - - rabbitmq: - image: "rabbitmq:3.10.2-management" - container_name: rmq - ports: - - "15672:15672" - - "5672:5672" - - "1883:1883" - environment: - RABBITMQ_NODENAME: rabbit@rmq - RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf - RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins - volumes: - - ./etc_rmq/:/etc/rabbitmq/external - - rmqdata:/var/lib/rabbitmq - restart: unless-stopped - - # Jaeger tracikng is solely for debug purposes. No data is stored! - jaeger: - image: "jaegertracing/all-in-one:1.35.0" - container_name: jaeger - restart: unless-stopped - command: ["--memory.max-traces=5000"] - ports: - - "5778:5778" - - "16686:16686" - - "14268:14268" - - "14250:14250" - - "9411:9411" - - "5775:5775/udp" - - "6831:6831/udp" - - "6832:6832/udp" - -volumes: - mssqldata: - pgsqldata: - rmqdata: - -networks: - default: - external: - name: sf-network \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/.env b/sf-docker/special/high-availability/server1/.env similarity index 98% rename from sf-docker/special/high-availability/all-in-one/.env rename to sf-docker/special/high-availability/server1/.env index 2117b0c6..f6a38d0f 100644 --- a/sf-docker/special/high-availability/all-in-one/.env +++ b/sf-docker/special/high-availability/server1/.env @@ -1,5 +1,5 @@ # RMQ config -RabbitMQ__Hostname=rmq +RabbitMQ__Hostname=rmq1 RabbitMQ__Username=guest RabbitMQ__Password=guest RabbitMQ__VirtualHost=/ diff --git a/sf-docker/special/high-availability/all-in-one/.env.sfac b/sf-docker/special/high-availability/server1/.env.sfac similarity index 100% rename from sf-docker/special/high-availability/all-in-one/.env.sfac rename to sf-docker/special/high-availability/server1/.env.sfac diff --git a/sf-docker/special/high-availability/all-in-one/.env.sfstation b/sf-docker/special/high-availability/server1/.env.sfstation similarity index 100% rename from sf-docker/special/high-availability/all-in-one/.env.sfstation rename to sf-docker/special/high-availability/server1/.env.sfstation diff --git a/sf-docker/special/high-availability/all-in-one/README.md b/sf-docker/special/high-availability/server1/README.md similarity index 100% rename from sf-docker/special/high-availability/all-in-one/README.md rename to sf-docker/special/high-availability/server1/README.md diff --git a/sf-docker/special/high-availability/all-in-one/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml similarity index 100% rename from sf-docker/special/high-availability/all-in-one/docker-compose.yml rename to sf-docker/special/high-availability/server1/docker-compose.yml diff --git a/sf-docker/special/high-availability/all-in-one/run.sh b/sf-docker/special/high-availability/server1/run.sh similarity index 100% rename from sf-docker/special/high-availability/all-in-one/run.sh rename to sf-docker/special/high-availability/server1/run.sh diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml new file mode 100644 index 00000000..bb49cac4 --- /dev/null +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' +services: + rmq1: + image: "rabbitmq:3.10.2-management" + container_name: rmq1 + ports: + - "15672:15672" + - "5672:5672" + - "1883:1883" + environment: + RABBITMQ_NODENAME: rabbit@rmq1 + RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf + RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins + RABBITMQ_ERLANG_COOKIE: rabbitcookie + volumes: + - ./etc_rmq/:/etc/rabbitmq/external + - rmqdata:/var/lib/rabbitmq + restart: unless-stopped + +volumes: + rmqdata: + +networks: + default: + external: + name: sf-network \ No newline at end of file diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/enabled_plugins b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/enabled_plugins similarity index 100% rename from sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/enabled_plugins rename to sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/enabled_plugins diff --git a/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf similarity index 53% rename from sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf rename to sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf index 020a9cc5..450b5232 100644 --- a/sf-docker/special/high-availability/all-in-one/sf_dependencies/etc_rmq/rabbitmq.conf +++ b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf @@ -5,4 +5,9 @@ ## 6 hours = 21600000 ms consumer_timeout = 21600000 -mqtt.allow_anonymous = false \ No newline at end of file +mqtt.allow_anonymous = false + +cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config +cluster_formation.classic_config.nodes.1 = rabbit@rmq1 +cluster_formation.classic_config.nodes.2 = rabbit@rmq2 +cluster_formation.classic_config.nodes.3 = rabbit@rmq3 \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/.env b/sf-docker/special/high-availability/server2/.env new file mode 100644 index 00000000..56bbeb69 --- /dev/null +++ b/sf-docker/special/high-availability/server2/.env @@ -0,0 +1,47 @@ +# RMQ config +RabbitMQ__Hostname=rmq2 +RabbitMQ__Username=guest +RabbitMQ__Password=guest +RabbitMQ__VirtualHost=/ +RabbitMQ__Port=5672 +RabbitMQ__UseSsl=false + +# Database config +#Database__DbEngine=MsSql +#ConnectionStrings__CoreDbContext=Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;TrustServerCertificate=true; +Database__DbEngine=PgSql +ConnectionStrings__CoreDbContext=Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true; + +# S3 config +S3Bucket__Endpoint=http://minio-proxy:9000 +S3Bucket__BucketName=inno-smartface +S3Bucket__AccessKey=minioadmin +S3Bucket__SecretKey=minioadmin + +# Set true when a Jaeger tracing is required +AppSettings__USE_JAEGER_APP_SETTINGS=false + +# Jaeger tracing endpoint. 'jaeger' is the name of included docker container. +# If targeting outside SmartFace docker, change to remote URL +JAEGER_AGENT_HOST=jaeger + +# API config - we use port 80 in docker and forward it as needed +Hosting__Host=http://0.0.0.0 +Hosting__Port=80 + +# we override the default generation of preview ports for camera in favor of static configuration +CameraDefaults__PreviewPort=30000 + +# Using NoSql database +NoSqlDataStorageDisabled=false + +# Using template for Gstreamer pipeline +GstPipelineTemplate=uridecodebin uri={0} source::latency=0 ! queue max-size-buffers=1 leaky=downstream ! nvvideoconvert ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink + +# Registry, must end with a forward slash `/` +REGISTRY=registry.gitlab.com/innovatrics/smartface/ + +# Version +SF_VERSION=v5_4.18.1 +AC_VERSION=v5_1.8.0 +SFS_VERSION=v5_1.15.0 diff --git a/sf-docker/special/high-availability/server2/.env.sfac b/sf-docker/special/high-availability/server2/.env.sfac new file mode 100644 index 00000000..f311821b --- /dev/null +++ b/sf-docker/special/high-availability/server2/.env.sfac @@ -0,0 +1,47 @@ +FilterConfiguration__FaceOrderConfiguration__Enabled=false +FilterConfiguration__FaceOrderConfiguration__Order=1 + +FilterConfiguration__OpeningDebounceConfiguration__OpeningDebounceEnabled=true +FilterConfiguration__OpeningDebounceConfiguration__OpeningDebounceMs=4000 + +FilterConfiguration__BlockingDebounceConfiguration__BlockingDebounceEnabled=true +FilterConfiguration__BlockingDebounceConfiguration__BlockingDebounceMs=4000 + +FilterConfiguration__ExclusiveCameraConfiguration__Enabled=true +FilterConfiguration__ExclusiveCameraConfiguration__ExclusivityMs=5000 + +FilterConfiguration__NotIdentifiedPersonConfiguration__Enabled=true +FilterConfiguration__NotIdentifiedPersonConfiguration__RoamingLimitTimeMs=3000 + +FilterConfiguration__BlacklistsConfiguration__Enabled=true +FilterConfiguration__BlacklistsConfiguration__Blacklists__0=firt_black_list_id +FilterConfiguration__BlacklistsConfiguration__Blacklists__1=second_black_list_id +FilterConfiguration__BlacklistsConfiguration__Blacklists__2=third_black_list_id + +FilterConfiguration__FaceMaskConfiguration__Enabled=false +FilterConfiguration__FaceMaskConfiguration__DenyingDebounceMs=4000 + +FilterConfiguration__IntentionalAccessConfiguration__Enabled=false +FilterConfiguration__IntentionalAccessConfiguration__AlwaysOpenForFaceAreaPercentLargerThan=7 +FilterConfiguration__IntentionalAccessConfiguration__RequiredFaceApproachingRatePercent=0.4 + +FilterConfiguration__StreamGroupsConfiguration__Enabled=true +FilterConfiguration__StreamGroupsConfiguration__GroupOpeningDebounceMs=3000 + +FilterConfiguration__SpoofCheckConfiguration__Enabled=false +FilterConfiguration__SpoofCheckConfiguration__DenyingDebounceMs=4000 + +# Set true when a Jaeger tracing is required +AppSettings__0__Key=USE_JAEGER_APP_SETTINGS +AppSettings__0__Value=false + +AppSettings__1__Key=JAEGER_SAMPLER_TYPE +AppSettings__1__Value=const + +AppSettings__2__Key=JAEGER_SAMPLER_PARAM +AppSettings__2__Value=1 + +# Jaeger tracing endpoint. 'jaeger' is the name of included docker container. +# If targeting outside SmartFace docker, change to remote URL +AppSettings__3__Key=JAEGER_AGENT_HOST +AppSettings__3__Value=jaeger \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/.env.sfstation b/sf-docker/special/high-availability/server2/.env.sfstation new file mode 100644 index 00000000..cf0d5ab5 --- /dev/null +++ b/sf-docker/special/high-availability/server2/.env.sfstation @@ -0,0 +1,96 @@ +# IP address, where SmartFace Station server will bind to +HOST=0.0.0.0 + +# Port number, where SmartFace Station server will bind to +PORT=8000 + +# Full addresses to SmartFace Server APIs +# CORE API example: http://[sf-server-host]:[port]/api/v1 +CORE_API_ROOT=http://SFApi:80/api/v1 + +# ODATA API example: http://[sf-server-host]:[port] +ODATA_API_ROOT=http://SFODataApi:80 + +# ZERO_MQ_HOST example: [sf-server-host] +ZERO_MQ_HOST=SFBase + +# Full address to SmartFace Server GraphQL APIs +GRAPHQL_ROOT=http://SFGraphQLApi:80/graphql + +# example: CAM_PREVIEW_HOST_[camera.serviceName]=[sf-camera-host] +CAM_PREVIEW_HOST_SFCAM1=SFCam1 +CAM_PREVIEW_HOST_SFCAM2=SFCam2 +CAM_PREVIEW_HOST_SFCAM3=SFCam3 +CAM_PREVIEW_HOST_SFCAM4=SFCam4 +CAM_PREVIEW_HOST_SFCAM5=SFCam5 + +# Address to Access Controller gRPC endpoint +# Example: [sf-server-host]:[port] +ACCESS_CONTROLLER_ADDRESS=SFAccessController:80 + +# Comma separated Watchlist IDs used as a global blacklists +BLACKLIST_WATCHLIST_IDS=abcdabcd-abcd-1234-abcd-abcdabcdacd + +# Whether to run with Keycloak authentication server or not +ENABLE_AUTHENTICATION=false + +# Full URL address to Keycloak's users management (if empty no url will be shown in webapp configuration) +KEYCLOAK_ADMIN_URL=http://keycloak-host:8080/auth/admin + +# In case of unauthorize access user will be redirected to provided URL (eg. keycloack login) +# If URL is not provided No access page will be shown +UNAUTHORIZE_ACCESS_REDIRECTION_URL=http://keycloak.login + +# Score to percentage conversion parameters +SCORE_CONVERSION_LOWER_LIMIT=20 +SCORE_CONVERSION_LOWER_LIMIT_PERCENTAGE=30 +SCORE_CONVERSION_UPPER_LIMIT=40 +SCORE_CONVERSION_UPPER_LIMIT_PERCENTAGE=90 + +# DOT camera parameters (HTTPS is required) +DOT_FACE_CAMERA_ENABLED=false +DOT_FACE_CAMERA_FACE_CENTER_LIMIT=0.2 +DOT_FACE_CAMERA_FACE_CONFIDENCE=0.06 + +# Wether to run with HTTPS authentication server or not +HTTPS_ENABLED=false +HTTPS_HOST_NAME= +HTTPS_KEY_FILE=server.key +HTTPS_CERT_FILE=server.cert + +# Setup for S3 / MinIO API +S3_ENDPOINT=http://127.0.0.1:9000 +S3_ACCESS_KEY=minioadmin +S3_SECRET_KEY=minioadmin +S3_REGION=eu-west-1 +S3_BUCKET=inno-smartface +# If we are using s3/minio over https this determine if certificate needs to be valid or not +# for http version of s3/minio needs to be set to false +S3_SKIP_SSL=false +# Presigned URL expiration in seconds +S3_URL_EXPIRATION=300 # 5 minutes +# Create bucket if it doesn't exist already +S3_PRECREATE_BUCKET=true + +# Add optional labels to watclist member (key is used in API requests, label is visual representation of key and used only in station frontend) +# WATCHLIST_MEMBER_KEY_0=date +# WATCHLIST_MEMBER_LABEL_0=Date of birth +# WATCHLIST_MEMBER_KEY_1=tax_number +# WATCHLIST_MEMBER_LABEL_1=Tax number +# WATCHLIST_MEMBER_KEY_2=phone +# WATCHLIST_MEMBER_LABEL_2=Phone number + +# Optional roles are used for locking specified part of frontend for given roles +# Claim name is "Group mapper name" specified in Keycloak or "cognito:groups" in Cognito +# ROLES_CLAIM_NAME=sf_roles +# ROLE_KEY_ADMIN=/admin +# ROLE_KEY_SECURITY_SUPERVISOR=/security_supervisor +# ROLE_KEY_SECURITY_OPERATOR=/security_operator +# ROLE_KEY_ACCESS_SUPERVISOR=/access_supervisor +# ROLE_KEY_ACCESS_OPERATOR=/access_operator +# ROLE_KEY_INVESTIGATION_SUPERVISOR=/investigation_supervisor +# ROLE_KEY_INVESTIGATION_OPERATOR=/investigation_operator +# ROLE_KEY_SECURITY_ADMIN=/security_admin +# ROLE_KEY_ACCESS_ADMIN=/access_admin +# ROLE_KEY_INVESTIGATION_ADMIN=/investigation_admin +# FORCED_ROLE_NAME_0=/admin diff --git a/sf-docker/special/high-availability/server2/README.md b/sf-docker/special/high-availability/server2/README.md new file mode 100644 index 00000000..05619de4 --- /dev/null +++ b/sf-docker/special/high-availability/server2/README.md @@ -0,0 +1,9 @@ +# SmartFace All-in-One + +## Deployment +1. Install `Docker` and `docker compose` on the host machine. +2. Login to container registry `docker login registry.gitlab.com -u -p `. The credentials are available in our [CRM portal](https://crm.innovatrics.com/). +3. Identify hardware id (hwid) for your machine with command `docker run registry.gitlab.com/innovatrics/smartface/license-manager:3.2.7`. This process work for native linux, for `WSL2` eg. linux containers on Windows you need special license for which you need to contact our sales. +4. Obtain license for your hwid from our CRM https://crm.innovatrics.com/client/products +5. Copy the license file `iengine.lic` to the root of this directory. +6. Run `run.sh` script. The run scripts contain comments which should clarify the steps needed to start everything \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/docker-compose.yml b/sf-docker/special/high-availability/server2/docker-compose.yml new file mode 100644 index 00000000..92c423e8 --- /dev/null +++ b/sf-docker/special/high-availability/server2/docker-compose.yml @@ -0,0 +1,525 @@ +version: "3.4" +services: + sf-base: + image: ${REGISTRY}sf-base:${SF_VERSION} + container_name: SFBase + command: --serviceName SFBase + ports: + - 2406:2406 + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-group: + image: ${REGISTRY}sf-grouping:${SF_VERSION} + container_name: SFGroup + command: --serviceName SFGroup + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-cam-1: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam1 + command: --serviceName SFCam1 + ports: + - 30001:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-2: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam2 + command: --serviceName SFCam2 + ports: + - 30002:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-3: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam3 + command: --serviceName SFCam3 + ports: + - 30003:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-4: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam4 + command: --serviceName SFCam4 + ports: + - 30004:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-5: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam5 + command: --serviceName SFCam5 + ports: + - 30005:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-nx: + image: ${REGISTRY}sf-cam:${SF_VERSION} + # Guid needs to match ServiceInstallNames.NX_TEST_CAMERA_GUID + container_name: 53b4d78e-323f-4a0f-aa6d-99c464448b6d + command: --serviceName 53b4d78e-323f-4a0f-aa6d-99c464448b6d + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + api: + image: ${REGISTRY}sf-api:${SF_VERSION} + container_name: SFApi + ports: + # we forward the configured ports to default SF ports + - 8098:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + - CameraDefaults__PreviewPort + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-graphql-api: + image: ${REGISTRY}sf-graphql-api:${SF_VERSION} + container_name: SFGraphQLApi + ports: + # we forward the configured ports to default SF ports + - 8097:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - AppSettings__Log_RabbitMq_Enabled + + odata-api: + image: ${REGISTRY}sf-odata-api:${SF_VERSION} + container_name: SFODataApi + ports: + # we forward the configured ports to default SF ports + - 8099:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + detector: + image: ${REGISTRY}sf-detector:${SF_VERSION} + container_name: SFDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + pedestrian-detector: + image: ${REGISTRY}sf-pedestrian-detector:${SF_VERSION} + container_name: SFPedestrianDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + extractor: + image: ${REGISTRY}sf-extractor:${SF_VERSION} + container_name: SFExtractCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + matcher: + image: ${REGISTRY}sf-matcher:${SF_VERSION} + container_name: SFWatchlistMatcher + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + cpuset: "0" + + face-matcher: + image: ${REGISTRY}sf-face-matcher:${SF_VERSION} + container_name: SFFaceMatcher + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + liveness: + image: ${REGISTRY}sf-liveness:${SF_VERSION} + container_name: SFLiveness + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + video-aggregator: + image: ${REGISTRY}sf-video-aggregator:${SF_VERSION} + container_name: SFVideoDataAggregator + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + video-collector: + image: ${REGISTRY}sf-video-collector:${SF_VERSION} + container_name: SFVideoDataCollector + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + video-reader: + image: ${REGISTRY}sf-video-reader:${SF_VERSION} + container_name: SFVideoReader + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + body-parts-detector: + image: ${REGISTRY}sf-body-parts-detector:${SF_VERSION} + container_name: SFBodyPartsDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + edge-stream-processor: + image: ${REGISTRY}sf-edge-stream-processor:${SF_VERSION} + container_name: SFEdgeStreamProcessor + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__Log_RabbitMq_Enabled + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + access-controller: + image: ${REGISTRY}sf-access-controller:${AC_VERSION} + container_name: SFAccessController + ports: + # we forward the configured ports to default SF ports + - 5050:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMq__HostName=${RabbitMQ__Hostname} + - RabbitMq__UserName=${RabbitMQ__Username} + - RabbitMq__Password=${RabbitMQ__Password} + - RabbitMq__Port=${RabbitMQ__Port} + - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} + env_file: .env.sfac + + sf-station: + image: ${REGISTRY}sf-station:${SFS_VERSION} + container_name: SFStation + restart: unless-stopped + ports: + - 8000:8000 + env_file: .env.sfstation + +networks: + default: + external: + name: sf-network diff --git a/sf-docker/special/high-availability/server2/run.sh b/sf-docker/special/high-availability/server2/run.sh new file mode 100644 index 00000000..8195ea35 --- /dev/null +++ b/sf-docker/special/high-availability/server2/run.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +set -x +set -e + +if [ ! -f iengine.lic ]; then + echo "License file not found. Please make sure that the license file is present in the current directory." >&2 + exit 1 +fi + +COMPOSE_COMMAND="docker compose" + +set +e + +$COMPOSE_COMMAND version + +if [ $? -ne 0 ]; then + COMPOSE_COMMAND="docker-compose" + $COMPOSE_COMMAND version + if [ $? -ne 0 ]; then + echo "No compose command found. Please install docker compose" >&2 + exit 1 + fi +fi + +set -e +# sf-network is used so that sf-dependencies and sf containers can communicate +# this can fail if the network already exists, but we don't mind that +docker network create sf-network || true + +# start dependencies of SF - MsSql, RMQ and minio +$COMPOSE_COMMAND -f sf_dependencies/docker-compose.yml up -d + +# sleep to wait for the dependencies to start up +sleep 10 + +# load version and registry from .env +VERSION=$(grep -E ^SF_VERSION .env | cut -d '=' -f2 | cut -d$'\r' -f1) +REGISTRY=$(grep -E ^REGISTRY .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# we use the DB engine that will be used by SF to create and migrate the DB +# to switch DB engine, change the .env file +DB_ENGINE=$(grep -E ^Database__DbEngine .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# load RabbitMQ properties from .env +RMQ_HOST=$(grep -E ^RabbitMQ__Hostname .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_USER=$(grep -E ^RabbitMQ__Username .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PASS=$(grep -E ^RabbitMQ__Password .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_VHOST=$(grep -E ^RabbitMQ__VirtualHost .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PORT=$(grep -E ^RabbitMQ__Port .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_SSL=$(grep -E ^RabbitMQ__UseSsl .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +S3_ENDPOINT=$(grep -E ^S3Bucket__Endpoint .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_ACCESS=$(grep -E ^S3Bucket__AccessKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_SECRET=$(grep -E ^S3Bucket__SecretKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_BUCKET=$(grep -E ^S3Bucket__BucketName .env | cut -d '=' -f2 | cut -d$'\r' -f1) +# set correct hostname to sfstation env file +sed -i "s/S3_ENDPOINT=.*/S3_ENDPOINT=http:\/\/$(hostname):9000/g" .env.sfstation + +echo $VERSION +echo $REGISTRY + +# create mqtt user for rmq mqtt plugin +docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true +docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true +docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true + +if [[ "$DB_ENGINE" == "MsSql" ]]; then + # create SmartFace database in MsSql + docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Test1234 -Q "CREATE DATABASE SmartFace" || true + # run database migration to current version + docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} +elif [[ "$DB_ENGINE" == "PgSql" ]]; then + # create SmartFace database in PgSql + docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true + # run database migration to current version + docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} +else + echo "Unknown DB engine: ${DB_ENGINE}!" >&2 + exit 1 +fi + +docker run --rm --name s3-bucket-create --network sf-network ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" + +# finally start SF images +$COMPOSE_COMMAND up -d --force-recreate \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml new file mode 100644 index 00000000..cf51d942 --- /dev/null +++ b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' +services: + rmq2: + image: "rabbitmq:3.10.2-management" + container_name: rmq2 + ports: + - "15672:15672" + - "5672:5672" + - "1883:1883" + environment: + RABBITMQ_NODENAME: rabbit@rmq2 + RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf + RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins + RABBITMQ_ERLANG_COOKIE: rabbitcookie + volumes: + - ./etc_rmq/:/etc/rabbitmq/external + - rmqdata:/var/lib/rabbitmq + restart: unless-stopped + +volumes: + rmqdata: + +networks: + default: + external: + name: sf-network \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins new file mode 100644 index 00000000..e7e3e53c --- /dev/null +++ b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins @@ -0,0 +1 @@ +[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus]. \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf new file mode 100644 index 00000000..450b5232 --- /dev/null +++ b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf @@ -0,0 +1,13 @@ +## Consumer timeout +## If a message delivered to a consumer has not been acknowledge before this timer +## triggers the channel will be force closed by the broker. This ensure that +## faultly consumers that never ack will not hold on to messages indefinitely. +## 6 hours = 21600000 ms +consumer_timeout = 21600000 + +mqtt.allow_anonymous = false + +cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config +cluster_formation.classic_config.nodes.1 = rabbit@rmq1 +cluster_formation.classic_config.nodes.2 = rabbit@rmq2 +cluster_formation.classic_config.nodes.3 = rabbit@rmq3 \ No newline at end of file From abf4d55eb768f87c4dbd267dbbea91ef76bbf5ff Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 11:14:18 +0800 Subject: [PATCH 06/23] mssqldata back --- .../server1/sf_dependencies/docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index bb49cac4..1b56de5e 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -1,5 +1,18 @@ version: '3' services: + mssql: + image: "mcr.microsoft.com/mssql/server:2019-latest" + container_name: mssql + ports: + - "1433:1433" + environment: + - ACCEPT_EULA=Y + - SA_PASSWORD=Test1234 + restart: unless-stopped + volumes: + - mssqldata:/var/opt/mssql + #- /var/lib/smartface/mssql:/var/opt/mssql + rmq1: image: "rabbitmq:3.10.2-management" container_name: rmq1 @@ -18,6 +31,7 @@ services: restart: unless-stopped volumes: + mssqldata: rmqdata: networks: From 7157e92fba45341addf185e8ebe47ac9fe4486c5 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 12:17:16 +0800 Subject: [PATCH 07/23] rabbitmq_federation --- .../special/high-availability/minio/docker-compose.yml | 9 +++++++-- .../high-availability/server1/docker-compose.yml | 2 +- sf-docker/special/high-availability/server1/run.sh | 10 +++++----- .../server1/sf_dependencies/docker-compose.yml | 2 +- .../server1/sf_dependencies/etc_rmq/enabled_plugins | 2 +- .../high-availability/server2/docker-compose.yml | 2 +- sf-docker/special/high-availability/server2/run.sh | 10 +++++----- .../server2/sf_dependencies/docker-compose.yml | 2 +- .../server2/sf_dependencies/etc_rmq/enabled_plugins | 2 +- 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/sf-docker/special/high-availability/minio/docker-compose.yml b/sf-docker/special/high-availability/minio/docker-compose.yml index a6ebd250..820dc776 100644 --- a/sf-docker/special/high-availability/minio/docker-compose.yml +++ b/sf-docker/special/high-availability/minio/docker-compose.yml @@ -48,7 +48,7 @@ services: - data4-1:/data1 - data4-2:/data2 - nginx: + minio-proxy: image: nginx:1.19.2-alpine hostname: nginx volumes: @@ -72,4 +72,9 @@ volumes: data3-1: data3-2: data4-1: - data4-2: \ No newline at end of file + data4-2: + +networks: + default: + external: + name: HighAvailabilityClusterNetwork diff --git a/sf-docker/special/high-availability/server1/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml index 92c423e8..1599f1d1 100644 --- a/sf-docker/special/high-availability/server1/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/docker-compose.yml @@ -522,4 +522,4 @@ services: networks: default: external: - name: sf-network + name: HighAvailabilityClusterNetwork diff --git a/sf-docker/special/high-availability/server1/run.sh b/sf-docker/special/high-availability/server1/run.sh index 8195ea35..31d16b6f 100644 --- a/sf-docker/special/high-availability/server1/run.sh +++ b/sf-docker/special/high-availability/server1/run.sh @@ -24,9 +24,9 @@ if [ $? -ne 0 ]; then fi set -e -# sf-network is used so that sf-dependencies and sf containers can communicate +# HighAvailabilityClusterNetwork is used so that sf-dependencies and sf containers can communicate # this can fail if the network already exists, but we don't mind that -docker network create sf-network || true +docker network create HighAvailabilityClusterNetwork || true # start dependencies of SF - MsSql, RMQ and minio $COMPOSE_COMMAND -f sf_dependencies/docker-compose.yml up -d @@ -69,18 +69,18 @@ if [[ "$DB_ENGINE" == "MsSql" ]]; then # create SmartFace database in MsSql docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Test1234 -Q "CREATE DATABASE SmartFace" || true # run database migration to current version - docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} + docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} elif [[ "$DB_ENGINE" == "PgSql" ]]; then # create SmartFace database in PgSql docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true # run database migration to current version - docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} + docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} else echo "Unknown DB engine: ${DB_ENGINE}!" >&2 exit 1 fi -docker run --rm --name s3-bucket-create --network sf-network ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" +docker run --rm --name s3-bucket-create --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" # finally start SF images $COMPOSE_COMMAND up -d --force-recreate \ No newline at end of file diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index 1b56de5e..457a69b8 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -37,4 +37,4 @@ volumes: networks: default: external: - name: sf-network \ No newline at end of file + name: HighAvailabilityClusterNetwork \ No newline at end of file diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/enabled_plugins b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/enabled_plugins index e7e3e53c..288b0ae2 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/enabled_plugins +++ b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/enabled_plugins @@ -1 +1 @@ -[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus]. \ No newline at end of file +[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus,rabbitmq_federation]. \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/docker-compose.yml b/sf-docker/special/high-availability/server2/docker-compose.yml index 92c423e8..1599f1d1 100644 --- a/sf-docker/special/high-availability/server2/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/docker-compose.yml @@ -522,4 +522,4 @@ services: networks: default: external: - name: sf-network + name: HighAvailabilityClusterNetwork diff --git a/sf-docker/special/high-availability/server2/run.sh b/sf-docker/special/high-availability/server2/run.sh index 8195ea35..31d16b6f 100644 --- a/sf-docker/special/high-availability/server2/run.sh +++ b/sf-docker/special/high-availability/server2/run.sh @@ -24,9 +24,9 @@ if [ $? -ne 0 ]; then fi set -e -# sf-network is used so that sf-dependencies and sf containers can communicate +# HighAvailabilityClusterNetwork is used so that sf-dependencies and sf containers can communicate # this can fail if the network already exists, but we don't mind that -docker network create sf-network || true +docker network create HighAvailabilityClusterNetwork || true # start dependencies of SF - MsSql, RMQ and minio $COMPOSE_COMMAND -f sf_dependencies/docker-compose.yml up -d @@ -69,18 +69,18 @@ if [[ "$DB_ENGINE" == "MsSql" ]]; then # create SmartFace database in MsSql docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Test1234 -Q "CREATE DATABASE SmartFace" || true # run database migration to current version - docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} + docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} elif [[ "$DB_ENGINE" == "PgSql" ]]; then # create SmartFace database in PgSql docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true # run database migration to current version - docker run --rm --name admin_migration --network sf-network ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} + docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} else echo "Unknown DB engine: ${DB_ENGINE}!" >&2 exit 1 fi -docker run --rm --name s3-bucket-create --network sf-network ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" +docker run --rm --name s3-bucket-create --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" # finally start SF images $COMPOSE_COMMAND up -d --force-recreate \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml index cf51d942..91fda8be 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml @@ -23,4 +23,4 @@ volumes: networks: default: external: - name: sf-network \ No newline at end of file + name: HighAvailabilityClusterNetwork \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins index e7e3e53c..288b0ae2 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins +++ b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/enabled_plugins @@ -1 +1 @@ -[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus]. \ No newline at end of file +[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus,rabbitmq_federation]. \ No newline at end of file From 245d59d9a2129d5f91fbe520dc7ece6ef0d6a840 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 12:42:06 +0800 Subject: [PATCH 08/23] SGDEVCPFCTN01 --- sf-docker/special/high-availability/server1/run.sh | 10 +++++++--- .../server1/sf_dependencies/.erlang.cookie | 1 + .../server1/sf_dependencies/docker-compose.yml | 4 ++-- .../server1/sf_dependencies/etc_rmq/rabbitmq.conf | 5 ++--- sf-docker/special/high-availability/server2/run.sh | 10 +++++++--- .../server2/sf_dependencies/.erlang.cookie | 1 + .../server2/sf_dependencies/docker-compose.yml | 4 ++-- 7 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 sf-docker/special/high-availability/server1/sf_dependencies/.erlang.cookie create mode 100644 sf-docker/special/high-availability/server2/sf_dependencies/.erlang.cookie diff --git a/sf-docker/special/high-availability/server1/run.sh b/sf-docker/special/high-availability/server1/run.sh index 31d16b6f..68ac59da 100644 --- a/sf-docker/special/high-availability/server1/run.sh +++ b/sf-docker/special/high-availability/server1/run.sh @@ -61,9 +61,13 @@ echo $VERSION echo $REGISTRY # create mqtt user for rmq mqtt plugin -docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true -docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true -docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true +docker exec -it rmq1 /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true +docker exec -it rmq1 /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true +docker exec -it rmq1 /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true + +docker exec -it rmq1 /opt/rabbitmq/sbin/rabbitmqctl stop_app +docker exec -it rmq1 /opt/rabbitmq/sbin/rabbitmqctl reset +docker exec -it rmq1 /opt/rabbitmq/sbin/rabbitmqctl start_app if [[ "$DB_ENGINE" == "MsSql" ]]; then # create SmartFace database in MsSql diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/.erlang.cookie b/sf-docker/special/high-availability/server1/sf_dependencies/.erlang.cookie new file mode 100644 index 00000000..bd41cba7 --- /dev/null +++ b/sf-docker/special/high-availability/server1/sf_dependencies/.erlang.cookie @@ -0,0 +1 @@ +12345 \ No newline at end of file diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index 457a69b8..468593d8 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -21,11 +21,11 @@ services: - "5672:5672" - "1883:1883" environment: - RABBITMQ_NODENAME: rabbit@rmq1 + RABBITMQ_NODENAME: rabbit@SGDEVCPFCTN01 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins - RABBITMQ_ERLANG_COOKIE: rabbitcookie volumes: + - ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie - ./etc_rmq/:/etc/rabbitmq/external - rmqdata:/var/lib/rabbitmq restart: unless-stopped diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf index 450b5232..f2accc7d 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf +++ b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf @@ -8,6 +8,5 @@ consumer_timeout = 21600000 mqtt.allow_anonymous = false cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config -cluster_formation.classic_config.nodes.1 = rabbit@rmq1 -cluster_formation.classic_config.nodes.2 = rabbit@rmq2 -cluster_formation.classic_config.nodes.3 = rabbit@rmq3 \ No newline at end of file +cluster_formation.classic_config.nodes.1 = rabbit@SGDEVCPFCTN01 +cluster_formation.classic_config.nodes.2 = rabbit@SGDEVSAFCTN01 \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/run.sh b/sf-docker/special/high-availability/server2/run.sh index 31d16b6f..6d973be7 100644 --- a/sf-docker/special/high-availability/server2/run.sh +++ b/sf-docker/special/high-availability/server2/run.sh @@ -61,9 +61,13 @@ echo $VERSION echo $REGISTRY # create mqtt user for rmq mqtt plugin -docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true -docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true -docker exec -it rmq /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true + +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl stop_app +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl join_cluster --ram rabbit@SGDEVCPFCTN01 +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl start_app if [[ "$DB_ENGINE" == "MsSql" ]]; then # create SmartFace database in MsSql diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/.erlang.cookie b/sf-docker/special/high-availability/server2/sf_dependencies/.erlang.cookie new file mode 100644 index 00000000..bd41cba7 --- /dev/null +++ b/sf-docker/special/high-availability/server2/sf_dependencies/.erlang.cookie @@ -0,0 +1 @@ +12345 \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml index 91fda8be..e2f70ed0 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml @@ -8,11 +8,11 @@ services: - "5672:5672" - "1883:1883" environment: - RABBITMQ_NODENAME: rabbit@rmq2 + RABBITMQ_NODENAME: rabbit@SGDEVSAFCTN01 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins - RABBITMQ_ERLANG_COOKIE: rabbitcookie volumes: + - ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie - ./etc_rmq/:/etc/rabbitmq/external - rmqdata:/var/lib/rabbitmq restart: unless-stopped From 03300e5ed4f39958ce8eeb96bd850c99944a0605 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 12:42:51 +0800 Subject: [PATCH 09/23] WIP --- .../server1/sf_dependencies/etc_rmq/rabbitmq.conf | 6 +----- .../server2/sf_dependencies/etc_rmq/rabbitmq.conf | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf index f2accc7d..020a9cc5 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf +++ b/sf-docker/special/high-availability/server1/sf_dependencies/etc_rmq/rabbitmq.conf @@ -5,8 +5,4 @@ ## 6 hours = 21600000 ms consumer_timeout = 21600000 -mqtt.allow_anonymous = false - -cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config -cluster_formation.classic_config.nodes.1 = rabbit@SGDEVCPFCTN01 -cluster_formation.classic_config.nodes.2 = rabbit@SGDEVSAFCTN01 \ No newline at end of file +mqtt.allow_anonymous = false \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf index 450b5232..020a9cc5 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf +++ b/sf-docker/special/high-availability/server2/sf_dependencies/etc_rmq/rabbitmq.conf @@ -5,9 +5,4 @@ ## 6 hours = 21600000 ms consumer_timeout = 21600000 -mqtt.allow_anonymous = false - -cluster_formation.peer_discovery_backend = rabbit_peer_discovery_classic_config -cluster_formation.classic_config.nodes.1 = rabbit@rmq1 -cluster_formation.classic_config.nodes.2 = rabbit@rmq2 -cluster_formation.classic_config.nodes.3 = rabbit@rmq3 \ No newline at end of file +mqtt.allow_anonymous = false \ No newline at end of file From 7c533dc8debe2b351c6f2fc9d41b4ca639fa3a4f Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:38:26 +0800 Subject: [PATCH 10/23] WIP --- .../server1/sf_dependencies/docker-compose.yml | 4 +++- sf-docker/special/high-availability/server2/run.sh | 3 ++- .../server2/sf_dependencies/docker-compose.yml | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index 468593d8..6a9895c0 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -20,8 +20,10 @@ services: - "15672:15672" - "5672:5672" - "1883:1883" + - "4369:4369" + - "25672:25672" environment: - RABBITMQ_NODENAME: rabbit@SGDEVCPFCTN01 + RABBITMQ_NODENAME: rabbit@rmq1 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins volumes: diff --git a/sf-docker/special/high-availability/server2/run.sh b/sf-docker/special/high-availability/server2/run.sh index 6d973be7..a2034189 100644 --- a/sf-docker/special/high-availability/server2/run.sh +++ b/sf-docker/special/high-availability/server2/run.sh @@ -66,7 +66,8 @@ docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administr docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl stop_app -docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl join_cluster --ram rabbit@SGDEVCPFCTN01 +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl reset +docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl join_cluster rabbit@rmq1 docker exec -it rmq2 /opt/rabbitmq/sbin/rabbitmqctl start_app if [[ "$DB_ENGINE" == "MsSql" ]]; then diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml index e2f70ed0..9cb0a42f 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml @@ -7,8 +7,10 @@ services: - "15672:15672" - "5672:5672" - "1883:1883" + - "4369:4369" + - "25672:25672" environment: - RABBITMQ_NODENAME: rabbit@SGDEVSAFCTN01 + RABBITMQ_NODENAME: rabbit@rmq2 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins volumes: From 21a64b85134ad3ce5d9d814329aa9c2d7eb2d7f8 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:41:55 +0800 Subject: [PATCH 11/23] WIP --- .../pgsql/docker-compose.yml | 30 + .../special/high-availability/pgsql/run.sh | 21 + .../special/high-availability/server3/.env | 47 ++ .../high-availability/server3/.env.sfac | 47 ++ .../high-availability/server3/.env.sfstation | 96 ++++ .../high-availability/server3/README.md | 9 + .../server3/docker-compose.yml | 525 ++++++++++++++++++ .../special/high-availability/server3/run.sh | 91 +++ .../server3/sf_dependencies/.erlang.cookie | 1 + .../sf_dependencies/docker-compose.yml | 28 + .../sf_dependencies/etc_rmq/enabled_plugins | 1 + .../sf_dependencies/etc_rmq/rabbitmq.conf | 8 + 12 files changed, 904 insertions(+) create mode 100644 sf-docker/special/high-availability/pgsql/docker-compose.yml create mode 100644 sf-docker/special/high-availability/pgsql/run.sh create mode 100644 sf-docker/special/high-availability/server3/.env create mode 100644 sf-docker/special/high-availability/server3/.env.sfac create mode 100644 sf-docker/special/high-availability/server3/.env.sfstation create mode 100644 sf-docker/special/high-availability/server3/README.md create mode 100644 sf-docker/special/high-availability/server3/docker-compose.yml create mode 100644 sf-docker/special/high-availability/server3/run.sh create mode 100644 sf-docker/special/high-availability/server3/sf_dependencies/.erlang.cookie create mode 100644 sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml create mode 100644 sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/enabled_plugins create mode 100644 sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/rabbitmq.conf diff --git a/sf-docker/special/high-availability/pgsql/docker-compose.yml b/sf-docker/special/high-availability/pgsql/docker-compose.yml new file mode 100644 index 00000000..664ac3d0 --- /dev/null +++ b/sf-docker/special/high-availability/pgsql/docker-compose.yml @@ -0,0 +1,30 @@ +version: '3' +services: + pgsql: + image: "postgres:14.3" + container_name: pgsql + ports: + - "5432:5432" + environment: + - POSTGRES_PASSWORD=Test1234 + restart: unless-stopped + volumes: + - pgsqldata:/var/lib/postgresql/data + #- /var/lib/smartface/pgsql:/var/lib/postgresql/data + + pgadmin: + image: "dpage/pgadmin4:6.10" + container_name: pgadmin + environment: + PGADMIN_DEFAULT_EMAIL: admin@admin.com + PGADMIN_DEFAULT_PASSWORD: Test1234 + ports: + - "7070:80" + +volumes: + pgsqldata: + +networks: + default: + external: + name: HighAvailabilityClusterNetwork \ No newline at end of file diff --git a/sf-docker/special/high-availability/pgsql/run.sh b/sf-docker/special/high-availability/pgsql/run.sh new file mode 100644 index 00000000..71f9582d --- /dev/null +++ b/sf-docker/special/high-availability/pgsql/run.sh @@ -0,0 +1,21 @@ +set -e +# HighAvailabilityClusterNetwork is used so that sf-dependencies and sf containers can communicate +# this can fail if the network already exists, but we don't mind that +docker network create HighAvailabilityClusterNetwork || true + +# start dependencies of SF - MsSql, RMQ and minio +$COMPOSE_COMMAND up -d + +# sleep to wait for the dependencies to start up +sleep 10 + +# to switch DB engine, change the .env file +DB_ENGINE=$(grep -E ^Database__DbEngine .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +echo $VERSION +echo $REGISTRY + +# create SmartFace database in PgSql +docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true +# run database migration to current version +docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/.env b/sf-docker/special/high-availability/server3/.env new file mode 100644 index 00000000..76b7546d --- /dev/null +++ b/sf-docker/special/high-availability/server3/.env @@ -0,0 +1,47 @@ +# RMQ config +RabbitMQ__Hostname=rmq3 +RabbitMQ__Username=guest +RabbitMQ__Password=guest +RabbitMQ__VirtualHost=/ +RabbitMQ__Port=5672 +RabbitMQ__UseSsl=false + +# Database config +#Database__DbEngine=MsSql +#ConnectionStrings__CoreDbContext=Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;TrustServerCertificate=true; +Database__DbEngine=PgSql +ConnectionStrings__CoreDbContext=Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true; + +# S3 config +S3Bucket__Endpoint=http://minio-proxy:9000 +S3Bucket__BucketName=inno-smartface +S3Bucket__AccessKey=minioadmin +S3Bucket__SecretKey=minioadmin + +# Set true when a Jaeger tracing is required +AppSettings__USE_JAEGER_APP_SETTINGS=false + +# Jaeger tracing endpoint. 'jaeger' is the name of included docker container. +# If targeting outside SmartFace docker, change to remote URL +JAEGER_AGENT_HOST=jaeger + +# API config - we use port 80 in docker and forward it as needed +Hosting__Host=http://0.0.0.0 +Hosting__Port=80 + +# we override the default generation of preview ports for camera in favor of static configuration +CameraDefaults__PreviewPort=30000 + +# Using NoSql database +NoSqlDataStorageDisabled=false + +# Using template for Gstreamer pipeline +GstPipelineTemplate=uridecodebin uri={0} source::latency=0 ! queue max-size-buffers=1 leaky=downstream ! nvvideoconvert ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink + +# Registry, must end with a forward slash `/` +REGISTRY=registry.gitlab.com/innovatrics/smartface/ + +# Version +SF_VERSION=v5_4.18.1 +AC_VERSION=v5_1.8.0 +SFS_VERSION=v5_1.15.0 diff --git a/sf-docker/special/high-availability/server3/.env.sfac b/sf-docker/special/high-availability/server3/.env.sfac new file mode 100644 index 00000000..f311821b --- /dev/null +++ b/sf-docker/special/high-availability/server3/.env.sfac @@ -0,0 +1,47 @@ +FilterConfiguration__FaceOrderConfiguration__Enabled=false +FilterConfiguration__FaceOrderConfiguration__Order=1 + +FilterConfiguration__OpeningDebounceConfiguration__OpeningDebounceEnabled=true +FilterConfiguration__OpeningDebounceConfiguration__OpeningDebounceMs=4000 + +FilterConfiguration__BlockingDebounceConfiguration__BlockingDebounceEnabled=true +FilterConfiguration__BlockingDebounceConfiguration__BlockingDebounceMs=4000 + +FilterConfiguration__ExclusiveCameraConfiguration__Enabled=true +FilterConfiguration__ExclusiveCameraConfiguration__ExclusivityMs=5000 + +FilterConfiguration__NotIdentifiedPersonConfiguration__Enabled=true +FilterConfiguration__NotIdentifiedPersonConfiguration__RoamingLimitTimeMs=3000 + +FilterConfiguration__BlacklistsConfiguration__Enabled=true +FilterConfiguration__BlacklistsConfiguration__Blacklists__0=firt_black_list_id +FilterConfiguration__BlacklistsConfiguration__Blacklists__1=second_black_list_id +FilterConfiguration__BlacklistsConfiguration__Blacklists__2=third_black_list_id + +FilterConfiguration__FaceMaskConfiguration__Enabled=false +FilterConfiguration__FaceMaskConfiguration__DenyingDebounceMs=4000 + +FilterConfiguration__IntentionalAccessConfiguration__Enabled=false +FilterConfiguration__IntentionalAccessConfiguration__AlwaysOpenForFaceAreaPercentLargerThan=7 +FilterConfiguration__IntentionalAccessConfiguration__RequiredFaceApproachingRatePercent=0.4 + +FilterConfiguration__StreamGroupsConfiguration__Enabled=true +FilterConfiguration__StreamGroupsConfiguration__GroupOpeningDebounceMs=3000 + +FilterConfiguration__SpoofCheckConfiguration__Enabled=false +FilterConfiguration__SpoofCheckConfiguration__DenyingDebounceMs=4000 + +# Set true when a Jaeger tracing is required +AppSettings__0__Key=USE_JAEGER_APP_SETTINGS +AppSettings__0__Value=false + +AppSettings__1__Key=JAEGER_SAMPLER_TYPE +AppSettings__1__Value=const + +AppSettings__2__Key=JAEGER_SAMPLER_PARAM +AppSettings__2__Value=1 + +# Jaeger tracing endpoint. 'jaeger' is the name of included docker container. +# If targeting outside SmartFace docker, change to remote URL +AppSettings__3__Key=JAEGER_AGENT_HOST +AppSettings__3__Value=jaeger \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/.env.sfstation b/sf-docker/special/high-availability/server3/.env.sfstation new file mode 100644 index 00000000..cf0d5ab5 --- /dev/null +++ b/sf-docker/special/high-availability/server3/.env.sfstation @@ -0,0 +1,96 @@ +# IP address, where SmartFace Station server will bind to +HOST=0.0.0.0 + +# Port number, where SmartFace Station server will bind to +PORT=8000 + +# Full addresses to SmartFace Server APIs +# CORE API example: http://[sf-server-host]:[port]/api/v1 +CORE_API_ROOT=http://SFApi:80/api/v1 + +# ODATA API example: http://[sf-server-host]:[port] +ODATA_API_ROOT=http://SFODataApi:80 + +# ZERO_MQ_HOST example: [sf-server-host] +ZERO_MQ_HOST=SFBase + +# Full address to SmartFace Server GraphQL APIs +GRAPHQL_ROOT=http://SFGraphQLApi:80/graphql + +# example: CAM_PREVIEW_HOST_[camera.serviceName]=[sf-camera-host] +CAM_PREVIEW_HOST_SFCAM1=SFCam1 +CAM_PREVIEW_HOST_SFCAM2=SFCam2 +CAM_PREVIEW_HOST_SFCAM3=SFCam3 +CAM_PREVIEW_HOST_SFCAM4=SFCam4 +CAM_PREVIEW_HOST_SFCAM5=SFCam5 + +# Address to Access Controller gRPC endpoint +# Example: [sf-server-host]:[port] +ACCESS_CONTROLLER_ADDRESS=SFAccessController:80 + +# Comma separated Watchlist IDs used as a global blacklists +BLACKLIST_WATCHLIST_IDS=abcdabcd-abcd-1234-abcd-abcdabcdacd + +# Whether to run with Keycloak authentication server or not +ENABLE_AUTHENTICATION=false + +# Full URL address to Keycloak's users management (if empty no url will be shown in webapp configuration) +KEYCLOAK_ADMIN_URL=http://keycloak-host:8080/auth/admin + +# In case of unauthorize access user will be redirected to provided URL (eg. keycloack login) +# If URL is not provided No access page will be shown +UNAUTHORIZE_ACCESS_REDIRECTION_URL=http://keycloak.login + +# Score to percentage conversion parameters +SCORE_CONVERSION_LOWER_LIMIT=20 +SCORE_CONVERSION_LOWER_LIMIT_PERCENTAGE=30 +SCORE_CONVERSION_UPPER_LIMIT=40 +SCORE_CONVERSION_UPPER_LIMIT_PERCENTAGE=90 + +# DOT camera parameters (HTTPS is required) +DOT_FACE_CAMERA_ENABLED=false +DOT_FACE_CAMERA_FACE_CENTER_LIMIT=0.2 +DOT_FACE_CAMERA_FACE_CONFIDENCE=0.06 + +# Wether to run with HTTPS authentication server or not +HTTPS_ENABLED=false +HTTPS_HOST_NAME= +HTTPS_KEY_FILE=server.key +HTTPS_CERT_FILE=server.cert + +# Setup for S3 / MinIO API +S3_ENDPOINT=http://127.0.0.1:9000 +S3_ACCESS_KEY=minioadmin +S3_SECRET_KEY=minioadmin +S3_REGION=eu-west-1 +S3_BUCKET=inno-smartface +# If we are using s3/minio over https this determine if certificate needs to be valid or not +# for http version of s3/minio needs to be set to false +S3_SKIP_SSL=false +# Presigned URL expiration in seconds +S3_URL_EXPIRATION=300 # 5 minutes +# Create bucket if it doesn't exist already +S3_PRECREATE_BUCKET=true + +# Add optional labels to watclist member (key is used in API requests, label is visual representation of key and used only in station frontend) +# WATCHLIST_MEMBER_KEY_0=date +# WATCHLIST_MEMBER_LABEL_0=Date of birth +# WATCHLIST_MEMBER_KEY_1=tax_number +# WATCHLIST_MEMBER_LABEL_1=Tax number +# WATCHLIST_MEMBER_KEY_2=phone +# WATCHLIST_MEMBER_LABEL_2=Phone number + +# Optional roles are used for locking specified part of frontend for given roles +# Claim name is "Group mapper name" specified in Keycloak or "cognito:groups" in Cognito +# ROLES_CLAIM_NAME=sf_roles +# ROLE_KEY_ADMIN=/admin +# ROLE_KEY_SECURITY_SUPERVISOR=/security_supervisor +# ROLE_KEY_SECURITY_OPERATOR=/security_operator +# ROLE_KEY_ACCESS_SUPERVISOR=/access_supervisor +# ROLE_KEY_ACCESS_OPERATOR=/access_operator +# ROLE_KEY_INVESTIGATION_SUPERVISOR=/investigation_supervisor +# ROLE_KEY_INVESTIGATION_OPERATOR=/investigation_operator +# ROLE_KEY_SECURITY_ADMIN=/security_admin +# ROLE_KEY_ACCESS_ADMIN=/access_admin +# ROLE_KEY_INVESTIGATION_ADMIN=/investigation_admin +# FORCED_ROLE_NAME_0=/admin diff --git a/sf-docker/special/high-availability/server3/README.md b/sf-docker/special/high-availability/server3/README.md new file mode 100644 index 00000000..05619de4 --- /dev/null +++ b/sf-docker/special/high-availability/server3/README.md @@ -0,0 +1,9 @@ +# SmartFace All-in-One + +## Deployment +1. Install `Docker` and `docker compose` on the host machine. +2. Login to container registry `docker login registry.gitlab.com -u -p `. The credentials are available in our [CRM portal](https://crm.innovatrics.com/). +3. Identify hardware id (hwid) for your machine with command `docker run registry.gitlab.com/innovatrics/smartface/license-manager:3.2.7`. This process work for native linux, for `WSL2` eg. linux containers on Windows you need special license for which you need to contact our sales. +4. Obtain license for your hwid from our CRM https://crm.innovatrics.com/client/products +5. Copy the license file `iengine.lic` to the root of this directory. +6. Run `run.sh` script. The run scripts contain comments which should clarify the steps needed to start everything \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/docker-compose.yml b/sf-docker/special/high-availability/server3/docker-compose.yml new file mode 100644 index 00000000..1599f1d1 --- /dev/null +++ b/sf-docker/special/high-availability/server3/docker-compose.yml @@ -0,0 +1,525 @@ +version: "3.4" +services: + sf-base: + image: ${REGISTRY}sf-base:${SF_VERSION} + container_name: SFBase + command: --serviceName SFBase + ports: + - 2406:2406 + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-group: + image: ${REGISTRY}sf-grouping:${SF_VERSION} + container_name: SFGroup + command: --serviceName SFGroup + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-cam-1: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam1 + command: --serviceName SFCam1 + ports: + - 30001:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-2: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam2 + command: --serviceName SFCam2 + ports: + - 30002:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-3: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam3 + command: --serviceName SFCam3 + ports: + - 30003:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-4: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam4 + command: --serviceName SFCam4 + ports: + - 30004:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-5: + image: ${REGISTRY}sf-cam:${SF_VERSION} + container_name: SFCam5 + command: --serviceName SFCam5 + ports: + - 30005:${CameraDefaults__PreviewPort} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - GstPipelineTemplate + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + sf-cam-nx: + image: ${REGISTRY}sf-cam:${SF_VERSION} + # Guid needs to match ServiceInstallNames.NX_TEST_CAMERA_GUID + container_name: 53b4d78e-323f-4a0f-aa6d-99c464448b6d + command: --serviceName 53b4d78e-323f-4a0f-aa6d-99c464448b6d + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + api: + image: ${REGISTRY}sf-api:${SF_VERSION} + container_name: SFApi + ports: + # we forward the configured ports to default SF ports + - 8098:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + - CameraDefaults__PreviewPort + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + sf-graphql-api: + image: ${REGISTRY}sf-graphql-api:${SF_VERSION} + container_name: SFGraphQLApi + ports: + # we forward the configured ports to default SF ports + - 8097:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - AppSettings__Log_RabbitMq_Enabled + + odata-api: + image: ${REGISTRY}sf-odata-api:${SF_VERSION} + container_name: SFODataApi + ports: + # we forward the configured ports to default SF ports + - 8099:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - Hosting__Host + - Hosting__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + detector: + image: ${REGISTRY}sf-detector:${SF_VERSION} + container_name: SFDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + pedestrian-detector: + image: ${REGISTRY}sf-pedestrian-detector:${SF_VERSION} + container_name: SFPedestrianDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + extractor: + image: ${REGISTRY}sf-extractor:${SF_VERSION} + container_name: SFExtractCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + matcher: + image: ${REGISTRY}sf-matcher:${SF_VERSION} + container_name: SFWatchlistMatcher + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + cpuset: "0" + + face-matcher: + image: ${REGISTRY}sf-face-matcher:${SF_VERSION} + container_name: SFFaceMatcher + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + liveness: + image: ${REGISTRY}sf-liveness:${SF_VERSION} + container_name: SFLiveness + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + # - Gpu__GpuEnabled=true + # - Gpu__GpuNeuralRuntime=Tensor + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" + #runtime: nvidia + + video-aggregator: + image: ${REGISTRY}sf-video-aggregator:${SF_VERSION} + container_name: SFVideoDataAggregator + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + video-collector: + image: ${REGISTRY}sf-video-collector:${SF_VERSION} + container_name: SFVideoDataCollector + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + video-reader: + image: ${REGISTRY}sf-video-reader:${SF_VERSION} + container_name: SFVideoReader + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - S3Bucket__Endpoint + - S3Bucket__BucketName + - S3Bucket__AccessKey + - S3Bucket__SecretKey + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + body-parts-detector: + image: ${REGISTRY}sf-body-parts-detector:${SF_VERSION} + container_name: SFBodyPartsDetectCpu + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__USE_JAEGER_APP_SETTINGS + - JAEGER_AGENT_HOST + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + edge-stream-processor: + image: ${REGISTRY}sf-edge-stream-processor:${SF_VERSION} + container_name: SFEdgeStreamProcessor + restart: unless-stopped + environment: + - RabbitMQ__Hostname + - RabbitMQ__Username + - RabbitMQ__Password + - RabbitMQ__Port + - ConnectionStrings__CoreDbContext + - Database__DbEngine + - AppSettings__Log_RollingFile_Enabled=false + - AppSettings__Log_RabbitMq_Enabled + - NoSqlDataStorageDisabled + volumes: + - "./iengine.lic:/etc/innovatrics/iengine.lic" + + access-controller: + image: ${REGISTRY}sf-access-controller:${AC_VERSION} + container_name: SFAccessController + ports: + # we forward the configured ports to default SF ports + - 5050:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMq__HostName=${RabbitMQ__Hostname} + - RabbitMq__UserName=${RabbitMQ__Username} + - RabbitMq__Password=${RabbitMQ__Password} + - RabbitMq__Port=${RabbitMQ__Port} + - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} + env_file: .env.sfac + + sf-station: + image: ${REGISTRY}sf-station:${SFS_VERSION} + container_name: SFStation + restart: unless-stopped + ports: + - 8000:8000 + env_file: .env.sfstation + +networks: + default: + external: + name: HighAvailabilityClusterNetwork diff --git a/sf-docker/special/high-availability/server3/run.sh b/sf-docker/special/high-availability/server3/run.sh new file mode 100644 index 00000000..e4cdb386 --- /dev/null +++ b/sf-docker/special/high-availability/server3/run.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +set -x +set -e + +if [ ! -f iengine.lic ]; then + echo "License file not found. Please make sure that the license file is present in the current directory." >&2 + exit 1 +fi + +COMPOSE_COMMAND="docker compose" + +set +e + +$COMPOSE_COMMAND version + +if [ $? -ne 0 ]; then + COMPOSE_COMMAND="docker-compose" + $COMPOSE_COMMAND version + if [ $? -ne 0 ]; then + echo "No compose command found. Please install docker compose" >&2 + exit 1 + fi +fi + +set -e +# HighAvailabilityClusterNetwork is used so that sf-dependencies and sf containers can communicate +# this can fail if the network already exists, but we don't mind that +docker network create HighAvailabilityClusterNetwork || true + +# start dependencies of SF - MsSql, RMQ and minio +$COMPOSE_COMMAND -f sf_dependencies/docker-compose.yml up -d + +# sleep to wait for the dependencies to start up +sleep 10 + +# load version and registry from .env +VERSION=$(grep -E ^SF_VERSION .env | cut -d '=' -f2 | cut -d$'\r' -f1) +REGISTRY=$(grep -E ^REGISTRY .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# we use the DB engine that will be used by SF to create and migrate the DB +# to switch DB engine, change the .env file +DB_ENGINE=$(grep -E ^Database__DbEngine .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# load RabbitMQ properties from .env +RMQ_HOST=$(grep -E ^RabbitMQ__Hostname .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_USER=$(grep -E ^RabbitMQ__Username .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PASS=$(grep -E ^RabbitMQ__Password .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_VHOST=$(grep -E ^RabbitMQ__VirtualHost .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PORT=$(grep -E ^RabbitMQ__Port .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_SSL=$(grep -E ^RabbitMQ__UseSsl .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +S3_ENDPOINT=$(grep -E ^S3Bucket__Endpoint .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_ACCESS=$(grep -E ^S3Bucket__AccessKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_SECRET=$(grep -E ^S3Bucket__SecretKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_BUCKET=$(grep -E ^S3Bucket__BucketName .env | cut -d '=' -f2 | cut -d$'\r' -f1) +# set correct hostname to sfstation env file +sed -i "s/S3_ENDPOINT=.*/S3_ENDPOINT=http:\/\/$(hostname):9000/g" .env.sfstation + +echo $VERSION +echo $REGISTRY + +# create mqtt user for rmq mqtt plugin +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl add_user mqtt mqtt || true +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl set_user_tags mqtt administrator || true +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl set_permissions -p "/" mqtt ".*" ".*" ".*" || true + +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl stop_app +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl reset +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl join_cluster rabbit@rmq1 +docker exec -it rmq3 /opt/rabbitmq/sbin/rabbitmqctl start_app + +if [[ "$DB_ENGINE" == "MsSql" ]]; then + # create SmartFace database in MsSql + docker exec mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Test1234 -Q "CREATE DATABASE SmartFace" || true + # run database migration to current version + docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=mssql;Database=SmartFace;User ID=sa;Password=Test1234;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} +elif [[ "$DB_ENGINE" == "PgSql" ]]; then + # create SmartFace database in PgSql + docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true + # run database migration to current version + docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} +else + echo "Unknown DB engine: ${DB_ENGINE}!" >&2 + exit 1 +fi + +docker run --rm --name s3-bucket-create --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} ensure-s3-bucket-exists --endpoint "$S3_ENDPOINT" --access-key "$S3_ACCESS" --secret-key "$S3_SECRET" --bucket-name "$S3_BUCKET" + +# finally start SF images +$COMPOSE_COMMAND up -d --force-recreate \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/sf_dependencies/.erlang.cookie b/sf-docker/special/high-availability/server3/sf_dependencies/.erlang.cookie new file mode 100644 index 00000000..bd41cba7 --- /dev/null +++ b/sf-docker/special/high-availability/server3/sf_dependencies/.erlang.cookie @@ -0,0 +1 @@ +12345 \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml new file mode 100644 index 00000000..db36b491 --- /dev/null +++ b/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3' +services: + rmq3: + image: "rabbitmq:3.10.2-management" + container_name: rmq3 + ports: + - "15672:15672" + - "5672:5672" + - "1883:1883" + - "4369:4369" + - "25672:25672" + environment: + RABBITMQ_NODENAME: rabbit@rmq3 + RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf + RABBITMQ_ENABLED_PLUGINS_FILE: /etc/rabbitmq/external/enabled_plugins + volumes: + - ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie + - ./etc_rmq/:/etc/rabbitmq/external + - rmqdata:/var/lib/rabbitmq + restart: unless-stopped + +volumes: + rmqdata: + +networks: + default: + external: + name: HighAvailabilityClusterNetwork \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/enabled_plugins b/sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/enabled_plugins new file mode 100644 index 00000000..288b0ae2 --- /dev/null +++ b/sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/enabled_plugins @@ -0,0 +1 @@ +[rabbitmq_management,rabbitmq_mqtt,rabbitmq_prometheus,rabbitmq_federation]. \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/rabbitmq.conf b/sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/rabbitmq.conf new file mode 100644 index 00000000..020a9cc5 --- /dev/null +++ b/sf-docker/special/high-availability/server3/sf_dependencies/etc_rmq/rabbitmq.conf @@ -0,0 +1,8 @@ +## Consumer timeout +## If a message delivered to a consumer has not been acknowledge before this timer +## triggers the channel will be force closed by the broker. This ensure that +## faultly consumers that never ack will not hold on to messages indefinitely. +## 6 hours = 21600000 ms +consumer_timeout = 21600000 + +mqtt.allow_anonymous = false \ No newline at end of file From f080c4944335fb23ba84e6042cd7cc393e5298b3 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:45:30 +0800 Subject: [PATCH 12/23] WIP II --- .../special/high-availability/pgsql/run.sh | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sf-docker/special/high-availability/pgsql/run.sh b/sf-docker/special/high-availability/pgsql/run.sh index 71f9582d..9dd34f24 100644 --- a/sf-docker/special/high-availability/pgsql/run.sh +++ b/sf-docker/special/high-availability/pgsql/run.sh @@ -1,3 +1,28 @@ +#!/bin/bash + +set -x +set -e + +if [ ! -f iengine.lic ]; then + echo "License file not found. Please make sure that the license file is present in the current directory." >&2 + exit 1 +fi + +COMPOSE_COMMAND="docker compose" + +set +e + +$COMPOSE_COMMAND version + +if [ $? -ne 0 ]; then + COMPOSE_COMMAND="docker-compose" + $COMPOSE_COMMAND version + if [ $? -ne 0 ]; then + echo "No compose command found. Please install docker compose" >&2 + exit 1 + fi +fi + set -e # HighAvailabilityClusterNetwork is used so that sf-dependencies and sf containers can communicate # this can fail if the network already exists, but we don't mind that From e967c77a188bcd2747f01eb7864dfad52212399e Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:46:11 +0800 Subject: [PATCH 13/23] WIP --- sf-docker/special/high-availability/pgsql/run.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sf-docker/special/high-availability/pgsql/run.sh b/sf-docker/special/high-availability/pgsql/run.sh index 9dd34f24..20dec3d5 100644 --- a/sf-docker/special/high-availability/pgsql/run.sh +++ b/sf-docker/special/high-availability/pgsql/run.sh @@ -3,11 +3,6 @@ set -x set -e -if [ ! -f iengine.lic ]; then - echo "License file not found. Please make sure that the license file is present in the current directory." >&2 - exit 1 -fi - COMPOSE_COMMAND="docker compose" set +e From 6f3a3421ef895e363a07928e5559186c96836dc6 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:48:32 +0800 Subject: [PATCH 14/23] WIP --- .../special/high-availability/pgsql/run.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sf-docker/special/high-availability/pgsql/run.sh b/sf-docker/special/high-availability/pgsql/run.sh index 20dec3d5..6f9efbb4 100644 --- a/sf-docker/special/high-availability/pgsql/run.sh +++ b/sf-docker/special/high-availability/pgsql/run.sh @@ -29,9 +29,30 @@ $COMPOSE_COMMAND up -d # sleep to wait for the dependencies to start up sleep 10 + +# load version and registry from .env +VERSION=$(grep -E ^SF_VERSION .env | cut -d '=' -f2 | cut -d$'\r' -f1) +REGISTRY=$(grep -E ^REGISTRY .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +# we use the DB engine that will be used by SF to create and migrate the DB # to switch DB engine, change the .env file DB_ENGINE=$(grep -E ^Database__DbEngine .env | cut -d '=' -f2 | cut -d$'\r' -f1) +# load RabbitMQ properties from .env +RMQ_HOST=$(grep -E ^RabbitMQ__Hostname .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_USER=$(grep -E ^RabbitMQ__Username .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PASS=$(grep -E ^RabbitMQ__Password .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_VHOST=$(grep -E ^RabbitMQ__VirtualHost .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_PORT=$(grep -E ^RabbitMQ__Port .env | cut -d '=' -f2 | cut -d$'\r' -f1) +RMQ_SSL=$(grep -E ^RabbitMQ__UseSsl .env | cut -d '=' -f2 | cut -d$'\r' -f1) + +S3_ENDPOINT=$(grep -E ^S3Bucket__Endpoint .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_ACCESS=$(grep -E ^S3Bucket__AccessKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_SECRET=$(grep -E ^S3Bucket__SecretKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) +S3_BUCKET=$(grep -E ^S3Bucket__BucketName .env | cut -d '=' -f2 | cut -d$'\r' -f1) +# set correct hostname to sfstation env file +sed -i "s/S3_ENDPOINT=.*/S3_ENDPOINT=http:\/\/$(hostname):9000/g" .env.sfstation + echo $VERSION echo $REGISTRY From 16f98b479ad9bbdce7c8b31d245fb440dc671907 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:51:22 +0800 Subject: [PATCH 15/23] WIP --- .../special/high-availability/pgsql/run.sh | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 sf-docker/special/high-availability/pgsql/run.sh diff --git a/sf-docker/special/high-availability/pgsql/run.sh b/sf-docker/special/high-availability/pgsql/run.sh deleted file mode 100644 index 6f9efbb4..00000000 --- a/sf-docker/special/high-availability/pgsql/run.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -x -set -e - -COMPOSE_COMMAND="docker compose" - -set +e - -$COMPOSE_COMMAND version - -if [ $? -ne 0 ]; then - COMPOSE_COMMAND="docker-compose" - $COMPOSE_COMMAND version - if [ $? -ne 0 ]; then - echo "No compose command found. Please install docker compose" >&2 - exit 1 - fi -fi - -set -e -# HighAvailabilityClusterNetwork is used so that sf-dependencies and sf containers can communicate -# this can fail if the network already exists, but we don't mind that -docker network create HighAvailabilityClusterNetwork || true - -# start dependencies of SF - MsSql, RMQ and minio -$COMPOSE_COMMAND up -d - -# sleep to wait for the dependencies to start up -sleep 10 - - -# load version and registry from .env -VERSION=$(grep -E ^SF_VERSION .env | cut -d '=' -f2 | cut -d$'\r' -f1) -REGISTRY=$(grep -E ^REGISTRY .env | cut -d '=' -f2 | cut -d$'\r' -f1) - -# we use the DB engine that will be used by SF to create and migrate the DB -# to switch DB engine, change the .env file -DB_ENGINE=$(grep -E ^Database__DbEngine .env | cut -d '=' -f2 | cut -d$'\r' -f1) - -# load RabbitMQ properties from .env -RMQ_HOST=$(grep -E ^RabbitMQ__Hostname .env | cut -d '=' -f2 | cut -d$'\r' -f1) -RMQ_USER=$(grep -E ^RabbitMQ__Username .env | cut -d '=' -f2 | cut -d$'\r' -f1) -RMQ_PASS=$(grep -E ^RabbitMQ__Password .env | cut -d '=' -f2 | cut -d$'\r' -f1) -RMQ_VHOST=$(grep -E ^RabbitMQ__VirtualHost .env | cut -d '=' -f2 | cut -d$'\r' -f1) -RMQ_PORT=$(grep -E ^RabbitMQ__Port .env | cut -d '=' -f2 | cut -d$'\r' -f1) -RMQ_SSL=$(grep -E ^RabbitMQ__UseSsl .env | cut -d '=' -f2 | cut -d$'\r' -f1) - -S3_ENDPOINT=$(grep -E ^S3Bucket__Endpoint .env | cut -d '=' -f2 | cut -d$'\r' -f1) -S3_ACCESS=$(grep -E ^S3Bucket__AccessKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) -S3_SECRET=$(grep -E ^S3Bucket__SecretKey .env | cut -d '=' -f2 | cut -d$'\r' -f1) -S3_BUCKET=$(grep -E ^S3Bucket__BucketName .env | cut -d '=' -f2 | cut -d$'\r' -f1) -# set correct hostname to sfstation env file -sed -i "s/S3_ENDPOINT=.*/S3_ENDPOINT=http:\/\/$(hostname):9000/g" .env.sfstation - -echo $VERSION -echo $REGISTRY - -# create SmartFace database in PgSql -docker exec pgsql psql -U postgres -c "CREATE DATABASE smartface" || true -# run database migration to current version -docker run --rm --name admin_migration --network HighAvailabilityClusterNetwork ${REGISTRY}sf-admin:${VERSION} run-migration -p 5 -c "Server=pgsql;Database=smartface;Username=postgres;Password=Test1234;Trust Server Certificate=true;" -dbe $DB_ENGINE --rmq-host ${RMQ_HOST} --rmq-user ${RMQ_USER} --rmq-pass ${RMQ_PASS} --rmq-virtual-host ${RMQ_VHOST} --rmq-port ${RMQ_PORT} --rmq-use-ssl ${RMQ_SSL} \ No newline at end of file From f662028fa4825b4b010c0de22efca8e605326e06 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 14:53:36 +0800 Subject: [PATCH 16/23] WIP --- .../server1/sf_dependencies/docker-compose.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index 6a9895c0..04d53212 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -1,18 +1,5 @@ version: '3' services: - mssql: - image: "mcr.microsoft.com/mssql/server:2019-latest" - container_name: mssql - ports: - - "1433:1433" - environment: - - ACCEPT_EULA=Y - - SA_PASSWORD=Test1234 - restart: unless-stopped - volumes: - - mssqldata:/var/opt/mssql - #- /var/lib/smartface/mssql:/var/opt/mssql - rmq1: image: "rabbitmq:3.10.2-management" container_name: rmq1 @@ -33,7 +20,6 @@ services: restart: unless-stopped volumes: - mssqldata: rmqdata: networks: From e9357528779c429c11f3ee98e72e0cb536d29782 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 15:23:54 +0800 Subject: [PATCH 17/23] WIP --- sf-docker/special/high-availability/README.md | 4 + .../high-availability/server1/README.md | 9 - .../server1/docker-compose.yml | 15 - .../sf_dependencies/docker-compose.yml | 12 +- .../high-availability/server2/README.md | 9 - .../server2/docker-compose.yml | 270 +----------------- .../sf_dependencies/docker-compose.yml | 12 +- .../high-availability/server3/README.md | 9 - .../server3/docker-compose.yml | 270 +----------------- .../sf_dependencies/docker-compose.yml | 12 +- 10 files changed, 33 insertions(+), 589 deletions(-) create mode 100644 sf-docker/special/high-availability/README.md delete mode 100644 sf-docker/special/high-availability/server1/README.md delete mode 100644 sf-docker/special/high-availability/server2/README.md delete mode 100644 sf-docker/special/high-availability/server3/README.md diff --git a/sf-docker/special/high-availability/README.md b/sf-docker/special/high-availability/README.md new file mode 100644 index 00000000..aa6e3e1e --- /dev/null +++ b/sf-docker/special/high-availability/README.md @@ -0,0 +1,4 @@ +# SmartFace Large Scale Deployment + +This sample is intended to be deployed on a single host for demonstration purposes. When running on multiple hosts (either physical or virtual), changes listed bellow are required. + diff --git a/sf-docker/special/high-availability/server1/README.md b/sf-docker/special/high-availability/server1/README.md deleted file mode 100644 index 05619de4..00000000 --- a/sf-docker/special/high-availability/server1/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# SmartFace All-in-One - -## Deployment -1. Install `Docker` and `docker compose` on the host machine. -2. Login to container registry `docker login registry.gitlab.com -u -p `. The credentials are available in our [CRM portal](https://crm.innovatrics.com/). -3. Identify hardware id (hwid) for your machine with command `docker run registry.gitlab.com/innovatrics/smartface/license-manager:3.2.7`. This process work for native linux, for `WSL2` eg. linux containers on Windows you need special license for which you need to contact our sales. -4. Obtain license for your hwid from our CRM https://crm.innovatrics.com/client/products -5. Copy the license file `iengine.lic` to the root of this directory. -6. Run `run.sh` script. The run scripts contain comments which should clarify the steps needed to start everything \ No newline at end of file diff --git a/sf-docker/special/high-availability/server1/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml index 1599f1d1..3c228ce1 100644 --- a/sf-docker/special/high-availability/server1/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/docker-compose.yml @@ -496,21 +496,6 @@ services: volumes: - "./iengine.lic:/etc/innovatrics/iengine.lic" - access-controller: - image: ${REGISTRY}sf-access-controller:${AC_VERSION} - container_name: SFAccessController - ports: - # we forward the configured ports to default SF ports - - 5050:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMq__HostName=${RabbitMQ__Hostname} - - RabbitMq__UserName=${RabbitMQ__Username} - - RabbitMq__Password=${RabbitMQ__Password} - - RabbitMq__Port=${RabbitMQ__Port} - - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} - env_file: .env.sfac - sf-station: image: ${REGISTRY}sf-station:${SFS_VERSION} container_name: SFStation diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index 04d53212..c75b8297 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -3,12 +3,14 @@ services: rmq1: image: "rabbitmq:3.10.2-management" container_name: rmq1 + expose: + - "15672" + - "5672" + - "1883" + - "4369" + - "25672" ports: - - "15672:15672" - - "5672:5672" - - "1883:1883" - - "4369:4369" - - "25672:25672" + - "15677:15672" environment: RABBITMQ_NODENAME: rabbit@rmq1 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf diff --git a/sf-docker/special/high-availability/server2/README.md b/sf-docker/special/high-availability/server2/README.md deleted file mode 100644 index 05619de4..00000000 --- a/sf-docker/special/high-availability/server2/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# SmartFace All-in-One - -## Deployment -1. Install `Docker` and `docker compose` on the host machine. -2. Login to container registry `docker login registry.gitlab.com -u -p `. The credentials are available in our [CRM portal](https://crm.innovatrics.com/). -3. Identify hardware id (hwid) for your machine with command `docker run registry.gitlab.com/innovatrics/smartface/license-manager:3.2.7`. This process work for native linux, for `WSL2` eg. linux containers on Windows you need special license for which you need to contact our sales. -4. Obtain license for your hwid from our CRM https://crm.innovatrics.com/client/products -5. Copy the license file `iengine.lic` to the root of this directory. -6. Run `run.sh` script. The run scripts contain comments which should clarify the steps needed to start everything \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/docker-compose.yml b/sf-docker/special/high-availability/server2/docker-compose.yml index 1599f1d1..16c86360 100644 --- a/sf-docker/special/high-availability/server2/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/docker-compose.yml @@ -1,30 +1,5 @@ version: "3.4" services: - sf-base: - image: ${REGISTRY}sf-base:${SF_VERSION} - container_name: SFBase - command: --serviceName SFBase - ports: - - 2406:2406 - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - sf-group: image: ${REGISTRY}sf-grouping:${SF_VERSION} container_name: SFGroup @@ -48,96 +23,12 @@ services: volumes: - "./iengine.lic:/etc/innovatrics/iengine.lic" - sf-cam-1: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam1 - command: --serviceName SFCam1 - ports: - - 30001:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-2: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam2 - command: --serviceName SFCam2 - ports: - - 30002:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-3: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam3 - command: --serviceName SFCam3 - ports: - - 30003:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-4: + sf-cam-6: image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam4 - command: --serviceName SFCam4 + container_name: SFCam6 + command: --serviceName SFCam6 ports: - - 30004:${CameraDefaults__PreviewPort} + - 30006:${CameraDefaults__PreviewPort} restart: unless-stopped environment: - RabbitMQ__Hostname @@ -160,136 +51,6 @@ services: # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" #runtime: nvidia - sf-cam-5: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam5 - command: --serviceName SFCam5 - ports: - - 30005:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-nx: - image: ${REGISTRY}sf-cam:${SF_VERSION} - # Guid needs to match ServiceInstallNames.NX_TEST_CAMERA_GUID - container_name: 53b4d78e-323f-4a0f-aa6d-99c464448b6d - command: --serviceName 53b4d78e-323f-4a0f-aa6d-99c464448b6d - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - api: - image: ${REGISTRY}sf-api:${SF_VERSION} - container_name: SFApi - ports: - # we forward the configured ports to default SF ports - - 8098:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - Hosting__Host - - Hosting__Port - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - - CameraDefaults__PreviewPort - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - - sf-graphql-api: - image: ${REGISTRY}sf-graphql-api:${SF_VERSION} - container_name: SFGraphQLApi - ports: - # we forward the configured ports to default SF ports - - 8097:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - Hosting__Host - - Hosting__Port - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - AppSettings__Log_RabbitMq_Enabled - - odata-api: - image: ${REGISTRY}sf-odata-api:${SF_VERSION} - container_name: SFODataApi - ports: - # we forward the configured ports to default SF ports - - 8099:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - Hosting__Host - - Hosting__Port - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - detector: image: ${REGISTRY}sf-detector:${SF_VERSION} container_name: SFDetectCpu @@ -496,29 +257,6 @@ services: volumes: - "./iengine.lic:/etc/innovatrics/iengine.lic" - access-controller: - image: ${REGISTRY}sf-access-controller:${AC_VERSION} - container_name: SFAccessController - ports: - # we forward the configured ports to default SF ports - - 5050:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMq__HostName=${RabbitMQ__Hostname} - - RabbitMq__UserName=${RabbitMQ__Username} - - RabbitMq__Password=${RabbitMQ__Password} - - RabbitMq__Port=${RabbitMQ__Port} - - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} - env_file: .env.sfac - - sf-station: - image: ${REGISTRY}sf-station:${SFS_VERSION} - container_name: SFStation - restart: unless-stopped - ports: - - 8000:8000 - env_file: .env.sfstation - networks: default: external: diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml index 9cb0a42f..fd2ba593 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml @@ -3,12 +3,14 @@ services: rmq2: image: "rabbitmq:3.10.2-management" container_name: rmq2 + expose: + - "15672" + - "5672" + - "1883" + - "4369" + - "25672" ports: - - "15672:15672" - - "5672:5672" - - "1883:1883" - - "4369:4369" - - "25672:25672" + - "15678:15672" environment: RABBITMQ_NODENAME: rabbit@rmq2 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf diff --git a/sf-docker/special/high-availability/server3/README.md b/sf-docker/special/high-availability/server3/README.md deleted file mode 100644 index 05619de4..00000000 --- a/sf-docker/special/high-availability/server3/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# SmartFace All-in-One - -## Deployment -1. Install `Docker` and `docker compose` on the host machine. -2. Login to container registry `docker login registry.gitlab.com -u -p `. The credentials are available in our [CRM portal](https://crm.innovatrics.com/). -3. Identify hardware id (hwid) for your machine with command `docker run registry.gitlab.com/innovatrics/smartface/license-manager:3.2.7`. This process work for native linux, for `WSL2` eg. linux containers on Windows you need special license for which you need to contact our sales. -4. Obtain license for your hwid from our CRM https://crm.innovatrics.com/client/products -5. Copy the license file `iengine.lic` to the root of this directory. -6. Run `run.sh` script. The run scripts contain comments which should clarify the steps needed to start everything \ No newline at end of file diff --git a/sf-docker/special/high-availability/server3/docker-compose.yml b/sf-docker/special/high-availability/server3/docker-compose.yml index 1599f1d1..efa96d26 100644 --- a/sf-docker/special/high-availability/server3/docker-compose.yml +++ b/sf-docker/special/high-availability/server3/docker-compose.yml @@ -1,30 +1,5 @@ version: "3.4" services: - sf-base: - image: ${REGISTRY}sf-base:${SF_VERSION} - container_name: SFBase - command: --serviceName SFBase - ports: - - 2406:2406 - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - sf-group: image: ${REGISTRY}sf-grouping:${SF_VERSION} container_name: SFGroup @@ -48,96 +23,12 @@ services: volumes: - "./iengine.lic:/etc/innovatrics/iengine.lic" - sf-cam-1: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam1 - command: --serviceName SFCam1 - ports: - - 30001:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-2: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam2 - command: --serviceName SFCam2 - ports: - - 30002:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-3: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam3 - command: --serviceName SFCam3 - ports: - - 30003:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-4: + sf-cam-7: image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam4 - command: --serviceName SFCam4 + container_name: SFCam7 + command: --serviceName SFCam7 ports: - - 30004:${CameraDefaults__PreviewPort} + - 30007:${CameraDefaults__PreviewPort} restart: unless-stopped environment: - RabbitMQ__Hostname @@ -160,136 +51,6 @@ services: # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" #runtime: nvidia - sf-cam-5: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam5 - command: --serviceName SFCam5 - ports: - - 30005:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-nx: - image: ${REGISTRY}sf-cam:${SF_VERSION} - # Guid needs to match ServiceInstallNames.NX_TEST_CAMERA_GUID - container_name: 53b4d78e-323f-4a0f-aa6d-99c464448b6d - command: --serviceName 53b4d78e-323f-4a0f-aa6d-99c464448b6d - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - api: - image: ${REGISTRY}sf-api:${SF_VERSION} - container_name: SFApi - ports: - # we forward the configured ports to default SF ports - - 8098:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - Hosting__Host - - Hosting__Port - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - - CameraDefaults__PreviewPort - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - - sf-graphql-api: - image: ${REGISTRY}sf-graphql-api:${SF_VERSION} - container_name: SFGraphQLApi - ports: - # we forward the configured ports to default SF ports - - 8097:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - Hosting__Host - - Hosting__Port - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - AppSettings__Log_RabbitMq_Enabled - - odata-api: - image: ${REGISTRY}sf-odata-api:${SF_VERSION} - container_name: SFODataApi - ports: - # we forward the configured ports to default SF ports - - 8099:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - Hosting__Host - - Hosting__Port - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - detector: image: ${REGISTRY}sf-detector:${SF_VERSION} container_name: SFDetectCpu @@ -496,29 +257,6 @@ services: volumes: - "./iengine.lic:/etc/innovatrics/iengine.lic" - access-controller: - image: ${REGISTRY}sf-access-controller:${AC_VERSION} - container_name: SFAccessController - ports: - # we forward the configured ports to default SF ports - - 5050:${Hosting__Port} - restart: unless-stopped - environment: - - RabbitMq__HostName=${RabbitMQ__Hostname} - - RabbitMq__UserName=${RabbitMQ__Username} - - RabbitMq__Password=${RabbitMQ__Password} - - RabbitMq__Port=${RabbitMQ__Port} - - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} - env_file: .env.sfac - - sf-station: - image: ${REGISTRY}sf-station:${SFS_VERSION} - container_name: SFStation - restart: unless-stopped - ports: - - 8000:8000 - env_file: .env.sfstation - networks: default: external: diff --git a/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml index db36b491..e7e1f53e 100644 --- a/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server3/sf_dependencies/docker-compose.yml @@ -3,12 +3,14 @@ services: rmq3: image: "rabbitmq:3.10.2-management" container_name: rmq3 + expose: + - "15672" + - "5672" + - "1883" + - "4369" + - "25672" ports: - - "15672:15672" - - "5672:5672" - - "1883:1883" - - "4369:4369" - - "25672:25672" + - "15679:15672" environment: RABBITMQ_NODENAME: rabbit@rmq3 RABBITMQ_CONFIG_FILE: /etc/rabbitmq/external/rabbitmq.conf From c9f3f36c405b5227fe9332fa540694aff001e3e7 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 16:17:53 +0800 Subject: [PATCH 18/23] WIP --- .../server1/docker-compose.yml | 158 +----------------- .../server2/docker-compose.yml | 35 ---- 2 files changed, 1 insertion(+), 192 deletions(-) diff --git a/sf-docker/special/high-availability/server1/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml index 3c228ce1..2822aefc 100644 --- a/sf-docker/special/high-availability/server1/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/docker-compose.yml @@ -2,7 +2,6 @@ version: "3.4" services: sf-base: image: ${REGISTRY}sf-base:${SF_VERSION} - container_name: SFBase command: --serviceName SFBase ports: - 2406:2406 @@ -27,7 +26,6 @@ services: sf-group: image: ${REGISTRY}sf-grouping:${SF_VERSION} - container_name: SFGroup command: --serviceName SFGroup restart: unless-stopped environment: @@ -50,7 +48,6 @@ services: sf-cam-1: image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam1 command: --serviceName SFCam1 ports: - 30001:${CameraDefaults__PreviewPort} @@ -76,147 +73,8 @@ services: # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" #runtime: nvidia - sf-cam-2: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam2 - command: --serviceName SFCam2 - ports: - - 30002:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-3: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam3 - command: --serviceName SFCam3 - ports: - - 30003:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-4: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam4 - command: --serviceName SFCam4 - ports: - - 30004:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-5: - image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam5 - command: --serviceName SFCam5 - ports: - - 30005:${CameraDefaults__PreviewPort} - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - GstPipelineTemplate - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - - sf-cam-nx: - image: ${REGISTRY}sf-cam:${SF_VERSION} - # Guid needs to match ServiceInstallNames.NX_TEST_CAMERA_GUID - container_name: 53b4d78e-323f-4a0f-aa6d-99c464448b6d - command: --serviceName 53b4d78e-323f-4a0f-aa6d-99c464448b6d - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - # - Gpu__GpuNeuralRuntime=Tensor - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - # - "/var/tmp/innovatrics/tensor-rt:/var/tmp/innovatrics/tensor-rt" - #runtime: nvidia - api: image: ${REGISTRY}sf-api:${SF_VERSION} - container_name: SFApi ports: # we forward the configured ports to default SF ports - 8098:${Hosting__Port} @@ -244,7 +102,6 @@ services: sf-graphql-api: image: ${REGISTRY}sf-graphql-api:${SF_VERSION} - container_name: SFGraphQLApi ports: # we forward the configured ports to default SF ports - 8097:${Hosting__Port} @@ -265,7 +122,6 @@ services: odata-api: image: ${REGISTRY}sf-odata-api:${SF_VERSION} - container_name: SFODataApi ports: # we forward the configured ports to default SF ports - 8099:${Hosting__Port} @@ -292,7 +148,6 @@ services: detector: image: ${REGISTRY}sf-detector:${SF_VERSION} - container_name: SFDetectCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -311,7 +166,6 @@ services: pedestrian-detector: image: ${REGISTRY}sf-pedestrian-detector:${SF_VERSION} - container_name: SFPedestrianDetectCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -330,7 +184,6 @@ services: extractor: image: ${REGISTRY}sf-extractor:${SF_VERSION} - container_name: SFExtractCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -349,7 +202,6 @@ services: matcher: image: ${REGISTRY}sf-matcher:${SF_VERSION} - container_name: SFWatchlistMatcher restart: unless-stopped environment: - RabbitMQ__Hostname @@ -367,7 +219,6 @@ services: face-matcher: image: ${REGISTRY}sf-face-matcher:${SF_VERSION} - container_name: SFFaceMatcher restart: unless-stopped environment: - RabbitMQ__Hostname @@ -384,7 +235,6 @@ services: liveness: image: ${REGISTRY}sf-liveness:${SF_VERSION} - container_name: SFLiveness restart: unless-stopped environment: - RabbitMQ__Hostname @@ -403,7 +253,6 @@ services: video-aggregator: image: ${REGISTRY}sf-video-aggregator:${SF_VERSION} - container_name: SFVideoDataAggregator restart: unless-stopped environment: - RabbitMQ__Hostname @@ -425,7 +274,6 @@ services: video-collector: image: ${REGISTRY}sf-video-collector:${SF_VERSION} - container_name: SFVideoDataCollector restart: unless-stopped environment: - RabbitMQ__Hostname @@ -447,7 +295,6 @@ services: video-reader: image: ${REGISTRY}sf-video-reader:${SF_VERSION} - container_name: SFVideoReader restart: unless-stopped environment: - RabbitMQ__Hostname @@ -466,7 +313,6 @@ services: body-parts-detector: image: ${REGISTRY}sf-body-parts-detector:${SF_VERSION} - container_name: SFBodyPartsDetectCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -481,7 +327,6 @@ services: edge-stream-processor: image: ${REGISTRY}sf-edge-stream-processor:${SF_VERSION} - container_name: SFEdgeStreamProcessor restart: unless-stopped environment: - RabbitMQ__Hostname @@ -498,7 +343,6 @@ services: sf-station: image: ${REGISTRY}sf-station:${SFS_VERSION} - container_name: SFStation restart: unless-stopped ports: - 8000:8000 @@ -507,4 +351,4 @@ services: networks: default: external: - name: HighAvailabilityClusterNetwork + name: HighAvailabilityClusterNetwork \ No newline at end of file diff --git a/sf-docker/special/high-availability/server2/docker-compose.yml b/sf-docker/special/high-availability/server2/docker-compose.yml index 16c86360..cf0586e4 100644 --- a/sf-docker/special/high-availability/server2/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/docker-compose.yml @@ -1,31 +1,7 @@ version: "3.4" services: - sf-group: - image: ${REGISTRY}sf-grouping:${SF_VERSION} - container_name: SFGroup - command: --serviceName SFGroup - restart: unless-stopped - environment: - - RabbitMQ__Hostname - - RabbitMQ__Username - - RabbitMQ__Password - - RabbitMQ__Port - - ConnectionStrings__CoreDbContext - - Database__DbEngine - - AppSettings__Log_RollingFile_Enabled=false - - AppSettings__USE_JAEGER_APP_SETTINGS - - JAEGER_AGENT_HOST - - S3Bucket__Endpoint - - S3Bucket__BucketName - - S3Bucket__AccessKey - - S3Bucket__SecretKey - - NoSqlDataStorageDisabled - volumes: - - "./iengine.lic:/etc/innovatrics/iengine.lic" - sf-cam-6: image: ${REGISTRY}sf-cam:${SF_VERSION} - container_name: SFCam6 command: --serviceName SFCam6 ports: - 30006:${CameraDefaults__PreviewPort} @@ -53,7 +29,6 @@ services: detector: image: ${REGISTRY}sf-detector:${SF_VERSION} - container_name: SFDetectCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -72,7 +47,6 @@ services: pedestrian-detector: image: ${REGISTRY}sf-pedestrian-detector:${SF_VERSION} - container_name: SFPedestrianDetectCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -91,7 +65,6 @@ services: extractor: image: ${REGISTRY}sf-extractor:${SF_VERSION} - container_name: SFExtractCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -110,7 +83,6 @@ services: matcher: image: ${REGISTRY}sf-matcher:${SF_VERSION} - container_name: SFWatchlistMatcher restart: unless-stopped environment: - RabbitMQ__Hostname @@ -128,7 +100,6 @@ services: face-matcher: image: ${REGISTRY}sf-face-matcher:${SF_VERSION} - container_name: SFFaceMatcher restart: unless-stopped environment: - RabbitMQ__Hostname @@ -145,7 +116,6 @@ services: liveness: image: ${REGISTRY}sf-liveness:${SF_VERSION} - container_name: SFLiveness restart: unless-stopped environment: - RabbitMQ__Hostname @@ -164,7 +134,6 @@ services: video-aggregator: image: ${REGISTRY}sf-video-aggregator:${SF_VERSION} - container_name: SFVideoDataAggregator restart: unless-stopped environment: - RabbitMQ__Hostname @@ -186,7 +155,6 @@ services: video-collector: image: ${REGISTRY}sf-video-collector:${SF_VERSION} - container_name: SFVideoDataCollector restart: unless-stopped environment: - RabbitMQ__Hostname @@ -208,7 +176,6 @@ services: video-reader: image: ${REGISTRY}sf-video-reader:${SF_VERSION} - container_name: SFVideoReader restart: unless-stopped environment: - RabbitMQ__Hostname @@ -227,7 +194,6 @@ services: body-parts-detector: image: ${REGISTRY}sf-body-parts-detector:${SF_VERSION} - container_name: SFBodyPartsDetectCpu restart: unless-stopped environment: - RabbitMQ__Hostname @@ -242,7 +208,6 @@ services: edge-stream-processor: image: ${REGISTRY}sf-edge-stream-processor:${SF_VERSION} - container_name: SFEdgeStreamProcessor restart: unless-stopped environment: - RabbitMQ__Hostname From 91b79e8c13b3200ee834e06c188dd40997891772 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 16:23:23 +0800 Subject: [PATCH 19/23] WIP --- .../special/high-availability/server2/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sf-docker/special/high-availability/server2/docker-compose.yml b/sf-docker/special/high-availability/server2/docker-compose.yml index cf0586e4..7b2b91eb 100644 --- a/sf-docker/special/high-availability/server2/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/docker-compose.yml @@ -1,10 +1,10 @@ version: "3.4" services: - sf-cam-6: + sf-cam-2: image: ${REGISTRY}sf-cam:${SF_VERSION} - command: --serviceName SFCam6 + command: --serviceName SFCam2 ports: - - 30006:${CameraDefaults__PreviewPort} + - 30002:${CameraDefaults__PreviewPort} restart: unless-stopped environment: - RabbitMQ__Hostname From 18940e18eefc71ff92259c43dee77d11452c4209 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 16:25:11 +0800 Subject: [PATCH 20/23] WIP --- .../server1/sf_dependencies/docker-compose.yml | 4 ++-- .../server2/sf_dependencies/docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml index c75b8297..d5a0b846 100644 --- a/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/sf_dependencies/docker-compose.yml @@ -18,11 +18,11 @@ services: volumes: - ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie - ./etc_rmq/:/etc/rabbitmq/external - - rmqdata:/var/lib/rabbitmq + - rmqdata1:/var/lib/rabbitmq restart: unless-stopped volumes: - rmqdata: + rmqdata1: networks: default: diff --git a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml index fd2ba593..6b3ade4f 100644 --- a/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml +++ b/sf-docker/special/high-availability/server2/sf_dependencies/docker-compose.yml @@ -18,11 +18,11 @@ services: volumes: - ./.erlang.cookie:/var/lib/rabbitmq/.erlang.cookie - ./etc_rmq/:/etc/rabbitmq/external - - rmqdata:/var/lib/rabbitmq + - rmqdata2:/var/lib/rabbitmq restart: unless-stopped volumes: - rmqdata: + rmqdata2: networks: default: From 9b3dbe67181c812cc74c7a8143779ce2046b006c Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 16:32:48 +0800 Subject: [PATCH 21/23] WIP --- sf-docker/special/high-availability/server1/docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sf-docker/special/high-availability/server1/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml index 2822aefc..80430f6c 100644 --- a/sf-docker/special/high-availability/server1/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/docker-compose.yml @@ -75,6 +75,7 @@ services: api: image: ${REGISTRY}sf-api:${SF_VERSION} + container_name: SFApi ports: # we forward the configured ports to default SF ports - 8098:${Hosting__Port} @@ -102,6 +103,7 @@ services: sf-graphql-api: image: ${REGISTRY}sf-graphql-api:${SF_VERSION} + container_name: SFGraphQLApi ports: # we forward the configured ports to default SF ports - 8097:${Hosting__Port} @@ -122,6 +124,7 @@ services: odata-api: image: ${REGISTRY}sf-odata-api:${SF_VERSION} + container_name: SFODataApi ports: # we forward the configured ports to default SF ports - 8099:${Hosting__Port} From be9a48254afc4e8f8a20f0eb155b04740824103e Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 16:58:34 +0800 Subject: [PATCH 22/23] WIP --- .../high-availability/server1/docker-compose.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sf-docker/special/high-availability/server1/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml index 80430f6c..59099b6e 100644 --- a/sf-docker/special/high-availability/server1/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/docker-compose.yml @@ -344,6 +344,21 @@ services: volumes: - "./iengine.lic:/etc/innovatrics/iengine.lic" + access-controller: + image: ${REGISTRY}sf-access-controller:${AC_VERSION} + container_name: SFAccessController + ports: + # we forward the configured ports to default SF ports + - 5050:${Hosting__Port} + restart: unless-stopped + environment: + - RabbitMq__HostName=${RabbitMQ__Hostname} + - RabbitMq__UserName=${RabbitMQ__Username} + - RabbitMq__Password=${RabbitMQ__Password} + - RabbitMq__Port=${RabbitMQ__Port} + - Kestrel__EndPoints__Http__Url=${Hosting__Host}:${Hosting__Port} + env_file: .env.sfac + sf-station: image: ${REGISTRY}sf-station:${SFS_VERSION} restart: unless-stopped From b3e56698c3d1daed79de115ff50c4ec040386fc7 Mon Sep 17 00:00:00 2001 From: Lukas Malik Date: Thu, 27 Apr 2023 17:03:11 +0800 Subject: [PATCH 23/23] WIP --- sf-docker/special/high-availability/server1/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/sf-docker/special/high-availability/server1/docker-compose.yml b/sf-docker/special/high-availability/server1/docker-compose.yml index 59099b6e..278f1837 100644 --- a/sf-docker/special/high-availability/server1/docker-compose.yml +++ b/sf-docker/special/high-availability/server1/docker-compose.yml @@ -2,6 +2,7 @@ version: "3.4" services: sf-base: image: ${REGISTRY}sf-base:${SF_VERSION} + container_name: SFBase command: --serviceName SFBase ports: - 2406:2406