mirror of
https://github.com/aljazceru/cypherapps.git
synced 2025-12-17 05:14:22 +01:00
First pass
This commit is contained in:
1
apps/sparkwallet/cookie
Normal file
1
apps/sparkwallet/cookie
Normal file
@@ -0,0 +1 @@
|
||||
cyphernode:sparkwallet:FoeDdQw5yl7pPfqdlGy3OEk/txGqyJjSbVtffhzs7kc=
|
||||
27
apps/sparkwallet/docker-compose.yaml
Normal file
27
apps/sparkwallet/docker-compose.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
cyphernode_sparkwallet:
|
||||
command: --no-tls
|
||||
image: cyphernode/sparkwallet:v0.2.5
|
||||
volumes:
|
||||
- "$LIGHTNING_DATAPATH/:/etc/lightning"
|
||||
- "$APP_SCRIPT_PATH/cookie:/data/spark/cookie"
|
||||
- "$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
apps/sparkwallet/start.sh
Normal file
10
apps/sparkwallet/start.sh
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
apps/sparkwallet/stop.sh
Normal file
10
apps/sparkwallet/stop.sh
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
apps/sparkwallet/test.sh
Normal file
38
apps/sparkwallet/test.sh
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
|
||||
14
apps/welcome/config.toml
Normal file
14
apps/welcome/config.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[server]
|
||||
listen = "0.0.0.0:8080"
|
||||
index_template = "templates/index.html"
|
||||
path_prefix = "/welcome"
|
||||
|
||||
[gatekeeper]
|
||||
status_url = "https://gatekeeper/v0/getblockchaininfo"
|
||||
installation_info_url = "https://gatekeeper/s/stats/installation.json"
|
||||
config_archive_url = "https://gatekeeper/s/stats/config.7z"
|
||||
certs_url = "https://gatekeeper/s/stats/client.7z"
|
||||
|
||||
key_label = "000"
|
||||
key_file = "/data/keys.properties"
|
||||
cert_file = "/data/cert.pem"
|
||||
25
apps/welcome/docker-compose.yaml
Normal file
25
apps/welcome/docker-compose.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
cyphernode_welcome:
|
||||
environment:
|
||||
- "TRACING=1"
|
||||
image: cyphernode/app_welcome:v0.2.0-rc.2
|
||||
volumes:
|
||||
- "$GATEKEEPER_DATAPATH/certs/cert.pem:/data/cert.pem"
|
||||
- "$GATEKEEPER_DATAPATH/keys.properties:/data/keys.properties"
|
||||
- "$APP_SCRIPT_PATH/config.toml:/data/config.toml"
|
||||
- "$GATEKEEPER_DATAPATH/htpasswd:/htpasswd/htpasswd"
|
||||
networks:
|
||||
- cyphernodeappsnet
|
||||
restart: always
|
||||
labels:
|
||||
- "traefik.docker.network=cyphernodeappsnet"
|
||||
- "traefik.frontend.rule=PathPrefix:/welcome; PathPrefixStrip:/welcome"
|
||||
- "traefik.frontend.passHostHeader=true"
|
||||
- "traefik.enable=true"
|
||||
- "traefik.port=8080"
|
||||
- "traefik.frontend.auth.basic.usersFile=/htpasswd/htpasswd"
|
||||
networks:
|
||||
cyphernodeappsnet:
|
||||
external: true
|
||||
13
apps/welcome/start.sh
Normal file
13
apps/welcome/start.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
# APP_SCRIPT_PATH
|
||||
# APP_START_SCRIPT_PATH
|
||||
# APP_ID
|
||||
|
||||
export SHARED_HTPASSWD_PATH
|
||||
export GATEKEEPER_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
|
||||
12
apps/welcome/stop.sh
Normal file
12
apps/welcome/stop.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
#echo "SCRIPT_NAME: $SCRIPT_NAME"
|
||||
#echo "SHARED_HTPASSWD_PATH: $SHARED_HTPASSWD_PATH"
|
||||
#echo "APP_SCRIPT_PATH: $APP_SCRIPT_PATH"
|
||||
#echo "APP_START_SCRIPT_PATH: $APP_START_SCRIPT_PATH"
|
||||
#echo "GATEKEEPER_DATAPATH: $GATEKEEPER_DATAPATH"
|
||||
|
||||
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
apps/welcome/test.sh
Normal file
38
apps/welcome/test.sh
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/welcome)
|
||||
[ "${rc}" -ne "401" ] && return 400
|
||||
return 0
|
||||
}
|
||||
|
||||
timeout_feature do_test
|
||||
returncode=$?
|
||||
|
||||
# return 0: tests cool
|
||||
# return 1: tests failed
|
||||
return $returncode
|
||||
Reference in New Issue
Block a user