docker: add send payment alice->bob workflow for newcomers
This commit is contained in:
1 parent
51d53eab32
commit
a421069dd8
9 files changed
+354
-63
No files matched your search
+25
-16
@@ -2,27 +2,36 @@ FROM golang:1.7
|
||||
|
||||
MAINTAINER Olaoluwa Osuntokun <laolu@lightning.network>
|
||||
|
||||
# Expose mainnet ports (server, rpc)
|
||||
EXPOSE 8333 8334
|
||||
|
||||
# Expose testnet ports (server, rpc)
|
||||
EXPOSE 18333 18334
|
||||
|
||||
# Expose simnet ports (server, rpc)
|
||||
EXPOSE 18555 18556
|
||||
|
||||
# Expose segnet ports (server, rpc)
|
||||
EXPOSE 28901 28902
|
||||
|
||||
# Grab and install the latest version of roasbeef's fork of btcd and all
|
||||
# related dependencies.
|
||||
RUN go get -u -v github.com/roasbeef/btcd/...
|
||||
|
||||
# Expose the mainnet, testnet, simnet, and segnet listening ports.
|
||||
EXPOSE 8333 18333 18335 28901
|
||||
RUN mkdir "/rpc" "/root/.btcd" "/root/.btcctl"
|
||||
RUN touch "/root/.btcd/btcd.conf"
|
||||
|
||||
# Expose the mainnet, testnet, simnet, and segnet rpc ports.
|
||||
EXPOSE 8333 18333 18336 28902
|
||||
# Manually generate certificate and add all domains, it is needed to connect
|
||||
# "btcctl" and "lnd" to "btcd" over docker links.
|
||||
RUN "/go/bin/gencerts" --host="*" --directory="/rpc" --force
|
||||
|
||||
# Create a volume to house the RPC credentials. This will be shared with any
|
||||
# lnd containers so they can securely query btcd's RPC server.
|
||||
# Create a volume to house pregenerated RPC credentials. This will be
|
||||
# shared with any lnd, btcctl containers so they can securely query btcd's RPC
|
||||
# server.
|
||||
# You should NOT do this before certificate generation!
|
||||
# Otherwise manually generated certificate will be overriden with shared
|
||||
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
||||
VOLUME ["/rpc"]
|
||||
|
||||
VOLUME ["/data"]
|
||||
|
||||
RUN mkdir /root/.btcd && mkdir /root/.btcctl
|
||||
|
||||
COPY btcd-start.sh /
|
||||
|
||||
# Finally, execute the shell script that will start btcd. We use a shell script
|
||||
# rather than executing the command directly with ENTRYPOINT in order to ensure
|
||||
# environment variables get properly substitued.
|
||||
ENTRYPOINT ["/btcd-start.sh"]
|
||||
COPY "start-btcctl.sh" .
|
||||
COPY "start-btcd.sh" .
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
/go/bin/btcd --datadir=/data --logdir=/data --simnet \
|
||||
--rpccert=/rpc/rpc.cert --rpckey=/rpc/rpc.key \
|
||||
--rpcuser=${RPCUSER} --rpcpass=${RPCPASS} --rpclisten=0.0.0.0 \
|
||||
--debuglevel=debug
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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")
|
||||
|
||||
btcctl \
|
||||
--simnet \
|
||||
--rpccert="/rpc/rpc.cert" \
|
||||
--rpcuser="$RPCUSER" \
|
||||
--rpcpass="$RPCPASS" \
|
||||
--rpcserver="rpcserver" \
|
||||
"$@"
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/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")
|
||||
|
||||
MINING_ADDRESS=$(set_env "$MINING_ADDRESS" "MINING_ADDRESS" "ScoDuqH7kYA9nvxuRg4Xk7E31AhsSc5zxp")
|
||||
|
||||
btcd \
|
||||
--debuglevel="$DEBUG" \
|
||||
--datadir="/data" \
|
||||
--logdir="/data" \
|
||||
--simnet \
|
||||
--rpccert="/rpc/rpc.cert" \
|
||||
--rpckey="/rpc/rpc.key" \
|
||||
--rpcuser="$RPCUSER" \
|
||||
--rpcpass="$RPCPASS" \
|
||||
--miningaddr="$MINING_ADDRESS" \
|
||||
--rpclisten="0.0.0.0" \
|
||||
"$@"
|
||||
|
||||
Reference in new issue
Block a user