Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.

Conversation

@Denommus
Copy link
Contributor

@Denommus Denommus commented Aug 3, 2022

Description

Using Nix to handle the dependencies of the project during the build. This means dependencies can be cached in a volume to generate the final image a lot quicker, by rebuilding only the dependencies (including crates) that have been changed. Potentially, we can cache these dependencies in a cache server so builds from scratch will download pre-built binaries from cachix (Nix's cache server).

The heart of the image is this block of code:

          baseImage = final.dockerTools.buildLayeredImage {
            name = "many-base";
            contents = [
              final.bash
              final.curl
              final.iputils
            ];
          };

          dockerImageFromPkg = pkg: name: final.dockerTools.buildLayeredImage {
            fromImage = final.baseImage;
            name = "many/${name}";
            tag = "latest";
            contents = [
              (pkg {}).bin
            ];
            created = "now";
            config.Cmd = [ "${(pkg {}).bin}/bin/${name}" ];
          };

This block creates a base image with some useful packages, and for package pkg it creates an image, based on the base image, containing the binary generated by the package.

Related Issue

Fixes #206

Testing

Manually tested running make start-nodes and other make targets.

Checklist:

  • I have read and followed the CONTRIBUTING guidelines for this project.
  • I have added or updated tests and they pass.
  • I have added or updated documentation and it is accurate.
  • I have noted any breaking changes in this module or downstream modules.

@Denommus Denommus requested review from fmorency and hansl August 3, 2022 19:02
@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2022

Codecov Report

Merging #209 (59acb9b) into main (cff0cf1) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main     #209   +/-   ##
=======================================
  Coverage   71.15%   71.15%           
=======================================
  Files          32       32           
  Lines        6067     6067           
=======================================
  Hits         4317     4317           
  Misses       1750     1750           
Impacted Files Coverage Δ
src/many-abci/src/module.rs 0.00% <0.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Contributor

@fmorency fmorency left a comment

Choose a reason for hiding this comment

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

Looks cool! Some questions from Slack

  • Any way to specify a debug build vs a release build?
  • Any way to specify which features to activate?
  • Any way to print the folder where the various pem, config and db files are located (full path)?
  • If we modify something in the Cargo.toml file, will this be reflected when building/running the docker-nix stuff?


.PHONY: stop-nodes
stop-nodes:
docker-compose -f genfiles/docker-compose.json -p e2e down
Copy link
Contributor

Choose a reason for hiding this comment

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

This will stop AND remove the nodes. I would like an option to only stop the nodes, WITHOUT removing them.

stop-nodes:
docker-compose -f genfiles/docker-compose.json -p e2e down

.PHONY: start-nodes-dettached
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an option to start/stop/remove a SINGLE node.

@Denommus Denommus requested a review from fmorency August 8, 2022 15:20
@@ -0,0 +1 @@
genfiles
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather override /docker/e2e than create a new root directory. I'd also be okay with /docker/nix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically, either move this to /docker/nix or just change the e2e docker files to use nix.

@Denommus Denommus requested a review from hansl August 9, 2022 16:33
@Denommus Denommus merged commit 983a1e5 into liftedinit:main Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tracking] Refactor Docker env

4 participants