Skip to content

docker: Use pregenerated keys in docker private network#5728

Closed
algochoi wants to merge 18 commits intoalgorand:masterfrom
algochoi:docker-pregen-keys
Closed

docker: Use pregenerated keys in docker private network#5728
algochoi wants to merge 18 commits intoalgorand:masterfrom
algochoi:docker-pregen-keys

Conversation

@algochoi
Copy link
Copy Markdown
Contributor

@algochoi algochoi commented Sep 5, 2023

Summary

Docker changes:

  • Mount the participation keys to the /etc/algorand/keys directory. This is done using --mount when the docker container is started up
  • If a private network is going to be started, use that directory if there are keys.

#5699

Test Plan

Manually generated keys from a custom template, then built and started docker image.

Pregenerate keys:
goal network pregen -t some_template.json -p pregen_k

Build the image (from root dir):

docker build \
    -t algochoi/algod:pregen-test  \
    --build-arg TARGETARCH=amd64 --no-cache \
    . 

Run (mounting the template and data directory is optional, and -v and --mount are interchangeable with slight differences in syntax):

docker run --rm -it --name algod-pregen-run \
    -p 4190:8080 \
    -e TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
    --mount type=bind,source="$(pwd)"/some_template.json,target=/etc/algorand/template.json \
    --mount type=bind,source="$(pwd)"/pregen_k,target=/etc/algorand/keys \
    --mount type=bind,source="$(pwd)"/docker_data,target=/algod/data algochoi/algod:pregen-test

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 5, 2023

Codecov Report

Merging #5728 (db8e897) into master (02b99bb) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5728      +/-   ##
==========================================
+ Coverage   55.54%   55.56%   +0.01%     
==========================================
  Files         476      476              
  Lines       66853    66853              
==========================================
+ Hits        37131    37144      +13     
+ Misses      27193    27186       -7     
+ Partials     2529     2523       -6     

see 17 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algochoi algochoi self-assigned this Sep 5, 2023
@algochoi algochoi changed the title Use pregenerated keys in docker private network docker: Use pregenerated keys in docker private network Sep 5, 2023
@algochoi algochoi requested review from a team, Eric-Warehime, shiqizng, tzaffi and winder and removed request for a team September 5, 2023 22:31
@algochoi algochoi marked this pull request as ready for review September 5, 2023 22:31
@winder
Copy link
Copy Markdown
Contributor

winder commented Sep 11, 2023

Command to generate keys inside the container end export them to a mounted volume

docker run --rm -it \
    -p 4190:8080 \
    --name pregen \
    -v /tmp/big_keys.json:/etc/algorand/template.json \
    -v (pwd)/pregen:/algod/pregen \
    --entrypoint "/node/bin/goal" \
    algorand/algod:nightly network pregen -t /etc/algorand/template.json -p /algod/pregen

Using the same template, these keys can be provided to quickly start a private network:

docker run --rm -it --name algod-pregen-run \
    -p 4190:8080 \
    -v /tmp/big_keys.json:/etc/algorand/template.json \
    -v (pwd)/pregen:/etc/algorand/keys \
    -v (pwd)/docker_data:/algod/data \
    wwinder/algod:pregen

@winder winder requested review from onetechnical and removed request for Eric-Warehime, shiqizng and tzaffi September 11, 2023 19:18
@winder
Copy link
Copy Markdown
Contributor

winder commented Sep 12, 2023

Closing in favor of #5735

@winder winder closed this Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants