diff --git a/.lnd/lnd.conf b/.lnd/lnd.conf deleted file mode 100644 index f948250..0000000 --- a/.lnd/lnd.conf +++ /dev/null @@ -1,11 +0,0 @@ -bitcoin.mainnet=1 -bitcoin.active=1 -bitcoin.node=neutrino - -alias=myalias -listen=0.0.0.0:9735 -rpclisten=0.0.0.0:10009 - -ignore-historical-gossip-filters=true -nobootstrap=true -numgraphsyncpeers=1 diff --git a/Dockerfile b/Dockerfile index 1c023ee..17c7953 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM golang:1.13-alpine as builder +LABEL maintainer="gonzaloaune@stakwork.com" # Force Go to use the cgo based DNS resolver. This is required to ensure DNS # queries required to connect to linked containers succeed. @@ -23,15 +24,19 @@ RUN git clone https://github.com/lightningnetwork/lnd /go/src/github.com/lightni RUN cd /go/src/github.com/lightningnetwork/lnd \ && git checkout $checkout \ && make \ -&& make install tags="signrpc walletrpc chainrpc invoicesrpc" +&& make install tags="signrpc walletrpc chainrpc invoicesrpc experimental" # Start a new, final image. FROM alpine as final -RUN mkdir /relay/ -WORKDIR /relay/ +EXPOSE 80 +EXPOSE 9735/tcp +EXPOSE 9735/udp +EXPOSE 10009/tcp +EXPOSE 10009/udp -VOLUME /relay/.lnd +ENV NODE_ALIAS gonza-mayo +ENV NODE_ENV production # Add bash and ca-certs, for quality of life and SSL-related reasons. RUN apk --no-cache add \ @@ -42,9 +47,12 @@ RUN apk --no-cache add \ COPY --from=builder /go/bin/lncli /bin/ COPY --from=builder /go/bin/lnd /bin/ -RUN apk add --update nodejs nodejs-npm sqlite +RUN apk add --update nodejs nodejs-npm sqlite git supervisor + +RUN git clone https://github.com/stakwork/sphinx-relay /relay/ + +WORKDIR /relay/ -COPY package.json . RUN npm install RUN npm install nodemon --save-dev RUN npm install express --save-dev @@ -56,5 +64,13 @@ RUN npm install --quiet node-gyp -g RUN npm install sqlite3 --build-from-source --save-dev RUN npm install --save-dev sequelize RUN npm rebuild -COPY . . RUN npm run tsc + +RUN mkdir /relay/.lnd/ +COPY ./lnd.conf.sample /relay/.lnd/lnd.conf + +RUN mkdir -p /var/log/supervisor +COPY ./supervisord.conf /etc/supervisord.conf +COPY ./lnd_supervisor.conf /etc/supervisor.d/lnd_supervisor.ini +COPY ./relay_supervisor.conf /etc/supervisor.d/relay_supervisor.ini +CMD ["/usr/bin/supervisord"] diff --git a/config/app.json b/config/app.json index b4c8eba..aa03216 100644 --- a/config/app.json +++ b/config/app.json @@ -15,7 +15,7 @@ "production": { "macaroon_location": "/relay/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", "tls_location": "/relay/.lnd/tls.cert", - "node_ip": "172.22.0.2", + "node_ip": "localhost", "lnd_port": "10009", "node_http_protocol": "http", "node_http_port": "3000", diff --git a/lnd.conf.sample b/lnd.conf.sample index f948250..f9a1311 100644 --- a/lnd.conf.sample +++ b/lnd.conf.sample @@ -1,11 +1,12 @@ bitcoin.mainnet=1 bitcoin.active=1 bitcoin.node=neutrino +accept-keysend=1 -alias=myalias listen=0.0.0.0:9735 rpclisten=0.0.0.0:10009 ignore-historical-gossip-filters=true nobootstrap=true numgraphsyncpeers=1 +routing.assumechanvalid=1 diff --git a/lnd_supervisor.conf b/lnd_supervisor.conf new file mode 100644 index 0000000..2418ed5 --- /dev/null +++ b/lnd_supervisor.conf @@ -0,0 +1,6 @@ +[program:lnd] +user=root +command=lnd --lnddir=/relay/.lnd/ +startretries=999999999999999999999999999 +autostart=true +autorestart=true \ No newline at end of file diff --git a/relay_supervisor.conf b/relay_supervisor.conf new file mode 100644 index 0000000..7eebc4c --- /dev/null +++ b/relay_supervisor.conf @@ -0,0 +1,6 @@ +[program:relay] +user=root +command=npm start --prefix /relay/ +startretries=999999999999999999999999999 +autostart=true +autorestart=true \ No newline at end of file diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..73c4ee7 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,17 @@ +[unix_http_server] +file=/run/supervisord.sock ; (the path to the socket file) + +[supervisord] +logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) +loglevel=info ; (log level;default info; others: debug,warn,trace) +nodaemon=true + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///run/supervisord.sock ; use a unix:// URL for a unix socket + +[include] +files = /etc/supervisor.d/*.ini +