Guide to host a masternode on hyper.sh for ~$12USD/Month
To use this guide you will need the following pieces of information:
after mnsync status shows your node is synced.. remotely start your masternode(eg run `masternode start-missing` using dash-cli or the wallet console.)
Guide to host a masternode in a Kubernetes cluster
(like Google container engine or something else?)
To use this guide you will need the following pieces of information:
after mnsync status shows 999 goodness.. remotely start your masternode.
Dockerfile used by both examples:
note you'll also need to provide a dash.conf stub.
sample:
To use this guide you will need the following pieces of information:
- hyper.sh account and download the command line utility(hyper)
- masternode private key
- exactly 1000 dash sitting in a new address with no other tx's in it.
- knowledge of how to remotely start a masternode.
Code:
#one time step: create a "floating ip" for a $1USD/month (this can be reused if you ever delete your node and recreate)
hyper fip allocate
hyper fip ls
ip= #the ip address you were allocated from hyper
key= #your masternode private key. (not your collateral private key)
nodename= #whatever you would like to name this container.
hyper create --size m1 -e MNIP=${ip} -e MNKEY=${key} --name "${nodename}" -P -t --restart always yourdockerhub/imagename:latest
hyper start "${nodename}"
hyper fip attach ${ip%:*} "${nodename}"
#watch the logs of your newly created container. hit ctrl-c when you've seen enough.
hyper logs -f "${nodename}"
#run commands within your container (for example..)
hyper exec -it "${nodename}" dash-cli mnsync status
hyper exec -it "${nodename}" bash
after mnsync status shows your node is synced.. remotely start your masternode(eg run `masternode start-missing` using dash-cli or the wallet console.)
Guide to host a masternode in a Kubernetes cluster
(like Google container engine or something else?)
To use this guide you will need the following pieces of information:
- access to a kubernetes cluster with kubectl configured.
- masternode private key
- exactly 1000 dash sitting in a new address with no other tx's in it.
- knowledge of how to remotely start a masternode.
Code:
#example by brute force.
nodename= #whatever you would like to call your node(no spaces or crazy chars)
key= #masternode private key (not collateral key)
cat << EOF |kubectl create -f -
kind: Service
apiVersion: v1
metadata:
labels:
name: $nodename
name: $nodename
spec:
type: LoadBalancer
ports:
- port: 9999
protocol: TCP
name: $nodename
selector:
name: $nodename
EOF
#depending on your provider.. the external ip may not be ready yet.. but the goal is to collect it from this output.
kubectl get service -o yaml
ip= #what you found.
cat << EOF |kubectl create -f -
kind: ReplicationController
apiVersion: v1
metadata:
name: $nodename
labels:
name: $nodename
spec:
replicas: 1
selector:
name: $nodename
template:
metadata:
labels:
name: $nodename
spec:
containers:
- image: yourdockerhub/imagename:latest
imagePullPolicy: Always
name: $nodename
ports:
- containerPort: 9999
protocol: TCP
env:
- name: MNKEY
value: $key
- name: MNIP
value: $ip
restartPolicy: Always
EOF
kubectl get pods
kubectl logs -f #podnamehere
#check mnsync status:
kubectl exec -it #podnamehere dash-cli mnsync status
#run a shell inside container..
kubectl exec -it #podnamehere bash
after mnsync status shows 999 goodness.. remotely start your masternode.
Dockerfile used by both examples:
Code:
# Dockerfile for Dashd
FROM debian:jessie
MAINTAINER your mom
LABEL description="dockerized dashd for running masternodes"
RUN apt-get update \
&& apt-get install -y curl iptables git python-virtualenv \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV DASH_DOWNLOAD_URL github.com/dashpay/dash/releases/download/v0.12.1.4/dashcore-0.12.1.4-linux64.tar.gz
RUN cd /tmp \
&& curl -sSL "$DASH_DOWNLOAD_URL" -o dash.tgz "$DASH_DOWNLOAD_URL.asc" -o dash.tgz.asc \
&& echo "AF1AE13F33D06F487F23DC814B88269ABD8DF332:6:"|gpg --import-ownertrust \
&& gpg --keyserver pgp.mit.edu --recv-keys 0x4B88269ABD8DF332 \
&& gpg --verify dash.tgz.asc dash.tgz \
&& tar xzf dash.tgz --no-anchored dashd dash-cli --transform='s/.*\///' \
&& mv dashd dash-cli /usr/bin/ \
&& rm -rf dash* \
&& echo "#""!/bin/bash\n/usr/bin/dashd -datadir=/dash \"\$@\"" > /usr/local/bin/dashd \
&& echo "#""!/bin/bash\n/usr/bin/dash-cli -datadir=/dash \"\$@\"" > /usr/local/bin/dash-cli \
&& chmod a+x /usr/local/bin/dashd /usr/local/bin/dash-cli /usr/bin/dashd /usr/bin/dash-cli
ENV HOME /dash
RUN /usr/sbin/useradd -s /bin/bash -m -d /dash dash \
&& chown dash:dash -R /dash
ADD dash.conf /dash/dash.conf
RUN chown dash:dash -R /dash
USER dash
RUN cd dash \
&& git clone git://github.com/dashpay/sentinel \
&& cd sentinel \
&& virtualenv venv \
&& venv/bin/pip install -r requirements.txt \
&& ln -s ~ ~/.dashcore
#fetch to semi recent block
#warning! makes for large image, but fast startup times.
ENV BLOCKS 644184
RUN dashd & sleep 10;echo "syncing blocks(this will take a while)"; while [ ${t:-0} -lt $BLOCKS ];do t=$(dash-cli getinfo|grep blocks); t=${t##* };t=${t%,};echo -n ${t:-0}" "; sleep 10;done;dash-cli getinfo;dash-cli stop;sleep 10
RUN rm /dash/wallet.dat
EXPOSE 9999
WORKDIR /dash
CMD echo externalip=${MNIP%:*} >> /dash/dash.conf; echo masternodeprivkey=$MNKEY >> /dash/dash.conf; while sleep 60;do sentinel/venv/bin/python sentinel/bin/sentinel.py;done& exec dashd -printtoconsole
note you'll also need to provide a dash.conf stub.
sample:
Code:
#daemon=1 never set this.. cause containers.
logtimestamps=1
maxconnections=256
masternode=1
#addnode=some node you like
#addnode=some other node you like
keypool=1
Last edited: