mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-02-03 19:54:28 +01:00
Move spark wallet to app zone
This commit is contained in:
27
dist/apps/sparkwallet/docker-compose.yaml
vendored
Normal file
27
dist/apps/sparkwallet/docker-compose.yaml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
cyphernode_sparkwallet:
|
||||
command: --no-tls
|
||||
image: cyphernode/sparkwallet:v0.2.3-local
|
||||
volumes:
|
||||
- "$LIGHTNING_DATAPATH/:/etc/lightning"
|
||||
- "$LIGHTNING_DATAPATH/sparkwallet:/data"
|
||||
- "$GATEKEEPER_DATAPATH/htpasswd:/htpasswd/htpasswd"
|
||||
labels:
|
||||
- "traefik.docker.network=cyphernodeappsnet"
|
||||
- "traefik.frontend.rule=ReplacePathRegex: ^/sparkwallet(.*) $$1"
|
||||
- "traefik.frontend.passHostHeader=true"
|
||||
- "traefik.frontend.auth.basic.usersFile=/htpasswd/htpasswd"
|
||||
- "traefik.frontend.headers.customRequestHeaders=X-Access:FoeDdQw5yl7pPfqdlGy3OEk/txGqyJjSbVtffhzs7kc="
|
||||
- "traefik.enable=true"
|
||||
- "traefik.port=9737"
|
||||
networks:
|
||||
- cyphernodenet
|
||||
- cyphernodeappsnet
|
||||
restart: always
|
||||
networks:
|
||||
cyphernodeappsnet:
|
||||
external: true
|
||||
cyphernodenet:
|
||||
external: true
|
||||
10
dist/apps/sparkwallet/start.sh
vendored
Normal file
10
dist/apps/sparkwallet/start.sh
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export SHARED_HTPASSWD_PATH
|
||||
export GATEKEEPER_DATAPATH
|
||||
export LIGHTNING_DATAPATH
|
||||
export APP_SCRIPT_PATH
|
||||
|
||||
if [ "$DOCKER_MODE" = "swarm" ]; then
|
||||
docker stack deploy -c $APP_SCRIPT_PATH/docker-compose.yaml $APP_ID
|
||||
elif [ "$DOCKER_MODE" = "compose" ]; then
|
||||
docker-compose -f $APP_SCRIPT_PATH/docker-compose.yaml up -d --remove-orphans
|
||||
fi
|
||||
10
dist/apps/sparkwallet/stop.sh
vendored
Normal file
10
dist/apps/sparkwallet/stop.sh
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export SHARED_HTPASSWD_PATH
|
||||
export GATEKEEPER_DATAPATH
|
||||
export LIGHTNING_DATAPATH
|
||||
export APP_SCRIPT_PATH
|
||||
|
||||
if [ "$DOCKER_MODE" = "swarm" ]; then
|
||||
docker stack rm $APP_ID
|
||||
elif [ "$DOCKER_MODE" = "compose" ]; then
|
||||
docker-compose -f $APP_SCRIPT_PATH/docker-compose.yaml down
|
||||
fi
|
||||
38
dist/apps/sparkwallet/test.sh
vendored
Normal file
38
dist/apps/sparkwallet/test.sh
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
timeout_feature() {
|
||||
local interval=10
|
||||
local totaltime=60
|
||||
local testwhat=${1}
|
||||
local returncode
|
||||
local endtime=$(($(date +%s) + ${totaltime}))
|
||||
|
||||
while :
|
||||
do
|
||||
eval ${testwhat}
|
||||
returncode=$?
|
||||
|
||||
# If no error or 2 minutes passed, we get out of this loop
|
||||
([ "${returncode}" -eq "0" ] || [ $(date +%s) -gt ${endtime} ]) && break
|
||||
|
||||
printf "\e[1;31mMaybe it's too early, I'll retry every ${interval} seconds for $((${totaltime} / 60)) minutes ($((${endtime} - $(date +%s))) seconds left).\e[1;0m"
|
||||
|
||||
sleep ${interval}
|
||||
done
|
||||
|
||||
return ${returncode}
|
||||
}
|
||||
|
||||
do_test() {
|
||||
local rc
|
||||
rc=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost/sparkwallet)
|
||||
[ "${rc}" -ne "401" ] && return 400
|
||||
return 0
|
||||
}
|
||||
|
||||
timeout_feature do_test
|
||||
returncode=$?
|
||||
|
||||
# return 0: tests cool
|
||||
# return 1: tests failed
|
||||
return $returncode
|
||||
@@ -134,25 +134,6 @@ services:
|
||||
- cyphernodenet
|
||||
restart: always
|
||||
|
||||
sparkwallet:
|
||||
command: --no-tls
|
||||
image: cyphernode/sparkwallet:<%= sparkwallet_version %>
|
||||
volumes:
|
||||
- "<%= lightning_datapath %>:/etc/lightning"
|
||||
- "<%= lightning_datapath %>/sparkwallet:/data"
|
||||
- "<%= traefik_datapath%>/htpasswd:/htpasswd/htpasswd"
|
||||
labels:
|
||||
- "traefik.docker.network=cyphernodeappsnet"
|
||||
- "traefik.frontend.rule=ReplacePathRegex: ^/sparkwallet(.*) $$1"
|
||||
- "traefik.frontend.passHostHeader=true"
|
||||
- "traefik.frontend.auth.basic.usersFile=/htpasswd/htpasswd"
|
||||
- "traefik.frontend.headers.customRequestHeaders=X-Access:FoeDdQw5yl7pPfqdlGy3OEk/txGqyJjSbVtffhzs7kc="
|
||||
- "traefik.enable=true"
|
||||
- "traefik.port=9737"
|
||||
networks:
|
||||
- cyphernodenet
|
||||
- cyphernodeappsnet
|
||||
restart: always
|
||||
<% } %>
|
||||
<% if ( features.indexOf('otsclient') !== -1 ) { %>
|
||||
otsclient:
|
||||
|
||||
@@ -120,18 +120,6 @@ checklnnode() {
|
||||
return 0
|
||||
}
|
||||
|
||||
checksparkwallet() {
|
||||
echo -en "\r\n\e[1;36mTesting Spark Wallet... " > /dev/console
|
||||
local rc
|
||||
|
||||
rc=$(curl -s -o /dev/null -w "%{http_code}" http://sparkwallet:9737)
|
||||
[ "${rc}" -ne "401" ] && return 400
|
||||
|
||||
echo -e "\e[1;36mSpark Wallet rocks!" > /dev/console
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
checkservice() {
|
||||
local interval=10
|
||||
local totaltime=120
|
||||
@@ -145,12 +133,12 @@ checkservice() {
|
||||
while :
|
||||
do
|
||||
outcome=0
|
||||
for container in gatekeeper proxy proxycron pycoin <%= (features.indexOf('otsclient') != -1)?'otsclient ':'' %>bitcoin <%= (features.indexOf('lightning') != -1)?'lightning sparkwallet ':'' %>; do
|
||||
for container in gatekeeper proxy proxycron pycoin <%= (features.indexOf('otsclient') != -1)?'otsclient ':'' %>bitcoin <%= (features.indexOf('lightning') != -1)?'lightning ':'' %>; do
|
||||
echo -e " \e[0;32mVerifying \e[0;33m${container}\e[0;32m..." > /dev/console
|
||||
(ping -c 10 ${container} 2> /dev/null | grep "0% packet loss" > /dev/null) &
|
||||
eval ${container}=$!
|
||||
done
|
||||
for container in gatekeeper proxy proxycron pycoin <%= (features.indexOf('otsclient') != -1)?'otsclient ':'' %>bitcoin <%= (features.indexOf('lightning') != -1)?'lightning sparkwallet ':'' %>; do
|
||||
for container in gatekeeper proxy proxycron pycoin <%= (features.indexOf('otsclient') != -1)?'otsclient ':'' %>bitcoin <%= (features.indexOf('lightning') != -1)?'lightning ':'' %>; do
|
||||
eval wait '$'${container} ; returncode=$? ; outcome=$((${outcome} + ${returncode}))
|
||||
eval c_${container}=${returncode}
|
||||
done
|
||||
@@ -171,9 +159,8 @@ checkservice() {
|
||||
# { "name": "otsclient", "active":true },
|
||||
# { "name": "bitcoin", "active":true },
|
||||
# { "name": "lightning", "active":true },
|
||||
# { "name": "sparkwallet", "active":true }
|
||||
# ]
|
||||
for container in gatekeeper proxy proxycron pycoin <%= (features.indexOf('otsclient') != -1)?'otsclient ':'' %>bitcoin <%= (features.indexOf('lightning') != -1)?'lightning sparkwallet ':'' %>; do
|
||||
for container in gatekeeper proxy proxycron pycoin <%= (features.indexOf('otsclient') != -1)?'otsclient ':'' %>bitcoin <%= (features.indexOf('lightning') != -1)?'lightning ':'' %>; do
|
||||
[ -n "${result}" ] && result="${result},"
|
||||
result="${result}{\"name\":\"${container}\",\"active\":"
|
||||
eval "returncode=\$c_${container}"
|
||||
@@ -232,7 +219,6 @@ feature_status() {
|
||||
# { "name": "otsclient", "active":true },
|
||||
# { "name": "bitcoin", "active":true },
|
||||
# { "name": "lightning", "active":true },
|
||||
# { "name": "sparkwallet", "active":true }
|
||||
# ],
|
||||
# "features": [
|
||||
# { "name": "gatekeeper", "working":true },
|
||||
@@ -240,7 +226,6 @@ feature_status() {
|
||||
# { "name": "otsclient", "working":true },
|
||||
# { "name": "bitcoin", "working":true },
|
||||
# { "name": "lightning", "working":true },
|
||||
# { "name": "sparkwallet", "working":true }
|
||||
# ]
|
||||
#}
|
||||
|
||||
@@ -270,7 +255,6 @@ fi
|
||||
# { "name": "otsclient", "working":true },
|
||||
# { "name": "bitcoin", "working":true },
|
||||
# { "name": "lightning", "working":true },
|
||||
# { "name": "sparkwallet", "working":true }
|
||||
# ]
|
||||
|
||||
result="${containers},\"features\":[{\"coreFeature\":true, \"name\":\"cyphernode proxy\",\"working\":true}, {\"coreFeature\":true, \"name\":\"gatekeeper\",\"working\":"
|
||||
@@ -331,22 +315,10 @@ fi
|
||||
finalreturncode=$((${returncode} | ${finalreturncode}))
|
||||
result="${result}$(feature_status ${returncode} 'Lightning error!')}"
|
||||
|
||||
result="${result},{\"name\":\"sparkwallet\",\"working\":"
|
||||
status=$(echo "{${containers}}" | jq ".containers[] | select(.name == \"sparkwallet\") | .active")
|
||||
if [[ "${brokenproxy}" != "true" && "${status}" = "true" ]]; then
|
||||
timeout_feature checksparkwallet
|
||||
returncode=$?
|
||||
else
|
||||
returncode=1
|
||||
fi
|
||||
finalreturncode=$((${returncode} | ${finalreturncode}))
|
||||
result="${result}$(feature_status ${returncode} 'Spark Wallet error!')}"
|
||||
<% } %>
|
||||
|
||||
result="{${result}]}"
|
||||
|
||||
echo "${result}" > /gatekeeper/installation.json
|
||||
|
||||
echo -e "\r\n\e[1;32mTests finished.\e[0m" > /dev/console
|
||||
|
||||
echo "EXIT_STATUS=${finalreturncode}" > /dist/exitStatus.sh
|
||||
|
||||
Reference in New Issue
Block a user