Go to file
Joseph Yiasemides e405b86259
Merge pull request #78 from poanetwork/ferigis.77.read_credentials_from_overlay
[#77] reading the credentials from the overlay
2018-09-04 08:01:57 +02:00
.circleci [#74] generating the new Doc 2018-08-23 05:56:16 -06:00
config [#77] reding the credentials from the overlay 2018-09-03 07:00:57 -06:00
doc [#74] generating the new Doc 2018-08-23 05:56:16 -06:00
lib [#77] reding the credentials from the overlay 2018-09-03 07:00:57 -06:00
pages [#71] Adding Getting Started guide 2018-08-21 06:07:44 -06:00
rel [#40] Introduce and document executable assembley 2018-05-21 15:35:39 +02:00
test [#77] reding the credentials from the overlay 2018-09-03 07:00:57 -06:00
.gitignore [#57] improving documentation 2018-07-06 14:59:27 -06:00
LICENSE Initial commit 2018-04-24 10:13:33 -04:00
README.md [#71] Adding Getting Started guide 2018-08-21 06:07:44 -06:00
coveralls.json [#30] excluding Collector and Transfer for being covered directly 2018-05-17 09:56:43 -06:00
mix.exs [#73] adding system metric collector 2018-08-27 07:13:39 -06:00
mix.lock [#59] migrate to message pack 2018-07-09 09:27:05 -06:00

README.md

POAAgent

Coverage Status codecov

Documentation

Or you can build the documenation locally running

mix deps.get
mix docs

That command will create a doc/ folder with the actual Documentation.

Run

POAAgent is an Elixir application, in order to run it first we need to fetch the dependencies and compile it.

mix deps.get
mix deps.compile
mix compile

To run the Elixir application while under development it may be convenient to use: env MIX_ENV=dev mix run --no-halt with an appropiate configuration in /config/dev.exs.

Run Tests

In order to run the tests we have to run the command

mix test

POAAgent comes also with a code analysis tool Credo and a types checker tool Dialyxir. In order to run them we have to run

mix credo
mix dialyzer

Building & Deploying an Executable

To build an executable you'll need Elixir 1.6 (and Erlang/OTP 20).

  1. Once you have a copy of this repository configure the agent for production in the file config/prod.exs.
  2. An real configuration example can be found in the default config/prod.exs.
  3. Do a mix deps.get to fetch, among other dependencies, the tooling for building server executables.
  4. A env MIX_ENV=prod mix release --name=poa_agent --env=prod will assemble an executable.

A resulting artifact resides at _build/prod/rel/poa_agent/releases/0.1.0/poa_agent.tar.gz which you can move to a remote host. Use tar xfz then bin/poa_agent start (bin/poa_agent stop will stop the server cleanly).

If you want to run it on the local host then the procedure is as simple as: _build/prod/rel/poa_agent/bin/poa_agent.

Note: executables must be built on the platform (OS and architecture) they are destined for under the project's current configuration. Other options are possible (see https://hexdocs.pm/distillery/getting-started.html).

Configuration

Executables are built with a configuration as described above. However the transfers and collectors are configurable at run-time through a JSON configuration. To configure this supply a path to a JSON file with the config_overlay key/value. The following is an extract from config/test.exs:

config :poa_agent,
    config_overlay: "config/config_overlay.json"

A corresponding example is provided in config/config_overlay.json:

{
    "POAAgent":{
        "collectors":[
            {
                "id": "eth_information",
                "url": "http://localhost:8546",
                "name": "NewNodeName",
                "contact": "mynewemail@gmail.com"
            }
        ],
        "transfers":[
            {
                "id": "rest_transfer",
                "address": "http://localhost:4003",
                "identifier": "NewIdentifier",
                "secret": "newsecret"
            }
        ]
    }
}

The file can reside anywhere on the machine that the Elixir executable has access to. The key/value pairs in the JSON configuration will replace the defaults specified in the Elixir configuration (i.e. config/{dev,test,prod}.exs).

Coverage

To get an HTML coverage report on your own machine try env MIX_ENV=test mix coveralls.html then open cover/excoveralls.html. You can get a simple print-out with env MIX_ENV=test mix coveralls.