hyperledger-labs / pdo-contracts

Apache License 2.0
3 stars 5 forks source link

Add docker support for contracts tests #23

Closed cmickeyb closed 6 months ago

cmickeyb commented 6 months ago

Building on the structure used for PDO, this commit adds a recipe for building a contracts container that can be used for testing of the contracts and the jupyter interface to the contracts.

The structure is similar to the PDO docker support: keys and configuration variables are shared through the xfer directory. Tools run in the container build the contracts, run the tests, and also run a jupyter server.

The behavior can be customized through a local makefile that allows for override of variables. A local environment file can be used to customize the behavior docker compose.

Run contract tests: cd docker; make test Run a Jupyter server: cd docker; make test_jupyter

cmickeyb commented 6 months ago

First pass of comments after (trying to) run the docker tests as my issue found below probably also will be a stumbling block for others.

BTW: now as we have 22.04 but you only adding libgl, did we change recently anything else in inference contract that guarding doesn't need the libcudart libraries anymore?

i was able to build & run just fine with only libgl using the pdo 0.2.99 (ubuntu 22) containers. did yours fail? (there is something else going wrong with the inference contract... but i don't want to debug that problem in this PR)

g2flyer commented 6 months ago

i was able to build & run just fine with only libgl using the pdo 0.2.99 (ubuntu 22) containers. did yours fail? (there is something else going wrong with the inference contract... but i don't want to debug that problem in this PR)

Now, it did all work fine. That's what surprised me as when i tried earlier -- what triggered the 22.04 pdo pr .. -- guardian start failed with unresolvable libcudart and afaict you call essentially the same tests which failed then but do not fail now. i couldn't spot in this PR any other change which could have explained that. That said, there are a number of pdo-contract prs which i haven't checked; maybe also something changed in the pip package? anyway, good thing it works now without libcuda as that brought a rathole of other packages and anyway seemed strange why an api service would need it (arguably, the same holds also for libgl ...)

cmickeyb commented 6 months ago

A readme.md much like what we have in the pdo HL repo (regarding usability of contracts container beyond just testing via test.yaml) would be very helpful.

You are absolutely correct. We really need documentation for this. AND... we need to update the readme in the PDO repository as well.

You had other comments about creating more useful docker compose files. I'm actually strongly opposed to that. The problem is that the particulars of the compose configuration are highly dependent on the particulars of your deployment. and every deployment is likely to be unique. the test.yaml provides a very good example of how to put the pieces together. better documentation about start_client.sh (in the PDO repository) and start_jupyter.sh (in the contract repo) should address those needs.

cmickeyb commented 6 months ago

2. The site.toml file creation cell in the issuer notebook is no longer a SKIP since it runs within a container. might be a point of confusion for some one who wants to just test the contract without understanding the details of the deployment (the whole point of this dock erization).

are you talking about the cell to create the groups file? it certainly should be optional. if you've copied in a configuration, with your own groups file then you absolutely do not want to run that. Or if you are restarting a container with a bunch of existing notebooks.