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

container: update documentation and remove unused tools #4982

Merged
merged 9 commits into from
Jan 18, 2023
Merged
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ COPY --chown=algorand:algorand --from=builder "/node/files/run/" "/node/run/"
# Expose Algod REST API, Algod Gossip, and Prometheus Metrics ports
EXPOSE $ALGOD_PORT 4160 9100

WORKDIR /node/bin

CMD ["/node/run/run.sh"]
36 changes: 35 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Algod Container

[![DockerHub](https://img.shields.io/badge/DockerHub-blue)](https://hub.docker.com/r/algorand/algod)

General purpose algod container image.
Copy link
Contributor

@jsgranados jsgranados Jan 11, 2023

Choose a reason for hiding this comment

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

Should we change this to:
"Official Algorand algod container image implementation"?

cc: @algoanne


## Image Configuration
Expand Down Expand Up @@ -42,6 +44,7 @@ Configuration can be modified by specifying certain files. These can be changed
| /etc/config.json | Override default configurations by providing your own file. |
| /etc/algod.token | Override default randomized REST API token. |
| /etc/algod.admin.token | Override default randomized REST API admin token. |
| /etc/logging.config | Use a custom [logging.config](https://developer.algorand.org/docs/run-a-node/reference/telemetry-config/#configuration) file for configuring telemetry. |

TODO: `/etc/template.json` for overriding the private network topology.

Expand All @@ -66,14 +69,45 @@ Explanation of parts:
* `-p 4190:8080` maps the internal algod REST API to local port 4190
* `-e NETWORK=` can be set to any of the supported public networks.
* `-e FAST_CATCHUP=` causes fast catchup to start shortly after launching the network.
* `-e TELEMETRY_NAME=` enables telemetry reporting to Algorand for network health analysis.
* `-e TELEMETRY_NAME=` enables telemetry reporting to Algorand for network health analysis. The value of this variable takes precedence over the GUID in `/etc/logging.config`.
* `-e TOKEN=` sets the REST API token to use.
* `-v ${PWD}/data:/algod/data/` mounts a local volume to the data directory, which can be used to restart and upgrade the deployment.

## Mounting the Data Directory

The data directory located at `/algod/data`. Mounting a volume at that location will allow you to shutdown and resume the node.

### Volume Permissions

The container executes in the context of the `algorand` user with it's own UID and GID which is handled differently depending on your operating system. Here are a few options for how to work with this environment:

#### Named Volume

Using a named volume will work without any specific configuration in most cases:

```bash
docker volume create algod-data
docker run -it --rm -d -v algod-data:/algod/data algorand/algod
```

#### Local Directory without SELinux

Explicitly set the UID and GID of the container:

```bash
docker run -it --rm -d -v /srv/data:/algod/data -u $UID:$GID algorand/algod
```

#### Local Directory with SELinux

Set the UID and GID of the container while add the `Z` option to the volume definition:

```bash
docker run -it --rm -d -v /srv/data:/algod/data:Z -u $UID:$GID algorand/algod
```

> See the documentation on [configuring the selinux label](https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label).

### Private Network

Private networks work a little bit differently. They are configured with, potentially, several data directories. The default topology supplied with this container is installed to `/algod/`, and has a single node named `data`. This means the private network has a data directory at `/algod/data`, matching the production configuration.
Expand Down
2 changes: 1 addition & 1 deletion docker/files/build/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ BUILD_NUMBER="" BRANCH="$BRANCH" make build

shopt -s extglob

cd "$BINDIR" && rm -vrf !(algocfg|algod|algoh|algokey|carpenter|catchupsrv|ddconfig.sh|diagcfg|find-nodes.sh|goal|kmd|msgpacktool|node_exporter|tealcut|tealdbg|update.sh|updater|COPYING)
cd "$BINDIR" && rm -vrf !(algocfg|algod|algokey|diagcfg|goal|kmd|msgpacktool|node_exporter|tealdbg|update.sh|updater|COPYING)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, actually, why are we removing all of these? Container size? It might be nice to use this container to get a copy of compiled binaries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

find-nodes.sh doesn't really make sense in this context, and neither does algoh? I'm not as familar with the other tools but that may be the case here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree most of these don't make sense in the context of running a container, but they do in the sense of copying the binaries out of the container. I don't feel strongly on it, and they do reduce the size of the container to remove, but I could envision someone grabbing this just for the files themselves.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't these mostly legacy tools? I would be a little surprised if anyone was using them, and even more surprised if the people using them are also interested in the docker container.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one idea here is to have an intermediate step. build and push the build container first, then we can extract things into more specific containers if necessary. then we have both, an artifact with all of the binaries that can be used in various ways and then containers for things like algod that have their own stand-alone APIs and storage.


"$BINDIR"/algod -v