docker: add send payment alice->bob workflow for newcomers

This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2017-01-12 16:43:55 -08:00
1 parent 51d53eab32
commit a421069dd8
9 files changed
+354 -63

No files matched your search

+3 -14
View File
@@ -13,18 +13,7 @@ ENV GODEBUG netdns=cgo
RUN go build
RUN go install . ./cmd/...
# Mount a volume where btcd's RPC credentials are stored. We'll need to read
# the TLS cert from this directory.
VOLUME ["/rpc"]
# Expose lnd ports (server, rpc).
EXPOSE 10011 10009
VOLUME ["/data"]
# Expose the p2p listening port, and the current RPC port.
EXPOSE 10009 10011
COPY docker/lnd/lnd-start.sh /
# Finally, execute the shell script that will start lnd. We use a shell script
# rather than executing the command directly with ENTRYPOINT in order to ensure
# environment variables get properly substitued.
ENTRYPOINT ["/lnd-start.sh"]
COPY "docker/lnd/start-lnd.sh" .
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
/go/bin/lnd --datadir=/data --logdir=/data --simnet \
--btcdhost=btcd --rpccert=/rpc/rpc.cert \
--rpcuser=${RPCUSER} --rpcpass=${RPCPASS} --debuglevel=debug
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Check env variable and in case of empty value and default value specified
# returns default value, in case of non-empty value returns value.
set_env() {
# docker initialized env variables with blank string and we can't just
# use -z flag as usually.
BLANK_STRING='""'
VARIABLE="$1"
NAME="$2"
DEFAULT="$3"
if [[ -z "$VARIABLE" || "$VARIABLE" == "$BLANK_STRING" ]]; then
if [ -z "$DEFAULT" ]; then
echo "You should specify '$NAME' env variable"
exit 0
else
VARIABLE="$DEFAULT"
fi
fi
# echo is used as return in case if string values
echo "$VARIABLE"
}
RPCUSER=$(set_env "$RPCUSER" "RPCUSER")
RPCPASS=$(set_env "$RPCPASS" "RPCPASS")
DEBUG=$(set_env "$DEBUG" "DEBUG")
lnd \
--datadir="/data" \
--logdir="/data" \
--simnet \
--btcdhost="btcd" \
--rpccert="/rpc/rpc.cert" \
--rpcuser="$RPCUSER" \
--rpcpass="$RPCPASS" \
--debuglevel="$DEBUG" \
"$@"