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
Adds data volume to lnd docker service #697
Conversation
This still needs the handling of lncli. It's looking for the macaroon in /root/.lnd |
I added a symlink creation during the container startup to be able to use lncli again without any argument. |
You should never make a new folder in / |
Actually, I did not create a new folder. The logs were already stored in /data That said, Docker is a bit different. Since it's isolated it is quite common to store things in / |
Why not use ~/.lnd default directory? Then you won’t need to make a symlink. |
I find it cleaner to store data in /data and that's why I wrote it this way. If this was outside of docker I would store it in /var/lib/lnd. The home directory is not where I usually store application data. It's definitely possible to make /root/.lnd a volume instead. I'll follow the devs opinion. |
I think using |
Ok I updated the patch to make /root/.lnd a volume and removed the --datadir option |
What about adding |
Good idea, I added it. |
This should also contain a fix to the docker example readme. It breaks the current explanation because when you try to make two lnd containers in the same host they can’t be separated, and use the same volume. You should modify the docker/README.md to add volume parameters for alice and bob to allow separate volumes. |
I wrote an update docker-compose.yml to add an alice and bob with different volumes. I am not sure we want to clutter that file with services that are only useful in the tutorial. It is possible to put them in a different docker compose file but then I need to create network for them to share. |
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.
Possible to do the changes to the README without changing the formatting? Makes it hard to see what has really changed atm 😛
volumes: | ||
- lnd_btc_data:/root/.lnd | ||
|
||
alice: |
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.
Could you make the changes to this file a separate commit that explains what they achieve?
I re-split the changes into 3 commits:
It should be more readable now |
@Osso Are these changes/instructions up-to-date with latest master? |
Mostly, the changes are still needed but the trailing spaces commit must be redone for the new readme. |
@Osso Any updates on this? Seems useful (I just cherry-picked the commit to use for some testing) 😅 |
links: | ||
- "btcd:blockchain" | ||
volumes: | ||
- alice_data:/root/.lnd |
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.
This doesn't seem to work, as Alice an Bob will share the same folder, and won't be able to run at the same time.
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.
alice_data and bob_data are 2 different volumes and won't conflict.
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.
Okay, will need to do some more testing, running into some issues... Will report back!
It's quite an old patch. I moved and did not have time to keep it up. |
docker/README.md
Outdated
@@ -90,7 +90,7 @@ Connect `Bob` node to `Alice` node. | |||
|
|||
```bash | |||
# Run "Bob" node and log into it: | |||
$ docker-compose run -d --name bob lnd_btc | |||
$ docker-compose run -d bob |
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.
This still needs to inlcude the --name
parameter, since if not the container will be given a random name.
@@ -34,3 +34,5 @@ RUN apk add --no-cache \ | |||
# Copy the entrypoint script. | |||
COPY "docker/lnd/start-lnd.sh" . | |||
RUN chmod +x start-lnd.sh | |||
|
|||
VOLUME /root/.lnd |
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.
👍
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.
Looks like this isn't actually needed if we use a named volume in docker-compose
@@ -82,12 +82,29 @@ services: | |||
container_name: lnd_ltc | |||
links: | |||
- "ltcd:blockchain" | |||
volumes: | |||
- lnd_ltc_data:/root/.lnd |
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.
The volume shouldn't be required here if you've already defined it in the Dockerfile
I believe. Is there any reason why you're also setting it up here?
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.
I am mirroring the way volumes are set up for the other services.
e.g. - litecoin:/data
Also, I prefer having a named volume for ease of management.
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.
After doing some further testing it seems docker-compose
requires this named volume for management instead of an anonymous volume which is what's created in the Dockerfile
.
|
||
lnd_btc: | ||
extends: lnd | ||
container_name: lnd_btc | ||
links: | ||
- "btcd:blockchain" | ||
volumes: | ||
- lnd_btc_data:/root/.lnd |
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.
Same comment here. shouldn't require it this volume if you create it in lnd/Dockerfile
|
||
# Run the "Alice" container and log into it: | ||
$ docker-compose run -d --name alice lnd_btc | ||
$ docker-compose run -d --name alice alice |
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.
I think it's a good idea to simplify the docs here, although it would be better to do something like:
docker-compose exec -it --name alice
and name the container when it's run.
driver: local | ||
|
||
# alice and bob are need for running README examples | ||
alice_data: |
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.
IMO this docker-compose
file should be left agnostic to implementation examples.
This is a very old PR and we probably should have reviewed it a long time ago. |
This is my proposed changes for issue #696