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

docker: add profile support and improved endpoint access. #5323

Merged
merged 1 commit into from
Apr 21, 2023

Conversation

winder
Copy link
Contributor

@winder winder commented Apr 21, 2023

Summary

Final feature from #5197

These changes make the docker container easier to use without providing a config.json file, and make the behavior more expected when a config.json file is provided.

  1. Move the endpoint address setting down. This ensures that the API is available at port 8080. Users who override the config.json file via /etc/algorand/config.json or the PROFILE environment variable would be likely to miss this option and be unable to access the REST API.
  2. New PROFILE environment variable. When set algocfg is used to initialize the config.json file.

Test Plan

Manual testing. By mounting a data directory in different scenarios observe that the config.json file is set as expected.

EndpointAddress Override

Mount a config.json file

~$ cat algod_config.json
{
	"CatchupParallelBlocks": 32,
	"MaxAcctLookback": 64,
	"EnableFollowMode": true
}
~$ docker run --rm -it \
    -p 4000:8080 \
    --name algod-test-run \
    -e TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
    -v (pwd)/algod_config.json:/etc/algorand/config.json \
    -v (pwd)/docker_data_dir:/algod/data \
    wwinder/algod:latest

Observe that the EndpointAddress is added to the other settings:

~$ cat docker_data_dir/config.json
{
	"EndpointAddress": "0.0.0.0:8080",
	"CatchupParallelBlocks": 32,
	"MaxAcctLookback": 64,
	"EnableFollowMode": true
}

algocfg profile

Add a PROFILE environment variable

~$ docker run --rm -it \
    -p 4000:8080 \
    --name algod-test-run \
    -e TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
    -e PROFILE=relay \
    -v (pwd)/docker_data_dir:/algod/data \
    wwinder/algod:latest

Observe that the profile settings, and EndpointAddress setting are properly set:

~$ cat docker_data_dir/config.json
{
	"GossipFanout": 0,
	"IncomingConnectionsLimit": 0,
	"EndpointAddress": "0.0.0.0:8080",
	"DNSBootstrapID": "",
	"EnableProfiler": true,
	"EnableRuntimeMetrics": true,
	"DisableNetworking": true
}

Copy link
Contributor

@algobarb algobarb left a comment

Choose a reason for hiding this comment

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

The changes LGTM

@winder winder marked this pull request as ready for review April 21, 2023 14:16
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.

3 participants