added backend packaging files

This commit is contained in:
Jakub Matys 2018-04-11 08:44:23 +02:00
parent fe4c2f5228
commit a07ef5ac80
38 changed files with 416 additions and 0 deletions

28
contrib/backends/Makefile Normal file
View File

@ -0,0 +1,28 @@
TARGETS = bitcoin zcash
IMAGE = blockbook-backend-build-deb
NO_CACHE = false
.PHONY: $(TARGETS)
all: $(TARGETS)
$(TARGETS): .docker-image
docker run -t --rm -e PACKAGER="`id -u`:`id -g`" -v $(CURDIR)/$@:/deb/$@ $(IMAGE) $@
mv $@/*.deb .
build-image:
rm -f .docker-image
$(MAKE) .docker-image
.docker-image:
docker build --no-cache=$(NO_CACHE)-t $(IMAGE) docker
@ docker images -q $(IMAGE) > $@
clean: clean-packages clean-image
clean-packages:
rm -f *.deb
clean-image:
- docker rmi $(IMAGE)
@ rm -f .docker-image

View File

@ -0,0 +1,13 @@
BITCOIN_VERSION := 0.16.0
all:
wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
tar -xf bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
mv bitcoin-${BITCOIN_VERSION} bitcoin
rm bitcoin/bin/bitcoin-qt
rm bitcoin/bin/bitcoin-tx
rm bitcoin/bin/test_bitcoin
clean:
rm -rf bitcoin
rm -f bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz*

View File

@ -0,0 +1,12 @@
daemon=1
server=1
testnet=1
rpcuser=rpc
rpcpassword=rpc
rpcport=18332
txindex=1
rpcworkqueue=32
zmqpubhashtx=tcp://127.0.0.1:18334
zmqpubhashblock=tcp://127.0.0.1:18334
zmqpubrawblock=tcp://127.0.0.1:18334
zmqpubrawtx=tcp://127.0.0.1:18334

View File

@ -0,0 +1,11 @@
daemon=1
server=1
rpcuser=rpc
rpcpassword=rpc
rpcport=8332
txindex=1
rpcworkqueue=32
zmqpubhashtx=tcp://127.0.0.1:8334
zmqpubhashblock=tcp://127.0.0.1:8334
zmqpubrawblock=tcp://127.0.0.1:8334
zmqpubrawtx=tcp://127.0.0.1:8334

View File

@ -0,0 +1 @@
/data/btc/bitcoin/btc.conf

View File

@ -0,0 +1 @@
/data/btc/bitcoin

View File

@ -0,0 +1 @@
btc.conf /data/btc/bitcoin

View File

@ -0,0 +1,10 @@
/data/btc/bitcoin/debug.log
/data/btc/bitcoin/db.log
{
rotate 7
daily
compress
missingok
notifempty
copytruncate
}

View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u bitcoin &> /dev/null
then
useradd --system -M -U bitcoin
fi
if [ "$(stat -c '%U' /data/btc/bitcoin)" != "bitcoin" ]
then
chown bitcoin:bitcoin /data/btc/bitcoin
fi
;;
esac
#DEBHELPER#

View File

@ -0,0 +1,44 @@
# It is not recommended to modify this file in-place, because it will
# be overwritten during package upgrades. If you want to add further
# options or overwrite existing ones then use
# $ systemctl edit bitcoin-btc.service
# See "man systemd.service" for details.
# Note that almost all daemon options could be specified in
# /data/btc/bitcoin/bitcoin.conf
[Unit]
Description=Bitcoin daemon (mainnet)
After=network.target
[Service]
ExecStart=/opt/satoshilabs/bitcoin/bin/bitcoind -datadir=/data/btc/bitcoin -conf=/data/btc/bitcoin/btc.conf -pid=/run/bitcoind/btc.pid
# Creates /run/bitcoind owned by bitcoin
RuntimeDirectory=bitcoind
User=bitcoin
Type=forking
PIDFile=/run/bitcoind/btc.pid
Restart=on-failure
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
/data/btc-testnet/bitcoin/btc-testnet.conf

View File

@ -0,0 +1 @@
/data/btc-testnet/bitcoin

View File

@ -0,0 +1 @@
btc-testnet.conf /data/btc-testnet/bitcoin

View File

@ -0,0 +1,10 @@
/data/btc-testnet/bitcoin/testnet3/debug.log
/data/btc-testnet/bitcoin/testnet3/db.log
{
rotate 7
daily
compress
missingok
notifempty
copytruncate
}

View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u bitcoin &> /dev/null
then
useradd --system -M -U bitcoin
fi
if [ "$(stat -c '%U' /data/btc-testnet/bitcoin)" != "bitcoin" ]
then
chown bitcoin:bitcoin /data/btc-testnet/bitcoin
fi
;;
esac
#DEBHELPER#

View File

@ -0,0 +1,44 @@
# It is not recommended to modify this file in-place, because it will
# be overwritten during package upgrades. If you want to add further
# options or overwrite existing ones then use
# $ systemctl edit bitcoin-testnet.service
# See "man systemd.service" for details.
# Note that almost all daemon options could be specified in
# /data/btc-testnet/bitcoin/bitcoin.conf
[Unit]
Description=Bitcoin daemon (testnet)
After=network.target
[Service]
ExecStart=/opt/satoshilabs/bitcoin/bin/bitcoind -datadir=/data/btc-testnet/bitcoin -conf=/data/btc-testnet/bitcoin/btc-testnet.conf -pid=/run/bitcoind/testnet.pid
# Creates /run/bitcoind owned by bitcoin
RuntimeDirectory=bitcoind
User=bitcoin
Type=forking
PIDFile=/run/bitcoind/testnet.pid
Restart=on-failure
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
bitcoin /opt/satoshilabs

View File

@ -0,0 +1,2 @@
/opt/satoshilabs/bitcoin/bin/bitcoind /usr/bin/bitcoind
/opt/satoshilabs/bitcoin/bin/bitcoin-cli /usr/bin/bitcoin-cli

View File

@ -0,0 +1,5 @@
bitcoin (0.16.0-satoshilabs1) unstable; urgency=medium
* Initial build
-- Jakub Matys <jakub.matys@satoshilabs.com> Thu, 05 Apr 2018 08:40:39 +0200

View File

@ -0,0 +1 @@
9

View File

@ -0,0 +1,21 @@
Source: bitcoin
Section: satoshilabs
Priority: optional
Maintainer: jakub.matys@satoshilabs.com
Build-Depends: debhelper, wget, tar, gzip, make, dh-systemd
Standards-Version: 3.9.5
Package: bitcoin
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Satoshilabs packaged bitcoin server (binaries)
Package: bitcoin-btc
Architecture: all
Depends: bitcoin (= ${binary:Version}), logrotate
Description: Satoshilabs packaged bitcoin server (configuration)
Package: bitcoin-testnet
Architecture: all
Depends: bitcoin (= ${binary:Version}), logrotate
Description: Satoshilabs packaged bitcoin server (configuration)

View File

@ -0,0 +1,6 @@
#!/usr/bin/make -f
DH_VERBOSE = 1
%:
dh $@ --with=systemd

View File

@ -0,0 +1,13 @@
FROM debian:9
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y devscripts debhelper wget tar gzip make dh-systemd && \
apt-get clean
ADD build.sh /deb/build.sh
WORKDIR /deb
ENTRYPOINT ["/deb/build.sh"]

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
if [ $# -ne 1 ]
then
echo "Usage: $(basename $0) target" > /dev/stderr
exit 1
fi
cd $1
mk-build-deps -ir -t "apt-get -qq --no-install-recommends"
dpkg-buildpackage -us -uc
mv ../*.deb .
chown $PACKAGER *.deb

View File

@ -0,0 +1,11 @@
ZCASH_VERSION := 1.0.15
all:
wget https://z.cash/downloads/zcash-${ZCASH_VERSION}-linux64.tar.gz
tar -xf zcash-${ZCASH_VERSION}-linux64.tar.gz
mv zcash-${ZCASH_VERSION} zcash
rm zcash/bin/zcash-tx
clean:
rm -rf zcash
rm -f zcash-${ZCASH_VERSION}-linux64.tar.gz*

View File

@ -0,0 +1,5 @@
zcash (1.0.15-satoshilabs1) unstable; urgency=medium
* Initial build
-- Jakub Matys <jakub.matys@satoshilabs.com> Thu, 05 Apr 2018 08:40:39 +0200

View File

@ -0,0 +1 @@
9

View File

@ -0,0 +1,16 @@
Source: zcash
Section: satoshilabs
Priority: optional
Maintainer: jakub.matys@satoshilabs.com
Build-Depends: debhelper, wget, tar, gzip, make, dh-systemd
Standards-Version: 3.9.5
Package: zcash
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Satoshilabs packaged zcash server (binaries)
Package: zcash-zec
Architecture: all
Depends: zcash (= ${binary:Version}), logrotate
Description: Satoshilabs packaged zcash server (configuration)

View File

@ -0,0 +1,6 @@
#!/usr/bin/make -f
DH_VERBOSE = 1
%:
dh $@ --with=systemd

View File

@ -0,0 +1 @@
/data/zec/zcash/zec.conf

View File

@ -0,0 +1 @@
/data/zec/zcash

View File

@ -0,0 +1 @@
zec.conf /data/zec/zcash

View File

@ -0,0 +1,10 @@
/data/zec/zcash/debug.log
/data/zec/zcash/db.log
{
rotate 7
daily
compress
missingok
notifempty
copytruncate
}

View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id -u zcash &> /dev/null
then
useradd --system -M -U zcash
fi
if [ "$(stat -c '%U' /data/zec/zcash)" != "zcash" ]
then
chown zcash:zcash /data/zec/zcash
fi
HOME=/data/zec/zcash /opt/satoshilabs/zcash/bin/zcash-fetch-params
;;
esac
#DEBHELPER#

View File

@ -0,0 +1,44 @@
# It is not recommended to modify this file in-place, because it will
# be overwritten during package upgrades. If you want to add further
# options or overwrite existing ones then use
# $ systemctl edit zcash-zec.service
# See "man systemd.service" for details.
# Note that almost all daemon options could be specified in
# /data/zec/zcash/zcash.conf
[Unit]
Description=ZCash daemon (mainnet)
After=network.target
[Service]
ExecStart=/opt/satoshilabs/zcash/bin/zcashd -datadir=/data/zec/zcash -conf=/data/zec/zcash/zec.conf -pid=/run/zcashd/zec.pid
# Creates /run/zcashd owned by zcash
RuntimeDirectory=zcashd
User=zcash
Type=forking
PIDFile=/run/zcashd/zec.pid
Restart=on-failure
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
zcash /opt/satoshilabs

View File

@ -0,0 +1,2 @@
/opt/satoshilabs/zcash/bin/zcashd /usr/bin/zcashd
/opt/satoshilabs/zcash/bin/zcash-cli /usr/bin/zcash-cli

View File

@ -0,0 +1,13 @@
daemon=1
server=1
rpcuser=rpc
rpcpassword=rpc
rpcport=8232
txindex=1
mainnet=1
addnode=mainnet.z.cash
rpcworkqueue=32
zmqpubhashtx=tcp://127.0.0.1:8234
zmqpubhashblock=tcp://127.0.0.1:8234
zmqpubrawblock=tcp://127.0.0.1:8234
zmqpubrawtx=tcp://127.0.0.1:8234