Manual BlockScout Deployment

faq
#1

For automated deployment, see deploying Blockscout with Ansible playbooks.

  1. git clone https://github.com/poanetwork/blockscout

  2. cd blockscout

  3. Setup default configurations:
    cp apps/explorer/config/dev.secret.exs.example apps/explorer/config/dev.secret.exs

    cp apps/block_scout_web/config/dev.secret.exs.example apps/block_scout_web/config/dev.secret.exs

  4. Update apps/explorer/config/dev.secret.exs

    Linux: Update the database username and password configuration

    Mac: Remove the username and password fields

    Optional: Set up default configuration for testing. cp apps/explorer/config/test.secret.exs.example apps/explorer/config/test.secret.exs Example usage: Changing the default Postgres port from localhost:15432 if Boxen is installed.

  5. If you have deployed previously, delete the apps/block_scout_web/priv/static folder. This removes static assets from the previous build.

  6. Install dependencies. mix do deps.get, local.rebar --force, deps.compile, compile

  7. If not already running, start postgres: pg_ctl -D /usr/local/var/postgres start

  8. Create and migrate database mix do ecto.create, ecto.migrate

    Note: If you have run previously, drop the previous database
    mix do ecto.drop, ecto.create, ecto.migrate

  9. Install Node.js dependencies

    • cd apps/block_scout_web/assets; npm install && node_modules/webpack/bin/webpack.js --mode production; cd -

    • cd apps/explorer && npm install; cd -

  10. Enable HTTPS in development. The Phoenix server only runs with HTTPS.

    • cd apps/block_scout_web

    • mix phx.gen.cert blockscout blockscout.local; cd -

    • Add blockscout and blockscout.local to your /etc/hosts


   127.0.0.1       localhost blockscout blockscout.local

   255.255.255.255 broadcasthost

   ::1             localhost blockscout blockscout.local

  • If using Chrome, Enable chrome://flags/#allow-insecure-localhost .
  1. Set your environment variables (list available here) as needed. For example:
export COIN=DAI
export NETWORK_ICON=_network_icon.html
export ... 
  1. Return to the root directory and start the Phoenix Server. mix phx.server

Check your instance:

  1. Check that there are no visual artifacts, all assets exist and there are no database errors.

  2. If there are no errors, stop BlockScout (ctrl+c)

  3. Build static assets for deployment mix phx.digest

  4. Delete build artifacts:

    a. Script: ./rel/commands/clear_build.sh

    b. Manually:

    • delete _build & deps directories
    • delete node modules located at
    • apps/block_scout_web/assets/node_modules
    • & apps/explorer/node_modules
    • delete logs/dev directory