haveno
haveno copied to clipboard
Dockerize deamons
This is needed to make the life of the UI team simpler.
We need to run on Docker:
- seednode
- arbitrator-daemon
- alice-daemon
- bob-daemon
- Monero
It will also help for #21
I'll take care and prioritize this in the next days. I'm not a Docker expert, so any suggestion is appreciated.
@CristianMG: Hey there. Copy pasting this message from #haveno-dev on matrix:
"The UI development team is starting to work on Haveno and would very much like to use a dockerized version of the Haveno daemons. I checked your old link at https://github.com/CristianMG/haveno/tree/master/docker but unfortunately it's no longer there. it seems you were close to opening a PR? do you still have that work available? by the way, the arbitrator now runs as a daemon instead of a desktop application, so that should help"
Any help would be appreciated :)
Copying and pasting from Matrix :)
You could probably create a haveno image with an ubuntu/openjdk11 base (haveno/dockerfiles/haveno/Dockerfile)... maybe use a separate image/dependencies for monerod (haveno/dockerfiles/monerod/Dockerfile) and then use docker compose and overwrite your starting commands to do something like:
really rough sketch of a potential docker-compose.yml:
version: '3'
services:
aliced:
build: haveno/dockerfiles/haveno
command/entrypoint: ["make alice-daemon"]
ports:
- 1234:1234
bobd:
build: haveno/dockerfiles/haveno
command: ["make bob-daemon"]
ports:
- 1234:1234
seed:
command: ["make seed-thing"]
monerod:
build: haveno/dockerfiles/monerod // Different image?
ports:
- 18089:18089
volumes:
- bitmonero:/home/monero/.bitmonero
volumes:
- bitmonero
I imagine monero will need a lot more dependencies to build, and you'll need to have a volume for blockchain data, etc. Probably good to reference Seth's simple-monerod docker image. I haven't done much docker startup command overriding so i'm not sure what's possible.
It may also be worth calling the daemon startup commands directly i.e. ./haveno-seednode
as you'll then be able to easily configure and override different startup flags in your docker compose file... this may not be very easy when calling the make commands.
I just pushed what i got so far: https://github.com/erciccione/haveno/tree/docker
This is still very much work in progress and there is still stuff to do:
- the network settings are temporary and needed to resolve a local connection problem
- all containers run as expected, but we need somebody familiar with docker-compose commands for things like sending commands to a container (for example, to start mining on one of the 2 nodes)
- format is messed. I'm leaving that for last
- the daemons seem to not be able to connect to the Monero daemon. I have to look into how the Docker network works.
I'm not familiar with Docker and have no prior knowledge of docker-compose, so any help is appreciated.
After running a command in either of the 2 containers with a monero node (node1
or node2
) using docker-compose exec $service $command
, I keep getting Error: Couldn't connect to daemon: 127.0.0.1:18081
even if the port i set is not 18081. This doesn't change, no matter what port i set. Trying to figure it out.
Found the issue thanks to moneromooo's help. Will update soon.
I managed to have all containers communicate to each other, and mine blocks. This doesn't feel solid though. docker-compose up
fails because of conflicting ports and trying to open ports singularly for every container (adding --service-ports
to docker compose run $SERVICE
) fails as well. Furthermore, adding volumes to the docker-compose file seems to be changing the behaviour of the containers quite drastically, so that's left aside for now.
This is the current docker-compose.yml file, but i'm not really happy with it. Seems to be quite hard to find updated info about docker-compose and i didn't find the official docs really useful. Any help from people familiar with docker/docker-compose would be highly appreciated.
The network_mode
hack is the only way i managed to communicate with the monero nodes, but seems to contribute to the problem of being unable to use docker-compose up
.
version: '3'
services:
node1:
build: monero/
command: ["--data-dir=/home/monero/node1", "--p2p-bind-port=48080", "--rpc-bind-port=48081", "--zmq-rpc-bind-port=48082", "--add-exclusive-node=127.0.0.1:38080"]
ports:
- "48080:48080"
- "48081:48081"
- "48082:48082"
networks:
- mynet
node2:
build: monero/
command: ["--data-dir=/home/monero/node2", "--p2p-bind-port=38080","--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=38081", "--confirm-external-bind", "--add-exclusive-node=127.0.0.1:48080"]
ports:
- "38080:38080"
- "38081:38081"
network_mode: "service:node1"
seed:
build: haveno/
entrypoint: ["./haveno-seednode"]
command: ["--baseCurrencyNetwork=XMR_STAGENET", "--useLocalhostForP2P=true", "--useDevPrivilegeKeys=true", "--nodePort=2002", "--appName=haveno-XMR_STAGENET_Seed_2002" ]
ports:
- "2002:2002"
network_mode: "service:node1"
alice:
build: haveno/
command: ["--baseCurrencyNetwork=XMR_STAGENET", "--useLocalhostForP2P=true", "--useDevPrivilegeKeys=true", "--nodePort=5555", "--appName=haveno-XMR_STAGENET_Alice", "--apiPassword=apitest", "--apiPort=9999", "--walletRpcBindPort=58081", "--passwordRequired=false" ]
ports:
- "5555:5555"
- "9999:9999"
network_mode: "service:node1"
bob:
build: haveno/
command: ["--baseCurrencyNetwork=XMR_STAGENET", "--useLocalhostForP2P=true", "--useDevPrivilegeKeys=true", "--nodePort=6666", "--appName=haveno-XMR_STAGENET_Bob", "--apiPassword=apitest", "--apiPort=10000", "--walletRpcBindPort=58082", "--passwordRequired=false"]
ports:
- "6666:6666"
- "10000:10000"
network_mode: "service:node1"
networks:
mynet:
driver: bridge
The Haveno and Monero dockerfiles are here: https://github.com/erciccione/haveno/tree/docker/docker
I pushed a draft at #297
@erciccione Tried to run the docker compose containers and everything worked well, but when trying to run the test cases of haveno-ts, all tests fail because the arbitrator
doesn't run. how can we solve that issue?
...
These services are now dockerized and run as part of our CI tests. Please re-open if we continue to have problems.