diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ddd9044a720e14011a188719c8798117bf76649a..be9c6e06d1955bf5a30a1e20fabaa7d99d78e28c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,27 +26,6 @@ push_to_github: - mv packed-refs-new packed-refs - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?" -enforce_readme: - stage: github-sync - variables: - GIT_STRATEGY: none - tags: - - github - before_script: - - '' - script: - - rm -rf ./* - - rm -rf .git - - git clone $GITHUB_URL_AND_KEY . - - git config --global user.email "contact@duniter.org" - - git config --global user.name "Duniter" - - git checkout master - - cat .github/github_disclaimer.md > README.md.new - - cat README.md >> README.md.new - - mv README.md.new README.md - - git commit -am "Enforce github readme" - - git push origin master - test: stage: test tags: diff --git a/app/modules/prover/lib/proof.ts b/app/modules/prover/lib/proof.ts index 9b15c0be5aaff08b078c5dd495dbb0432be983ea..2108984c79fea9c1fefe14b814399a1e4b7bf678 100644 --- a/app/modules/prover/lib/proof.ts +++ b/app/modules/prover/lib/proof.ts @@ -217,7 +217,7 @@ function beginNewProofOfWork(stuff:any) { ****************/ // We wait for a maximum time of `turnDuration`. // This will trigger the end of the turn by the concurrent race I. During that time, the proof.js script - // just does nothing: this gives of a bit of breath to the CPU. Tthe amount of "breath" depends on the "cpu" + // just does nothing: this gives of a bit of breath to the CPU. The amount of "breath" depends on the "cpu" // parameter. await countDown(turnDuration); } diff --git a/app/modules/ws2p/index.ts b/app/modules/ws2p/index.ts index a54d265f1a8b3368f99b05333d5e8f83b929ecaa..c91451e46a817b5e3576b2d284ae85c2a1b14219 100644 --- a/app/modules/ws2p/index.ts +++ b/app/modules/ws2p/index.ts @@ -16,8 +16,8 @@ export const WS2PDependency = { cliOptions: [ { value: '--ws2p-upnp', desc: 'Use UPnP to open remote port.' }, { value: '--ws2p-noupnp', desc: 'Do not use UPnP to open remote port.' }, - { value: '--ws2p-host <host>', desc: 'Port to listen to.' }, - { value: '--ws2p-port <port>', desc: 'Host to listen to.', parser: (val:string) => parseInt(val) }, + { value: '--ws2p-host <host>', desc: 'Host to listen to.' }, + { value: '--ws2p-port <port>', desc: 'Port to listen to.', parser: (val:string) => parseInt(val) }, { value: '--ws2p-remote-host <address>', desc: 'Availabily host.' }, { value: '--ws2p-remote-port <port>', desc: 'Availabily port.', parser: (val:string) => parseInt(val) }, { value: '--ws2p-remote-path <path>', desc: 'Availabily web path.' }, diff --git a/index.ts b/index.ts index ecf7be9d67231df6e4e63ef96c903457272b675d..7563b20575717ce26eea50d24505dd5a880f63c9 100644 --- a/index.ts +++ b/index.ts @@ -486,6 +486,7 @@ function commandLineConf(program:any, conf:any = {}) { if (cli.currency) conf.currency = cli.currency; if (cli.server.port) conf.port = cli.server.port; if (cli.cpu) conf.cpu = Math.max(0.01, Math.min(1.0, cli.cpu)); + if (cli.nbCores) conf.nbCores = Math.max(1, Math.min(ProverConstants.CORES_MAXIMUM_USE_IN_PARALLEL, cli.nbCores)); if (cli.prefix) conf.prefix = Math.max(ProverConstants.MIN_PEER_ID, Math.min(ProverConstants.MAX_PEER_ID, cli.prefix)); if (cli.logs.http) conf.httplogs = true; if (cli.logs.nohttp) conf.httplogs = false; diff --git a/release/arch/debian/build-deb.sh b/release/arch/debian/build-deb.sh index 72540f48c54beb46a3f8af28ec7e368e7567feac..3de0d51771b97fb8c8db576df6b16a5eb9cc1487 100644 --- a/release/arch/debian/build-deb.sh +++ b/release/arch/debian/build-deb.sh @@ -219,5 +219,7 @@ zip -qr ${RELEASES}/duniter-server-x64/opt/duniter/duniter-desktop.nw * cd ${RELEASES} sed -i "s/Package: .*/Package: duniter/g" ${RELEASES}/duniter-server-x64/DEBIAN/control rm -rf ${RELEASES}/duniter-server-x64/usr +mkdir -p ${RELEASES}/duniter-server-x64/lib/systemd/system +cp "${RELEASES}/duniter/release/contrib/systemd/duniter.service" ${RELEASES}/duniter-server-x64/lib/systemd/system fakeroot dpkg-deb --build duniter-server-x64 mv duniter-server-x64.deb /vagrant/duniter-server-${DUNITER_TAG}-linux-x64.deb diff --git a/release/contrib/openrc/duniter.confd b/release/contrib/openrc/duniter.confd new file mode 100644 index 0000000000000000000000000000000000000000..af0c9a3a8c797e81534463b723d4fb7a9112f790 --- /dev/null +++ b/release/contrib/openrc/duniter.confd @@ -0,0 +1,19 @@ +# File containing crypto keys +#DUNITER_KEYS=/etc/duniter/keys.yml + +# Uncomment the following line to start the web GUI +#DUNITER_WEB=yes + +# Parameters for the web GUI +#DUNITER_WEB_HOST=localhost +#DUNITER_WEB_PORT=9220 + +# User and group of running process +#DUNITER_GROUP=duniter +#DUNITER_USER=duniter + +# Directory of duniter files +#DUNITER_HOME=/var/lib/duniter + +# Directory of duniter data +#DUNITER_DATA=duniter_default diff --git a/release/contrib/openrc/duniter.initd b/release/contrib/openrc/duniter.initd new file mode 100644 index 0000000000000000000000000000000000000000..3a8aa6ed508e5a2e6ca1a5980c235194eee65bdc --- /dev/null +++ b/release/contrib/openrc/duniter.initd @@ -0,0 +1,50 @@ +#!/sbin/openrc-run + +: ${DUNITER_GROUP:=duniter} +: ${DUNITER_USER:=duniter} + +: ${DUNITER_HOME:=/var/lib/duniter} +: ${DUNITER_DATA:=duniter_default} + +command="/usr/bin/duniter" +if yesno "${DUNITER_WEB}"; then + command_args="webstart" + if [[ ! -z ${DUNITER_WEB_HOST} ]]; then + command_args="${command_args} --webmhost \"${DUNITER_WEB_HOST}\"" + fi + if [[ ! -z ${DUNITER_WEB_PORT} ]]; then + command_args="${command_args} \"--webmport ${DUNITER_WEB_PORT}\"" + fi +else + command_args="start" +fi +if [[ ! -z ${DUNITER_KEYS} ]] && [[ -r ${DUNITER_KEYS} ]]; then + command_args="${command_args} --keyfile \"${DUNITER_KEYS}\"" +fi +command_args="${command_args} --home \"${DUNITER_HOME}\" --mdb \"${DUNITER_DATA}\"" +start_stop_daemon_args="--user \"${DUNITER_USER}\":\"${DUNITER_GROUP}\"" +description="Duniter node" + +depend() { + need net +} + +status() { + if ${command} status --home "${DUNITER_HOME}" --mdb "${DUNITER_DATA}" | grep -q "is running"; then + einfo "status: started" + return 0 + else + if service_started; then + mark_service_stopped + eerror "status: crashed" + return 32 + else + einfo "status: stopped" + return 3 + fi + fi +} + +stop() { + ${command} stop --home "${DUNITER_HOME}" --mdb "${DUNITER_DATA}" +} diff --git a/release/contrib/systemd/duniter.service b/release/contrib/systemd/duniter.service new file mode 100644 index 0000000000000000000000000000000000000000..82cbf75aeaa726cc539059cf295e8ad6f348ca7b --- /dev/null +++ b/release/contrib/systemd/duniter.service @@ -0,0 +1,22 @@ +[Unit] +Description=Duniter node +After=network.target + +[Service] +# Should be set to web in order to start with web GUI +Environment=DUNITER_WEB= +Environment=DUNITER_HOME="/var/lib/duniter" +Environment=DUNITER_DATA="duniter_default" +# If using a key file, DUNITER_OPTS can be defined like so: +#Environment=DUNITER_OPTS=--keyfile "/etc/duniter/keys.yml" +Environment=DUNITER_OPTS= +Group=duniter +User=duniter +Type=forking +ExecStart=/usr/bin/duniter ${DUNITER_WEB}start --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} $DUNITER_OPTS +ExecReload=/usr/bin/duniter ${DUNITER_WEB}restart --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} $DUNITER_OPTS +ExecStop=/usr/bin/duniter stop --home ${DUNITER_HOME} --mdb ${DUNITER_DATA} +Restart=on-failure + +[Install] +WantedBy=multi-user.target