Manual Deployment Guide
Deploy Blockscout with a user-friendly UI and all microservices
Last updated
Was this helpful?
Deploy Blockscout with a user-friendly UI and all microservices
Last updated
Was this helpful?
📗 This guide walks you through a new Blockscout deployment including the user-friendly UI frontend and installation of all microservices. If you'd prefer a more automated approach see the .
Please familiarize yourself with the , , and requirements before installing Blockscout.
CPU: 4core / 8core
RAM: 8GB / 16GB / 32GB
DISK: 120gb or 500GB NVME SSD or Standard SSD
OS: Linux, MacOS
If you are running Blockscout on a cloud server or other remote environment, see the
For Erlang/Elixir, is recommended to install and set the appropriate versions. Note the supported versions for Erlang/Elixir/Node are specified in the .tool-versions
file. Additional Instructions for setting up the environment are available for and .
brew install erlang
brew install elixir
brew install postgresql
brew install node
brew install automake
brew install libtool
Not Required
Ubuntu - apt-get install inotify-tools
brew install gcc
brew install gmp
Make
-
sudo apt install make
if Debian 9
G++ Compiler
-
sudo apt install g++
if Debian 9
The following guide contains 5 sections that cover a complete Blockscout installation.
1) Clone the repository
git clone https://github.com/blockscout/blockscout blockscout-backend
2) Change directories
cd blockscout-backend
3) Provide DB URL with your username
export DATABASE_URL=postgresql://username:password@localhost:5432/blockscout
Linux: Update the database username and password configuration
Mac: Use logged-in user name and empty password (export DATABASE_URL=postgresql://username:@localhost:5432/blockscout
)
4) Install Mix dependencies and compile
mix do deps.get, local.rebar --force, deps.compile
5) Generate a new secret_key_base for the DB
mix phx.gen.secret
6) Copy keybase and export as an env (for example)
export SECRET_KEY_BASE=VTIB3uHDNbvrY0+60ZWgUoUBKDn9ppLR8MI4CpRz4/qLyEFs54ktJfaNT6Z221No
CLI basic example:
Notes:
If you're in production environment, please, set MIX_ENV=prod
. The current default is MIX_ENV=dev
which is a slower and less secure setting. However, for development purposes, unsetting or setting is MIX_ENV=dev
is preferred.
8) Compile the application:
mix compile
9) If not already running, start Postgres: pg_ctl -D /usr/local/var/postgres start
or brew services start postgresql
10) Create and migrate database
mix do ecto.create, ecto.migrate
If you are in dev environment and have run the application previously with a different blockchain, drop the previous database:
mix do ecto.drop, ecto.create, ecto.migrate
Be careful since this will delete all data from the DB. Don't execute it on production if you don't want to lose all of the data!
11) 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 -
12)
Build static assets for deployment
mix phx.digest
13) Enable HTTPS in development. The Phoenix server only runs with HTTPS.
cd apps/block_scout_web; mix phx.gen.cert blockscout blockscout.local; cd -
14) Add blockscout and blockscout.local to your /etc/hosts
🎉 This completes the backend setup! Proceed to setup microservices.
You will use Docker to run 4 Rust microservices: smart-contract verification, smart-contract sol2uml visualizer, sig-provider, and stats services. These add additional functionality to your instance once everything is connected.
Docker v20.10+
Docker-compose 2.x.x+
Go to the docker-compose directory
cd ./blockscout-backend/docker-compose
run docker-compose
docker-compose -f microservices.yml up -d
A visualizer for smart contracts.
A separate smart contract verification service.
You can also use the Blockscout endpoint for smart-contract verification if you prefer (instructions in the integration section)
To stop all microservices, run docker-compose -f microservices.yml down
Add the microservices env variables to the backend. Use the export command to add.
🎉 This completes the microservices setup! Proceed to run the backend and frontend.
Return to the blockscout-backend directory ./blockscout-backend
Run mix phx.server
The frontend can be added to the same high-level directory as the blockscout-backend or a different directory of your choice.
clone the blockscout frontend repository
git clone https://github.com/blockscout/frontend blockscout-frontend
change directories
cd blockscout-frontend
create a .env file, for example
touch .env
install dependencies
yarn install
run frontend
yarn dev
🎉 Once completed, the frontend should be available at http://localhost:3000
Notes:
Optional: Change credentials in apps/explorer/config/test.exs
for test env
Example usage: Changing the default Postgres port from localhost:5432 if is installed.
You can check the regex pattern for the db url via with the following regular expression:
7) Export remaining as needed.
The ETHEREUM_JSONRPC_VARIANT
will vary depending on your client (nethermind, geth etc). .
To configure “My Account” section on the backend, see
Check : pg_isready
Stats will be served from
You can check, that service works by requesting . It should return {"status":"SERVING"}
sig-provider will be at
You can check, that service works by requesting . It should return {"status":"SERVING"}
sc-visualizer will be located at
Check the visualizer service works by requesting the page - it should return {"status":"SERVING"}
.
sc-verifier will be at .
Check that the sc-verifier service works by requesting page
The API will be available at
Add this minimal set of required env variables ()
To configure the My Account section, you will add additional env variables on the frontend. See
More info related to the frontend is available at: