Files
cyphernode/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml

480 lines
14 KiB
YAML

version: "3"
services:
##########################
# POSTGRESQL #
##########################
postgres:
image: postgres:<%= postgres_version %>
user: $USER
environment:
- "POSTGRES_USER=cyphernode"
- "POSTGRES_PASSWORD=<%= postgres_password %>"
- "POSTGRES_DB=cyphernode"
- "PGDATA=/var/lib/postgresql/data/pgdata"
volumes:
- "<%= postgres_datapath %>:/var/lib/postgresql/data"
networks:
- cyphernodenet
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
<% if ( features.indexOf('tor') !== -1 ) { %>
##########################
# TOR #
##########################
tor:
image: cyphernode/tor:<%= tor_version %>
# Sleeping 7 seconds to let lightning and traefik start
command: $USER sh -c 'rm -f /container_monitor/tor_ready ; sleep 10 ; export HOME=/tor ; tor -f /tor/torrc'
volumes:
- "<%= tor_datapath %>:/tor"
- container_monitor:/container_monitor
healthcheck:
test: chown -R $USER /container_monitor && su-exec $USER sh -c 'tor-resolve torproject.org && touch /container_monitor/tor_ready || rm -f /container_monitor/tor_ready'
interval: 30s
timeout: 10s
retries: 10
networks:
- cyphernodenet
- cyphernodeappsnet
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
<% } %>
<% if ( features.indexOf('lightning') !== -1 && lightning_implementation === 'c-lightning' ) { %>
##########################
# LIGHTNING #
##########################
lightning:
image: cyphernode/clightning:<%= lightning_version %>
command: $USER /.lightning/bitcoin/entrypoint.sh
<% if( lightning_expose ) { %>
ports:
- "9735:9735"
<% } %>
volumes:
- "<%= lightning_datapath %>:/.lightning"
- "<%= bitcoin_datapath %>/bitcoin-client.conf:/.bitcoin/bitcoin.conf:ro"
- container_monitor:/container_monitor
healthcheck:
test: chown -R $USER /container_monitor && su-exec $USER sh -c 'lightning-cli getinfo && touch /container_monitor/lightning_ready || rm -f /container_monitor/lightning_ready'
interval: 30s
timeout: 10s
retries: 10
stop_grace_period: 30s
networks:
- cyphernodenet
<% if ( features.indexOf('tor') !== -1 ) { %>
depends_on:
- tor
<% } %>
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
<% } %>
<% if( bitcoin_mode === 'internal' ) { %>
##########################
# BITCOIN #
##########################
bitcoin:
image: cyphernode/bitcoin:<%= bitcoin_version %>
command: $USER /.bitcoin/entrypoint.sh
<% if( bitcoin_expose ) { %>
ports:
- "<%= (net === 'regtest') ? '18444:18444' : ((net === 'testnet') ? '18333:18333' : '8333:8333') %>"
<% } %>
volumes:
- "<%= bitcoin_datapath %>:/.bitcoin"
- "<%= bitcoin_datapath %>/createWallets.sh:/.bitcoin/createWallets.sh:ro"
- container_monitor:/container_monitor
healthcheck:
test: chown -R $USER /container_monitor && su-exec $USER sh -c 'bitcoin-cli echo && touch /container_monitor/bitcoin_ready || rm -f /container_monitor/bitcoin_ready'
interval: 30s
timeout: 10s
retries: 10
stop_grace_period: 30s
networks:
- cyphernodenet
<% if ( features.indexOf('tor') !== -1 ) { %>
depends_on:
- tor
<% } %>
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
<% } %>
##########################
# PROXY #
##########################
proxy:
image: cyphernode/proxy:<%= proxy_version %>
command: $USER ./startproxy.sh
environment:
- "TRACING=1"
- "WATCHER_BTC_NODE_RPC_URL=<%= (bitcoin_mode === 'internal') ? 'bitcoin' : bitcoin_node_ip %>:<%= (net === 'regtest') ? '18443' : ((net === 'testnet') ? '18332' : '8332') %>/wallet"
- "WATCHER_BTC_NODE_DEFAULT_WALLET=watching01.dat"
- "WATCHER_BTC_NODE_XPUB_WALLET=xpubwatching01.dat"
- "WATCHER_BTC_NODE_RPC_USER=<%= bitcoin_rpcuser %>:<%= bitcoin_rpcpassword %>"
- "WATCHER_BTC_NODE_RPC_CFG=/tmp/watcher_btcnode_curlcfg.properties"
- "SPENDER_BTC_NODE_RPC_URL=<%= (bitcoin_mode === 'internal') ? 'bitcoin' : bitcoin_node_ip %>:<%= (net === 'regtest') ? '18443' : ((net === 'testnet') ? '18332' : '8332') %>/wallet"
- "SPENDER_BTC_NODE_DEFAULT_WALLET=spending01.dat"
- "SPENDER_BTC_NODE_RPC_USER=<%= bitcoin_rpcuser %>:<%= bitcoin_rpcpassword %>"
- "SPENDER_BTC_NODE_RPC_CFG=/tmp/spender_btcnode_curlcfg.properties"
- "PROXY_LISTENING_PORT=8888"
- "DB_PATH=/proxy/db"
- "DB_FILE=/proxy/db/proxydb"
- "PYCOIN_CONTAINER=pycoin:7777"
<% if ( use_xpub && xpub ) { %>
- "DERIVATION_PUB32=<%= xpub %>"
- "DERIVATION_PATH=<%= derivation_path %>"
<% } %>
- "WATCHER_BTC_NODE_PRUNED=<%= bitcoin_prune ? 'true' : 'false' %>"
- "OTSCLIENT_CONTAINER=otsclient:6666"
- "OTS_FILES=/proxy/otsfiles"
- "XPUB_DERIVATION_GAP=100"
- "PGPASSFILE=/proxy/db/pgpass"
<% if ( devmode ) { %>
ports:
- "8888:8888"
<% } %>
volumes:
- "<%= logs_datapath %>:/cnlogs"
- "<%= proxy_datapath %>:/proxy/db"
<% if ( features.indexOf('lightning') !== -1 && lightning_implementation === 'c-lightning' ) { %>
- "<%= lightning_datapath %>:/.lightning"
<% } %>
<% if ( features.indexOf('otsclient') !== -1 ) { %>
- "<%= otsclient_datapath %>:/proxy/otsfiles"
<% } %>
<% if ( features.indexOf('tor') !== -1 ) { %>
- "<%= tor_datapath %>:/proxy/tor"
<% } %>
- container_monitor:/container_monitor
healthcheck:
test: chown -R $USER /container_monitor && su-exec $USER sh -c 'curl localhost:8888/helloworld && touch /container_monitor/proxy_ready || rm -f /container_monitor/proxy_ready'
interval: 30s
timeout: 10s
retries: 10
stop_grace_period: 30s
networks:
- cyphernodenet
depends_on:
- postgres
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
##########################
# PROXYCRON #
##########################
proxycron:
image: cyphernode/proxycron:<%= proxycron_version %>
environment:
- "TX_CONF_URL=proxy:8888/executecallbacks"
- "OTS_URL=proxy:8888/ots_backoffice"
networks:
- cyphernodenet
depends_on:
- proxy
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
##########################
# BROKER #
##########################
broker:
image: eclipse-mosquitto:<%= mosquitto_version %>
networks:
- cyphernodenet
- cyphernodeappsnet
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
##########################
# NOTIFIER #
##########################
notifier:
image: cyphernode/notifier:<%= notifier_version %>
command: $USER ./startnotifier.sh
<% if ( features.indexOf('tor') !== -1 ) { %>
environment:
- "TRACING=1"
- "TOR_HOST=tor"
- "TOR_PORT=9050"
<% } %>
volumes:
- "<%= logs_datapath %>:/cnlogs"
networks:
- cyphernodenet
- cyphernodeappsnet
depends_on:
- broker
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
##########################
# PYCOIN #
##########################
pycoin:
image: cyphernode/pycoin:<%= pycoin_version %>
command: $USER ./startpycoin.sh
environment:
- "TRACING=1"
- "PYCOIN_LISTENING_PORT=7777"
<% if ( devmode ) { %>
ports:
- "7777:7777"
<% } %>
volumes:
- "<%= logs_datapath %>:/cnlogs"
networks:
- cyphernodenet
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
<% if ( features.indexOf('otsclient') !== -1 ) { %>
##########################
# OTSCLIENT #
##########################
otsclient:
image: cyphernode/otsclient:<%= otsclient_version %>
command: $USER /script/startotsclient.sh
environment:
- "TRACING=1"
- "OTSCLIENT_LISTENING_PORT=6666"
<% if (net === 'testnet') { %>
- "TESTNET=1"
<% } %>
<% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_otsoperations') !== -1 ) { %>
- "TOR_HOST=tor"
- "TOR_PORT=9050"
<% } %>
volumes:
- "<%= logs_datapath %>:/cnlogs"
- "<%= otsclient_datapath %>:/otsfiles"
- "<%= bitcoin_datapath %>/bitcoin-client.conf:/.bitcoin/bitcoin.conf:ro"
networks:
- cyphernodenet
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
<% } %>
##########################
# GATEKEEPER #
##########################
gatekeeper:
# HTTP authentication API gate
image: cyphernode/gatekeeper:<%= gatekeeper_version %>
command: $USER
environment:
- "TRACING=1"
<% if( gatekeeper_expose ) { %>
ports:
- "<%= gatekeeper_port %>:<%= gatekeeper_port %>"
<% } %>
volumes:
- "<%= logs_datapath %>:/cnlogs"
- "<%= gatekeeper_datapath %>/certs:/etc/ssl/certs:ro"
- "<%= gatekeeper_datapath %>/private:/etc/ssl/private:ro"
- "<%= gatekeeper_datapath %>/keys.properties:/etc/nginx/conf.d/keys.properties"
- "<%= gatekeeper_datapath %>/api.properties:/etc/nginx/conf.d/api.properties"
- "<%= gatekeeper_datapath %>/default.conf:/etc/nginx/conf.d/default.conf"
- "<%= gatekeeper_datapath %>/htpasswd:/etc/nginx/conf.d/status/htpasswd"
- "<%= gatekeeper_datapath %>/installation.json:/etc/nginx/conf.d/s/stats/installation.json"
- "<%= gatekeeper_datapath %>/client.7z:/etc/nginx/conf.d/s/stats/client.7z"
- "<%= gatekeeper_datapath %>/config.7z:/etc/nginx/conf.d/s/stats/config.7z"
- container_monitor:/container_monitor
networks:
- cyphernodenet
- cyphernodeappsnet
depends_on:
- proxy
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
##########################
# TRAEFIK #
##########################
traefik:
image: traefik:<%= traefik_version %>
ports:
- <%= traefik_http_port %>:<%= traefik_http_port %>
- <%= traefik_https_port %>:<%= traefik_https_port %>
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "<%= traefik_datapath%>/traefik.toml:/traefik.toml:ro"
- "<%= traefik_datapath%>/acme.json:/acme.json"
- "<%= traefik_datapath%>/htpasswd:/htpasswd/htpasswd:ro"
networks:
- cyphernodeappsnet
depends_on:
- gatekeeper
<% if ( docker_mode === 'swarm' ) { %>
deploy:
replicas: 1
placement:
constraints:
- node.labels.io.cyphernode == true
restart_policy:
condition: "any"
delay: 1s
update_config:
parallelism: 1
<% } else { %>
restart: always
<% } %>
volumes:
container_monitor:
networks:
cyphernodenet:
external: true
cyphernodeappsnet:
external: true