| @@ -54,7 +54,7 @@ services: | |||
| - ./env/kafka-init.env | |||
| presense-decoder: | |||
| image: afasystemadmin/ble-ai-localizer:decoder_v1 | |||
| image: afasystemadmin/ble-ai-localizer:decoder_v1.3 | |||
| container_name: presense-decoder | |||
| env_file: | |||
| - ./env/presense-decoder.env | |||
| @@ -73,7 +73,7 @@ services: | |||
| max-file: "3" | |||
| presense-server: | |||
| image: afasystemadmin/ble-ai-localizer:server_v1 | |||
| image: afasystemadmin/ble-ai-localizer:server_v1.3 | |||
| container_name: presense-server | |||
| env_file: | |||
| - ./env/presense-server.env | |||
| @@ -94,7 +94,7 @@ services: | |||
| max-file: "3" | |||
| presense-bridge: | |||
| image: afasystemadmin/ble-ai-localizer:bridge_v1 | |||
| image: afasystemadmin/ble-ai-localizer:bridge_v1.3 | |||
| container_name: presense-bridge | |||
| env_file: | |||
| - ./env/presense-bridge.env | |||
| @@ -113,7 +113,7 @@ services: | |||
| max-file: "3" | |||
| presense-location: | |||
| image: afasystemadmin/ble-ai-localizer:location_v1 | |||
| image: afasystemadmin/ble-ai-localizer:location_v1.3 | |||
| container_name: presense-location | |||
| env_file: | |||
| - ./env/presense-location.env | |||
| @@ -0,0 +1,137 @@ | |||
| services: | |||
| db: | |||
| image: postgres:18 | |||
| container_name: db | |||
| restart: always | |||
| ports: | |||
| - "127.0.0.1:5432:5432" | |||
| env_file: | |||
| - ./env/db.env | |||
| healthcheck: | |||
| test: ["CMD-SHELL", "pg_isready -U postgres"] | |||
| interval: 5s | |||
| timeout: 5s | |||
| retries: 5 | |||
| start_period: 30s | |||
| volumes: | |||
| - pgdata:/var/postgresql/data | |||
| kafdrop: | |||
| image: obsidiandynamics/kafdrop | |||
| restart: "no" | |||
| ports: | |||
| - "127.0.0.1:9000:9000" | |||
| env_file: | |||
| - ./env/kafdrop.env | |||
| depends_on: | |||
| - "kafka" | |||
| kafka: | |||
| image: apache/kafka:3.9.0 | |||
| restart: "no" | |||
| ports: | |||
| - "127.0.0.1:9092:9092" | |||
| - "127.0.0.1:9093:9093" | |||
| env_file: | |||
| - ./env/kafka.env | |||
| healthcheck: | |||
| test: ["CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --list"] | |||
| interval: 10s | |||
| timeout: 5s | |||
| retries: 10 | |||
| start_period: 20s | |||
| volumes: | |||
| - kafkadata:/var/lib/kafka/data | |||
| kafka-init: | |||
| image: apache/kafka:3.9.0 | |||
| command: [ "sh", "-c", "ls -l /tmp/create_topic.sh && /tmp/create_topic.sh" ] | |||
| depends_on: | |||
| kafka: | |||
| condition: service_healthy | |||
| volumes: | |||
| - ./init-scripts/create_topic.sh:/tmp/create_topic.sh | |||
| env_file: | |||
| - ./env/kafka-init.env | |||
| presense-decoder: | |||
| image: afasystemadmin/ble-ai-localizer:decoder_v1 | |||
| container_name: presense-decoder | |||
| env_file: | |||
| - ./env/presense-decoder.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| presense-server: | |||
| image: afasystemadmin/ble-ai-localizer:server_v1 | |||
| container_name: presense-server | |||
| env_file: | |||
| - ./env/presense-server.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| ports: | |||
| - "127.0.0.1:1902:1902" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| presense-bridge: | |||
| image: afasystemadmin/ble-ai-localizer:bridge_v1 | |||
| container_name: presense-bridge | |||
| env_file: | |||
| - ./env/presense-bridge.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| presense-location: | |||
| image: afasystemadmin/ble-ai-localizer:location_v1 | |||
| container_name: presense-location | |||
| env_file: | |||
| - ./env/presense-location.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| volumes: | |||
| pgdata: | |||
| kafkadata: | |||
| @@ -0,0 +1,137 @@ | |||
| services: | |||
| db: | |||
| image: postgres:18 | |||
| container_name: db | |||
| restart: always | |||
| ports: | |||
| - "127.0.0.1:5432:5432" | |||
| env_file: | |||
| - ./env/db.env | |||
| healthcheck: | |||
| test: ["CMD-SHELL", "pg_isready -U postgres"] | |||
| interval: 5s | |||
| timeout: 5s | |||
| retries: 5 | |||
| start_period: 30s | |||
| volumes: | |||
| - pgdata:/var/postgresql/data | |||
| kafdrop: | |||
| image: obsidiandynamics/kafdrop | |||
| restart: "no" | |||
| ports: | |||
| - "127.0.0.1:9000:9000" | |||
| env_file: | |||
| - ./env/kafdrop.env | |||
| depends_on: | |||
| - "kafka" | |||
| kafka: | |||
| image: apache/kafka:3.9.0 | |||
| restart: "no" | |||
| ports: | |||
| - "127.0.0.1:9092:9092" | |||
| - "127.0.0.1:9093:9093" | |||
| env_file: | |||
| - ./env/kafka.env | |||
| healthcheck: | |||
| test: ["CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --list"] | |||
| interval: 10s | |||
| timeout: 5s | |||
| retries: 10 | |||
| start_period: 20s | |||
| volumes: | |||
| - kafkadata:/var/lib/kafka/data | |||
| kafka-init: | |||
| image: apache/kafka:3.9.0 | |||
| command: [ "sh", "-c", "ls -l /tmp/create_topic.sh && /tmp/create_topic.sh" ] | |||
| depends_on: | |||
| kafka: | |||
| condition: service_healthy | |||
| volumes: | |||
| - ./init-scripts/create_topic.sh:/tmp/create_topic.sh | |||
| env_file: | |||
| - ./env/kafka-init.env | |||
| presense-decoder: | |||
| image: afasystemadmin/ble-ai-localizer:decoder_v1.3 | |||
| container_name: presense-decoder | |||
| env_file: | |||
| - ./env/presense-decoder.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| presense-server: | |||
| image: afasystemadmin/ble-ai-localizer:server_v1.3 | |||
| container_name: presense-server | |||
| env_file: | |||
| - ./env/presense-server.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| ports: | |||
| - "127.0.0.1:1902:1902" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| presense-bridge: | |||
| image: afasystemadmin/ble-ai-localizer:bridge_v1.3 | |||
| container_name: presense-bridge | |||
| env_file: | |||
| - ./env/presense-bridge.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| presense-location: | |||
| image: afasystemadmin/ble-ai-localizer:location_v1.3 | |||
| container_name: presense-location | |||
| env_file: | |||
| - ./env/presense-location.env | |||
| environment: | |||
| LOG_LEVEL: "info" | |||
| depends_on: | |||
| kafka-init: | |||
| condition: service_completed_successfully | |||
| db: | |||
| condition: service_healthy | |||
| restart: always | |||
| logging: | |||
| driver: "json-file" | |||
| options: | |||
| max-size: "10m" | |||
| max-file: "3" | |||
| volumes: | |||
| pgdata: | |||
| kafkadata: | |||
| @@ -1,5 +1,5 @@ | |||
| KAFKA_URL=kafka:29092 | |||
| MQTT_HOST=192.168.1.101 | |||
| MQTT_HOST=127.0.0.1 | |||
| MQTT_USERNAME=user | |||
| MQTT_PASSWORD=pass | |||
| MQTT_CLIENT_ID=bridge | |||
| @@ -4,5 +4,7 @@ ClientSecret=wojuoB7Z5xhlPFrF2lIxJSSdVHCApEgC | |||
| HTTPUsername=core | |||
| HTTPPassword=C0r3_us3r_Cr3d3nt14ls | |||
| HTTPAudience=Fastapi | |||
| API_AUTH_URL=https://10.251.0.30:10002 | |||
| API_AUTH_URL=https://presensersapistilli.primomiglio.it/mnsso | |||
| ALGORITHM=ai | |||
| API_BASE_URL=https://presensersapistilli.primomiglio.it:5050 | |||
| API_AUTH_REALM=realms/primomiglio.it/protocol/openid-connect/token | |||
| @@ -10,6 +10,7 @@ HTTPPassword=C0r3_us3r_Cr3d3nt14ls | |||
| HTTPAudience=Fastapi | |||
| HTTPADDR=0.0.0.0:1902 | |||
| CONFIG_PATH=/app/cmd/server/config.json | |||
| API_BASE_URL=https://10.251.0.30:5050 | |||
| API_AUTH_URL=https://10.251.0.30:10002 | |||
| API_BASE_URL=https://presensersapistilli.primomiglio.it:5050 | |||
| API_AUTH_URL=https://presensersapistilli.primomiglio.it/mnsso | |||
| API_AUTH_REALM=realms/primomiglio.it/protocol/openid-connect/token | |||
| ALGORITHM=ai | |||
| @@ -24,7 +24,7 @@ func GetToken(ctx context.Context, cfg *config.Config, client *http.Client) (str | |||
| formData.Set("password", cfg.HTTPPassword) | |||
| formData.Set("audience", cfg.HTTPAudience) | |||
| req, err := http.NewRequest("POST", fmt.Sprintf("%s/realms/API.Server.local/protocol/openid-connect/token", cfg.APIAuthURL), strings.NewReader(formData.Encode())) | |||
| req, err := http.NewRequest("POST", fmt.Sprintf("%s/%s", cfg.APIAuthURL, cfg.APIAuthREALM), strings.NewReader(formData.Encode())) | |||
| if err != nil { | |||
| return "", err | |||
| } | |||
| @@ -26,6 +26,7 @@ type Config struct { | |||
| ConfigPath string | |||
| APIBaseURL string | |||
| APIAuthURL string | |||
| APIAuthREALM string | |||
| // TLSInsecureSkipVerify enables skipping TLS cert verification (e.g. for dev); default false. | |||
| TLSInsecureSkipVerify bool | |||
| } | |||
| @@ -74,6 +75,7 @@ func Load() *Config { | |||
| HTTPAudience: getEnvPanic("HTTPAudience"), | |||
| ConfigPath: getEnv("CONFIG_PATH", "/app/cmd/server/config.json"), | |||
| APIBaseURL: getEnv("API_BASE_URL", "https://10.251.0.30:5050"), | |||
| APIAuthREALM: getEnv("API_AUTH_REALM", "realms/API.Server.local/protocol/openid-connect/token"), | |||
| TLSInsecureSkipVerify: getEnvBool("TLS_INSECURE_SKIP_VERIFY", false), | |||
| } | |||
| } | |||
| @@ -100,6 +102,7 @@ func LoadServer() *Config { | |||
| ConfigPath: getEnv("CONFIG_PATH", "/app/cmd/server/config.json"), | |||
| APIBaseURL: getEnv("API_BASE_URL", "https://10.251.0.30:5050"), | |||
| APIAuthURL: getEnv("API_AUTH_URL", "https://10.251.0.30:10002"), | |||
| APIAuthREALM: getEnv("API_AUTH_REALM", "realms/API.Server.local/protocol/openid-connect/token"), | |||
| TLSInsecureSkipVerify: getEnvBool("TLS_INSECURE_SKIP_VERIFY", false), | |||
| } | |||
| } | |||
| @@ -125,6 +128,7 @@ func LoadLocation() *Config { | |||
| HTTPAudience: getEnvPanic("HTTPAudience"), | |||
| APIAuthURL: getEnv("API_AUTH_URL", "https://10.251.0.30:10002"), | |||
| APIBaseURL: getEnv("API_BASE_URL", "https://10.251.0.30:5050"), | |||
| APIAuthREALM: getEnv("API_AUTH_REALM", "realms/API.Server.local/protocol/openid-connect/token"), | |||
| } | |||
| } | |||
| @@ -1,20 +1,20 @@ | |||
| #!/bin/bash | |||
| # Build the server | |||
| docker build -t afasystemadmin/ble-ai-localizer:server_v1.2 -f ../../build/package/Dockerfile.server ../../ | |||
| docker build -t afasystemadmin/ble-ai-localizer:server_v1.3 -f ../../build/package/Dockerfile.server ../../ | |||
| # Build the location | |||
| docker build -t afasystemadmin/ble-ai-localizer:location_v1.2 -f ../../build/package/Dockerfile.location ../../ | |||
| docker build -t afasystemadmin/ble-ai-localizer:location_v1.3 -f ../../build/package/Dockerfile.location ../../ | |||
| # Build the decoder | |||
| docker build -t afasystemadmin/ble-ai-localizer:decoder_v1.2 -f ../../build/package/Dockerfile.decoder ../../ | |||
| docker build -t afasystemadmin/ble-ai-localizer:decoder_v1.3 -f ../../build/package/Dockerfile.decoder ../../ | |||
| # Build the bridge | |||
| docker build -t afasystemadmin/ble-ai-localizer:bridge_v1.2 -f ../../build/package/Dockerfile.bridge ../../ | |||
| docker build -t afasystemadmin/ble-ai-localizer:bridge_v1.3 -f ../../build/package/Dockerfile.bridge ../../ | |||
| docker image ls | |||
| docker push afasystemadmin/ble-ai-localizer:server_v1.2 | |||
| docker push afasystemadmin/ble-ai-localizer:location_v1.2 | |||
| docker push afasystemadmin/ble-ai-localizer:decoder_v1.2 | |||
| docker push afasystemadmin/ble-ai-localizer:bridge_v1.2 | |||
| docker push afasystemadmin/ble-ai-localizer:server_v1.3 | |||
| docker push afasystemadmin/ble-ai-localizer:location_v1.3 | |||
| docker push afasystemadmin/ble-ai-localizer:decoder_v1.3 | |||
| docker push afasystemadmin/ble-ai-localizer:bridge_v1.3 | |||