- Build image
docker build -t danger-zone-ms .
- Run image
docker run -d --name danger-zone-ms \ -e POSTGRES_HOST='localhost:5432' \ -e POSTGRES_USER='postgres' \ -e POSTGRES_PASSWORD='' \ -e REDIS_HOST='redis:6379' \ -e REDIS_PASSWORD='' \ -e REDIS_CHANNEL_CREATE_ZONE='c-dangerzone:create' \ -e REDIS_CHANNEL_DELETE_ZONE='c-dangerzone:delete' \ --network hte \ -p 8080:8080 \ danger-zone-ms
title Danger Zone MicroService
participant "Mobile App" as app
participant "Danger zone MicroService" as danger_ms
database "Redis" as redis
database "MongoDB" as mongo
==Create danger zone==
app->danger_ms: POST /dangerzones {deviceID, lat, lon, radius, ttl}
danger_ms->mongo: Create item
danger_ms->redis: PUBLISH c-dangerzones:create {deviceID, lat, lon, radius, ttl}
app<--danger_ms:201 {deviceID, lat, lon, radius, ttl}
==Get all danger zones==
app->danger_ms: GET /dangerzones
danger_ms->mongo: Read item
app<--danger_ms:200 [{deviceID, lat, lon, radius, ttl}, ...]
==Get danger zone by device ID==
app->danger_ms: GET /dangerzones?device_id=deviceID
danger_ms->mongo: Read item
app<--danger_ms:200 {deviceID, lat, lon, radius, ttl}
==Delete danger zone==
app->danger_ms: DELETE /dangerzones?device_id=deviceID
danger_ms->mongo: Delete item
danger_ms->redis:PUBLISH c-dangerzones:delete deviceID
app<--danger_ms:204