NoSQL Databases
MPS can support NoSQL databases. This is an optional alternative to the existing SQL-based reference deployment that uses Postgres. RPS will still require a relational database such as PostgreSQL.
NoSQL databases come in a variety of types based on their data model. The main types are document, key-value, wide-column, and graph. They provide flexible schemas and scale easily with large amounts of data and high user loads.
NoSQL support is integrated using the MongoDB API. This does not just limit integration options to MongoDB itself, but can utilize other providers such as:
MongoDB Docker Deployment¶
The below steps will show how to modify the basic Open AMT Getting Started Docker deployment to integrate MongoDB for MPS to store and reference device data.
-
Stop any running containers. This will wipe all data and devices will have to be reprovisioned against the new RPS/MPS servers.
docker compose down -v
Edit Environment Variables¶
-
Open the
.envfile. -
Add a new environment variable in the MPS section.
... MPS_JWT_SECRET=secret MPS_JWT_ISSUER=9EmRJTbIiIb4bIeSsmgcWIjrR6HyETqc MPS_MQTT_ADDRESS= MPS_DB_PROVIDER=mongo # MPS ROUTER PORT=8003 ... -
Save the file.
Edit docker-compose.yml¶
-
Open the
docker-compose.ymlfile. -
Add the Mongo image and configuration. This guide reuses the preexisting
POSTGRES_USERandPOSTGRES_PASSWORDenvironment variables for the MongoDB credentials and connection strings for easy configuration and demonstration.mongo: image: mongo restart: always ports: - 27017:27017 networks: - openamtnetwork environment: MONGO_INITDB_ROOT_USERNAME: ${POSTGRES_USER} MONGO_INITDB_ROOT_PASSWORD: ${POSTGRES_PASSWORD} -
Update connection strings of
mpsandmpsrouter.mpsrouterenvironment: MPS_CONNECTION_STRING: mongodb://${POSTGRES_USER}:${POSTGRES_PASSWORD}@mongo:27017 PORT: ${PORT} MPS_PORT: ${MPSWEBPORT}mpsenvironment: MPS_INSTANCE_NAME: '' MPS_SECRETS_PATH: ${SECRETS_PATH} MPS_VAULT_TOKEN: ${VAULT_TOKEN} MPS_VAULT_ADDRESS: ${VAULT_ADDRESS} MPS_CONNECTION_STRING: mongodb://${POSTGRES_USER}:${POSTGRES_PASSWORD}@mongo:27017 MPS_CONSUL_ENABLED: ${CONSUL_ENABLED} MPS_CONSUL_HOST: ${CONSUL_HOST} MPS_CONSUL_PORT: ${CONSUL_PORT} MPS_DB_PROVIDER: ${MPS_DB_PROVIDER} -
Save the file.
Deploy Stack¶
-
Start the containers.
docker compose up -d -
Check that all the containers are running and healthy.
docker ps --format "table {{.Image}}\t{{.Status}}\t{{.Names}}"Success
IMAGE STATUS NAMES intel/oact-rps:latest Up 19 seconds (healthy) open-amt-cloud-toolkit-rps-1 hashicorp/vault Up 19 seconds open-amt-cloud-toolkit-vault-1 intel/oact-mpsrouter:latest Up 19 seconds (healthy) open-amt-cloud-toolkit-mpsrouter-1 postgres:15 Up 19 seconds (healthy) open-amt-cloud-toolkit-db-1 intel/oact-webui:latest Up 19 seconds open-amt-cloud-toolkit-webui-1 kong:3.1 Up 19 seconds (healthy) open-amt-cloud-toolkit-kong-1 intel/oact-mps:latest Up 19 seconds (healthy) open-amt-cloud-toolkit-mps-1 mongo Up 19 seconds open-amt-cloud-toolkit-mongo-1 -
Now, updates will be made to the
devicescollection when actions affecting an AMT device occur (e.g. Device Provisioning/Unprovisioning).