diff --git a/docker/config.ini b/docker/config.ini index 0c09c3ff..9b98260b 100644 --- a/docker/config.ini +++ b/docker/config.ini @@ -2,8 +2,9 @@ network=testnet price=1000 max_squeaks_per_address_per_hour=100 -database=postgresql +database=sqlite sqk_dir= +enable_sync=true [lnd] host=lnd diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 2cfd8144..36eddf88 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,17 +1,6 @@ version: '3' services: - db: - image: postgres - container_name: db - environment: - - POSTGRES_DB=postgres - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres - volumes: - - postgres_dir:/var/lib/postgresql/data - - ../createdb.sql:/docker-entrypoint-initdb.d/init.sql - btcd: image: btcd container_name: btcd @@ -39,6 +28,26 @@ services: - lnd_dir:/root/.lnd links: - "btcd:btcd" + sysctls: + - net.ipv6.conf.all.disable_ipv6=0 + entrypoint: ["./start-lnd.sh"] + + lnd_other: + image: lnd_other + container_name: lnd_other + build: + context: ../ + dockerfile: docker/lnd/Dockerfile + environment: + - NETWORK=testnet + - RPCHOST=btcd + volumes: + - shared:/rpc + - lnd_other_dir:/root/.lnd + links: + - "btcd:btcd" + sysctls: + - net.ipv6.conf.all.disable_ipv6=0 entrypoint: ["./start-lnd.sh"] sqkserver: @@ -56,8 +65,23 @@ services: links: - "btcd:btcd" - "lnd:lnd" - depends_on: - - db + sysctls: + - net.ipv6.conf.all.disable_ipv6=0 + entrypoint: ["./start-sqkserver.sh"] + + sqkserver_other: + image: sqkserver_other + container_name: sqkserver_other + build: + context: ../ + dockerfile: docker/sqkserver/Dockerfile + volumes: + - shared:/rpc + - lnd_other_dir:/root/.lnd + - ./config.ini:/app/config.ini + links: + - "btcd:btcd" + - "lnd_other:lnd" sysctls: - net.ipv6.conf.all.disable_ipv6=0 entrypoint: ["./start-sqkserver.sh"] @@ -72,6 +96,21 @@ services: - 8080:8080 links: - "sqkserver:sqkserver" + environment: + - SERVICE_NAME=sqkserver + + envoy_other: + image: envoy_other + container_name: envoy_other + build: + context: ../ + dockerfile: docker/envoy/Dockerfile + ports: + - 8090:8080 + links: + - "sqkserver_other:sqkserver_other" + environment: + - SERVICE_NAME=sqkserver_other frontend: image: frontend @@ -79,9 +118,22 @@ services: build: context: ../ dockerfile: docker/frontend/Dockerfile + args: + - PORT=8080 ports: - 8081:8081 + frontend_other: + image: frontend_other + container_name: frontend_other + build: + context: ../ + dockerfile: docker/frontend/Dockerfile + args: + - PORT=8090 + ports: + - 8091:8081 + volumes: bitcoin: driver: local @@ -94,5 +146,9 @@ volumes: lnd_dir: driver: local + # lnd_other_dir volume is needed for sharing the lnd tls certificate + lnd_other_dir: + driver: local + postgres_dir: driver: local diff --git a/docker/envoy/Dockerfile b/docker/envoy/Dockerfile index e9365b2a..8b314b37 100644 --- a/docker/envoy/Dockerfile +++ b/docker/envoy/Dockerfile @@ -14,7 +14,18 @@ FROM envoyproxy/envoy:v1.15.0 -# COPY "docker/envoy/envoy.yaml" /etc/envoy/envoy.yaml -COPY "frontend/envoy.yaml" /etc/envoy/envoy.yaml +#COPY "frontend/envoy.yaml" /etc/envoy/envoy.yaml -CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml -l trace --log-path /tmp/envoy_info.log +#CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml -l trace --log-path /tmp/envoy_info.log + + + +COPY "frontend/envoy.yaml" /tmpl/envoy.yaml.tmpl +COPY docker/envoy/docker-entrypoint.sh / + +RUN chmod 500 /docker-entrypoint.sh + +RUN apt-get update && \ + apt-get install gettext -y + +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/docker/envoy/docker-entrypoint.sh b/docker/envoy/docker-entrypoint.sh new file mode 100644 index 00000000..f221bef8 --- /dev/null +++ b/docker/envoy/docker-entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +echo "Generating envoy.yaml config file..." +cat /tmpl/envoy.yaml.tmpl | envsubst \$ENVOY_LB_ALG,\$SERVICE_NAME > /etc/envoy.yaml + +echo "Starting Envoy..." +/usr/local/bin/envoy -c /etc/envoy.yaml diff --git a/docker/frontend/Dockerfile b/docker/frontend/Dockerfile index 2f8e5cbc..80f3654c 100644 --- a/docker/frontend/Dockerfile +++ b/docker/frontend/Dockerfile @@ -1,5 +1,7 @@ FROM node:10-stretch +ARG PORT + RUN apt-get -qq update && apt-get -qq install -y \ unzip @@ -32,6 +34,7 @@ RUN chmod +x pb_disable-eslint.sh && \ ./pb_disable-eslint.sh src/proto/ RUN npm install && \ + REACT_APP_PORT=${PORT} \ npm run build EXPOSE 8081 diff --git a/frontend/envoy.yaml b/frontend/envoy.yaml index 3f6dee65..55f76e59 100644 --- a/frontend/envoy.yaml +++ b/frontend/envoy.yaml @@ -50,5 +50,5 @@ static_resources: - endpoint: address: socket_address: - address: sqkserver + address: ${SERVICE_NAME} port_value: 8994 diff --git a/frontend/squeak-node-frontend/src/squeakclient/squeakclient.js b/frontend/squeak-node-frontend/src/squeakclient/squeakclient.js index 319eb9eb..67ec9208 100644 --- a/frontend/squeak-node-frontend/src/squeakclient/squeakclient.js +++ b/frontend/squeak-node-frontend/src/squeakclient/squeakclient.js @@ -1,3 +1,8 @@ import { SqueakAdminClient } from "../proto/squeak_admin_grpc_web_pb" -export let client = new SqueakAdminClient('http://' + window.location.hostname + ':8080') +const PORT = process.env.REACT_APP_PORT; + +console.log("port:"); +console.log(PORT); + +export let client = new SqueakAdminClient('http://' + window.location.hostname + ':' + PORT)