Commit 5a1728fc authored by squbs's avatar squbs

initial version 1.14.5

parents
language: bash
services: docker
env:
- VARIANT=xenial
install:
- git clone https://github.com/docker-library/official-images.git official-images
before_script:
- env | sort
- image="straksd:$VARIANT"
script:
- docker build -t "$image" .
- official-images/test/run.sh "$image"
- test/run.sh "$image"
after_script:
- docker images
# vim:set et ts=2 sw=2:
# Contributing to docker-straksd
Community contributions are welcome and help move the project along. Please review this document before sending any pull requests.
Thanks!
## Bug Fixes
All bug fixes are welcome. Please try to add a test if the bug is something that should have been fixed already. Oops.
## Feature Additions
New features are welcome provided that the feature has a general audience and is reasonably simple. The goal of the repository is to support a wide audience and be simple enough.
Please add new documentation in the `docs` folder for any new features. Pull requests for missing documentation is welcome as well. Keep the `README.md` focused on the most popular use case, details belong in the docs directory.
If you have a special feature, you're likely to try but it will likely be rejected if not too many people seem interested.
## Tests
In an effort to not repeat bugs (and break less popular features), unit tests are run on [Travis CI](https://travis-ci.org/squbs/docker-straksd). The goal of the tests are to be simple and to be placed in the `test` directory where it will be automatically run.
See [test directory](https://github.com/squbs/docker-straksd/tree/master/test) for details.
## Style
The style of the repo follows that of the Linux kernel, in particular:
* Pull requests should be rebased to small atomic commits so that the merged history is more coherent
* The subject of the commit should be in the form "<subsystem>: <subject>"
* More details in the body
* Match surrounding coding style (line wrapping, spaces, etc)
More details in the [SubmittingPatches](https://www.kernel.org/doc/Documentation/SubmittingPatches) document included with the Linux kernel. In particular the following sections:
* `2) Describe your changes`
* `3) Separate your changes`
FROM ubuntu:xenial
MAINTAINER squbs <[email protected]>
ARG USER_ID
ARG GROUP_ID
ENV HOME /straks
ENV STRAKS_VER 1.14.5.0
# add user with specified (or default) user/group ids
ENV USER_ID ${USER_ID:-1000}
ENV GROUP_ID ${GROUP_ID:-1000}
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -g ${GROUP_ID} straks \
&& useradd -u ${USER_ID} -g straks -s /bin/bash -m -d /straks straks
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y libtool autotools-dev autoconf automake
RUN apt-get install -y libssl-dev
RUN apt-get install -y libboost-all-dev
RUN apt-get install -y pkg-config
RUN apt-get -y install python-software-properties software-properties-common git
RUN add-apt-repository -y ppa:bitcoin/bitcoin
RUN apt-get -y update
RUN apt-get install -y libdb4.8-dev
RUN apt-get install -y libdb4.8++-dev
RUN apt-get install -y libminiupnpc-dev
RUN apt-get install -y libqt4-dev libprotobuf-dev protobuf-compiler
RUN apt-get install -y libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev
RUN apt-get install -y libcanberra-gtk-module
RUN apt-get install -y gtk2-engines-murrine
RUN apt-get install -y libqrencode-dev
RUN apt-get install -y libevent-dev
RUN apt-get install -y libzmq3-dev
RUN apt-get install -y wget
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# [1] if you want to compile from source, needs a lot of ram
#RUN cd ${HOME} && git clone https://github.com/straks/straks.git
#RUN cd ${HOME}/straks && ./autogen.sh
#RUN cd ${HOME}/straks && ./configure
#RUN cd ${HOME}/straks && make
#RUN cd ${HOME}/straks && cp straksd /usr/bin/straksd && cp straks-cli /usr/bin/straks-cli && cp straks-tx /usr/bin/straks-tx && cp qt/straks-qt /usr/bin/straks-qt
# [2] pre-compiled binaries
RUN cd ${HOME} && wget https://github.com/straks/straks/releases/download/${STRAKS_VER}/straks-${STRAKS_VER}-linux-amd64.tar.gz && tar zxvf straks-${STRAKS_VER}-linux-amd64.tar.gz
RUN cd ${HOME}/straks-${STRAKS_VER}-linux-amd64 && cp straksd /usr/bin/straksd && cp straks-cli /usr/bin/straks-cli && cp straks-tx /usr/bin/straks-tx && cp straks-qt /usr/bin/straks-qt
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y \
ca-certificates \
wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD ./bin /usr/local/bin
VOLUME ["/straks"]
EXPOSE 7575 7574
WORKDIR /straks
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["straks_oneshot"]
FROM armv7/armhf-ubuntu:xenial
MAINTAINER squbs <[email protected]>
ARG USER_ID
ARG GROUP_ID
ENV HOME /straks
ENV STRAKS_VER 1.14.5.0
# add user with specified (or default) user/group ids
ENV USER_ID ${USER_ID:-1000}
ENV GROUP_ID ${GROUP_ID:-1000}
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -g ${GROUP_ID} straks \
&& useradd -u ${USER_ID} -g straks -s /bin/bash -m -d /straks straks
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y libtool autotools-dev autoconf automake
RUN apt-get install -y libssl-dev
RUN apt-get install -y libboost-all-dev
RUN apt-get install -y pkg-config
RUN apt-get -y install python-software-properties software-properties-common git
RUN add-apt-repository -y ppa:bitcoin/bitcoin
RUN apt-get -y update
RUN apt-get install -y libdb4.8-dev
RUN apt-get install -y libdb4.8++-dev
RUN apt-get install -y libminiupnpc-dev
RUN apt-get install -y libqt4-dev libprotobuf-dev protobuf-compiler
RUN apt-get install -y libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev
RUN apt-get install -y libcanberra-gtk-module
RUN apt-get install -y gtk2-engines-murrine
RUN apt-get install -y libqrencode-dev
RUN apt-get install -y libevent-dev
RUN apt-get install -y libzmq3-dev
RUN apt-get install -y wget
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# needs a lot of virtual memory...
RUN cd ${HOME} && git clone https://github.com/straks/straks.git
RUN cd ${HOME}/straks && ./autogen.sh
RUN cd ${HOME}/straks && ./configure
RUN cd ${HOME}/straks && make
RUN cd ${HOME}/straks && cp straksd /usr/bin/straksd && cp straks-cli /usr/bin/straks-cli && cp straks-tx /usr/bin/straks-tx && cp qt/straks-qt /usr/bin/straks-qt
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y \
ca-certificates \
wget \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD ./bin /usr/local/bin
VOLUME ["/straks"]
EXPOSE 7575 7574
WORKDIR /straks
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["straks_oneshot"]
The MIT License (MIT)
Copyright (c) 2014 Kyle Manna
Copyright (c) 2017 The STRAKS developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
APPNAME=straks-node
#VERSION=$(shell git describe --tags)
VERSION=1.14.5
NAMESPACE=squbs
build:
docker build -t $(NAMESPACE)/$(APPNAME) -t $(NAMESPACE)/$(APPNAME):$(VERSION) .
APPNAME=straks-node
#VERSION=$(shell git describe --tags)
VERSION=1.14.5-armhf
NAMESPACE=squbs
build:
docker build -f Dockerfile.armhf -t $(NAMESPACE)/$(APPNAME) -t $(NAMESPACE)/$(APPNAME):$(VERSION) .
STRAKS Node For Docker
======================
[![Docker Stars](https://img.shields.io/docker/stars/squbs/straks-node.svg)](https://hub.docker.com/r/squbs/straks-node/)
[![Docker Pulls](https://img.shields.io/docker/pulls/squbs/straks-node.svg)](https://hub.docker.com/r/squbs/straks-node/)
[![ImageLayers](https://images.microbadger.com/badges/image/squbs/straks-node.svg)](https://microbadger.com/#/images/squbs/straks-node)
Docker image that runs a STRAKS node in a container for easy deployment.
Requirements
------------
* Physical machine, cloud instance, or VPS that supports Docker (i.e. [Digital Ocean](https://goo.gl/eWziH7), KVM or XEN based VMs) running Ubuntu 16.04 or later (*not OpenVZ containers!*)
* At least 5 GB to store the block chain files (chain will grow continously)
* At least 1 GB RAM + 2 GB swap file
* Run `sudo usermod -aG docker <user>` and then logout/login or reboot, if you're a new Docker user
* Encrypted wallets will need to be unlocked for staking (see below)
Really Fast Quick Start
-----------------------
One liner for Ubuntu Xenial/Zesty machines with JSON-RPC enabled on localhost and adds systemd service:
curl https://raw.githubusercontent.com/straks/straks-node/master/bootstrap-host.sh | sh
For Raspberry Pi 2/3:
curl https://raw.githubusercontent.com/straks/straks-node/master/bootstrap-host-armhf.sh | sh
Quick Start
-----------
1. Create a `straks-data` volume to persist the STRAKS blockchain data, should exit immediately. The `straks-data` container will store the blockchain when the node container is recreated (software upgrade, reboot, etc):
docker volume create --name=straks-data
docker run -v straks-data:/straks --name=straks-node -d \
-p 7575:7575 \
-p 7574:7574 \
squbs/straks-node
2. Verify that the container is running and `straks-node` daemon is downloading the blockchain:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ee825ac17747 squbs/straks-node:latest "straks_oneshot" 2 seconds ago Up 1 seconds 127.0.0.1:7575->7575/tcp, 0.0.0.0:7574->7574/tcp straks-node
3. You can then access the daemon's output thanks to the [docker logs command]( https://docs.docker.com/reference/commandline/cli/#logs)
$ docker logs -f straks-node
4. Install optional init scripts for upstart and systemd located in the `init` directory.
General Commands
----------------
1. Open a bash shell within the running container and issue commands to the daemon:
$ docker exec -it straks-node bash
$ straksd getinfo
2. Copy file (e.g. straks.conf) in and out of the container:
# Copy to your local dir:
$ docker cp straks-node:/straks/.straks/straks.conf .
# Copy back to the container:
$ docker straks.conf straks-node:/straks/.straks/straks.conf
# Stop/start the container
$ docker stop straks-node
$ docker start straks-node
3. Backup wallet (two approaches):
# Approach 1
# This will create a human readable file dump (depending on encryption status etc):
(a) Dump wallet:
$ docker exec -it straks-node straksd dumpwallet backup_wallet.dat
(b) Copy to local dir:
$ docker cp straks-node:/straks/backup_wallet.dat .
# Approach 2
# This will create a binary file:
(a) Copy dat file to local dir:
$ docker cp straks-node:/straks/.straks/wallet.dat backup_wallet.dat
4. Check `straks-node` log file using system `tail -f` command:
$ docker ps
# Note the 'COINTAINER ID' for straks-node
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ee825ac17747 squbs/straks-node:1.14.5 "docker-entrypoint..." 21 seconds ago Up 21 seconds 7575/tcp, 0.0.0.0:7574->7574/tcp straks-node`
# Run inspect command on container id
$ docker inspect --format='{{.LogPath}}' ee825ac17747
# Docker will output location and filename of the container log file:
$ /var/lib/docker/containers/ee825ac17747f2abaf627600860697e1213249ab83bb0cf136684dd4a4b7f55d/ee825ac17747f2abaf627600860697e1213249ab83bb0cf136684dd4a4b7f55d-json.log
$ tail -f ee825ac17747f2abaf627600860697e1213249ab83bb0cf136684dd4a4b7f55d-json.log
5. Modify `straks.conf` and/or `wallet.dat` files without `docker cp`:
$ docker volume inspect straks-data
# output:
[
{
"CreatedAt": "2017-11-26T16:07:53Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/straks-data/_data",
"Name": "straks-data",
"Options": {},
"Scope": "local"
}
]
# The 'Mountpoint' directory is the system location of all your user files that reside within the container.
# 'cd' into this directory - use sudo if you have permission issues - and then copy your conf
# and wallet files over existing files that may exist in the `.straks/` folder
# WARNING: make sure to stop the `straks-node` process before changing config or wallet files
6. Simple json-rpc call to straks-node from another machine (or host):
# username and password can be found in the `straks.conf` file
# daemon-host-ip can be localhost/0.0.0.0/127.0.0.1 or a lan/wan ip address
$ curl -s --user '<username>:<password>' --data-binary '{"jsonrpc": "2.0","method": "getinfo", "params": [] }' -H 'content-type: application/json-rpc;' http://<daemon-host-ip>:7574
If you have `jq` installed, you can do some pretty json printing:
$ curl -s --user '<username>:<password>' --data-binary '{"jsonrpc": "2.0","method": "getinfo", "params": [] }' -H 'content-type: application/json-rpc;' http://127.0.0.1:7574 | jq '.'
Or `python -m json.tool`:
$ curl -s --user '<username>:<password>' --data-binary '{"jsonrpc": "2.0","method": "getinfo", "params": [] }' -H 'content-type: application/json-rpc;' http://127.0.0.1:7574 | python -m json.tool
Documentation
-------------
* Additional documentation in the [docs folder](docs).
#!/bin/bash
set -ex
# This shouldn't be in the Dockerfile or containers built from the same image
# will have the same credentials.
echo "Working directory set to:"
echo $HOME
if [ ! -d "$HOME/.straks" ]; then
mkdir -p $HOME/.straks
fi
if [ ! -e "$HOME/.straks/straks.conf" ]; then
echo "Creating straks.conf"
# Seed a random password for JSON RPC server
cat <<EOF > $HOME/.straks/straks.conf
#################
# General Config
#################
printtoconsole=${PRINTTOCONSOLE:-1}
rpcuser=${RPCUSER:-ustraks}
rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`}
rpcport=7574
rpcallowip=127.0.0.1
server=1
daemon=0
listen=1
maxconnections=100
####################
# Masternode Config
####################
#masternode=1
#masternodeprivkey=
#externalip=:7575
#promode=1
EOF
fi
cat $HOME/.straks/straks.conf
echo "Initialization completed successfully"
#!/bin/bash
set -ex
# Generate straks.conf
straks_init
#if [ $# -gt 0 ]; then
# args=("[email protected]")
#else
# args=("-rpcallowip=::/0")
#fi
#exec straksd "${args[@]}"
exec straksd
#!/bin/bash
#
# Configure broken host machine to run correctly
#
set -ex
STAK_IMAGE=${STAK_IMAGE:-squbs/straks-node:1.14.5-armhf}
memtotal=$(grep ^MemTotal /proc/meminfo | awk '{print int($2/1024) }')
# Only do swap hack if needed
if [ $memtotal -lt 2048 -a $(swapon -s | wc -l) -lt 2 ]; then
sudo fallocate -l 2048M /swap || sudo dd if=/dev/zero of=/swap bs=1M count=2048
sudo mkswap /swap
grep -q "^/swap" /etc/fstab || sudo echo "/swap swap swap defaults 0 0" >> /etc/fstab
sudo swapon -a
fi
free -m
curl -fsSL get.docker.com -o /tmp/get-docker.sh
sh /tmp/get-docker.sh
#try to add user to group
puser=$(whoami)
sudo usermod -aG docker $puser
newgrp docker
# Always clean-up, but fail successfully
docker kill straks-node 2>/dev/null || true
docker rm straks-node 2>/dev/null || true
stop docker-straks-node 2>/dev/null || true
# Always pull remote images to avoid caching issues
if [ -z "${STAK_IMAGE##*/*}" ]; then
docker pull $STAK_IMAGE
fi
# Initialize the data container
docker volume create --name=straks-data
docker run -v straks-data:/straks --rm $STAK_IMAGE straks_init
# Start straks-node via systemd and docker
wget https://raw.githubusercontent.com/straks/straks-node/master/init/docker-straks-node-armhf.service
sudo mv docker-straks-node-armhf.service /etc/systemd/system/docker-straks-node.service
sudo systemctl enable docker-straks-node.service
set +ex
echo "Resulting straks.conf:"
docker run -v straks-data:/straks --rm $STAK_IMAGE cat /straks/.straks/straks.conf
#!/bin/bash
#
# Configure broken host machine to run correctly
#
set -ex
STAK_IMAGE=${STAK_IMAGE:-squbs/straks-node}
memtotal=$(grep ^MemTotal /proc/meminfo | awk '{print int($2/1024) }')
# Only do swap hack if needed
if [ $memtotal -lt 2048 -a $(swapon -s | wc -l) -lt 2 ]; then
sudo fallocate -l 2048M /swap || sudo dd if=/dev/zero of=/swap bs=1M count=2048
sudo mkswap /swap
grep -q "^/swap" /etc/fstab || sudo echo "/swap swap swap defaults 0 0" >> /etc/fstab
sudo swapon -a
fi
free -m
curl -fsSL get.docker.com -o /tmp/get-docker.sh
sh /tmp/get-docker.sh
#try to add user to group
puser=$(whoami)
sudo usermod -aG docker $puser
newgrp docker
# Always clean-up, but fail successfully
docker kill straks-node 2>/dev/null || true
docker rm straks-node 2>/dev/null || true
stop docker-straks-node 2>/dev/null || true
# Always pull remote images to avoid caching issues
if [ -z "${STAK_IMAGE##*/*}" ]; then
docker pull $STAK_IMAGE
fi
# Initialize the data container
docker volume create --name=straks-data
docker run -v straks-data:/straks --rm $STAK_IMAGE straks_init
# Start straks-node via systemd and docker
sudo curl https://raw.githubusercontent.com/straks/straks-node/master/init/docker-straks-node.service > /etc/systemd/system/docker-straks-node.service
sudo systemctl enable docker-straks-node.service
set +ex
echo "Resulting straks.conf:"
docker run -v straks-data:/straks --rm $STAK_IMAGE cat /straks/.straks/straks.conf
#!/bin/bash
docker ps -a | grep "straks-node" | awk '{print $3}' | xargs docker rmi
docker images | grep "straks-node" | awk '{print $1}' | xargs docker rm
docker volume rm straks-data
#!/bin/sh
set -e
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
set -- straks_oneshot "[email protected]"
fi
# allow the container to be started with `--user`
if [ "$1" = 'straks_oneshot' -a "$(id -u)" = '0' ]; then
chown -R straks .
exec gosu straks "$0" "[email protected]"
fi
exec "[email protected]"
Building
========
The image can be built from source by running:
docker build .
A recommended security practice is to add an additional unprivileged user to run the daemon as on the host. For example, as a privileged user, run this on the host:
useradd straks
To build an image which uses this unprivileged user's id and group id, run:
docker build --build-arg USER_ID=$( id -u straks ) --build-arg GROUP_ID=$( id -g straks ) .
Now, when the container is run with the default options, the straks process will only have the privileges of the straks user on the host machine. This is especially important for a process such as straks which runs as a network service exposed to the internet.
straks-node Config Tuning
=========================
You can use environment variables to customize config ([see docker run environment options](https://docs.docker.com/engine/reference/run/#/env-environment-variables)):
docker run -v straks-data:/straks --name=straks-node -d \
-p 7575:7575 \
-p 127.0.0.1:7574:7574 \
-e PRINTTOCONSOLE=1 \
-e RPCUSER=ustraks \
-e RPCPASSWORD=mysecretrpcpassword \
squbs/straks-node
Or you can use your very own config file like that:
docker run -v straks-data:/straks --name=straks-node -d \
-p 7575:7575 \
-p 127.0.0.1:7574:7574 \
-v /etc/mystraks.conf:/straks/.straks/straks.conf \
squbs/straks-node
[Unit]
Description=STRAKS Daemon Docker Container
Documentation=https://github.com/straks/straks-node
After=network.target docker.socket
Requires=docker.socket
[Service]
RestartSec=10
Restart=always
# Modify IP6_PREFIX to match network config
Environment="NAME=straks-node"
Environment="DATA_VOL=straks-data"
Environment="IMG=squbs/straks-node:1.14.5-armhf"
Environment="PORT=7575:7575/tcp"
Environment="PORTRPC=7574:7574/tcp"
# To override environment variables, use local configuration directory:
# /etc/systemd/system/docker-straksd.service/local.conf
# http://www.freedesktop.org/software/systemd/man/systemd.unit.html
# Clean-up bad state if still hanging around
ExecStartPre=-/usr/bin/docker rm -f $NAME
# Attempt to pull new image for security updates
ExecStartPre=-/usr/bin/docker pull $IMG
# Main process
ExecStart=/usr/bin/docker run --rm -v ${DATA_VOL}:/straks --name ${NAME} -p ${PORT} -p ${PORTRPC} ${IMG} straks_oneshot $ARGS
[Install]
WantedBy=multi-user.target
[Unit]
Description=STRAKS Daemon Docker Container
Documentation=https://github.com/straks/straks-node
After=network.target docker.socket
Requires=docker.socket
[Service]
RestartSec=10
Restart=always
# Modify IP6_PREFIX to match network config
Environment="NAME=straks-node"
Environment="DATA_VOL=straks-data"
Environment="IMG=squbs/straks-node:1.14.5"
Environment="PORT=7575:7575/tcp"
Environment="PORTRPC=7574:7574/tcp"
# To override environment variables, use local configuration directory:
# /etc/systemd/system/docker-straksd.service/local.conf
# http://www.freedesktop.org/software/systemd/man/systemd.unit.html
# Clean-up bad state if still hanging around
ExecStartPre=-/usr/bin/docker rm -f $NAME
# Attempt to pull new image for security updates
ExecStartPre=-/usr/bin/docker pull $IMG
# Main process
ExecStart=/usr/bin/docker run --rm -v ${DATA_VOL}:/straks --name ${NAME} -p ${PORT} -p ${PORTRPC} ${IMG} straks_oneshot $ARGS
[Install]
WantedBy=multi-user.target
# Copy to /etc/init/docker-straks-node.conf
description "Docker container for STRAKS p2p node"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
pre-start script
# Clean-up if left behind
docker rm -f straks-node || true
# Attempt to always update and fail silently if the network isn't ready
docker pull squbs/straks-node || true
end script
script
exec docker run --rm -v straks-data:/straks --name=straks-node --rm -p 7575:7575 -p 127.0.0.1:7574:7574 squbs/straks-node
end script
#!/bin/bash
# ONLY USE FOR FIRST RUN!!!!
# ...on subsequent starts dimply run "docker start straks-node"
docker volume create straks-data
docker run -v straks-data:/straks --name=straks-node -d -p 7575:7575 -p 7574:7574 squbs/straks-node:1.14.5
# run "docker logs straks-node" for container output
# run "docker exec -it straks-node bash" for interactive shell
#################
# General Config
#################
rpcuser=ustraks
rpcpassword=YourSuperGreatPassword_DO_NOT_USE_THIS_DEFAULT_TEXT_OR_YOU_WILL_GET_ROBBED
rpcport=7574
rpcallowip=127.0.0.1
server=1
daemon=0
listen=1
#maxconnections=100
####################
# Masternode Config
####################
#masternode=1
#masternodeprivkey=
#externalip=:7575
#promode=1
# Tests
Philosophy is to not re-invent the wheel while allowing users to quickly test repository specific tests.