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

feat(docker): allow users to use Zebra + LWD with persistent states #8215

Merged
merged 6 commits into from
Feb 1, 2024

Conversation

gustavovalverde
Copy link
Member

@gustavovalverde gustavovalverde commented Jan 30, 2024

Motivation

We want to make it easy for users to use Zebra and Lightwalletd without the risk of losing their cached states, and avoiding complexity when running both tools together.

Fixes #8023

Thanks to @AArnott for putting up this guide, as it served as the foundation for building these compose files.

PR Author Checklist

Check before marking the PR as ready for review:

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?
For significant changes:
  • Is there a summary in the CHANGELOG?
  • Can these changes be split into multiple PRs?

If a checkbox isn't relevant to the PR, mark it as done.

Complex Code or Requirements

  • A Health-check was needed for Zebra, so the Lightwalletd service doesn't start until Zebra is ready
  • The default LWD has to be run unsecurely with --no-tls-very-insecure as we can't create certificates for the user
  • curl is required in our production image to allow the health-check to work

Solution

  • Create a docker-compose.yml to run an isolated Zebra node
  • Create a docker-compose.lwd.yml to run a lightwalletd server alongside Zebra
  • Create a zcash.conf file for lightwalletd
  • Move unused production environment variables from test.env to .env

Testing

This can be tested running:

docker-compose -f docker/docker-compose.yml up

For a Zcash Node, and change its behavior in .env

docker-compose -f docker/docker-compose.yml -f docker/docker-compose.lwd.yml up

To run LWD + Zcash

Review

Note: This is not ready until respective user documentation is updated

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

@gustavovalverde gustavovalverde added A-devops Area: Pipelines, CI/CD and Dockerfiles C-enhancement Category: This is an improvement I-usability Zebra is hard to understand or use C-feature Category: New features P-Medium ⚡ labels Jan 30, 2024
@gustavovalverde gustavovalverde self-assigned this Jan 30, 2024
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Jan 31, 2024
@gustavovalverde gustavovalverde marked this pull request as ready for review January 31, 2024 11:20
@gustavovalverde gustavovalverde requested review from a team as code owners January 31, 2024 11:20
@gustavovalverde gustavovalverde requested review from upbqdn and removed request for a team January 31, 2024 11:20
Copy link
Contributor

@AArnott AArnott left a comment

Choose a reason for hiding this comment

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

I'm confused at how you've created two docker-compose files and how you've distributed the yaml across them. In my blog post I used just one file. I've never seen it broken out like this, so I'm probably just ignorant and my comments may be wrong. But hopefully at least one of us will come out having learned something. :)

docker/docker-compose.lwd.yml Outdated Show resolved Hide resolved
docker/docker-compose.lwd.yml Outdated Show resolved Hide resolved
docker/docker-compose.yml Outdated Show resolved Hide resolved
@gustavovalverde
Copy link
Member Author

I'm confused at how you've created two docker-compose files and how you've distributed the yaml across them

@AArnott that's a really good question, this is a docker compose functionality https://docs.docker.com/compose/multiple-compose-files/merge/

As our users might have different needs, we've created 2 docker-compose yaml:

  1. docker-compose.yml which runs the Zebra node completely isolated, and
  2. docker-compose.lwd.yml which inherits and overrides the first one

A user might decide to just run the Zebra node with docker-compose -f docker/docker-compose.yml up or running Zebra + LWD together, with docker-compose -f docker/docker-compose.yml -f docker/docker-compose.lwd.yml up using both files.

@AArnott
Copy link
Contributor

AArnott commented Jan 31, 2024

a user might decide to just run the Zebra node

That sounds good. Then why are zebra-specific things only put into the lwd file? A zebra-only container should still know its own ports and healthcheck, shouldn't it?

@gustavovalverde
Copy link
Member Author

A zebra-only container should still know its own ports and healthcheck, shouldn't it?

@AArnott Yes, I did this as the healtcheck depends on port 8232 (the RPC endpoint) to be opened. But we don't always want this port opened by default on a Zebra node. Though it's required if we want to have lightwalletd.

@upbqdn upbqdn removed the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Feb 1, 2024
upbqdn
upbqdn previously approved these changes Feb 1, 2024
docker/.env Outdated Show resolved Hide resolved
docker/.env Outdated Show resolved Hide resolved
docker/docker-compose.yml Outdated Show resolved Hide resolved
docker/docker-compose.yml Outdated Show resolved Hide resolved
docker/docker-compose.lwd.yml Outdated Show resolved Hide resolved
docker/docker-compose.lwd.yml Outdated Show resolved Hide resolved
@github-actions github-actions bot added the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Feb 1, 2024
@upbqdn upbqdn removed the C-trivial Category: A trivial change that is not worth mentioning in the CHANGELOG label Feb 1, 2024
mergify bot added a commit that referenced this pull request Feb 1, 2024
@mergify mergify bot merged commit 5feb40e into main Feb 1, 2024
153 checks passed
@mergify mergify bot deleted the feat-compose-users branch February 1, 2024 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-devops Area: Pipelines, CI/CD and Dockerfiles C-enhancement Category: This is an improvement C-feature Category: New features I-usability Zebra is hard to understand or use P-Medium ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: Explain how to use a persistent state disk with Docker
3 participants