From 67d51365b8d1675b53df5a3a8d433d474257965c Mon Sep 17 00:00:00 2001 From: kexkey Date: Thu, 11 Mar 2021 14:12:45 -0500 Subject: [PATCH 01/10] Upgraded versions: Alpine, Bitcoin Core, C-Lightning, etc. --- api_auth_docker/Dockerfile | 2 +- cron_docker/Dockerfile | 2 +- cyphernodeconf_docker/Dockerfile | 6 ++-- .../templates/installer/testfeatures.sh | 3 +- dist/setup.sh | 34 ++++++++----------- otsclient_docker/Dockerfile | 12 ++----- proxy_docker/Dockerfile | 4 +-- pycoin_docker/Dockerfile | 6 ++-- tor_docker/Dockerfile | 6 ++-- 9 files changed, 32 insertions(+), 43 deletions(-) diff --git a/api_auth_docker/Dockerfile b/api_auth_docker/Dockerfile index ab22ed9..aa178dc 100644 --- a/api_auth_docker/Dockerfile +++ b/api_auth_docker/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:alpine +FROM nginx:1.18.0-alpine RUN apk add --update --no-cache \ bash \ diff --git a/cron_docker/Dockerfile b/cron_docker/Dockerfile index 44eb442..f9710d0 100644 --- a/cron_docker/Dockerfile +++ b/cron_docker/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine:3.12.4 RUN apk add --update --no-cache \ curl diff --git a/cyphernodeconf_docker/Dockerfile b/cyphernodeconf_docker/Dockerfile index 9698fe2..df64a55 100644 --- a/cyphernodeconf_docker/Dockerfile +++ b/cyphernodeconf_docker/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13-alpine3.10 as builder-torgen +FROM golang:1.13.15-alpine3.12 as builder-torgen RUN apk add git build-base @@ -13,7 +13,7 @@ RUN go get RUN go build torgen.go RUN chmod +x /go/src/torgen/torgen -FROM alpine:3.11.0 as builder-qrencode +FROM alpine:3.12.4 as builder-qrencode RUN apk add --update --no-cache \ autoconf \ @@ -30,7 +30,7 @@ RUN git clone -b v4.1.0 https://github.com/fukuchi/libqrencode.git \ && make \ && make install -FROM node:12.2.0-alpine +FROM node:15.11.0-alpine3.12 ENV EDITOR=/usr/bin/nano diff --git a/cyphernodeconf_docker/templates/installer/testfeatures.sh b/cyphernodeconf_docker/templates/installer/testfeatures.sh index 627c62f..5831922 100644 --- a/cyphernodeconf_docker/templates/installer/testfeatures.sh +++ b/cyphernodeconf_docker/templates/installer/testfeatures.sh @@ -128,7 +128,8 @@ checktor() { echo -en "\r\n\e[1;36mTesting Tor... " > /dev/console local rc - rc=$(curl -s -o /dev/null -w "%{http_code}" --socks5-hostname tor:9050 http://expyuzz4wqqyqhjn.onion/) + # Testing with onion.torproject.org hidden service. + rc=$(curl -s -o /dev/null -w "%{http_code}" --socks5-hostname tor:9050 http://yz7lpwfhhzcdyc5y.onion/) [ "${rc}" -ne "200" ] && return 250 echo -e "\e[1;36mTor rocks!" > /dev/console diff --git a/dist/setup.sh b/dist/setup.sh index 1e73c09..c803b22 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -510,26 +510,20 @@ install_docker() { if [[ $FEATURE_LIGHTNING == true ]]; then if [[ $LIGHTNING_IMPLEMENTATION == "c-lightning" ]]; then - local dockerfile="Dockerfile" - if [[ $archpath == "rpi" ]]; then - dockerfile="Dockerfile-alpine" - fi + if [ ! -d $LIGHTNING_DATAPATH/bitcoin ]; then + step " create $LIGHTNING_DATAPATH" + sudo_if_required mkdir -p $LIGHTNING_DATAPATH/bitcoin + next + fi - if [ ! -d $LIGHTNING_DATAPATH/bitcoin ]; then - step " create $LIGHTNING_DATAPATH" - sudo_if_required mkdir -p $LIGHTNING_DATAPATH/bitcoin - next - fi - - copy_file $cyphernodeconf_filepath/lightning/c-lightning/config $LIGHTNING_DATAPATH/config 1 $SUDO_REQUIRED - copy_file $cyphernodeconf_filepath/lightning/c-lightning/entrypoint.sh $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh 1 $SUDO_REQUIRED - - if [[ ! -x $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh ]]; then - step " make entrypoint.sh executable" - sudo_if_required chmod +x $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh - next - fi + copy_file $cyphernodeconf_filepath/lightning/c-lightning/config $LIGHTNING_DATAPATH/config 1 $SUDO_REQUIRED + copy_file $cyphernodeconf_filepath/lightning/c-lightning/entrypoint.sh $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh 1 $SUDO_REQUIRED + if [[ ! -x $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh ]]; then + step " make entrypoint.sh executable" + sudo_if_required chmod +x $LIGHTNING_DATAPATH/bitcoin/entrypoint.sh + next + fi fi fi @@ -838,8 +832,8 @@ PROXYCRON_VERSION="v0.6.0-dev" OTSCLIENT_VERSION="v0.6.0-dev" PYCOIN_VERSION="v0.6.0-dev" CYPHERAPPS_VERSION="dev" -BITCOIN_VERSION="v0.20.1" -LIGHTNING_VERSION="v0.9.1" +BITCOIN_VERSION="v0.21.0" +LIGHTNING_VERSION="v0.9.3" TRAEFIK_VERSION="v1.7.9-alpine" MOSQUITTO_VERSION="1.6" diff --git a/otsclient_docker/Dockerfile b/otsclient_docker/Dockerfile index 7270774..7cce253 100644 --- a/otsclient_docker/Dockerfile +++ b/otsclient_docker/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.9 as builder +FROM alpine:3.12.4 as builder RUN apk add --no-cache --update alpine-sdk bsd-compat-headers \ && git clone https://github.com/Kexkey/proxychains-ng.git @@ -9,18 +9,12 @@ RUN cd /proxychains-ng \ && make install \ && make install-config -FROM node:11.1-alpine +FROM node:15.11.0-alpine3.12 RUN apk add --update --no-cache \ - git \ jq \ su-exec \ - && git clone https://github.com/opentimestamps/javascript-opentimestamps.git \ - && cd javascript-opentimestamps \ -# Handle 'Error: could not get uid/gid' -# See: https://github.com/npm/uid-number/issues/3 - && npm config set unsafe-perm true \ - && npm install -g + && npm install -g opentimestamps WORKDIR /script diff --git a/proxy_docker/Dockerfile b/proxy_docker/Dockerfile index 334a96f..33c5538 100644 --- a/proxy_docker/Dockerfile +++ b/proxy_docker/Dockerfile @@ -1,4 +1,4 @@ -FROM cyphernode/alpine-glibc-base:v3.11.0_2.29-0 +FROM cyphernode/alpine-glibc-base:v3.12.4_2.33-0 ENV HOME /proxy @@ -12,7 +12,7 @@ WORKDIR ${HOME} COPY app/data/* ./ COPY app/script/* ./ -COPY --from=cyphernode/clightning:v0.9.1 /usr/local/bin/lightning-cli ./ +COPY --from=cyphernode/clightning:v0.9.3 /usr/local/bin/lightning-cli ./ COPY --from=eclipse-mosquitto:1.6 /usr/bin/mosquitto_rr /usr/bin/mosquitto_sub /usr/bin/mosquitto_pub /usr/bin/ COPY --from=eclipse-mosquitto:1.6 /usr/lib/libmosquitto* /usr/lib/ COPY --from=eclipse-mosquitto:1.6 /usr/lib/libcrypto* /usr/lib/ diff --git a/pycoin_docker/Dockerfile b/pycoin_docker/Dockerfile index 32b820b..9b9b484 100644 --- a/pycoin_docker/Dockerfile +++ b/pycoin_docker/Dockerfile @@ -1,12 +1,12 @@ -FROM python:3.6-alpine3.8 +FROM python:3.8.6-alpine3.12 ENV HOME /pycoin RUN apk add --update --no-cache git jq su-exec \ && cd / \ && git clone https://github.com/Kexkey/pycoin.git \ - && mkdir /usr/local/lib/python3.6/site-packages/pycoin \ - && cp -rf pycoin/pycoin/* /usr/local/lib/python3.6/site-packages/pycoin \ + && mkdir /usr/local/lib/python3.8/site-packages/pycoin \ + && cp -rf pycoin/pycoin/* /usr/local/lib/python3.8/site-packages/pycoin \ && rm -rf pycoin/* COPY script/pycoin.sh ${HOME}/pycoin.sh diff --git a/tor_docker/Dockerfile b/tor_docker/Dockerfile index 45fd86d..bde5e96 100644 --- a/tor_docker/Dockerfile +++ b/tor_docker/Dockerfile @@ -1,6 +1,6 @@ -FROM alpine:3.12 AS builder +FROM alpine:3.12.4 AS builder -ARG TOR_VER=0.4.4.5 +ARG TOR_VER=0.4.5.6 ARG TORGZ=https://dist.torproject.org/tor-$TOR_VER.tar.gz RUN apk --no-cache add --update \ @@ -17,7 +17,7 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 0xFE43009C4607B1FB 0x6AF && tar xfz tor-$TOR_VER.tar.gz && cd tor-$TOR_VER \ && ./configure && make install -FROM alpine:3.12 +FROM alpine:3.12.4 RUN apk --no-cache add --update \ su-exec From 75c961a0ca499ce061abde4c4a9ffadfeddcc7e0 Mon Sep 17 00:00:00 2001 From: kexkey Date: Sat, 13 Mar 2021 21:52:24 -0500 Subject: [PATCH 02/10] Downgraded to glibc 2.31 --- proxy_docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy_docker/Dockerfile b/proxy_docker/Dockerfile index 33c5538..1543480 100644 --- a/proxy_docker/Dockerfile +++ b/proxy_docker/Dockerfile @@ -1,4 +1,4 @@ -FROM cyphernode/alpine-glibc-base:v3.12.4_2.33-0 +FROM cyphernode/alpine-glibc-base:v3.12.4_2.31-0 ENV HOME /proxy From a1464f124573c4894a53be4ceccd130c542cd652 Mon Sep 17 00:00:00 2001 From: kexkey Date: Thu, 18 Mar 2021 11:48:52 -0400 Subject: [PATCH 03/10] Removed useless and confusing variables in build.sh --- build.sh | 4 +--- dist/setup.sh | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 5d9f960..8948a75 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ TRACING=1 -# CYPHERNODE VERSION "v0.6.0-dev" +# CYPHERNODE VERSION "v0.6.0-dev", dev over v0.6.0 CONF_VERSION="v0.6.0-dev-local" GATEKEEPER_VERSION="v0.6.0-dev-local" TOR_VERSION="v0.6.0-dev-local" @@ -11,8 +11,6 @@ NOTIFIER_VERSION="v0.6.0-dev-local" PROXYCRON_VERSION="v0.6.0-dev-local" OTSCLIENT_VERSION="v0.6.0-dev-local" PYCOIN_VERSION="v0.6.0-dev-local" -BITCOIN_VERSION="v0.20.1" -LIGHTNING_VERSION="v0.9.1" trace() { diff --git a/dist/setup.sh b/dist/setup.sh index c803b22..893838e 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -821,7 +821,7 @@ ALWAYSYES=0 SUDO_REQUIRED=0 AUTOSTART=0 -# CYPHERNODE VERSION "v0.6.0-dev" +# CYPHERNODE VERSION "v0.6.0-dev", dev over v0.6.0 SETUP_VERSION="v0.6.0-dev" CONF_VERSION="v0.6.0-dev" GATEKEEPER_VERSION="v0.6.0-dev" From f5009806bb42a8d2a8f71b1ecf7552db2897ab8e Mon Sep 17 00:00:00 2001 From: SKP Date: Mon, 20 Jan 2020 13:05:35 +0100 Subject: [PATCH 04/10] Make swarm single host mode explicit --- .../installer/docker/docker-compose.yaml | 200 +++++++++++++----- dist/setup.sh | 42 +++- 2 files changed, 182 insertions(+), 60 deletions(-) diff --git a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml index 99d0196..20c6ab1 100644 --- a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml +++ b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml @@ -22,12 +22,20 @@ services: networks: - cyphernodenet - cyphernodeappsnet - <% if (docker_mode == 'compose') { %> + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> restart: always <% } %> -# deploy: -# placement: -# constraints: [node.hostname==dev] <% } %> <% if ( features.indexOf('lightning') !== -1 && lightning_implementation === 'c-lightning' ) { %> @@ -54,16 +62,24 @@ services: stop_grace_period: 30s networks: - cyphernodenet - <% if (docker_mode == 'compose') { %> - restart: always - <% } %> <% if ( features.indexOf('tor') !== -1 ) { %> depends_on: - tor <% } %> -# deploy: --lightning-dir=/.lightning -# placement: -# constraints: [node.hostname==dev] + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> + restart: always + <% } %> <% } %> <% if( bitcoin_mode === 'internal' ) { %> @@ -93,16 +109,24 @@ services: stop_grace_period: 30s networks: - cyphernodenet - <% if (docker_mode == 'compose') { %> - restart: always - <% } %> <% if ( features.indexOf('tor') !== -1 ) { %> depends_on: - tor <% } %> -# deploy: -# placement: -# constraints: [node.hostname==dev] + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> + restart: always + <% } %> <% } %> ########################## @@ -153,12 +177,20 @@ services: <% } %> networks: - cyphernodenet - <% if (docker_mode == 'compose') { %> + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> restart: always <% } %> -# deploy: -# placement: -# constraints: [node.hostname==dev] ########################## # PROXYCRON # @@ -171,14 +203,22 @@ services: - "OTS_URL=proxy:8888/ots_backoffice" networks: - cyphernodenet - <% if (docker_mode == 'compose') { %> - restart: always - <% } %> depends_on: - proxy -# deploy: -# placement: -# constraints: [node.hostname==dev] + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> + restart: always + <% } %> ########################## # BROKER # @@ -189,12 +229,20 @@ services: networks: - cyphernodenet - cyphernodeappsnet - <% if (docker_mode == 'compose') { %> + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> restart: always <% } %> -# deploy: -# placement: -# constraints: [node.hostname==dev] ########################## # NOTIFIER # @@ -213,14 +261,22 @@ services: networks: - cyphernodenet - cyphernodeappsnet - <% if (docker_mode == 'compose') { %> - restart: always - <% } %> depends_on: - broker -# deploy: -# placement: -# constraints: [node.hostname==dev] + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> + restart: always + <% } %> ########################## # PYCOIN # @@ -240,12 +296,20 @@ services: - "<%= logs_datapath %>:/cnlogs" networks: - cyphernodenet - <% if (docker_mode == 'compose') { %> + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> restart: always <% } %> -# deploy: -# placement: -# constraints: [node.hostname==dev] <% if ( features.indexOf('otsclient') !== -1 ) { %> ########################## @@ -272,12 +336,20 @@ services: command: $USER /script/startotsclient.sh networks: - cyphernodenet - <% if (docker_mode == 'compose') { %> + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> restart: always <% } %> -# deploy: -# placement: -# constraints: [node.hostname==dev] <% } %> ########################## @@ -308,14 +380,22 @@ services: networks: - cyphernodenet - cyphernodeappsnet - <% if (docker_mode == 'compose') { %> - restart: always - <% } %> depends_on: - proxy -# deploy: -# placement: -# constraints: [node.hostname==dev] + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.core == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> + restart: always + <% } %> ########################## # TRAEFIK # @@ -333,14 +413,22 @@ services: - "<%= traefik_datapath%>/htpasswd:/htpasswd/htpasswd:ro" networks: - cyphernodeappsnet - <% if (docker_mode == 'compose') { %> - restart: always - <% } %> depends_on: - gatekeeper -# deploy: -# placement: -# constraints: [node.hostname==dev] + <% if ( docker_mode === 'swarm' ) { %> + deploy: + replicas: 1 + placement: + constraints: + - node.labels.io.cyphernode.infra == true + restart_policy: + condition: "any" + delay: 1s + update_config: + parallelism: 1 + <% } else { %> + restart: always + <% } %> volumes: container_monitor: diff --git a/dist/setup.sh b/dist/setup.sh index 893838e..262fa92 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -538,10 +538,44 @@ install_docker() { docker swarm join-token worker > /dev/null 2>&1 local noSwarm=$?; - if [[ $DOCKER_MODE == 'swarm' && $noSwarm == 1 ]]; then - step " init docker swarm" - try docker swarm init --task-history-limit 1 > /dev/null 2>&1 - next + if [[ $DOCKER_MODE == 'swarm' ]]; then + if [[ $noSwarm == 1 ]]; then + step " init docker swarm" + try docker swarm init --task-history-limit 1 > /dev/null 2>&1 + next + fi + + local nodeid + nodeid=$(docker node ls -f role=manager --format="{{.ID}}") + + # we only support swarm in single host mode, so all labels needed to spawn containers in the swarm + # are given to the manager of the swarm + # it is possible to move the io.cyphernode.apps label to a different node, + # for apps which rely on shared volumes with core components, we have the io.cyphernode.clingyapps + if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.core" }}') == "true" ]]; then + step "  [32madd docker node label: io.cyphernode.core" + try docker node update --label-add io.cyphernode.core=true ${nodeid} > /dev/null 2>&1 + next + fi + + if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.infra" }}') == "true" ]]; then + step "  [32madd docker node label: io.cyphernode.infra" + try docker node update --label-add io.cyphernode.infra=true ${nodeid} > /dev/null 2>&1 + next + fi + + if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.apps" }}') == "true" ]]; then + step "  [32madd docker node label: io.cyphernode.apps" + try docker node update --label-add io.cyphernode.apps=true ${nodeid} > /dev/null 2>&1 + next + fi + + if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.clingyapps" }}') == "true" ]]; then + step "  [32madd docker node label: io.cyphernode.clingyapps" + try docker node update --label-add io.cyphernode.clingyapps=true ${nodeid} > /dev/null 2>&1 + next + fi + fi local net_entry=$(docker network ls | grep cyphernodenet); From aa85b436607a99ddcfb02fe9b8cbf967ea9afb06 Mon Sep 17 00:00:00 2001 From: SKP Date: Tue, 21 Jan 2020 15:22:16 +0100 Subject: [PATCH 05/10] Added swarm mode config to traefik config --- cyphernodeconf_docker/templates/traefik/traefik.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/cyphernodeconf_docker/templates/traefik/traefik.toml b/cyphernodeconf_docker/templates/traefik/traefik.toml index ccd33d6..e589790 100644 --- a/cyphernodeconf_docker/templates/traefik/traefik.toml +++ b/cyphernodeconf_docker/templates/traefik/traefik.toml @@ -17,6 +17,7 @@ endpoint = "unix:///var/run/docker.sock" domain = "cyphernode.localhost" watch = true exposedByDefault = false +swarmMode = <%= ( docker_mode === 'swarm' )?'true':'false' %> [acme] email = "letsencrypt@yourdomain.com" From 1c143682c4ab0f2258a80db67aad524140576f60 Mon Sep 17 00:00:00 2001 From: SKP Date: Tue, 21 Jan 2020 15:22:41 +0100 Subject: [PATCH 06/10] Reliably get swarm nodeid of current host --- dist/setup.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/setup.sh b/dist/setup.sh index 262fa92..1a9eaf9 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -545,34 +545,34 @@ install_docker() { next fi - local nodeid - nodeid=$(docker node ls -f role=manager --format="{{.ID}}") + local localnodeid + localnodeid=$(docker info -f '{{.Swarm.NodeID}}') # we only support swarm in single host mode, so all labels needed to spawn containers in the swarm # are given to the manager of the swarm # it is possible to move the io.cyphernode.apps label to a different node, # for apps which rely on shared volumes with core components, we have the io.cyphernode.clingyapps - if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.core" }}') == "true" ]]; then + if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.core" }}') == "true" ]]; then step "  [32madd docker node label: io.cyphernode.core" - try docker node update --label-add io.cyphernode.core=true ${nodeid} > /dev/null 2>&1 + try docker node update --label-add io.cyphernode.core=true ${localnodeid} > /dev/null 2>&1 next fi - if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.infra" }}') == "true" ]]; then + if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.infra" }}') == "true" ]]; then step "  [32madd docker node label: io.cyphernode.infra" - try docker node update --label-add io.cyphernode.infra=true ${nodeid} > /dev/null 2>&1 + try docker node update --label-add io.cyphernode.infra=true ${localnodeid} > /dev/null 2>&1 next fi - if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.apps" }}') == "true" ]]; then + if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.apps" }}') == "true" ]]; then step "  [32madd docker node label: io.cyphernode.apps" - try docker node update --label-add io.cyphernode.apps=true ${nodeid} > /dev/null 2>&1 + try docker node update --label-add io.cyphernode.apps=true ${localnodeid} > /dev/null 2>&1 next fi - if [[ $(docker node inspect ${nodeid} --format '{{ index .Spec.Labels "io.cyphernode.clingyapps" }}') == "true" ]]; then + if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.clingyapps" }}') == "true" ]]; then step "  [32madd docker node label: io.cyphernode.clingyapps" - try docker node update --label-add io.cyphernode.clingyapps=true ${nodeid} > /dev/null 2>&1 + try docker node update --label-add io.cyphernode.clingyapps=true ${localnodeid} > /dev/null 2>&1 next fi From 357f0ecd5e68a725f00357c333f65d071cf78f20 Mon Sep 17 00:00:00 2001 From: SKP Date: Tue, 21 Jan 2020 15:39:40 +0100 Subject: [PATCH 07/10] Simplified one label swarm. --- .../installer/docker/docker-compose.yaml | 22 +++++++------- dist/setup.sh | 30 ++++--------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml index 20c6ab1..280cee3 100644 --- a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml +++ b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml @@ -27,7 +27,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -71,7 +71,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -118,7 +118,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -182,7 +182,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -210,7 +210,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -234,7 +234,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -268,7 +268,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -301,7 +301,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -341,7 +341,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -387,7 +387,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.core == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s @@ -420,7 +420,7 @@ services: replicas: 1 placement: constraints: - - node.labels.io.cyphernode.infra == true + - node.labels.io.cyphernode == true restart_policy: condition: "any" delay: 1s diff --git a/dist/setup.sh b/dist/setup.sh index 1a9eaf9..f86b2a6 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -549,33 +549,13 @@ install_docker() { localnodeid=$(docker info -f '{{.Swarm.NodeID}}') # we only support swarm in single host mode, so all labels needed to spawn containers in the swarm - # are given to the manager of the swarm - # it is possible to move the io.cyphernode.apps label to a different node, - # for apps which rely on shared volumes with core components, we have the io.cyphernode.clingyapps - if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.core" }}') == "true" ]]; then - step "  [32madd docker node label: io.cyphernode.core" - try docker node update --label-add io.cyphernode.core=true ${localnodeid} > /dev/null 2>&1 + # are given to the host setup is run on. Setup must be run on any manager, if swarm mode is enabled + # and a swarm was already initialised + if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode" }}') == "true" ]]; then + step "  [32madd docker node label: io.cyphernode" + try docker node update --label-add io.cyphernode=true ${localnodeid} > /dev/null 2>&1 next fi - - if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.infra" }}') == "true" ]]; then - step "  [32madd docker node label: io.cyphernode.infra" - try docker node update --label-add io.cyphernode.infra=true ${localnodeid} > /dev/null 2>&1 - next - fi - - if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.apps" }}') == "true" ]]; then - step "  [32madd docker node label: io.cyphernode.apps" - try docker node update --label-add io.cyphernode.apps=true ${localnodeid} > /dev/null 2>&1 - next - fi - - if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode.clingyapps" }}') == "true" ]]; then - step "  [32madd docker node label: io.cyphernode.clingyapps" - try docker node update --label-add io.cyphernode.clingyapps=true ${localnodeid} > /dev/null 2>&1 - next - fi - fi local net_entry=$(docker network ls | grep cyphernodenet); From d5ddbbd6faacc7224d53d172424453ab08cc00f6 Mon Sep 17 00:00:00 2001 From: SKP Date: Tue, 21 Jan 2020 15:56:45 +0100 Subject: [PATCH 08/10] NOT!!! --- dist/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/setup.sh b/dist/setup.sh index f86b2a6..7c894a3 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -551,8 +551,8 @@ install_docker() { # we only support swarm in single host mode, so all labels needed to spawn containers in the swarm # are given to the host setup is run on. Setup must be run on any manager, if swarm mode is enabled # and a swarm was already initialised - if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode" }}') == "true" ]]; then - step "  [32madd docker node label: io.cyphernode" + if [[ $(docker node inspect ${localnodeid} --format '{{ index .Spec.Labels "io.cyphernode" }}') != "true" ]]; then + step " add docker node label io.cyphernode" try docker node update --label-add io.cyphernode=true ${localnodeid} > /dev/null 2>&1 next fi From 73ea2a502ca23e6f18e6651387c4e2d12b2e2ddf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Mar 2021 17:07:37 +0000 Subject: [PATCH 09/10] Bump y18n from 4.0.0 to 4.0.1 in /cyphernodeconf_docker Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] --- cyphernodeconf_docker/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cyphernodeconf_docker/package-lock.json b/cyphernodeconf_docker/package-lock.json index 6b2f2a5..41ef21e 100644 --- a/cyphernodeconf_docker/package-lock.json +++ b/cyphernodeconf_docker/package-lock.json @@ -5461,9 +5461,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yargs": { From 18f853a408f0b01eecb9328d84ffd35ed4190a3a Mon Sep 17 00:00:00 2001 From: Philippe Lamy Date: Fri, 30 Apr 2021 08:26:20 -0400 Subject: [PATCH 10/10] fixed a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff1d4a5..e96aab2 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Currently used to make sure callbacks have been called for missed transactions. # How to use cyphernode? -The core component of cyphernode is a request handler which exposes HTTP endpoints via REST API, acting as an absctration layer between your apps and the open-source Bitcoin sofware you want to interact with. +The core component of cyphernode is a request handler which exposes HTTP endpoints via REST API, acting as an abstraction layer between your apps and the open-source Bitcoin sofware you want to interact with. ## Documentation