Jump to content
Sign in to follow this  
buzzkillb

Fortunastakes using Docker

Recommended Posts

This may or may not be an easier way to control your fortunastake servers. Its for sure an easy way to run more than 1 on same PC as long as that PC / raspberry pi / tablet?? / whatever can run Docker. Can also run nativetor in each container, which is an interesting way to run onion FS's. If you do this guide once, you will see why I went through so much trouble to write this out.

Github is located here with the dockerfiles
https://github.com/buzzkillb/denariusDocker

How to install docker on ubuntu 16.04. Might be different on newer releases, disco dingo has a snap package, just putting basic install here to show what the commands are.
https://docs.docker.com/install/linux/docker-ce/ubuntu/

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

To test it installed correctly.

sudo docker run hello-world

modify your user account so you dont need to run sudo on the docker commands.

sudo usermod -aG docker your-user

Now to the good stuff.

as of v3.3.9.1 denariusd creates a denarius.conf in the datadir, so we can handle this 2 ways. Either run the docker daemon and let it autocreate denarius.conf and then edit that, or just create denarius.conf before running the docker daemon.

The main thing to know is that the docker daemon requires daemon=0.

Setup typical denarius.conf to enable fortunastake server.

typical chaindata directory is ~/.denarius but this can go anywhere. like ~/D/FS01

example denarius.conf

rpcuser=USEARANDOMNAME
rpcpassword=USEARANDOMPASSWORD
daemon=0
port=9999
fortunastake=1
fortunastakeprivkey=6J8tAUsVchangethisofcoursehXBgfdeewqsdghySWEQEeb4XGSC251sM7bYQgEXh7

Lets run from ~/.denarius to get started. This will run the docker container of latest wallet daemon compiled from source using ubuntu 18.04 as the OS. I also created one that uses ubuntu 16.04, and one that works on armv7 devices like a raspberry pi3. For now lets use the first one I made.

docker run --name=denariusd --rm -t -d -v ~/.denarius:/data -P buzzkillb/denariusd

What this does is pulls and runs the docker daemon container and uses your ~/.denarius folder as the data storage. So if you shutdown the container your data isnt inside of that container and gets lost on any shutdowns. A hint: this folder is where your denarius.conf is located. change ~/.denarius to ~/D/FS01 and now you can make many if you want. Just stick a denarius.conf in FS01, FS02, FS03, etc.

Some basic commands to use this.

docker exec denariusd denariusd -datadir=/data getinfo
docker exec denariusd denariusd -datadir=/data getbalance
docker exec denariusd denariusd -datadir=/data fortunastake status

To read the logs, (this is like tail -f debug.log)

docker logs denariusd -f

Now lets say you ran many of these containers for many fortunastakes. You would run it like this.

docker run --name=FS01 --rm -t -d -v ~/D/FS01:/data -P buzzkillb/denariusd

Even easier, install docker-compose
https://docs.docker.com/compose/install/
and then create a directory to store a docker compose file in, like 

cd ~
mkdir bigd
cd bigd
nano docker-compose.yml

Stick this in the yml file.

FS01:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/FS01:/data
FS02:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/FS02:/data
FS03:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/FS03:/data

then in that folder 

docker-compose up -d

This will start 3 fortunastakes on the same PC. Just need about 700mb of ram per FS.

I have some more examples of commands on the github link, but this should get someone started on making this a bit easier.

I will build the latest daemon on these, so if you want to autoupdate whenever these happen, try out watchtower.

https://github.com/containrrr/watchtower

docker run -d \
    --name watchtower \
    -v /var/run/docker.sock:/var/run/docker.sock \
    containrrr/watchtower

This will stop the container, pull the latest, and restart from same command used to start.

I am also using dozzle to watch the logs from a web browser.

https://github.com/amir20/dozzle

docker run --name dozzle -d --volume=/var/run/docker.sock:/var/run/docker.sock -p 8888:8080 amir20/dozzle:latest

 


Join Denarius Discord - https://discord.gg/JQEmXwb

Share this post


Link to post
Share on other sites

Difference in the docker-compose.yml file to run nativetor=0 or nativetor=1

ipv4:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/noTOR:/data
nativetor:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/yesTOR:/data
    - ~/D/yesTOR:/root/.denarius

after running, to check you are on an onion address

docker exec dd_nativetor_1 denariusd -datadir=/data getinfo

image.png.14c4450d73bfd59043291333fb3491b0.png


Join Denarius Discord - https://discord.gg/JQEmXwb

Share this post


Link to post
Share on other sites

not sure if nativetor completely works with this so instead install tor on ubuntu
https://2019.www.torproject.org/docs/debian.html.en

docker-compose.yml

FS01:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/FS01:/data
  net: host
FS02:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/FS02:/data
  net: host
FS03:
  image: buzzkillb/denariusd:latest
  volumes:
    - ~/D/FS03:/data
  net: host

denarius.conf

rpcuser=denariusrpc
rpcpassword=changethispassword
rpcallowip=127.0.0.1
daemon=0
port=9999
fortunastake=1
listen=1
externalip=onionnodeaddy.onion
fortunastakeaddr=onionnodeaddy.onion:9999
fortunastakeprivkey=6YOURFortunaStakePRIVATEKEYFo5F7vx922puZDGCwY1JVjb
tor=127.0.0.1:9050
bind=127.0.0.1:33301
rpcport=32301
addnode=aibn2hiqsqwdrmbb.onion
addnode=jawnwg5qlyyhjcxf.onion

increment the 1 at the end of bind and rpcport up by 1 for each FS

in your docker-compose.yml directory

docker-compose up -d

 


Join Denarius Discord - https://discord.gg/JQEmXwb

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...