Go to file
Felipe Ripoll 2cfd02b664 [#45] Endpoint for blacklist tokens 2018-08-10 06:26:42 -06:00
.circleci [#45] Endpoint for blacklist tokens 2018-08-10 06:26:42 -06:00
assets [#24] improving Documentation 2018-07-06 12:57:28 -06:00
config [#43] return token_expired when the JWT token expires 2018-08-08 17:34:44 -06:00
doc [#28] migrating to message pack 2018-07-09 07:58:47 -06:00
lib [#45] Endpoint for blacklist tokens 2018-08-10 06:26:42 -06:00
pages [#24] improving Documentation 2018-07-06 12:57:28 -06:00
priv/repo/migrations [#45] Endpoint for blacklist tokens 2018-08-10 06:26:42 -06:00
rel [#26] building a release 2018-07-06 16:00:34 -06:00
test [#45] Endpoint for blacklist tokens 2018-08-10 06:26:42 -06:00
.gitignore [#37] adding endpoint for creating users 2018-08-07 05:59:16 -06:00
LICENSE Create LICENSE 2018-05-25 17:29:12 +03:00
README.md [#33] adding mnesia and setting up users 2018-07-30 06:43:16 -06:00
coveralls.json [#14] designing receiver's mechanism 2018-06-18 13:29:23 -06:00
mix.exs [#35] adding sessions endpoint over https 2018-08-01 08:18:50 -06:00
mix.lock [#35] adding sessions endpoint over https 2018-08-01 08:18:50 -06:00

README.md

POABackend

Coverage Status codecov

Storage and data-processing companion for the poa-netstats-agent

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 Tests

POABackend uses Mnesia as a local database with Ecto. In order to have this running we have to create a folder where Mnesia will store our data. In order to do that we have to define it in the config/test.exs file like this:

config :mnesia,
  dir: 'your/local/path' # make sure this directory exists!

once we have the path defined we have to create the database (those commands must be run only once if you are going to use always this same path for testing). In your root folder run:

MIX_ENV=test mix ecto.create
MIX_ENV=test mix ecto.migrate

Now the environment is set. We can run the tests with:

mix test

POABackend 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 backend for production in the file config/prod.exs.
  2. An example configuration can be found in the current 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_backend --env=prod will assemble an executable.

A resulting artifact resides at _build/prod/rel/poa_backend/releases/0.1.0/poa_backend.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_backend/bin/poa_backend.

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).