/Synoloy-cardano-sl

HOW TO: Building cardano-sl in a Docker container on Synology DS415+

Primary LanguageShell

System: Docker container running Debian:latest on Synology DS415+ (8 Gb RAM)

Building this on a Synology DS415+ is a very lengthy proccess. It will take a few hours. After the build is finished you can run the cardano-sl node 24/7 in this container. This is especially convienant as we enter the Cardano Reward Era also known as Shelley

Get the Debian image:

docker pull debian:latest

Setup Docker: check your LAN IP address. My Gateway is 192.168.178.1 so I define my subnet as --subnet 192.168.178.0/24. If your Gateway is for example 192.168.0.1 then define subnet as --subnet 192.168.0.0/24.

docker network create -d macvlan --subnet 192.168.178.0/24 --ip-range 192.168.178.250/3 --gateway 192.168.178.1 -o parent=ovs_eth0 cardano_net
docker run -d --name=cardano-sl --network cardano_net debian:latest tail -f /dev/null

This is a minimal install of Debian so we have to add lots of stuff:

apt-get update
apt-get upgrade
apt-get install apt-utils
apt-get install net-tools
apt-get install openssh-server
apt-get install -y git curl build-essential libgtk2.0.0 libasound2 libnotify-bin libgconf-2-4 libnss3 libxss1
apt-get install sudo
apt-get install nano

Configure and start the SSH server with nohup: we need to create a SSH tunnel later on in the process. Every time you restart this container you have to restart the SSH server.

echo 'root:screencast' | chpasswd
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
echo "export VISIBLE=now" >> /etc/profile
mkdir /run/sshd
nohup /usr/sbin/sshd -D >/dev/null 2>&1 &

Prebuild specific installations:

curl https://nixos.org/nix/install | sh
curl -sSL https://get.haskellstack.org/ | sh

To employ the signed IOHK binary cache:

mkdir -p /etc/nix
nano /etc/nix/nix.conf

add to /etc/nix/nix.conf

binary-caches            = https://cache.nixos.org https://hydra.iohk.io
binary-cache-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
build-users-group =

Getting the Cardano-sl code:

$ git clone https://github.com/input-output-hk/cardano-sl.git
$ cd cardano-sl
$ git checkout master

Building the node: you can build all but 'cardano-sl-wallet' is enough for the backend

nix-build -A cardano-sl-static --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
nix-build -A cardano-report-server-static --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
nix-build -A cardano-sl-auxx --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
nix-build -A cardano-sl-explorer-static --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
nix-build -A cardano-sl-wallet --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
nix-build -A cardano-sl-tools --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
nix-build -A connectScripts.mainnetWallet -o connect-to-mainnet

Starting Cardano-sl node in Synology DS415+ Docker container:

./connect-to-mainnnet

or run it like a deamon:

nohup ./connect-to-mainnet >/dev/null 2>&1 &

I'm running Daedalus on MacBook Pro in VM with a Debian Desktop and create a SSH tunnel to the Debian server on Synology NAS:

terminal 1:

ssh -L 8090:localhost:8090 user@servername

terminal 2:

npm run hot-server

terminal 3:

npm run hot-start

If you succeed in building the node and would like to test the Daedalus wallet you can send me some ADA on this address. I'm happy to confirm its arrival :-)

DdzFFzCqrht9ZXsGFpW1EDApRjFYih8VfHnyUs7y7nDxMytE3h63KTRkoQSUUb2sV6pdVqqyV1LFAF436S3Qrw7TtmiVoP2KQid83n2r

License

Cardano SL is released under the terms of the MIT license. Please see LICENSE for more information.