Skip to content

Instantly share code, notes, and snippets.

@AndreiD
Last active November 27, 2018 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreiD/955452d290a4d95444fd0f3ddd3d45f1 to your computer and use it in GitHub Desktop.
Save AndreiD/955452d290a4d95444fd0f3ddd3d45f1 to your computer and use it in GitHub Desktop.
poascount blockchain explorer setup ubuntu 16
#!/bin/bash
set -e
# let'em have colors
end="\033[0m"
red="\033[0;31m"
green="\033[0;32m"
echo -e "${green}......................................${end}"
echo -e "${green}........ Script Version 1.0a .........${end}"
echo -e "${green}......................................${end}"
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y software-properties-common openssh-server curl apt-transport-https ca-certificates htop nethogs git
cd /tmp
echo -e "${green}........NodeJS & PM2 .........${end}"
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get -y install nodejs
npm -v
sudo npm install pm2 -g
pm2 -V
echo -e "${green}........Erlang & Elixir .........${end}"
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get -y install erlang
sudo apt-get -y install elixir
echo -e "${green}........Other tools .........${end}"
sudo apt-get -y install autotools-dev automake autoconf libtool-bin libgmp3-dev inotify-tools
echo -e "${green}........Postgres .........${end}"
sudo apt-get -y install postgresql postgresql-contrib
cd ~
git clone https://github.com/poanetwork/blockscout
cp ~/blockscout/apps/explorer/config/dev.secret.exs.example ~/blockscout/apps/explorer/config/dev.secret.exs
cp ~/blockscout/apps/block_scout_web/config/dev.secret.exs.example ~/blockscout/apps/block_scout_web/config/dev.secret.exs
echo -e "${red}.......You have to do the following steps manually!.........${end}"
echo -e "${green}sudo passwd postgres${end}"
echo -e "${green}su - postgres${end}"
echo -e "${green}psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'password';"${end}"
echo -e "${green}Edit: apps/explorer/config/dev.secret.exs${end}"
echo -e "${green}Follow build instructions from here https://github.com/poanetwork/blockscout${end}"
echo -e "${green}Problems: https://github.com/poanetwork/blockscout/issues/954${end}"
echo -e "${green}Problems: https://github.com/poanetwork/blockscout/issues/1110${end}"
~~~~~~~~~ OR DOCKER FILE ~~~~~~~~~
FROM ubuntu
RUN apt-get update
RUN apt-get install -y vim wget unzip git
ENV LOG=/tmp/log
RUN apt-get install -y erlang
RUN mkdir -p /opt/elixir && \
wget https://github.com/elixir-lang/elixir/releases/download/v1.7.2/Precompiled.zip >"$LOG" && \
unzip Precompiled.zip -d /opt/elixir >"$LOG"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt install -y postgresql postgresql-contrib
RUN apt-get install -y nodejs
RUN apt-get install -y automake
RUN apt-get install -y libtool
RUN apt-get install -y inotify-tools
RUN apt-get install -y gcc
RUN apt-get install -y libgmp3-dev
#RUN git clone https://github.com/poanetwork/blockscout
USER postgres
RUN service postgresql start && psql -c "ALTER USER postgres WITH PASSWORD '123123';"
USER root
RUN apt-get install -y make
RUN apt-get install -y g++
RUN apt-get install -y npm
ENV ETHEREUM_JSONRPC_VARIANT=geth
ENV ETHEREUM_JSONRPC_HTTP_URL=http://172.17.0.2:9001 # this is historical, I deleted it after start the docker container.
# just copy anything from the root of blockscout/ to the image
COPY ./ /root/
RUN ls /root
ENV PATH=$PATH:/opt/elixir/bin
RUN cd /root && \
mix do local.hex --force, deps.get, local.rebar --force
RUN cd /root/deps/libsecp256k1 && ../../.mix/rebar compile && mix deps.get
RUN cd /root/deps/libsecp256k1 && mix compile
RUN cd /root && \
mix do deps.compile, compile
RUN cd /root && service postgresql start && \
mix ecto.create && mix ecto.migrate
RUN cd /root/apps/block_scout_web/assets && npm install
RUN cd /root/apps/explorer && npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment