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

fix: container ux #186

Merged
merged 22 commits into from
May 24, 2024
Merged

fix: container ux #186

merged 22 commits into from
May 24, 2024

Conversation

evilrobot-01
Copy link
Contributor

@evilrobot-01 evilrobot-01 commented May 21, 2024

  • tests: refactors to improve testability, increasing coverage. There is still more work to be done though.
  • ci: adds docker job to simply ensure the docker image builds. An additional issue should be opened up to ensure that all commands are tested on all platforms, including on the docker image. This may require publishing, but I dont think we are ready to publish a docker image yet.
  • docs: needs to be addressed separately, once this is approved.

A general guide on manually testing as follows.

Overview

The following guide provides an overview on launching a local network, including a parachain generated from a template, within a container. Note that port accessibility from outside of the container still needs to be addressed, with suggested workarounds provided at the end. It is suggested to review these before starting with anything else to assess suitability.

Build and then run pop within a container interactively, optionally mounting a local directory to pop's cache within the container for reuse.

docker build -t pop .
docker run -it -v ./.cache:/root/.cache/pop --entrypoint bash pop

Then generate a parachain using pop, changing into the relevant directory once done:

pop new parachain
cd ./my-parachain

Before building the parachain, source the required binary dependencies for launching the local network by simply specifying the relevant network configuration file (e.g. network.toml). These binaries are typically those required to run the relay chain or any system parachains, but could also include other parachains in your solution beyond those which you are developing.

pop up parachain -f ./network.toml

You should be shown which binaries are missing and be prompted to source them automatically where possible, using the latest versions available when not explicitly specified using the command line arguments. See pop up parachain --help for more information.

Note: We currently do this before building the parachain simply to conserve space within the container, as any build artifacts are automatically removed once these binaries are built. This is currently not the case when building a locally generated parachain, where retaining build artifacts is preferred for faster rebuilds of the parachain after local changes. The pop up ... command will be updated to automatically build the parachain as required in the near future.

Now build the parachain binary and then finally launch the local network.

pop build parachain
pop up parachain -f ./network.toml

Note: the ports used by each of the network nodes will remain inaccessible from outside of the container by default. Consider using the --net=host beta feature available on Docker Desktop (YMMV). More information is available at https://docs.docker.com/network/network-tutorial-host/#prerequisites. An alternative is expose a known port for each network node when launching the container and then specify those ports within the generated network.toml file - e.g. rpc_port = 8833 before launching the local network within the container.

Copy link

codecov bot commented May 21, 2024

Codecov Report

Attention: Patch coverage is 71.52174% with 262 lines in your changes are missing coverage. Please review.

Project coverage is 55.97%. Comparing base (7da805f) to head (fb0df6a).

@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   50.46%   55.97%   +5.50%     
==========================================
  Files          33       33              
  Lines        2905     3398     +493     
  Branches     2905     3398     +493     
==========================================
+ Hits         1466     1902     +436     
+ Misses       1215     1213       -2     
- Partials      224      283      +59     
Files Coverage Δ
crates/pop-cli/src/commands/install/mod.rs 0.00% <0.00%> (ø)
crates/pop-cli/src/commands/up/parachain.rs 12.06% <0.00%> (-6.13%) ⬇️
crates/pop-parachains/src/up.rs 83.27% <81.13%> (+13.37%) ⬆️

@evilrobot-01 evilrobot-01 marked this pull request as ready for review May 23, 2024 09:56
Cargo.toml Show resolved Hide resolved
Ensures that any additional status updates are output to the console rather than being lost. Examples are the cloning and downloading status updates.
@AlexD10S AlexD10S requested a review from al3mart May 24, 2024 06:30
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Great PR!
We will use this refactor to increase test coverage as a reference for the pop_contracts crate.

@peterwht peterwht merged commit 3cfff73 into main May 24, 2024
15 checks passed
@peterwht peterwht deleted the frank/container-ux branch May 24, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants