Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft payjoin integration #21

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions payjoin/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: "3"

services:
payjoin:
environment:
- "RUST_LOG=debug"
- "TRACING=1"
- "CYPHERNODE_URL=https://gatekeeper:${GATEKEEPER_PORT}"
image: dangould/payjoin-client:0.1.28
command: 18443 bitcoin p receive 69420 "https://localhost/pj"
# // port cookie receive amount endpoint
volumes:
- "$APP_SCRIPT_PATH/data:/payjoin/data"
- "$GATEKEEPER_DATAPATH/certs/cert.pem:/payjoin/cert.pem:ro"
- "$LOGS_DATAPATH:/payjoin/logs"
networks:
- cyphernodeappsnet
- payjoinnet
restart: always
labels:
- "traefik.enable=true"
- "traefik.docker.network=cyphernodeappsnet"
- "traefik.frontend.rule=PathPrefixStrip:/pj"
- "traefik.frontend.passHostHeader=true"
- "traefik.port=3000"
deploy:
labels:
- "traefik.enable=true"
- "traefik.docker.network=cyphernodeappsnet"
- "traefik.frontend.rule=PathPrefixStrip:/pj"
- "traefik.frontend.passHostHeader=true"
- "traefik.port=3000"
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
delay: 1s
update_config:
parallelism: 1
logging:
driver: local
networks:
cyphernodeappsnet:
external: true
payjoinnet:
external: true
Empty file added payjoin/isCoreApp
Empty file.
40 changes: 40 additions & 0 deletions payjoin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/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\r\n"

sleep ${interval}
done

return ${returncode}
}

do_test() {
local rc
rc=$(curl -k -s -o /dev/null -w "%{http_code}" https://127.0.0.1:${TRAEFIK_HTTPS_PORT}/payjoin)
[ "${rc}" -ne "400" ] && return 400
return 0
}

export TRAEFIK_HTTPS_PORT

timeout_feature do_test
returncode=$?

# return 0: tests cool
# return 1: tests failed
return $returncode