mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
docker: remove litcoin docker scripts
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
0d89a45abe
commit
215e0f26fe
@@ -1,55 +0,0 @@
|
|||||||
version: '2'
|
|
||||||
services:
|
|
||||||
# ltc is an image of litecoin node which used as base image for ltcd and
|
|
||||||
# ltcctl. The environment variables default values determined on stage of
|
|
||||||
# container start within starting script.
|
|
||||||
ltcd:
|
|
||||||
image: ltcd
|
|
||||||
container_name: ltcd
|
|
||||||
build:
|
|
||||||
context: ltcd/
|
|
||||||
volumes:
|
|
||||||
- shared:/rpc
|
|
||||||
- litecoin:/data
|
|
||||||
environment:
|
|
||||||
- RPCUSER
|
|
||||||
- RPCPASS
|
|
||||||
- NETWORK
|
|
||||||
- DEBUG
|
|
||||||
- MINING_ADDRESS
|
|
||||||
entrypoint: ["./start-ltcd.sh"]
|
|
||||||
|
|
||||||
lnd:
|
|
||||||
image: lnd
|
|
||||||
container_name: lnd_ltc
|
|
||||||
build:
|
|
||||||
context: ../
|
|
||||||
dockerfile: dev.Dockerfile
|
|
||||||
environment:
|
|
||||||
- RPCUSER
|
|
||||||
- RPCPASS
|
|
||||||
- NETWORK
|
|
||||||
- CHAIN=litecoin
|
|
||||||
- DEBUG
|
|
||||||
volumes:
|
|
||||||
- shared:/rpc
|
|
||||||
- lnd_ltc:/root/.lnd
|
|
||||||
entrypoint: ["./start-lnd.sh"]
|
|
||||||
links:
|
|
||||||
- "ltcd:blockchain"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
# shared volume is need to store the btcd rpc certificates and use it within
|
|
||||||
# ltcctl and lnd containers.
|
|
||||||
shared:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
# litecoin volume is needed for maintaining blockchain persistence
|
|
||||||
# during ltcd container recreation.
|
|
||||||
litecoin:
|
|
||||||
driver: local
|
|
||||||
|
|
||||||
# lnd volume is used for persisting lnd application data and chain state
|
|
||||||
# during container lifecycle.
|
|
||||||
lnd_ltc:
|
|
||||||
driver: local
|
|
||||||
@@ -48,9 +48,6 @@ NETWORK=$(set_default "$NETWORK" "simnet")
|
|||||||
CHAIN=$(set_default "$CHAIN" "bitcoin")
|
CHAIN=$(set_default "$CHAIN" "bitcoin")
|
||||||
BACKEND="btcd"
|
BACKEND="btcd"
|
||||||
HOSTNAME=$(hostname)
|
HOSTNAME=$(hostname)
|
||||||
if [[ "$CHAIN" == "litecoin" ]]; then
|
|
||||||
BACKEND="ltcd"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# CAUTION: DO NOT use the --noseedback for production/mainnet setups, ever!
|
# CAUTION: DO NOT use the --noseedback for production/mainnet setups, ever!
|
||||||
# Also, setting --rpclisten to $HOSTNAME will cause it to listen on an IP
|
# Also, setting --rpclisten to $HOSTNAME will cause it to listen on an IP
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
FROM golang:1.21.0-alpine as builder
|
|
||||||
|
|
||||||
LABEL maintainer="Olaoluwa Osuntokun <laolu@lightning.engineering>"
|
|
||||||
|
|
||||||
# Grab and install the latest version of roasbeef's fork of ltcd and all
|
|
||||||
# related dependencies.
|
|
||||||
WORKDIR $GOPATH/src/github.com/ltcsuite/ltcd
|
|
||||||
RUN apk add --no-cache --update alpine-sdk git
|
|
||||||
RUN git clone https://github.com/ltcsuite/ltcd ./
|
|
||||||
RUN go install -v . ./cmd/...
|
|
||||||
RUN go install . ./cmd/ltcctl ./cmd/gencerts
|
|
||||||
|
|
||||||
# Start a new image
|
|
||||||
FROM alpine as final
|
|
||||||
|
|
||||||
# Expose mainnet ports (server, rpc)
|
|
||||||
EXPOSE 9333 9334
|
|
||||||
|
|
||||||
# Expose testnet ports (server, rpc)
|
|
||||||
EXPOSE 19334 19335
|
|
||||||
|
|
||||||
# Expose simnet ports (server, rpc)
|
|
||||||
EXPOSE 18555 18556
|
|
||||||
|
|
||||||
# Copy the compiled binaries from the builder image.
|
|
||||||
COPY --from=builder /go/bin/ltcctl /bin/
|
|
||||||
COPY --from=builder /go/bin/ltcd /bin/
|
|
||||||
COPY --from=builder /go/bin/gencerts /bin/
|
|
||||||
|
|
||||||
COPY "start-ltcctl.sh" .
|
|
||||||
COPY "start-ltcd.sh" .
|
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
bash \
|
|
||||||
ca-certificates \
|
|
||||||
&& chmod +x start-ltcctl.sh \
|
|
||||||
&& chmod +x start-ltcd.sh \
|
|
||||||
&& mkdir "/rpc" "/root/.ltcd" "/root/.ltcctl" \
|
|
||||||
&& touch "/root/.ltcd/ltcd.conf" \
|
|
||||||
# "ltcctl" and "lnd" to "ltcd" over docker links.
|
|
||||||
&& "/bin/gencerts" --host="*" --directory="/rpc" --force
|
|
||||||
|
|
||||||
# Create a volume to house pregenerated RPC credentials. This will be
|
|
||||||
# shared with any lnd, btcctl containers so they can securely query ltcd's RPC
|
|
||||||
# server.
|
|
||||||
# You should NOT do this before certificate generation!
|
|
||||||
# Otherwise manually generated certificate will be overridden with shared
|
|
||||||
# mounted volume! For more info read dockerfile "VOLUME" documentation.
|
|
||||||
VOLUME ["/rpc"]
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# exit from script if error was raised.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# error function is used within a bash function in order to send the error
|
|
||||||
# message directly to the stderr output and exit.
|
|
||||||
error() {
|
|
||||||
echo "$1" > /dev/stderr
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# return is used within bash function in order to return the value.
|
|
||||||
return() {
|
|
||||||
echo "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# set_default function gives the ability to move the setting of default
|
|
||||||
# env variable from docker file to the script thereby giving the ability to the
|
|
||||||
# user override it durin container start.
|
|
||||||
set_default() {
|
|
||||||
# docker initialized env variables with blank string and we can't just
|
|
||||||
# use -z flag as usually.
|
|
||||||
BLANK_STRING='""'
|
|
||||||
|
|
||||||
VARIABLE="$1"
|
|
||||||
DEFAULT="$2"
|
|
||||||
|
|
||||||
if [[ -z "$VARIABLE" || "$VARIABLE" == "$BLANK_STRING" ]]; then
|
|
||||||
|
|
||||||
if [ -z "$DEFAULT" ]; then
|
|
||||||
error "You should specify default variable"
|
|
||||||
else
|
|
||||||
VARIABLE="$DEFAULT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "$VARIABLE"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set default variables if needed.
|
|
||||||
RPCUSER=$(set_default "$RPCUSER" "devuser")
|
|
||||||
RPCPASS=$(set_default "$RPCPASS" "devpass")
|
|
||||||
NETWORK=$(set_default "$NETWORK" "simnet")
|
|
||||||
|
|
||||||
PARAMS=""
|
|
||||||
if [ "$NETWORK" != "mainnet" ]; then
|
|
||||||
PARAMS="--$NETWORK"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PARAMS=$(echo $PARAMS \
|
|
||||||
"--rpccert=/rpc/rpc.cert" \
|
|
||||||
"--rpcuser=$RPCUSER" \
|
|
||||||
"--rpcpass=$RPCPASS" \
|
|
||||||
"--rpcserver=localhost" \
|
|
||||||
)
|
|
||||||
|
|
||||||
PARAMS="$PARAMS $@"
|
|
||||||
exec ltcctl $PARAMS
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# exit from script if error was raised.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# error function is used within a bash function in order to send the error
|
|
||||||
# message directly to the stderr output and exit.
|
|
||||||
error() {
|
|
||||||
echo "$1" > /dev/stderr
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# return is used within bash function in order to return the value.
|
|
||||||
return() {
|
|
||||||
echo "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# set_default function gives the ability to move the setting of default
|
|
||||||
# env variable from docker file to the script thereby giving the ability to the
|
|
||||||
# user override it durin container start.
|
|
||||||
set_default() {
|
|
||||||
# docker initialized env variables with blank string and we can't just
|
|
||||||
# use -z flag as usually.
|
|
||||||
BLANK_STRING='""'
|
|
||||||
|
|
||||||
VARIABLE="$1"
|
|
||||||
DEFAULT="$2"
|
|
||||||
|
|
||||||
if [[ -z "$VARIABLE" || "$VARIABLE" == "$BLANK_STRING" ]]; then
|
|
||||||
|
|
||||||
if [ -z "$DEFAULT" ]; then
|
|
||||||
error "You should specify default variable"
|
|
||||||
else
|
|
||||||
VARIABLE="$DEFAULT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "$VARIABLE"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set default variables if needed.
|
|
||||||
RPCUSER=$(set_default "$RPCUSER" "devuser")
|
|
||||||
RPCPASS=$(set_default "$RPCPASS" "devpass")
|
|
||||||
DEBUG=$(set_default "$DEBUG" "info")
|
|
||||||
NETWORK=$(set_default "$NETWORK" "simnet")
|
|
||||||
|
|
||||||
PARAMS=""
|
|
||||||
if [ "$NETWORK" != "mainnet" ]; then
|
|
||||||
PARAMS="--$NETWORK"
|
|
||||||
fi
|
|
||||||
|
|
||||||
PARAMS=$(echo $PARAMS \
|
|
||||||
"--debuglevel=$DEBUG" \
|
|
||||||
"--rpcuser=$RPCUSER" \
|
|
||||||
"--rpcpass=$RPCPASS" \
|
|
||||||
"--datadir=/data" \
|
|
||||||
"--logdir=/data" \
|
|
||||||
"--rpccert=/rpc/rpc.cert" \
|
|
||||||
"--rpckey=/rpc/rpc.key" \
|
|
||||||
"--rpclisten=0.0.0.0" \
|
|
||||||
"--txindex"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set the mining flag only if address is non empty.
|
|
||||||
if [[ -n "$MINING_ADDRESS" ]]; then
|
|
||||||
PARAMS="$PARAMS --miningaddr=$MINING_ADDRESS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add user parameters to command.
|
|
||||||
PARAMS="$PARAMS $@"
|
|
||||||
|
|
||||||
# Print command and start bitcoin node.
|
|
||||||
echo "Command: ltcd $PARAMS"
|
|
||||||
exec ltcd $PARAMS
|
|
||||||
Reference in New Issue
Block a user