Merge pull request #27 from poanetwork/ferigis.26.build_release

Ferigis.26.build release
This commit is contained in:
Joseph Yiasemides 2018-07-09 12:37:34 +02:00 committed by GitHub
commit d9b2e033c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 3 deletions

View File

@ -32,4 +32,21 @@ mix test
```
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`).

View File

@ -1,7 +1,46 @@
use Mix.Config
config :poa_backend,
:secret, "mysecret"
# configuration for custom handlers. The format is {custom_handler_name, module, args}
config :poa_backend,
:custom_handlers,
[
{:rest_custom_handler, POABackend.CustomHandler.REST, [scheme: :http, port: 4002]}
]
# configuration of the Receivers we want to start. The format is {id, module, args}
config :poa_backend,
:receivers,
[
# {:dynamodb_receiver, POABackend.Receivers.DynamoDB, [
# scheme: "http://",
# host: "localhost",
# port: 8000,
# access_key_id: "BogusAwsAccessKeyId",
# secret_access_key: "BogusAwsSecretAccessKey",
# region: "us-east-1"
# ]}
{:dashboard_receiver, POABackend.Receivers.Dashboard, [
scheme: :http,
ws_url: "/ws",
port: 8181,
ws_secret: "wssecret"
]}
]
# here we define the type of metrics we accept. We will create a GenStage Producer per each type
config :poa_backend,
:metrics,
[
:ethereum_metrics
]
# here we have to define the relationship between receivers and metric types. The format is {receiver_id, [metric_type]}.
# one receiver can subscribe to multiple metric types
config :poa_backend,
:subscriptions,
[
{:dashboard_receiver, [:ethereum_metrics]}
]

View File

@ -44,14 +44,16 @@ defmodule POABackend.MixProject do
{:websockex, "~> 0.4", only: [:test]},
# Docs
{:ex_doc, "~> 0.18", only: :dev, runtime: false}
{:ex_doc, "~> 0.18", only: :dev, runtime: false},
# Releases
{:distillery, "~> 1.5", runtime: false}
]
end
defp docs do
[
source_ref: "v#{@version}",
# main: "POABackend",
source_url: "https://github.com/poanetwork/poa-netstats-wharehouse",
extras: ["pages/initial_architecture.md": [filename: "initial_architecture", title: "Initial Architecture"]],
groups_for_modules: [

View File

@ -5,6 +5,7 @@
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"},
"credo": {:hex, :credo, "0.9.3", "76fa3e9e497ab282e0cf64b98a624aa11da702854c52c82db1bf24e54ab7c97a", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"},
"distillery": {:hex, :distillery, "1.5.3", "b2f4fc34ec71ab4f1202a796f9290e068883b042319aa8c9aa45377ecac8597a", [], [], "hexpm"},
"earmark": {:hex, :earmark, "1.2.5", "4d21980d5d2862a2e13ec3c49ad9ad783ffc7ca5769cf6ff891a4553fbaae761", [:mix], [], "hexpm"},
"ex_aws": {:hex, :ex_aws, "2.0.2", "8df2f96f58624a399abe5a0ce26db648ee848aca6393b9c65c939ece9ac07bfa", [:mix], [{:configparser_ex, "~> 2.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "1.6.3 or 1.6.5 or 1.7.1 or 1.8.6 or ~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optional: true]}, {:poison, ">= 1.2.0", [hex: :poison, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:xml_builder, "~> 0.1.0", [hex: :xml_builder, repo: "hexpm", optional: true]}], "hexpm"},
"ex_aws_dynamo": {:hex, :ex_aws_dynamo, "2.0.0", "07b1117bbd1b1d04e2598190834c69c271db1d357cc21b82240d1a0b17194165", [:mix], [{:ex_aws, "~> 2.0.0", [hex: :ex_aws, repo: "hexpm", optional: false]}], "hexpm"},

17
rel/config.exs Normal file
View File

@ -0,0 +1,17 @@
use Mix.Releases.Config,
default_release: :poa_backend,
default_environment: :prod
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"O*Ke`PUEMlN@H@XJWeV6:(@rsc!]Rh^RhxfuNysi6eYr%<rZ./V4%DVh]N}Xbc?,"
end
release :poa_backend do
set version: current_version(:poa_backend)
set applications: [
:runtime_tools
]
end