Giter Site home page Giter Site logo

decode-system-test's Introduction

decode-system-test

This repo will contain a docker-compose config linking together the components developed for the DECODE IoT pilot, demonstrating how they can work together in order to provide the proposed functionality.

Requirements

  • Docker (with compose) - recent build
  • make (not required, but convenient at least on Linux/OSX)

Running the components

To run the components you should just be able to run:

$ make start

This should pull and start all components running, with some logic to ensure all required databases within Postgres are created, and that services wait for Postgres to be ready before they try and run.

Note this is just a convenience helper for docker-compose up here.

Or to clean everything:

$ make teardown

This final command should remove all components including volumes and networks.

If you do not have make available, you can run all services directly provided you have docker-compose available.

To start manually:

$ docker-compose up

Services

Once everything has started you should have the following components running:

Component Configuration

For sensitive configuration values, you can add a .env file based on the template file included here.

Datastore

The binary generated for this application is called iotstore. It has the following four subcommands:

  • delete - can be used to delete old data from the database
  • help - displays help informmation
  • migrate - allows database migrations to be created and applied
  • server - the primary command that starts up the server.

For operational use the server command is the only one that is generally required.

Configuration for server command

Flag Environment Variable Description Default value Required
--addr or -a IOTSTORE_ADDR The address to which the server binds :8080 No
--domains IOTSTORE_DOMAINS Comma separated list of domains to obtain TLS certs No
--verbose IOTSTORE_VERBOSE Flag that if set enables verbose mode False No
--database-url or -d IOTSTORE_DATABASE_URL Connection string for Postgres database Yes
SENTRY_DSN Optional DSN string for Sentry error reporting No

Encoder

The binary generated for this application is called iotenc. It has the following four subcommands:

  • help - displays help informmation
  • migrate - allows database migrations to be created and applied
  • server - the primary command that starts up the server.

For operational use the server command is the only one that is generally required.

Configuration for server command

Flag Environment Variable Description Default value Required
--addr or -a IOTENCODER_ADDR The address to which the server binds :8081 No
--broker-addr or -b IOTENCODER_BROKER_ADDR Address at which the MQTT broker is listening tcps://mqtt.smartcitizen.me:8883 No
--database-url IOTENCODER_DATABASE_URL Connection string for Postgres database Yes
--datastore or -d IOTENCODER_DATASTORE Address at which the datastore component is listening Yes
--domains IOTENCODER_DOMAINS Comma separated list of domains to obtain TLS certs No
--encryption-password IOTENCODER_ENCRYPTION_PASSWORD Password used to encrypt secret tokens we write to Postgres Yes
--hashid-length or -l IOTENCODER_HASHID_LENGTH Minimum length of generated ids for streams 8 No
--hashid-salt IOTENCODER_HASHID_SALT Salt value used for generating ids for streams Yes
--verbose IOTENCODER_VERBOSE Flag that if set enables verbose mode False No
SENTRY_DSN Optional DSN string for Sentry error reporting No

Policystore

Configuration

The binary generated for this application is called policystore. It has the following four subcommands:

  • help - displays help informmation
  • migrate - allows database migrations to be created and applied
  • server - the primary command that starts up the server.

For operational use the server command is the only one that is generally required.

Configuration for server command

Flag Environment Variable Description Default value Required
--addr or -a POLICYSTORE_ADDR The address to which the server binds 0.0.0.0:8082 No
--database-url or -d POLICYSTORE_DATABASE_URL URL at which Postgres is listening Yes
--domains POLICYSTORE_DOMAINS Comma separated list of domains for TLS certs No
--encryption-password POLICYSTORE_ENCRYPTION_PASSWORD Password used to encrypt secrets in the DB Yes
--hashid-length or -l POLICYSTORE_HASHID_LENGTH Minimum length of generated IDs 8 No
--hashid-salt POLICYSTORE_HASHID_SALT Salt value used when generating IDs Yes
SENTRY_DSN Optional DSN string for Sentry error reporting No

decode-system-test's People

Contributors

chespinoza avatar smulube avatar

Watchers

 avatar uh avatar James Cloos avatar

decode-system-test's Issues

Unbound variable when running the test_script.sh

./test_script.sh  create_stream
--> create a stream
./test_script.sh: line 16: $1: unbound variable

local data="{\"device_token\":\"$1\",\"policy_id\":\"$2\",\"recipient_public_key\":\"$3\",\"location\":{\"longitude\":0.023,\"latitude\":55.253},\"exposure\":\"INDOOR\",\"operations\":[]}"

It also happens with
./test_script.sh print
./test_script.sh: line 10: $1: unbound variable

Why are we exposing ports in docker-compose.yml ?

Why do we need to expose all the ports like postgres 5432?

  • This means they will be accessible on the the host unless the host installs and configures some kind of firewall.
  • All the containers are on the same internal Docker network, so they don't need to expose all the ports

Why are we using a Makefile?

Is it not just adding a layer of complexity?

I personally prefer to use the docker-compose command, aliased as just doco ๐Ÿ˜„

When the readme tells me to use the make command, I have to read the Makefile and see what is does, thus, adding an extra layer. I also had to find out what .PHONY does in the Makefile ๐Ÿค“

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.