Tech

Setup Toshi Bitcoin Node with Docker on AWS

  • このエントリーをはてなブックマークに追加

This is too old. See following official document.

coinbase/toshi: An open source Bitcoin node built to power large scale web applications.

Install docker

What is Toshi

Toshi is an open source Bitcoin node built to power large scale web applications.
Toshi is made by Coinbase.

Toshi – Open Source Bitcoin Node
https://toshi.io/

Ref.

All setup procesure is followed by the video.

Deploy Toshi Bitcoin Node with Docker on AWS in 30 minutes. Beginner Friendly! – YouTube

Setup AWS

Setup EC2 and disk.

  • EC2 instance: whatever (I guess)
  • OS: Ubuntu 12.04 (64bit)
  • Disk: 300G Disk

And start EC2 instance and login to it with downloaded pem file.

Login to an AWS server

ssh -i ~/.ssh/toshi_key.pem ubuntu@xxx.xxx.xxx.xxx

Make user ‘toshi’ and switch to it

sudo adduser toshi
sudo adduser toshi sudo
su - toshi

Install Docker

curl -sSL https://get.docker.com/ubuntu | sudo sh

Git clone toshi

git clone https://github.com/coinbase/toshi.git

Check Dockerfile

cd toshi
cat Dockerfile

Build Docker

sudo docker build -t=coinbase/toshi .

Setup PostgreSQL

sudo docker run --name toshi_db -d postgres

Setup Redis

sudo docker run --name toshi_redis -d redis

See Processes

sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c82184c21e6d redis:latest "/entrypoint.sh redi 26 seconds ago Up 25 seconds 6379/tcp toshi_redis
128fc3d09d45 postgres:latest "/docker-entrypoint. 2 minutes ago Up 2 minutes 5432/tcp toshi_db

See DB & Redis IP addresses & port numbers

See all DB information

sudo docker inspect toshi_db

See DB & Redis IP addresses

sudo docker inspect toshi_db | grep IPAddress
sudo docker inspect toshi_redis | grep IPAddress

See port numbers

sudo docker ps

IP addresses and port numbers will be something like these.

  • 172.17.0.3 5432/tcp
  • 172.17.0.4 6379/tcp

Run Toshi

sudo docker run --name toshi_main -d -p 5000:5000 -e REDIS_URL=redis://172.17.0.6:6379 -e DATABASE_URL=postgres://postgres:@172.17.0.5:5432 -e TOSHI_ENV=production coinbase/toshi sh -c 'bundle exec rake db:create db:migrate; foreman start'

You will see the string (container ID).

$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3facc68ea657 coinbase/toshi:latest "sh -c 'bundle exec 32 seconds ago Up 31 seconds 0.0.0.0:5000->5000/tcp toshi_main
c82184c21e6d redis:latest "/entrypoint.sh redi 16 minutes ago Up 16 minutes 6379/tcp toshi_redis
128fc3d09d45 postgres:latest "/docker-entrypoint. 18 minutes ago Up 18 minutes 5432/tcp toshi_db

Make sure if toshi is working

sudo docker logs -f toshi_main

Got to the Toshi web interface.

http://IP address:5000/

Reference

Deploy Toshi Bitcoin Node with Docker on AWS in 30 minutes. Beginner Friendly! – YouTube

  • このエントリーをはてなブックマークに追加