Initial Vexta Core v0.1.0 release
This commit is contained in:
commit
25c454329d
2481 changed files with 689289 additions and 0 deletions
12
contrib/init/README.md
Normal file
12
contrib/init/README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Sample configuration files for:
|
||||
```
|
||||
systemd: vextad.service
|
||||
Upstart: vextad.conf
|
||||
OpenRC: vextad.openrc
|
||||
vextad.openrcconf
|
||||
CentOS: vextad.init
|
||||
macOS: org.vexta.vextad.plist
|
||||
```
|
||||
have been made available to assist packagers in creating node packages here.
|
||||
|
||||
See [doc/init.md](../../doc/init.md) for more information.
|
||||
65
contrib/init/vextad.conf
Normal file
65
contrib/init/vextad.conf
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
description "Vexta Core Daemon"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on starting rc RUNLEVEL=[016]
|
||||
|
||||
env VEXTAD_BIN="/usr/bin/vextad"
|
||||
env VEXTAD_USER="vexta"
|
||||
env VEXTAD_GROUP="vexta"
|
||||
env VEXTAD_PIDDIR="/var/run/vextad"
|
||||
# upstart can't handle variables constructed with other variables
|
||||
env VEXTAD_PIDFILE="/var/run/vextad/vextad.pid"
|
||||
env VEXTAD_CONFIGFILE="/etc/vexta/vexta.conf"
|
||||
env VEXTAD_DATADIR="/var/lib/vextad"
|
||||
|
||||
expect fork
|
||||
|
||||
respawn
|
||||
respawn limit 5 120
|
||||
kill timeout 600
|
||||
|
||||
pre-start script
|
||||
# this will catch non-existent config files
|
||||
# vextad will check and exit with this very warning, but it can do so
|
||||
# long after forking, leaving upstart to think everything started fine.
|
||||
# since this is a commonly encountered case on install, just check and
|
||||
# warn here.
|
||||
if ! grep -qs '^rpcpassword=' "$VEXTAD_CONFIGFILE" ; then
|
||||
echo "ERROR: You must set a secure rpcpassword to run vextad."
|
||||
echo "The setting must appear in $VEXTAD_CONFIGFILE"
|
||||
echo
|
||||
echo "This password is security critical to securing wallets "
|
||||
echo "and must not be the same as the rpcuser setting."
|
||||
echo "You can generate a suitable random password using the following "
|
||||
echo "command from the shell:"
|
||||
echo
|
||||
echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'"
|
||||
echo
|
||||
echo "It is recommended that you also set alertnotify so you are "
|
||||
echo "notified of problems:"
|
||||
echo
|
||||
echo "ie: alertnotify=echo %%s | mail -s \"Vexta Alert\"" \
|
||||
"admin@foo.com"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$VEXTAD_PIDDIR"
|
||||
chmod 0755 "$VEXTAD_PIDDIR"
|
||||
chown $VEXTAD_USER:$VEXTAD_GROUP "$VEXTAD_PIDDIR"
|
||||
chown $VEXTAD_USER:$VEXTAD_GROUP "$VEXTAD_CONFIGFILE"
|
||||
chmod 0660 "$VEXTAD_CONFIGFILE"
|
||||
end script
|
||||
|
||||
exec start-stop-daemon \
|
||||
--start \
|
||||
--pidfile "$VEXTAD_PIDFILE" \
|
||||
--chuid $VEXTAD_USER:$VEXTAD_GROUP \
|
||||
--exec "$VEXTAD_BIN" \
|
||||
-- \
|
||||
-pid="$VEXTAD_PIDFILE" \
|
||||
-conf="$VEXTAD_CONFIGFILE" \
|
||||
-datadir="$VEXTAD_DATADIR" \
|
||||
-disablewallet \
|
||||
-daemon
|
||||
|
||||
67
contrib/init/vextad.init
Normal file
67
contrib/init/vextad.init
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# vextad The vexta core server.
|
||||
#
|
||||
#
|
||||
# chkconfig: 345 80 20
|
||||
# description: vextad
|
||||
# processname: vextad
|
||||
#
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
# you can override defaults in /etc/sysconfig/vextad, see below
|
||||
if [ -f /etc/sysconfig/vextad ]; then
|
||||
. /etc/sysconfig/vextad
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
prog=vextad
|
||||
# you can override the lockfile via VEXTAD_LOCKFILE in /etc/sysconfig/vextad
|
||||
lockfile=${VEXTAD_LOCKFILE-/var/lock/subsys/vextad}
|
||||
|
||||
# vextad defaults to /usr/bin/vextad, override with VEXTAD_BIN
|
||||
vextad=${VEXTAD_BIN-/usr/bin/vextad}
|
||||
|
||||
# vextad opts default to -disablewallet, override with VEXTAD_OPTS
|
||||
vextad_opts=${VEXTAD_OPTS--disablewallet}
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $prog: "
|
||||
daemon $DAEMONOPTS $vextad $vextad_opts
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $lockfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $prog -t600
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status $prog
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: service $prog {start|stop|status|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
93
contrib/init/vextad.openrc
Normal file
93
contrib/init/vextad.openrc
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
# backward compatibility for existing gentoo layout
|
||||
#
|
||||
if [ -d "/var/lib/vexta/.vexta" ]; then
|
||||
VEXTAD_DEFAULT_DATADIR="/var/lib/vexta/.vexta"
|
||||
else
|
||||
VEXTAD_DEFAULT_DATADIR="/var/lib/vextad"
|
||||
fi
|
||||
|
||||
VEXTAD_CONFIGFILE=${VEXTAD_CONFIGFILE:-/etc/vexta/vexta.conf}
|
||||
VEXTAD_PIDDIR=${VEXTAD_PIDDIR:-/var/run/vextad}
|
||||
VEXTAD_PIDFILE=${VEXTAD_PIDFILE:-${VEXTAD_PIDDIR}/vextad.pid}
|
||||
VEXTAD_DATADIR=${VEXTAD_DATADIR:-${VEXTAD_DEFAULT_DATADIR}}
|
||||
VEXTAD_USER=${VEXTAD_USER:-${DIGIBYTE_USER:-vexta}}
|
||||
VEXTAD_GROUP=${VEXTAD_GROUP:-vexta}
|
||||
VEXTAD_BIN=${VEXTAD_BIN:-/usr/bin/vextad}
|
||||
VEXTAD_NICE=${VEXTAD_NICE:-${NICELEVEL:-0}}
|
||||
VEXTAD_OPTS="${VEXTAD_OPTS:-${DIGIBYTE_OPTS}}"
|
||||
|
||||
name="Vexta Core Daemon"
|
||||
description="Vexta cryptocurrency P2P network daemon"
|
||||
|
||||
command="/usr/bin/vextad"
|
||||
command_args="-pid=\"${VEXTAD_PIDFILE}\" \
|
||||
-conf=\"${VEXTAD_CONFIGFILE}\" \
|
||||
-datadir=\"${VEXTAD_DATADIR}\" \
|
||||
-daemon \
|
||||
${VEXTAD_OPTS}"
|
||||
|
||||
required_files="${VEXTAD_CONFIGFILE}"
|
||||
start_stop_daemon_args="-u ${VEXTAD_USER} \
|
||||
-N ${VEXTAD_NICE} -w 2000"
|
||||
pidfile="${VEXTAD_PIDFILE}"
|
||||
|
||||
# The retry schedule to use when stopping the daemon. Could be either
|
||||
# a timeout in seconds or multiple signal/timeout pairs (like
|
||||
# "SIGKILL/180 SIGTERM/300")
|
||||
retry="${VEXTAD_SIGTERM_TIMEOUT}"
|
||||
|
||||
depend() {
|
||||
need localmount net
|
||||
}
|
||||
|
||||
# verify
|
||||
# 1) that the datadir exists and is writable (or create it)
|
||||
# 2) that a directory for the pid exists and is writable
|
||||
# 3) ownership and permissions on the config file
|
||||
start_pre() {
|
||||
checkpath \
|
||||
-d \
|
||||
--mode 0750 \
|
||||
--owner "${VEXTAD_USER}:${VEXTAD_GROUP}" \
|
||||
"${VEXTAD_DATADIR}"
|
||||
|
||||
checkpath \
|
||||
-d \
|
||||
--mode 0755 \
|
||||
--owner "${VEXTAD_USER}:${VEXTAD_GROUP}" \
|
||||
"${VEXTAD_PIDDIR}"
|
||||
|
||||
checkpath -f \
|
||||
-o "${VEXTAD_USER}:${VEXTAD_GROUP}" \
|
||||
-m 0660 \
|
||||
"${VEXTAD_CONFIGFILE}"
|
||||
|
||||
checkconfig || return 1
|
||||
}
|
||||
|
||||
checkconfig()
|
||||
{
|
||||
if grep -qs '^rpcuser=' "${VEXTAD_CONFIGFILE}" && \
|
||||
! grep -qs '^rpcpassword=' "${VEXTAD_CONFIGFILE}" ; then
|
||||
eerror ""
|
||||
eerror "ERROR: You must set a secure rpcpassword to run vextad."
|
||||
eerror "The setting must appear in ${VEXTAD_CONFIGFILE}"
|
||||
eerror ""
|
||||
eerror "This password is security critical to securing wallets "
|
||||
eerror "and must not be the same as the rpcuser setting."
|
||||
eerror "You can generate a suitable random password using the following "
|
||||
eerror "command from the shell:"
|
||||
eerror ""
|
||||
eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'"
|
||||
eerror ""
|
||||
eerror "It is recommended that you also set alertnotify so you are "
|
||||
eerror "notified of problems:"
|
||||
eerror ""
|
||||
eerror "ie: alertnotify=echo %%s | mail -s \"Vexta Alert\"" \
|
||||
"admin@foo.com"
|
||||
eerror ""
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
33
contrib/init/vextad.openrcconf
Normal file
33
contrib/init/vextad.openrcconf
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# /etc/conf.d/vextad: config file for /etc/init.d/vextad
|
||||
|
||||
# Config file location
|
||||
#VEXTAD_CONFIGFILE="/etc/vexta/vexta.conf"
|
||||
|
||||
# What directory to write pidfile to? (created and owned by $VEXTAD_USER)
|
||||
#VEXTAD_PIDDIR="/var/run/vextad"
|
||||
|
||||
# What filename to give the pidfile
|
||||
#VEXTAD_PIDFILE="${VEXTAD_PIDDIR}/vextad.pid"
|
||||
|
||||
# Where to write vextad data (be mindful that the blockchain is large)
|
||||
#VEXTAD_DATADIR="/var/lib/vextad"
|
||||
|
||||
# User and group to own vextad process
|
||||
#VEXTAD_USER="vexta"
|
||||
#VEXTAD_GROUP="vexta"
|
||||
|
||||
# Path to vextad executable
|
||||
#VEXTAD_BIN="/usr/bin/vextad"
|
||||
|
||||
# Nice value to run vextad under
|
||||
#VEXTAD_NICE=0
|
||||
|
||||
# Additional options (avoid -conf and -datadir, use flags above)
|
||||
#VEXTAD_OPTS=""
|
||||
|
||||
# The timeout in seconds OpenRC will wait for vextad to terminate
|
||||
# after a SIGTERM has been raised.
|
||||
# Note that this will be mapped as argument to start-stop-daemon's
|
||||
# '--retry' option, which means you can specify a retry schedule
|
||||
# here. For more information see man 8 start-stop-daemon.
|
||||
VEXTAD_SIGTERM_TIMEOUT=600
|
||||
82
contrib/init/vextad.service
Normal file
82
contrib/init/vextad.service
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# 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 vextad.service
|
||||
# See "man systemd.service" for details.
|
||||
|
||||
# Note that almost all daemon options could be specified in
|
||||
# /etc/vexta/vexta.conf, but keep in mind those explicitly
|
||||
# specified as arguments in ExecStart= will override those in the
|
||||
# config file.
|
||||
|
||||
[Unit]
|
||||
Description=Vexta daemon
|
||||
Documentation=https://github.com/vexta/vexta/blob/master/doc/init.md
|
||||
|
||||
# https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/vextad -daemonwait \
|
||||
-pid=/run/vextad/vextad.pid \
|
||||
-conf=/etc/vexta/vexta.conf \
|
||||
-datadir=/var/lib/vextad
|
||||
|
||||
# Make sure the config directory is readable by the service user
|
||||
PermissionsStartOnly=true
|
||||
ExecStartPre=/bin/chgrp vexta /etc/vexta
|
||||
|
||||
# Process management
|
||||
####################
|
||||
|
||||
Type=forking
|
||||
PIDFile=/run/vextad/vextad.pid
|
||||
Restart=on-failure
|
||||
TimeoutStartSec=infinity
|
||||
TimeoutStopSec=600
|
||||
|
||||
# Directory creation and permissions
|
||||
####################################
|
||||
|
||||
# Run as vexta:vexta
|
||||
User=vexta
|
||||
Group=vexta
|
||||
|
||||
# /run/vextad
|
||||
RuntimeDirectory=vextad
|
||||
RuntimeDirectoryMode=0710
|
||||
|
||||
# /etc/vexta
|
||||
ConfigurationDirectory=vexta
|
||||
ConfigurationDirectoryMode=0710
|
||||
|
||||
# /var/lib/vextad
|
||||
StateDirectory=vextad
|
||||
StateDirectoryMode=0710
|
||||
|
||||
# Hardening measures
|
||||
####################
|
||||
|
||||
# Provide a private /tmp and /var/tmp.
|
||||
PrivateTmp=true
|
||||
|
||||
# Mount /usr, /boot/ and /etc read-only for the process.
|
||||
ProtectSystem=full
|
||||
|
||||
# Deny access to /home, /root and /run/user
|
||||
ProtectHome=true
|
||||
|
||||
# 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
|
||||
25
contrib/init/vextad.service.app.service
Normal file
25
contrib/init/vextad.service.app.service
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# 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 vextad.service
|
||||
# See "man systemd.service" for details.
|
||||
|
||||
# Note that almost all daemon options could be specified in
|
||||
# /etc/vexta/vexta.conf
|
||||
|
||||
[Unit]
|
||||
Description=Vexta daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/vextad -daemon -conf=/etc/vexta/vexta.conf -pid=/run/vextad/vextad.pid
|
||||
# Creates /run/vextad owned by vexta
|
||||
RuntimeDirectory=vextad
|
||||
User=vexta
|
||||
Type=forking
|
||||
PIDFile=/run/vextad/vextad.pid
|
||||
Restart=on-failure
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Reference in a new issue