build: include bitcoind service
This commit is contained in:
parent
f9e5121b63
commit
92c0c11c65
|
@ -47,6 +47,7 @@ log_title "Setting up Debian package:"
|
|||
mkdir -vp "$deb_dir/DEBIAN" \
|
||||
"$deb_dir/etc/bitcore" \
|
||||
"$deb_dir/usr/opt/bitcore" \
|
||||
"$deb_dir/usr/opt/bitcore/bin" \
|
||||
"$deb_dir/usr/bin"
|
||||
|
||||
mkdir -vp "$deb_dir/etc/init"
|
||||
|
@ -54,15 +55,18 @@ mkdir -vp "$deb_dir/etc/systemd/system"
|
|||
replace_vars "${root_dir}/scripts/debian/control" "$deb_dir/DEBIAN/control"
|
||||
replace_vars "${root_dir}/scripts/debian/postinst" "$deb_dir/DEBIAN/postinst"
|
||||
replace_vars "${root_dir}/scripts/debian/prerm" "$deb_dir/DEBIAN/prerm"
|
||||
replace_vars "${root_dir}/scripts/debian/upstart.conf" "$deb_dir/etc/init/bitcore.conf"
|
||||
replace_vars "${root_dir}/scripts/debian/systemd.service" "$deb_dir/etc/systemd/system/bitcore.service"
|
||||
replace_vars "${root_dir}/scripts/debian/bitcore.conf" "$deb_dir/etc/init/bitcore.conf"
|
||||
replace_vars "${root_dir}/scripts/debian/bitcore.service" "$deb_dir/etc/systemd/system/bitcore.service"
|
||||
replace_vars "${root_dir}/scripts/debian/bitcore-bitcoind.conf" "$deb_dir/etc/init/bitcore-bitcoind.conf"
|
||||
replace_vars "${root_dir}/scripts/debian/bitcore-bitcoind.service" "$deb_dir/etc/systemd/system/bitcore-bitcoind.service"
|
||||
chmod -vR 0755 "$deb_dir/DEBIAN/"
|
||||
|
||||
log_title "Copying Bitcore"
|
||||
|
||||
app_dir="$deb_dir/usr/opt/bitcore/"
|
||||
app_dir="$deb_dir/usr/opt/bitcore"
|
||||
|
||||
rsync -vr "${root_dir}/bin" "${app_dir}"
|
||||
cp -v "${root_dir}/bin/bitcored" "${app_dir}/bin/bitcored"
|
||||
cp -v "${root_dir}/bin/bitcore" "${app_dir}/bin/bitcore"
|
||||
chmod -vR 0755 "${app_dir}/bin/bitcore" "${app_dir}/bin/bitcored"
|
||||
cp -v "${root_dir}/package.json" "${app_dir}"
|
||||
cp -v "${root_dir}/README.md" "${app_dir}"
|
||||
|
@ -70,6 +74,7 @@ cp -v "${root_dir}/index.js" "${app_dir}"
|
|||
pushd "${deb_dir}/usr/bin"
|
||||
ln -vs "../opt/bitcore/bin/bitcore"
|
||||
ln -vs "../opt/bitcore/bin/bitcored"
|
||||
ln -vs "../opt/bitcore/node_modules/.bin/bitcoind" "bitcore-bitcoind"
|
||||
popd
|
||||
|
||||
log_title "Installing Bitcore Modules"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
description "Bitcoin Core for Bitcore"
|
||||
author "BitPay, Inc."
|
||||
|
||||
limit nofile 20000 30000
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
||||
kill timeout 300
|
||||
kill signal SIGINT
|
||||
|
||||
# user/group for bitcore daemon to run as
|
||||
setuid bitcore
|
||||
setgid bitcore
|
||||
|
||||
# home dir of the bitcore daemon user
|
||||
env HOME=/home/bitcore
|
||||
|
||||
respawn
|
||||
respawn limit 5 15
|
||||
|
||||
script
|
||||
exec bitcore-bitcored -datadir=/home/bitcore/.bitcore/data/
|
||||
end script
|
|
@ -0,0 +1,20 @@
|
|||
[Unit]
|
||||
Description=Bitcoin Core for Bitcore
|
||||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/usr/opt/bitcore
|
||||
ExecStart=/usr/bin/bitcore-bitcoind -datadir=/home/bitcore/.bitcore/data/
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
RestartSec=15
|
||||
User=bitcore
|
||||
ExecStartPre=/bin/mkdir -p /run/bitcore
|
||||
ExecStartPre=/bin/chown bitcore:bitcore /run/bitcore
|
||||
ExecStartPre=/bin/chmod 755 /run/bitcore
|
||||
PermissionsStartOnly=true
|
||||
TimeoutStopSec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,5 +1,3 @@
|
|||
# Bitcored Upstart script
|
||||
|
||||
description "Bitcore Daemon"
|
||||
author "BitPay, Inc."
|
||||
|
|
@ -18,9 +18,9 @@ fi
|
|||
cd "/usr/opt/bitcore"
|
||||
SKIP_BITCOIN_DOWNLOAD=1 npm rebuild
|
||||
|
||||
# setup log directory
|
||||
mkdir -p "/var/log/bitcore"
|
||||
chown -R bitcore:bitcore "/var/log/bitcore"
|
||||
# setup data directory
|
||||
mkdir -p "/home/bitcore/.bitcore/data"
|
||||
chown -R bitcore:bitcore "/home/bitcore/.bitcore"
|
||||
|
||||
# start bitcore
|
||||
if hash service 2> /dev/null; then
|
||||
|
|
Loading…
Reference in New Issue