Skip to content
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

add named volume to lnd service for persisting data accross container… #2533

Conversation

yancyribbens
Copy link
Contributor

@yancyribbens yancyribbens commented Jan 23, 2019

Add a named volume to docker-compose.yml for persisting lnd application volume state. Without this volume, if the container is brought down (for example using docker-compose down) the state is lost, and lnd needs to resync, eg:

lnd_btc | 2019-01-18 16:38:41.154 [INF] LNWL: Caught up to height 10000

Adding this volume will persist the state along with btc similar to how a local install would work. The new volume can be inspected using docker volume inspect docker_lnd . Using a named volume in docker-compose allows docker to re-attach to the named volume during docker up. This is preferable to an anonymous volume which isn't recognized by docker-compose and so this PR replaces #2507

@halseth
Copy link
Collaborator

@halseth halseth commented Jan 28, 2019

Does this also replace #697?

@yancyribbens
Copy link
Contributor Author

@yancyribbens yancyribbens commented Jan 28, 2019

Yes unless you prefer to cherry pick from #697 instead. When I opened #2507 I wasn't aware of #697.

@halseth
Copy link
Collaborator

@halseth halseth commented Jan 31, 2019

This is a much simpler change, so i would prefer sticking to this.

@yancyribbens
Copy link
Contributor Author

@yancyribbens yancyribbens commented Jan 31, 2019

SGTM

@Roasbeef Roasbeef added enhancement docker P3 needs review labels Feb 1, 2019
halseth
halseth approved these changes Feb 4, 2019
Copy link
Collaborator

@halseth halseth left a comment

utACK 👍

@darwin
Copy link
Contributor

@darwin darwin commented Apr 12, 2019

This is definitely needed. I based my mainnet lnd setup on these docker scripts and did this change when tweaking it. But there is one additional subtle change you should make.

You should remove custom --logdir

--logdir="/data" \

By default, lnd logs into lnd's data folder /root/.lnd/logs/... which is what you want because that folder is mapped to host directory and persists. Logging into forced /data inside container would not persist logs between container rebuilds. Logs are not a big issue with simnet, but if someone took your setup (like I did) and based mainnet lnd setup on it, this could be an easy mistake.

@yancyribbens
Copy link
Contributor Author

@yancyribbens yancyribbens commented Apr 17, 2019

Thanks @darwin. I've updated the PR to use the default home directory.

@halseth halseth requested a review from guggero Nov 7, 2019
Copy link
Collaborator

@guggero guggero left a comment

Sorry this has been lying around for so long. We'll be putting more focus on Docker stuff in the future.

There's a small nit in the comment.
And could you please also squash the two commits and a docker: prefix to the commit message?

docker/docker-compose.yml Outdated Show resolved Hide resolved
@guggero guggero self-assigned this Nov 7, 2019
@yancyribbens yancyribbens force-pushed the persistent-lnd-volume-docker-compose branch from dacae4b to c41c5df Compare Nov 7, 2019
@guggero
Copy link
Collaborator

@guggero guggero commented Nov 8, 2019

Thanks for the changes! I tested the tutorial again and it works as expected.

Something went wrong with the commits, now there are 5 instead of one. Feel free to ping me on Slack if you need help with git.

@yancyribbens
Copy link
Contributor Author

@yancyribbens yancyribbens commented Nov 8, 2019

@guggero sure no problem! i'll rebase the commit history and ping you if needed.

@yancyribbens yancyribbens force-pushed the persistent-lnd-volume-docker-compose branch from dadfb61 to 5c4edca Compare Nov 8, 2019
@yancyribbens
Copy link
Contributor Author

@yancyribbens yancyribbens commented Nov 8, 2019

@guggero comments have been squashed

guggero
guggero approved these changes Nov 9, 2019
Copy link
Collaborator

@guggero guggero left a comment

LGTM 👍

@halseth halseth merged commit 3b22540 into lightningnetwork:master Nov 11, 2019
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker enhancement needs review P3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants