Skip to content

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

Merged
halseth merged 1 commit into
lightningnetwork:masterfrom
yancyribbens:persistent-lnd-volume-docker-compose
Nov 11, 2019
Merged

add named volume to lnd service for persisting data accross container…#2533
halseth merged 1 commit into
lightningnetwork:masterfrom
yancyribbens:persistent-lnd-volume-docker-compose

Conversation

@yancyribbens

Copy link
Copy Markdown
Contributor

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

halseth commented Jan 28, 2019

Copy link
Copy Markdown
Contributor

Does this also replace #697?

@yancyribbens

Copy link
Copy Markdown
Contributor Author

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

@halseth

halseth commented Jan 31, 2019

Copy link
Copy Markdown
Contributor

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

@yancyribbens

Copy link
Copy Markdown
Contributor Author

SGTM

@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour docker Docker-related PRs/Issues P3 might get fixed, nice to have needs review PR needs review by regular contributors labels Feb 1, 2019

@halseth halseth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 👍

@darwin

darwin commented Apr 12, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@halseth halseth requested a review from guggero November 7, 2019 10:22

@guggero guggero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread docker/docker-compose.yml Outdated
@guggero guggero self-assigned this Nov 7, 2019
Comment thread docker/docker-compose.yml Outdated
@yancyribbens yancyribbens force-pushed the persistent-lnd-volume-docker-compose branch from dacae4b to c41c5df Compare November 7, 2019 17:23
@guggero

guggero commented Nov 8, 2019

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor Author

@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 November 8, 2019 17:33
@yancyribbens

Copy link
Copy Markdown
Contributor Author

@guggero comments have been squashed

@guggero guggero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@halseth halseth merged commit 3b22540 into lightningnetwork:master Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker-related PRs/Issues enhancement Improvements to existing features / behaviour needs review PR needs review by regular contributors P3 might get fixed, nice to have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants