-
Notifications
You must be signed in to change notification settings - Fork 42
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
Simplify build and install for CCF #468
Simplify build and install for CCF #468
Conversation
Several changes to improve the performance (and remove dependencies) for CCF startup. Many of the changes are centered in the ccf Makefile to separate the creation of the ccf clients (like the ping test, ledger authority retrieval and policy scripts that might reasonably be executed from anywhere) from the environment needed for a ccf service node (the script to start a ccf network). The big win from the separation is that we can remove dependency on the sandbox script & pre-install all of the python package dependencies independently from the execution of the ccf nodes. The result is that the ledger containers start in a couple seconds instead of several minutes. Note that a future PR will package the ccf client scripts separately and install them with other PDO packages so they are available on all PDO installations. Signed-off-by: Mic Bowman <[email protected]>
When registration is requested, we need the CCF member keys in order to perform the registration Check for the keys & copy them to ${PDO_LEDGER_KEY_ROOT}. Signed-off-by: Mic Bowman <[email protected]>
try cp ${XFER_DIR}/ccf/keys/memberccf_cert.pem ${PDO_LEDGER_KEY_ROOT}/ | ||
try cp ${XFER_DIR}/ccf/keys/memberccf_privk.pem ${PDO_LEDGER_KEY_ROOT}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these should make PDO_LEDGER_KEY_ROOT
the authoritative place where to look for the ledger keys -- to be double checked with HW mode tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
umm... it already was (and it is pretty well documented):
PDO_LEDGER_KEY_ROOT is the root directory where the system keys are stored for ledger integration; files in this directory are not automatically generated. When ccf is used as ledger, the ccf network cert {networkcert.pem} must be placed under this folder. These keys get generated during ccf deployment.
and:
xfer
-- this directory is used to pass configuration information and keys between the container and the host; for example, to push a previously built configuration into the container, put the files in the appropriate subdirectory in xfer.
try cp ${XFER_DIR}/ccf/keys/memberccf_cert.pem ${PDO_LEDGER_KEY_ROOT}/ | ||
try cp ${XFER_DIR}/ccf/keys/memberccf_privk.pem ${PDO_LEDGER_KEY_ROOT}/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same as above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely speeds up drastically the start up time of ccf container although a make test
still takes quite a long time (10 mins), even with warm caches. Code also looks good, liked the additional comments. See a few minor comments & suggestions below.
PS: benchmarking the reduced time for the actual test via make test_no_reset
(now 2:53 on my laptop) i realized that we are missing a dependency to clean_config
for target test_no_reset
in make.dev
. Should we just sneak in a change in this PR (with HW mode-related changes it already is now a bit multi-purpose ;-) or should i create a separate PR for that?
|
||
pdo-environment : $(PDO_INSTALL_ROOT) | ||
|
||
ledger-environment : $(CCF_LEDGER_DIR)/lib/python3.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth declaring the python version as a variable to prepare for the maybe-case that ccf starts supporting also ubuntu >20.04? In any case, maybe having it close to CCF_VERSION and commenting that this comes from the current intrinsic 20.04-implying-python-3.8 invariant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly. although in this case the python version is completely determined by ccf.
|
||
# This directory indicates whether the ccf ledger python | ||
# virtual environment has been created | ||
$(CCF_LEDGER_DIR)/lib/python3.8 : pdo-environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment on python version. Given that we use it at multiple places (also below) i think it would be even more useful to define as variable?
virtualenv -p python3.8 --no-download $(PDO_HOME)/ccf | ||
$(CCF_LEDGER_DIR)/bin/pip install --upgrade pip | ||
$(CCF_LEDGER_DIR)/bin/pip install --upgrade -r $(CCF_BASE)/bin/requirements.txt | ||
$(CCF_LEDGER_DIR)/bin/pip install ccf==$(CCF_VERSION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, the pre-reqs installed in the prior step do not depend on the ccf version?
BTW: this target in principle is also cacheable and takes even with docker-cached packages one minute but will be re-executed after a make clean
as it's after the COPY in the docker file. Maybe this 1 minute is not worth optimizing given that make clean test
takes 10 mins, but just a thought in case we want to improve that time eventually ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well... (and i think this is in one of the comments) for the MOMENT we require ccf 1.0.19 for the PDO installation and for the ccf pdo scripts. HOWEVER, the actual ccf nodes require a different version. i tried to get the version out of the CCF_BASE (something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more note continuing the python version discussion... all of the ccf scripts have the python version hardcoded in them. there is no place i could find where the python dependency is expressed in a way i can automate configuration. so 1) i don't think hard coding it is such a problem right now and 2) i don't think there is an easy way to derive it from the ccf version
ledgers/ccf/Makefile
Outdated
cd $(BLDDIR) && cmake .. -GNinja \ | ||
-DCCF_DIR=$(CCF_BASE) \ | ||
-DCOMPILE_TARGET=$(COMPILE_TARGET) \ | ||
-DCMAKE_INSTALL_PREFIX=$(CCFDSTDIR) | ||
cd $(BLDDIR) && $(NINJA) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that somewhat cleaner with newer cmake as 'cmake --build $(BLDDIR)? (I guess we don't have a test target for an additional
cmake --test $(BLDDIR)`?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. i'm getting there. there are several other modern cmake improvements that can be made. in this case i also don't know the best way to build with ninja in cmake. all things queued up for later investigation.
I've snuck in a couple other small fixes. I'll just add this. |
# environment has been created | ||
$(PDO_INSTALL_ROOT) : | ||
make -C $(PDO_SOURCE_ROOT)/build environment | ||
make -C $(PDO_SOURCE_ROOT)/bin install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
installing all of PDO environment inside the CCF container seems to be an overkill. Doesn't hurt, I guess all that we want is ccf 1.0.19, do we need anything else ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you have a misunderstanding of how your code worked in the past. you were already installing everything in python_requirements.txt which is all this does (except cleaner).
AND...
I absolutely think we should be installing pdo client packages (and all of these scripts should be installed in every pdo client). there is a separate issue to track that discussion (#469 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, looks good.
* add dependency checking to remove parallel make issues * add secp256k1 to PDO CCF docker * more use of cmake, add clean_config to test_no_reset * wrap makefiles with check for failure Signed-off-by: Mic Bowman <[email protected]>
c4ad438
to
27ea18b
Compare
Several changes to improve the performance (and remove dependencies) for CCF startup. Many of the changes are centered in the ccf Makefile to separate the creation of the ccf clients (like the ping test, ledger authority retrieval and policy scripts that might reasonably be executed from anywhere) from the environment needed for a ccf service node (the script to start a ccf network).
The big win from the separation is that we can remove dependency on the sandbox script & pre-install all of the python package dependencies independently from the execution of the ccf nodes. The result is that the ledger containers start in a couple seconds instead of several minutes.
Note that a future PR will package the ccf client scripts separately and install them with other PDO packages so they are available on all PDO installations.
@bvavala your review is requested because the second commit adds the code to copy the member keys into the
ledger key directory.