added backend packaging files
This commit is contained in:
parent
fe4c2f5228
commit
a07ef5ac80
28
contrib/backends/Makefile
Normal file
28
contrib/backends/Makefile
Normal 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
|
||||
13
contrib/backends/bitcoin/Makefile
Normal file
13
contrib/backends/bitcoin/Makefile
Normal 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*
|
||||
12
contrib/backends/bitcoin/btc-testnet.conf
Normal file
12
contrib/backends/bitcoin/btc-testnet.conf
Normal 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
|
||||
11
contrib/backends/bitcoin/btc.conf
Normal file
11
contrib/backends/bitcoin/btc.conf
Normal 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
|
||||
1
contrib/backends/bitcoin/debian/bitcoin-btc.conffiles
Normal file
1
contrib/backends/bitcoin/debian/bitcoin-btc.conffiles
Normal file
@ -0,0 +1 @@
|
||||
/data/btc/bitcoin/btc.conf
|
||||
1
contrib/backends/bitcoin/debian/bitcoin-btc.dirs
Normal file
1
contrib/backends/bitcoin/debian/bitcoin-btc.dirs
Normal file
@ -0,0 +1 @@
|
||||
/data/btc/bitcoin
|
||||
1
contrib/backends/bitcoin/debian/bitcoin-btc.install
Normal file
1
contrib/backends/bitcoin/debian/bitcoin-btc.install
Normal file
@ -0,0 +1 @@
|
||||
btc.conf /data/btc/bitcoin
|
||||
10
contrib/backends/bitcoin/debian/bitcoin-btc.logrotate
Normal file
10
contrib/backends/bitcoin/debian/bitcoin-btc.logrotate
Normal file
@ -0,0 +1,10 @@
|
||||
/data/btc/bitcoin/debug.log
|
||||
/data/btc/bitcoin/db.log
|
||||
{
|
||||
rotate 7
|
||||
daily
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
20
contrib/backends/bitcoin/debian/bitcoin-btc.postinst
Normal file
20
contrib/backends/bitcoin/debian/bitcoin-btc.postinst
Normal 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#
|
||||
44
contrib/backends/bitcoin/debian/bitcoin-btc.service
Normal file
44
contrib/backends/bitcoin/debian/bitcoin-btc.service
Normal 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
|
||||
@ -0,0 +1 @@
|
||||
/data/btc-testnet/bitcoin/btc-testnet.conf
|
||||
1
contrib/backends/bitcoin/debian/bitcoin-testnet.dirs
Normal file
1
contrib/backends/bitcoin/debian/bitcoin-testnet.dirs
Normal file
@ -0,0 +1 @@
|
||||
/data/btc-testnet/bitcoin
|
||||
1
contrib/backends/bitcoin/debian/bitcoin-testnet.install
Normal file
1
contrib/backends/bitcoin/debian/bitcoin-testnet.install
Normal file
@ -0,0 +1 @@
|
||||
btc-testnet.conf /data/btc-testnet/bitcoin
|
||||
10
contrib/backends/bitcoin/debian/bitcoin-testnet.logrotate
Normal file
10
contrib/backends/bitcoin/debian/bitcoin-testnet.logrotate
Normal 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
|
||||
}
|
||||
20
contrib/backends/bitcoin/debian/bitcoin-testnet.postinst
Normal file
20
contrib/backends/bitcoin/debian/bitcoin-testnet.postinst
Normal 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#
|
||||
44
contrib/backends/bitcoin/debian/bitcoin-testnet.service
Normal file
44
contrib/backends/bitcoin/debian/bitcoin-testnet.service
Normal 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
|
||||
1
contrib/backends/bitcoin/debian/bitcoin.install
Normal file
1
contrib/backends/bitcoin/debian/bitcoin.install
Normal file
@ -0,0 +1 @@
|
||||
bitcoin /opt/satoshilabs
|
||||
2
contrib/backends/bitcoin/debian/bitcoin.links
Normal file
2
contrib/backends/bitcoin/debian/bitcoin.links
Normal file
@ -0,0 +1,2 @@
|
||||
/opt/satoshilabs/bitcoin/bin/bitcoind /usr/bin/bitcoind
|
||||
/opt/satoshilabs/bitcoin/bin/bitcoin-cli /usr/bin/bitcoin-cli
|
||||
5
contrib/backends/bitcoin/debian/changelog
Normal file
5
contrib/backends/bitcoin/debian/changelog
Normal 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
|
||||
1
contrib/backends/bitcoin/debian/compat
Normal file
1
contrib/backends/bitcoin/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
||||
21
contrib/backends/bitcoin/debian/control
Normal file
21
contrib/backends/bitcoin/debian/control
Normal 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)
|
||||
6
contrib/backends/bitcoin/debian/rules
Executable file
6
contrib/backends/bitcoin/debian/rules
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
DH_VERBOSE = 1
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd
|
||||
13
contrib/backends/docker/Dockerfile
Normal file
13
contrib/backends/docker/Dockerfile
Normal 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"]
|
||||
15
contrib/backends/docker/build.sh
Executable file
15
contrib/backends/docker/build.sh
Executable 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
|
||||
11
contrib/backends/zcash/Makefile
Normal file
11
contrib/backends/zcash/Makefile
Normal 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*
|
||||
5
contrib/backends/zcash/debian/changelog
Normal file
5
contrib/backends/zcash/debian/changelog
Normal 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
|
||||
1
contrib/backends/zcash/debian/compat
Normal file
1
contrib/backends/zcash/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
||||
16
contrib/backends/zcash/debian/control
Normal file
16
contrib/backends/zcash/debian/control
Normal 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)
|
||||
6
contrib/backends/zcash/debian/rules
Executable file
6
contrib/backends/zcash/debian/rules
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
DH_VERBOSE = 1
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd
|
||||
1
contrib/backends/zcash/debian/zcash-zec.conffiles
Normal file
1
contrib/backends/zcash/debian/zcash-zec.conffiles
Normal file
@ -0,0 +1 @@
|
||||
/data/zec/zcash/zec.conf
|
||||
1
contrib/backends/zcash/debian/zcash-zec.dirs
Normal file
1
contrib/backends/zcash/debian/zcash-zec.dirs
Normal file
@ -0,0 +1 @@
|
||||
/data/zec/zcash
|
||||
1
contrib/backends/zcash/debian/zcash-zec.install
Normal file
1
contrib/backends/zcash/debian/zcash-zec.install
Normal file
@ -0,0 +1 @@
|
||||
zec.conf /data/zec/zcash
|
||||
10
contrib/backends/zcash/debian/zcash-zec.logrotate
Normal file
10
contrib/backends/zcash/debian/zcash-zec.logrotate
Normal file
@ -0,0 +1,10 @@
|
||||
/data/zec/zcash/debug.log
|
||||
/data/zec/zcash/db.log
|
||||
{
|
||||
rotate 7
|
||||
daily
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
||||
22
contrib/backends/zcash/debian/zcash-zec.postinst
Normal file
22
contrib/backends/zcash/debian/zcash-zec.postinst
Normal 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#
|
||||
44
contrib/backends/zcash/debian/zcash-zec.service
Normal file
44
contrib/backends/zcash/debian/zcash-zec.service
Normal 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
|
||||
1
contrib/backends/zcash/debian/zcash.install
Normal file
1
contrib/backends/zcash/debian/zcash.install
Normal file
@ -0,0 +1 @@
|
||||
zcash /opt/satoshilabs
|
||||
2
contrib/backends/zcash/debian/zcash.links
Normal file
2
contrib/backends/zcash/debian/zcash.links
Normal file
@ -0,0 +1,2 @@
|
||||
/opt/satoshilabs/zcash/bin/zcashd /usr/bin/zcashd
|
||||
/opt/satoshilabs/zcash/bin/zcash-cli /usr/bin/zcash-cli
|
||||
13
contrib/backends/zcash/zec.conf
Normal file
13
contrib/backends/zcash/zec.conf
Normal 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
|
||||
Loading…
Reference in New Issue
Block a user