Co-authored-by: Alex Garibay <alex.garibay@dockyard.com>pull/86/head
@ -0,0 +1,36 @@ |
|||||||
|
# POA Explorer |
||||||
|
|
||||||
|
This is a tool for inspecting and analyzing the POA Network blockchain. |
||||||
|
|
||||||
|
|
||||||
|
## Machine Requirements |
||||||
|
|
||||||
|
* Erlang/OTP 20.2+ |
||||||
|
* Elixir 1.5+ |
||||||
|
* Postgres 10.0 |
||||||
|
|
||||||
|
|
||||||
|
## Required Accounts |
||||||
|
|
||||||
|
* Heroku for deployment |
||||||
|
* Github for code storage |
||||||
|
|
||||||
|
|
||||||
|
## Setup Instructions |
||||||
|
|
||||||
|
### Development |
||||||
|
|
||||||
|
To get POA Explorer up and running locally: |
||||||
|
|
||||||
|
* Set up some default configuration with: `$ cp config/dev.secret.exs.example config/dev.secret.esx` |
||||||
|
* Install dependencies with `$ mix do deps.get, local.rebar, deps.compile, compile` |
||||||
|
* Create and migrate your database with `$ mix ecto.create && mix ecto.migrate` |
||||||
|
* Run IEx (Interactive Elixir) to access the index and explore: `$ iex -S mix` |
||||||
|
|
||||||
|
### Testing |
||||||
|
|
||||||
|
* Format the Elixir code: `$ mix format` |
||||||
|
* Run the test suite: `$ mix test` |
||||||
|
* Lint the Elixir code: `$ mix credo --strict` |
||||||
|
* Run the dialyzer: `mix dialyzer --halt-exit-status` |
||||||
|
* Check the Elixir code for vulnerabilities: `$ mix sobelow --config` |
@ -1,9 +1,6 @@ |
|||||||
ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) |
ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) |
||||||
ExUnit.start() |
ExUnit.start() |
||||||
|
|
||||||
{:ok, _} = Application.ensure_all_started(:wallaby) |
|
||||||
Application.put_env(:wallaby, :base_url, ExplorerWeb.Endpoint.url()) |
|
||||||
|
|
||||||
{:ok, _} = Application.ensure_all_started(:ex_machina) |
{:ok, _} = Application.ensure_all_started(:ex_machina) |
||||||
|
|
||||||
Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual) |
Ecto.Adapters.SQL.Sandbox.mode(Explorer.Repo, :manual) |
||||||
|
@ -0,0 +1,48 @@ |
|||||||
|
# POA Explorer Web |
||||||
|
|
||||||
|
This is a tool for inspecting and analyzing the POA Network blockchain from a web browser. |
||||||
|
|
||||||
|
## Machine Requirements |
||||||
|
|
||||||
|
* Erlang/OTP 20.2+ |
||||||
|
* Elixir 1.5+ |
||||||
|
* Postgres 10.0 |
||||||
|
|
||||||
|
|
||||||
|
## Required Accounts |
||||||
|
|
||||||
|
* Heroku for deployment |
||||||
|
* Github for code storage |
||||||
|
|
||||||
|
|
||||||
|
## Setup Instructions |
||||||
|
|
||||||
|
### Development |
||||||
|
|
||||||
|
To get POA Explorer Web interface up and running locally: |
||||||
|
|
||||||
|
* Setup `../explorer` |
||||||
|
* Set up some default configuration with: `$ cp config/dev.secret.exs.example config/dev.secret.esx` |
||||||
|
* Install Node.js dependencies with `$ cd assets && npm install && cd ..` |
||||||
|
* Start Phoenix with `$ mix phx.server` (This can be run from this directory or the project root: the project root is recommended.) |
||||||
|
|
||||||
|
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. |
||||||
|
|
||||||
|
You can also run IEx (Interactive Elixir): `$ iex -S mix phx.server` (This can be run from this directory or the project root: the project root is recommended.) |
||||||
|
|
||||||
|
### Testing |
||||||
|
|
||||||
|
* Build the assets: `$ cd assets && yarn build` |
||||||
|
* Format the Elixir code: `$ mix format` |
||||||
|
* Run the test suite: `$ mix test` |
||||||
|
* Lint the Elixir code: `$ mix credo --strict` |
||||||
|
* Run the dialyzer: `mix dialyzer --halt-exit-status` |
||||||
|
* Check the Elixir code for vulnerabilities: `$ mix sobelow --config` |
||||||
|
* Lint the JavaScript code: `$ cd assets && yarn eslint` |
||||||
|
|
||||||
|
|
||||||
|
## Internationalization |
||||||
|
|
||||||
|
The app is currently internationalized. It is only localized to U.S. English. |
||||||
|
|
||||||
|
To translate new strings, run `$ mix gettext.extract --merge` and edit the new strings in `priv/gettext/en/LC_MESSAGES/default.po`. |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1014 B After Width: | Height: | Size: 1014 B |
Before Width: | Height: | Size: 935 B After Width: | Height: | Size: 935 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 983 B After Width: | Height: | Size: 983 B |
@ -0,0 +1,31 @@ |
|||||||
|
# This file is responsible for configuring your application |
||||||
|
# and its dependencies with the aid of the Mix.Config module. |
||||||
|
# |
||||||
|
# This configuration file is loaded before any dependency and |
||||||
|
# is restricted to this project. |
||||||
|
use Mix.Config |
||||||
|
|
||||||
|
# General application configuration |
||||||
|
config :explorer_web, |
||||||
|
namespace: ExplorerWeb, |
||||||
|
ecto_repos: [Explorer.Repo] |
||||||
|
|
||||||
|
# Configures gettext |
||||||
|
config :explorer_web, ExplorerWeb.Gettext, locales: ~w(en), default_locale: "en" |
||||||
|
|
||||||
|
# Configures the endpoint |
||||||
|
config :explorer_web, ExplorerWeb.Endpoint, |
||||||
|
url: [host: "localhost"], |
||||||
|
render_errors: [view: ExplorerWeb.ErrorView, accepts: ~w(html json)], |
||||||
|
pubsub: [name: ExplorerWeb.PubSub, adapter: Phoenix.PubSub.PG2] |
||||||
|
|
||||||
|
config :ex_cldr, |
||||||
|
default_locale: "en", |
||||||
|
locales: ["en"], |
||||||
|
gettext: ExplorerWeb.Gettext |
||||||
|
|
||||||
|
config :exq_ui, server: false |
||||||
|
|
||||||
|
# Import environment specific config. This must remain at the bottom |
||||||
|
# of this file so it overrides the configuration defined above. |
||||||
|
import_config "#{Mix.env()}.exs" |
@ -0,0 +1,54 @@ |
|||||||
|
use Mix.Config |
||||||
|
|
||||||
|
# For development, we disable any cache and enable |
||||||
|
# debugging and code reloading. |
||||||
|
# |
||||||
|
# The watchers configuration can be used to run external |
||||||
|
# watchers to your application. For example, we use it |
||||||
|
# with brunch.io to recompile .js and .css sources. |
||||||
|
config :explorer_web, ExplorerWeb.Endpoint, |
||||||
|
http: [port: 4000], |
||||||
|
debug_errors: true, |
||||||
|
code_reloader: true, |
||||||
|
check_origin: false, |
||||||
|
watchers: [ |
||||||
|
node: [ |
||||||
|
"node_modules/brunch/bin/brunch", |
||||||
|
"watch", |
||||||
|
"--stdin", |
||||||
|
cd: Path.expand("../assets", __DIR__) |
||||||
|
] |
||||||
|
] |
||||||
|
|
||||||
|
# ## SSL Support |
||||||
|
# |
||||||
|
# In order to use HTTPS in development, a self-signed |
||||||
|
# certificate can be generated by running the following |
||||||
|
# command from your terminal: |
||||||
|
# |
||||||
|
# openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout priv/server.key -out priv/server.pem |
||||||
|
# |
||||||
|
# The `http:` config above can be replaced with: |
||||||
|
# |
||||||
|
# https: [port: 4000, keyfile: "priv/server.key", certfile: "priv/server.pem"], |
||||||
|
# |
||||||
|
# If desired, both `http:` and `https:` keys can be |
||||||
|
# configured to run both http and https servers on |
||||||
|
# different ports. |
||||||
|
|
||||||
|
# Watch static and templates for browser reloading. |
||||||
|
config :explorer_web, ExplorerWeb.Endpoint, |
||||||
|
live_reload: [ |
||||||
|
patterns: [ |
||||||
|
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$}, |
||||||
|
~r{priv/gettext/.*(po)$}, |
||||||
|
~r{lib/explorer_web/views/.*(ex)$}, |
||||||
|
~r{lib/explorer_web/templates/.*(eex)$} |
||||||
|
] |
||||||
|
] |
||||||
|
|
||||||
|
# Set a higher stacktrace during development. Avoid configuring such |
||||||
|
# in production as building large stacktraces may be expensive. |
||||||
|
config :phoenix, :stacktrace_depth, 20 |
||||||
|
|
||||||
|
import_config "dev.secret.exs" |
@ -0,0 +1,5 @@ |
|||||||
|
use Mix.Config |
||||||
|
|
||||||
|
# Configures the endpoint |
||||||
|
config :explorer_web, ExplorerWeb.Endpoint, |
||||||
|
secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5" |
@ -0,0 +1,31 @@ |
|||||||
|
use Mix.Config |
||||||
|
|
||||||
|
# For production, we often load configuration from external |
||||||
|
# sources, such as your system environment. For this reason, |
||||||
|
# you won't find the :http configuration below, but set inside |
||||||
|
# ExplorerWeb.Endpoint.init/2 when load_from_system_env is |
||||||
|
# true. Any dynamic configuration should be done there. |
||||||
|
# |
||||||
|
# Don't forget to configure the url host to something meaningful, |
||||||
|
# Phoenix uses this information when generating URLs. |
||||||
|
# |
||||||
|
# Finally, we also include the path to a cache manifest |
||||||
|
# containing the digested version of static files. This |
||||||
|
# manifest is generated by the mix phx.digest task |
||||||
|
# which you typically run after static files are built. |
||||||
|
config :explorer_web, ExplorerWeb.Endpoint, |
||||||
|
cache_static_manifest: "priv/static/cache_manifest.json", |
||||||
|
force_ssl: [rewrite_on: [:x_forwarded_proto]], |
||||||
|
instrumenters: [NewRelixir.Instrumenters.Phoenix], |
||||||
|
load_from_system_env: true, |
||||||
|
pubsub: [ |
||||||
|
adapter: Phoenix.PubSub.Redis, |
||||||
|
url: System.get_env("REDIS_URL"), |
||||||
|
node_name: System.get_env("DYNO") |
||||||
|
], |
||||||
|
secret_key_base: System.get_env("SECRET_KEY_BASE"), |
||||||
|
url: [ |
||||||
|
scheme: "https", |
||||||
|
host: Map.fetch!(System.get_env(), "HEROKU_APP_NAME") <> ".herokuapp.com", |
||||||
|
port: 443 |
||||||
|
] |
@ -0,0 +1,13 @@ |
|||||||
|
use Mix.Config |
||||||
|
|
||||||
|
config :explorer_web, :sql_sandbox, true |
||||||
|
|
||||||
|
# We don't run a server during test. If one is required, |
||||||
|
# you can enable the server option below. |
||||||
|
config :explorer_web, ExplorerWeb.Endpoint, |
||||||
|
http: [port: 4001], |
||||||
|
secret_key_base: "27Swe6KtEtmN37WyEYRjKWyxYULNtrxlkCEKur4qoV+Lwtk8lafsR16ifz1XBBYj", |
||||||
|
server: true |
||||||
|
|
||||||
|
# Configure wallaby |
||||||
|
config :wallaby, screenshot_on_failure: true |
@ -0,0 +1,33 @@ |
|||||||
|
defmodule ExplorerWeb.Application do |
||||||
|
@moduledoc """ |
||||||
|
Supervises `ExplorerWeb.Endpoint` in order to serve Web UI. |
||||||
|
""" |
||||||
|
|
||||||
|
use Application |
||||||
|
|
||||||
|
alias ExplorerWeb.Endpoint |
||||||
|
|
||||||
|
def start(_type, _args) do |
||||||
|
import Supervisor.Spec |
||||||
|
|
||||||
|
# Define workers and child supervisors to be supervised |
||||||
|
children = [ |
||||||
|
# Start the endpoint when the application starts |
||||||
|
supervisor(Endpoint, []), |
||||||
|
# Start your own worker by calling: PoaexpWeb.Worker.start_link(arg1, arg2, arg3) |
||||||
|
# worker(PoaexpWeb.Worker, [arg1, arg2, arg3]), |
||||||
|
] |
||||||
|
|
||||||
|
# See https://hexdocs.pm/elixir/Supervisor.html |
||||||
|
# for other strategies and supported options |
||||||
|
opts = [strategy: :one_for_one, name: ExplorerWeb.Supervisor] |
||||||
|
Supervisor.start_link(children, opts) |
||||||
|
end |
||||||
|
|
||||||
|
# Tell Phoenix to update the endpoint configuration |
||||||
|
# whenever the application is updated. |
||||||
|
def config_change(changed, _new, removed) do |
||||||
|
Endpoint.config_change(changed, removed) |
||||||
|
:ok |
||||||
|
end |
||||||
|
end |