-
Notifications
You must be signed in to change notification settings - Fork 942
Usable Dockerfile for CLightning #1318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -0,0 +1 @@ | |||
Dockerfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Missing \n
Dockerfile
Outdated
&& gpg --keyserver keyserver.ubuntu.com --recv-keys "$LITECOIN_PGP_KEY" \ | ||
&& wget -qO litecoin.asc "$LITECOIN_ASC_URL" \ | ||
&& gpg --verify litecoin.asc \ | ||
&& BD=litecoin-$LITECOIN_VERSION/bin \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Inconsistent indentation.
Dockerfile
Outdated
COPY tools/docker-entrypoint.sh entrypoint.sh | ||
|
||
EXPOSE 9112 9735 9835 | ||
ENTRYPOINT [ "./entrypoint.sh" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Missing \n
Please fix the linting warnings reported by |
Thanks, I fixed the indent (will squash later), for the |
Concept ACK from me :-) |
Thanks @NicolasDorier this is indeed much better 😃 Making I'd prefer to have these files in the |
This docker is meant to be integrated with docker hub automated build. This mean that everytimes you commit, dockerhub pick it up, build from the sources and apply a tag to it. Using |
52807aa
to
45ac9fc
Compare
Would not be better to use debian:stretch-slim? System itself it is same as ubuntu but resulting image will be almost 30MB smaller... |
I am not against it, just not a linux expert and I don't really have time to hunt about which package name / tooling change between distro. :( |
a9c41d3
to
b10c6cf
Compare
Technicaly Ubuntu extends Debian, tooling and packages are mostly same. This will do the trick (I've tested build): 1c1
< FROM ubuntu:16.04 as builder
---
> FROM debian:stretch-slim as builder
4c4
< libsqlite3-dev python python3 wget
---
> libsqlite3-dev python python3 wget gnupg dirmngr
42c42
< FROM ubuntu:16.04
---
> FROM debian:stretch-slim |
Thanks @analogic , trying and testing this now. |
Fixed spellcheck (travis was quite useful), added and tested with debian, it works fine. |
@NicolasDorier Do you mean |
@cdecker if you concept ACK the |
Yeah, I see your point, just a bit hesitant to put stuff in the root of the project :-) Concept ACK Edit: regarding docker image size, we might even get away with alpine, which is truly tiny. |
@cdecker Sure, Alpine would work too, but I am afraid that it is will make image harder to extend for average docker user |
f639e7e
to
a2ab974
Compare
Just added documentation in the |
Note that the doc assumes you have setup automated build on docker hub on elementsproject/lightning ! |
0e3197b
to
87060b2
Compare
tools/docker-entrypoint.sh
Outdated
socat -d -d "TCP4-listen:$LIGHTNINGD_PORT,fork,reuseaddr" "UNIX-CONNECT:$LIGHTNINGD_DATA/lightning-rpc" | ||
else | ||
lightningd | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Missing \n
tools/docker-entrypoint.sh
Outdated
< <(inotifywait -e create,open --format '%f' --quiet "$LIGHTNINGD_DATA" --monitor) | ||
echo "C-Lightning started" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove redundant \n
87060b2
to
ecec5b6
Compare
README.md
Outdated
|
||
sudo docker run \ | ||
-v $HOME/.lightning:/root/.lightning \ | ||
-v $HOME/.bitcoin:/root/.bitcoin \ | ||
-p 9735:9735 \ | ||
cdecker/lightningd:latest | ||
|
||
The second docker image is [elementsproject/lightning](https://hub.docker.com/r/elementsproject/lightningd/) (from this [Dockerfile](Dockerfile)), it is meant to be used inside docker-compose. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elementsproject/lightning
-> elementsproject/lightningd
@jsarenik the Knowing that the runtime image is different from the build image, the |
mmh getting
UPDATE: debugging out, might come from CRLF ;S |
befce87
to
1f7efbd
Compare
@NicolasDorier just once and just during build. Either by exporting |
1f7efbd
to
19e349c
Compare
I'm currently setting things up, but we might end up having to manually push them for the time being (security settings around this org is pretty strict). Also I find myself overriding the Can we trim the magic down to adding prefix and suffix to the executed command, but not completely overriding? I like the tracing instrumentation, but I don't like the forced path through a config file and the cli args being discarded. |
By the way I have good experience with separate set of scripts inside the git tree which are shared across all CI systems (e.g. Travis config would point to a script that contains commands instead of defining them, the same for Docker, etc.) See https://github.com/jsarenik/spf-tools/tree/master/misc and https://github.com/jsarenik/spf-tools/blob/master/.travis.yml |
Why are you overriding with |
Because I'd like to have access to the other command line flags (like |
Lightning Charge allows specifying an Alternatively, since lightningd is the main thing being run here, the entrypoint can forward |
@cdecker why not doing docker run -e LIGHTNINGD_OPT=" \
log-level=debug
blah=value
" clightning/lightningd But additionally, I can also pass the pass parameters so you can do this: docker run clightning/lightningd --log-level=debug blah=value UPDATE: just saw @shesek response. But indeed it would be the same approach as charge which work well and is flexible enough. |
@cdecker I pushed, try |
Note that Perhaps it would be better to specify the Also, mutating the Edit: and the fact that |
I never had any reason to mount and modify the config file outside the docker-compose or command line parameters via mounted folders. But what we can do in this case is to not modify the config file if I think supporting the The best would be either, we keep only for config file, or to back this directly into clightning code, or that we completely remove it. |
I would suggest that:
That seems to be even simpler than the current implementation, no? |
Ok so how about this which seem nice compromise:
When using docker compose, passing the configuration file in the docker-compose file is more convenient and readable, so I am not too happy removing it. |
b876087
to
dbca184
Compare
Closing this one, supersede by #1616 |
I already did a PR in the past with this, but decided to close it after there was complains about
socat
dependency.This PR makes a second attempt, this time,
socat
is disabled by default. (it is used only for dev purposes)It ships
litecoin-cli
andbitcoin-cli
with it.Environment variable:
EXPOSE_TCP
default to false, if true, use socat to expose clightning on port9835
.LIGHTNINGD_OPT
is the config file of the clightning instance.A new parameter, not existing in clightning parameters called
chain=btc|ltc
has been added and is interpreted in theentrypoint.sh
, it will transform thenetwork=
parameter with the following table if present:chain + network = replaced network
btc + mainnet = bitcoin
btc + testnet = testnet
btc + regtest = regtest
ltc + mainnet = litecoin
ltc + testnet = litecoin-testnet
This has been done to uniformise the way of identifying the chain to use across different docker images I am using.
Note that this image is used in production by BTCPay (https://hub.docker.com/r/nicolasdorier/clightning/), so I don't strictly need it in the lightning repository. But I think it has better its place here than in my fork. (I rebase this PR/docker image one time per week)
Using
EXPOSE_TCP
allow the contributors to debug BTCPay with clightning integration whatever the OS they are using.