Docker container for Advance Protocol Wallet / Masternode.Hi, I am creating basic Dockerfiles to build and host wallets / masternodes.
Why?
With this containers you are able to have multiple wallets / masternodes on the same VPS.
Each container runs in its own environment and does not effect any services on the host system or other containers.
People running multiple masternodes rent for each a VPS, with this you can have multiple masternodes on the same VPS.
Read up on Docker @
https://www.docker.com/what-container if you interrested.
I will guide you through a basic installation on a Ubuntu 17.10 OS.
We will create a docker image with Alpine Linux as base and compile the latest Advance Protocol daemon on it.
Login (ssh) into your VPS:
# Lets upgrade all packages.
> apt-get update
> apt-get upgrade -y
# If you are on a VPS with low RAM and no swap space, lets create one
> fallocate -l 2G /swapfile
> chmod 600 /swapfile
> mkswap /swapfile
> swapon /swapfile
> cp /etc/fstab /etc/fstab.bak
> echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# Install Docker
> apt-get install apt-transport-https ca-certificates curl software-properties-common -y
> curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
> apt-key fingerprint 0EBFCD88
> add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
> apt-get update
> apt-get install docker-ce -y
# Create a directory and copy paste the content into the Dockerfile
> mkdir -p advDockerBuild
> cd advDockerBuild
> nano Dockerfile
# save the file: CLTR+X
# Dockerfile for advanced protocol on alpine linux
FROM alpine
LABEL version="1.0"
LABEL description="Dockerized advance protocol daemon"
LABEL maintainer="TEmp"
# Install all necessary packages
RUN apk --no-cache --update add nano libstdc++ libtool build-base git autoconf automake linux-headers boost-dev openssl-dev db-dev miniupnpc-dev gmp-dev libevent-dev
# clone the advance protocol git and compile it
RUN mkdir -p advanceSource && \
cd advanceSource && \
git clone https://github.com/AdvanceProtocol/advance . && \
chmod +x src/leveldb/build_detect_platform && \
chmod +x src/secp256k1/autogen.sh && \
cd src/leveldb && \
make libleveldb.a libmemenv.a && \
cd ../.. && \
./autogen.sh && \
./configure --disable-qt --with-incompatible-bdb && \
make
# here comes the clean up
RUN apk del build-base git autoconf automake libtool linux-headers && \
rm -rvf /var/cache/apk/* && \
cd /advanceSource/src && \
cp advanced advance-tx advance-cli /usr/bin && \
cd ~ && \
rm -rvf /advanceSource
# Create the image, this will take some time!
> docker build -t advanced .
# After the image is created, start it with an interactive shell inside
# You can repeat this step and create multiple containers now, make sure to use different ports and names
# -it = interactive
# -p = map ports from host to container
# --name = give the container a name
> docker run -it -p 30888:30888 --name ADV01 advanced
# Inside of the docker container, we will start the advanced daemon for the first time
>> advanced &
# Now cd into the dataDirectory and edit the config file, eg.: port, masternode settings, ....
>> cd ~/.advanceprotocol/
>> nano advance.conf
server=1
listen=1
daemon=1
port=30888
addnode=104.238.191.14
addnode=198.13.61.201
addnode=165.227.231.237
addnode=159.89.16.82
addnode=159.89.85.37
addnode=45.63.114.75
# Lets restart the daemon now
>> advance-cli stop
>> advanced &
# Verify its running
>> ps -ef
# Check the debug.log
>> tail -f debug.log
# DETACH the container
# press CLTR+P+Q
# SOME USEFUL DOCKER COMMANDS
# Verfiy the container is running on the host system
> docker ps -a
# Stats of all your containers
> docker stats
# Start / Stop containers
> docker start <containername>
> docker stop <containername>
# Execute a command inside of your container and exit again
> docker exec <containername> ps -ef
# Spawn a shell inside of the container
> docker exec -it <containername> /bin/sh
# Attach to a container
> docker attach <containername>
Thats it for now, hope this helps some of you who want to run multiple / sandboxed wallets (masternodes) on the same machine.
Ofc, you can do more with docker images
+ make the start full automatic
+ restart in case daemon crashes
+ send emails on events
+ basically limit is what you imagine!!
I build docker images for other coins as well. For questions, you can find me in the discord channel.
If you found this useful buy me a coffee =)
ADV: AW7pJYPGpCcNK8zwoGxE5pZUPnHfZg8Ed9
BTC: 1P1vR2T3kpJHXdWoMbiXq18moqGjGoz7Kz