Skip to content

Commit

Permalink
chore: cleanup docker folder structure (#4951)
Browse files Browse the repository at this point in the history
* chore: cleanup docker folder structure

* fix: rename `container-name` parameter to `image-tag`
  • Loading branch information
muXxer authored Jan 22, 2025
1 parent 539bf11 commit 0ac76d0
Show file tree
Hide file tree
Showing 81 changed files with 68 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ target/
build/
storage/
docker/
dev-tools/
setups/
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@
/crates/typed-store-error/ @iotaledger/core-protocol
/crates/typed-store-workspace-hack/ @iotaledger/core-protocol

# Docker
/docker/ @iotaledger/infrastructure @iotaledger/node @iotaledger/devops-admin
/dev-tools/ @iotaledger/infrastructure @iotaledger/node @iotaledger/devops-admin
/setups/ @iotaledger/infrastructure @iotaledger/node @iotaledger/devops-admin

# Frontend apps to be looked after by Boxfish Studio or the tooling team
/apps/ @iotaledger/tooling
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/diffs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ runs:
- "dashboards/**"
- "doc/**"
- "docker/**"
- "dev-tools/**"
- "setups/**"
- "external-crates/**"
- "kiosk/**"
- "nre/**"
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ lcov.info
*storybook.log

# iota-private-network
docker/iota-private-network/data
docker/iota-private-network/configs/validators/validator*
docker/iota-private-network/configs/genesis/genesis.blob
dev-tools/iota-private-network/data
dev-tools/iota-private-network/configs/validators/validator*
dev-tools/iota-private-network/configs/genesis/genesis.blob
2 changes: 1 addition & 1 deletion crates/iota-graphql-e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It is recommended that the database server is started in a docker container.
## Using `docker compose`

```sh
$ POSTGRES_USER=postgres POSTGRES_DB=postgres POSTGRES_PASSWORD=postgrespw POSTGRES_INITDB_ARGS="-U postgres" docker compose -f docker/pg-services-local/docker-compose.yaml up -d postgres
$ POSTGRES_USER=postgres POSTGRES_DB=postgres POSTGRES_PASSWORD=postgrespw POSTGRES_INITDB_ARGS="-U postgres" docker compose -f dev-tools/pg-services-local/docker-compose.yaml up -d postgres
```

## Using `docker`
Expand Down
4 changes: 2 additions & 2 deletions crates/iota-graphql-rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ If you're using VS Code, make sure to update `settings.json` with the appropriat

### Using docker compose (recommended)

See [pg-services-local](../../docker/pg-services-local/README.md), which automatically sets up the GraphQL server along with an Indexer instance, the postgres database and a local network.
See [pg-services-local](../../dev-tools/pg-services-local/README.md), which automatically sets up the GraphQL server along with an Indexer instance, the postgres database and a local network.

### Using manual setup

Expand Down Expand Up @@ -115,7 +115,7 @@ Find more example queries in the [examples](examples) directory.
### Launching the server with Indexer

For local development, it might be useful to spin up an actual Indexer as well (not only the postgres instance) which writes data to the database, so you can query it with the GraphQL server.
You can run it with a local network using the `iota start` subcommand or [pg-services-local](../../docker/pg-services-local/README.md) or as a [standalone service](../iota-indexer/README.md#standalone-indexer-setup).
You can run it with a local network using the `iota start` subcommand or [pg-services-local](../../dev-tools/pg-services-local/README.md) or as a [standalone service](../iota-indexer/README.md#standalone-indexer-setup).

To run it with the `iota start` subcommand, switch to the root directory of the repository and run the following command to start the Indexer with the Sync worker:

Expand Down
4 changes: 2 additions & 2 deletions crates/iota-indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ For more in depth information check the [Database Schema](./schema.md).

### Using docker compose (recommended)

See [pg-services-local](../../docker/pg-services-local/README.md), which automatically sets up the Indexer Sync worker and the Indexer RPC worker along with a postgres database and local network.
See [pg-services-local](../../dev-tools/pg-services-local/README.md), which automatically sets up the Indexer Sync worker and the Indexer RPC worker along with a postgres database and local network.

### Using manual setup

To run an Indexer, a running postgres instance is required.

#### Database setup

You can either spin up the postgres instance as a single service via [docker-compose](../../docker/pg-services-local/README.md) or manually set up it up.
You can either spin up the postgres instance as a single service via [docker-compose](../../dev-tools/pg-services-local/README.md) or manually set up it up.
If you choose for manual setup, follow the steps below:

1. Install a local [Postgres server](https://www.postgresql.org/download) and start it.
Expand Down
13 changes: 7 additions & 6 deletions crates/iota-rosetta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ This will generate the `rosetta-cli.json` and `iota.ros` file to be used by the

### Build local test network using Docker Compose

#### 1. CD into the Dockerfile directory
#### 1. Build the required images

```shell
cd <iota project directory>/docker/iota-rosetta-local
pushd <iota project directory>/docker/iota-rosetta && ./build.sh && popd
pushd <iota project directory>/docker/iota-tools && ./build.sh && popd
```

#### 2. Build the image
#### 2. CD into the iota-rosetta-local directory

```shell
./build.sh
cd <iota project directory>/dev-tools/iota-rosetta-local
```

#### 3. Start the container
Expand Down Expand Up @@ -81,13 +82,13 @@ you can also start the individual server using docker run.
To start the rosetta-online server, run

```shell
docker run iotaledger/iota-rosetta-local iota-rosetta start-online-server
docker run iotaledger/iota-rosetta iota-rosetta start-online-server
```

Alternatively, to start the rosetta-offline server, run

```shell
docker run iotaledger/iota-rosetta-local iota-rosetta start-offline-server
docker run iotaledger/iota-rosetta iota-rosetta start-offline-server
```

## Supported APIs
Expand Down
2 changes: 1 addition & 1 deletion crates/telemetry-subscribers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ NOTE: JSON output requires the `json` crate feature to be enabled.

#### Tracing locally:

1. In `docker/grafana-local` run `docker compose up` to start a local grafana instance.
1. In `dev-tools/grafana-local` run `docker compose up` to start a local grafana instance.
2. Set `TRACE_FILTER=<filter expression>` - for local use `TRACE_FILTER=iota=trace,info` is a good place to start.
3. Start the iota-node or other process.
4. Go to http://localhost:3000 (or [http://localhost:3000/ with traces already filtered to iota-node](http://localhost:3000/explore?panes=%7B%22iHz%22:%7B%22datasource%22:%22tempo%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22datasource%22:%7B%22type%22:%22tempo%22,%22uid%22:%22tempo%22%7D,%22queryType%22:%22traceqlSearch%22,%22limit%22:20,%22filters%22:%5B%7B%22id%22:%22service-name%22,%22tag%22:%22service.name%22,%22operator%22:%22%3D%22,%22scope%22:%22resource%22,%22value%22:%5B%22iota-node%22%5D,%22valueType%22:%22string%22%7D,%7B%22id%22:%22span-name%22,%22tag%22:%22name%22,%22operator%22:%22%3D%22,%22scope%22:%22span%22,%22value%22:%5B%5D,%22valueType%22:%22string%22%7D,%7B%22id%22:%224f3681c5%22,%22operator%22:%22%3D%22,%22scope%22:%22span%22%7D%5D%7D%5D,%22range%22:%7B%22from%22:%22now-5m%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Steps for running:
1. build local stress image

```
cd docker/stress
cd dev-tools/stress
docker build -t stress:testing --build-arg IOTA_TOOLS_IMAGE_TAG=mainnet-v1.19.1 .
```

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: "3.9"
services:
iota-network:
image: iotaledger/iota-rosetta-local
image: iotaledger/iota-tools
ports:
- "9000:9000"
expose:
Expand All @@ -12,8 +12,9 @@ services:
- -c
- |
/usr/local/bin/iota start
rosetta-online:
image: iotaledger/iota-rosetta-local
image: iotaledger/iota-rosetta
ports:
- "9002:9002"
expose:
Expand All @@ -27,8 +28,9 @@ services:
/usr/local/bin/iota-rosetta start-online-remote-server --full-node-url http://iota-network:9000
stdin_open: true
tty: true

rosetta-offline:
image: iotaledger/iota-rosetta-local
image: iotaledger/iota-rosetta
ports:
- "9003:9003"
expose:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/stress/readme.md → dev-tools/stress/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stress

This image is currently meant to be built locally, and run as a part of `docker/iota-network/docker-compose.yaml`
This image is currently meant to be built locally, and run as a part of `dev-tools/iota-network/docker-compose.yaml`

eg:
`docker build -t stress:testing --build-arg IOTA_TOOLS_IMAGE_TAG=mainnet-v1.19.1 .`
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/iota-bridge-indexer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/bridge-indexer"
./../utils/build-script.sh --image-tag "iotaledger/bridge-indexer"
2 changes: 1 addition & 1 deletion docker/iota-graphql-rpc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota-graphql-rpc"
./../utils/build-script.sh --image-tag "iotaledger/iota-graphql-rpc"
2 changes: 1 addition & 1 deletion docker/iota-indexer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota-indexer"
./../utils/build-script.sh --image-tag "iotaledger/iota-indexer"
2 changes: 1 addition & 1 deletion docker/iota-node/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota-node"
./../utils/build-script.sh --image-tag "iotaledger/iota-node"
2 changes: 1 addition & 1 deletion docker/iota-proxy/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota-proxy"
./../utils/build-script.sh --image-tag "iotaledger/iota-proxy"
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ COPY iota-execution iota-execution
COPY Cargo.toml Cargo.lock ./

RUN cargo build --profile ${PROFILE} \
--bin iota \
--bin iota-rosetta \
--features ${CARGO_BUILD_FEATURES:=default}

Expand All @@ -44,7 +43,6 @@ else \
echo "Error: No build directory found"; \
exit 1; \
fi && \
mv $TARGET_DIR/iota ./ && \
mv $TARGET_DIR/iota-rosetta ./;

# Production image
Expand All @@ -59,10 +57,7 @@ RUN apt update && apt install -y libpq5 ca-certificates curl
# Install rosetta-cli
RUN curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/master/scripts/install.sh | sh -s

COPY --from=builder /iota/iota /usr/local/bin
COPY --from=builder /iota/iota-rosetta /usr/local/bin
COPY --from=builder /iota/crates/iota-config/data/fullnode-template.yaml /iota/devnet/fullnode.yaml
RUN /usr/local/bin/iota genesis

ARG BUILD_DATE
ARG GIT_REVISION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../../docker/utils/build-script.sh --container-name "iotaledger/iota-rosetta-local"
./../../docker/utils/build-script.sh --image-tag "iotaledger/iota-rosetta"
2 changes: 1 addition & 1 deletion docker/iota-source-validation-service/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota-source-validation-service"
./../utils/build-script.sh --image-tag "iotaledger/iota-source-validation-service"
2 changes: 1 addition & 1 deletion docker/iota-tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota-tools"
./../utils/build-script.sh --image-tag "iotaledger/iota-tools"
2 changes: 1 addition & 1 deletion docker/iota/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright (c) Mysten Labs, Inc.
# Modifications Copyright (c) 2024 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0
./../utils/build-script.sh --container-name "iotaledger/iota"
./../utils/build-script.sh --image-tag "iotaledger/iota"
26 changes: 13 additions & 13 deletions docker/utils/build-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ DOCKERFILE="$CURRENT_WORKING_DIR/Dockerfile"
GIT_REVISION="$(git describe --always --abbrev=12 --dirty --exclude '*')"
BUILD_DATE="$(date -u +'%Y-%m-%d')"
PROFILE="release"
CONTAINER_NAME=""
IMAGE_TAG=""

# Parse command line arguments
# Usage:
# --container-name <container_name> - the name of the container
# --image-tag <image_tag> - the name and tag of the image
while [ "$#" -gt 0 ]; do
case "$1" in
--container-name=*)
CONTAINER_NAME="${1#*=}"
--image-tag=*)
IMAGE_TAG="${1#*=}"
shift
;;
--container-name)
CONTAINER_NAME="$2"
--image-tag)
IMAGE_TAG="$2"
shift 2
;;
*)
print_error "Unknown argument: $1"
print_step "Usage: $0 --container-name <container_name>"
print_step "Usage: $0 --image-tag <image_tag>"
exit 1
;;
esac
done

# check if the container name is set
if [ -z "$CONTAINER_NAME" ]; then
print_error "Container name is not set"
print_step "Usage: $0 --container-name <container_name>"
# check if the image tag is set
if [ -z "$IMAGE_TAG" ]; then
print_error "Image tag is not set"
print_step "Usage: $0 --image-tag <image_tag>"
exit 1
fi

Expand All @@ -59,7 +59,7 @@ fi
RUST_IMAGE_VERSION=${RUST_VERSION}-bookworm

echo
echo "Building \"$CONTAINER_NAME\" docker image"
echo "Building \"$IMAGE_TAG\" docker image"
echo "Dockerfile: $DOCKERFILE"
echo "docker context: $REPO_ROOT"
echo "profile: $PROFILE"
Expand All @@ -70,7 +70,7 @@ echo "git revision: $GIT_REVISION"
echo

docker build -f "$DOCKERFILE" "$REPO_ROOT" \
-t ${CONTAINER_NAME} \
-t ${IMAGE_TAG} \
--build-arg RUST_IMAGE_VERSION="${RUST_IMAGE_VERSION}" \
--build-arg PROFILE="$PROFILE" \
--build-arg CARGO_BUILD_FEATURES="$CARGO_BUILD_FEATURES" \
Expand Down
2 changes: 1 addition & 1 deletion docs/content/operator/iota-full-node/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Learn how to set up an IOTA Full Node using docker.
---
import Quiz from '@site/src/components/Quiz';
import questions from '/json/node-operators/iota-full-node/node-setup.json';
import Docker from './../../../../docker/fullnode/README.md';
import Docker from './../../../../setups/fullnode/docker/README.md';
import WarningAdvanced from './../../_snippets/warning-advanced-instructions-node-setup.mdx'
import NodeHardwareRequirements from './../../_snippets/node-hardware-requirements.mdx'

Expand Down
2 changes: 1 addition & 1 deletion docs/content/references/exchange-integration-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Run the command in this section using the same branch of the repository for each
```
1. Download the docker-compose.yaml file:
```bash
wget https://github.com/iotaledger/iota/blob/branch-name/docker/fullnode/docker-compose.yaml
wget https://github.com/iotaledger/iota/blob/branch-name/setups/fullnode/docker/docker-compose.yaml
```
1. Download the fullnode-template.yaml file:
```bash
Expand Down
2 changes: 1 addition & 1 deletion nre/ansible/roles/iota-node/files/iota-node.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ User=iota
WorkingDirectory=/opt/iota/
Environment=RUST_BACKTRACE=1
Environment=RUST_LOG=info,iota_core=debug,consensus=debug,jsonrpsee=error
ExecStart=/opt/iota/bin/iota-node --config-path /opt/iota/config/validator.yaml
ExecStart=/usr/local/bin/iota-node --config-path /opt/iota/config/validator.yaml
Restart=always

[Install]
Expand Down
2 changes: 1 addition & 1 deletion nre/ansible/roles/iota-node/tasks/iota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
- name: Place binary
ansible.builtin.get_url:
url: "https://releases.iota.io/{{ iota_release }}/iota-node"
dest: /opt/iota/bin/iota-node
dest: /usr/local/bin/iota-node
force: true
mode: "0755"

Expand Down
2 changes: 1 addition & 1 deletion nre/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
- /opt/iota/db:/opt/iota/db:rw
command:
[
"/opt/iota/bin/iota-node",
"/usr/local/bin/iota-node",
"--config-path",
"/opt/iota/config/validator.yaml",
]
Expand Down
2 changes: 1 addition & 1 deletion nre/helm/graphql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# RPC_URL is also expected to be an env var so the command properly populates
command: [
"/opt/iota/bin/iota-graphql-rpc",
"/usr/local/bin/iota-graphql-rpc",
"start-server",
"--host",
"0.0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion nre/k8s/iota-graphql-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
spec:
containers:
- command:
- /opt/iota/bin/iota-graphql-rpc
- /usr/local/bin/iota-graphql-rpc
- start-server
- --host
- 0.0.0.0
Expand Down
2 changes: 1 addition & 1 deletion nre/k8s/iota-node-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
spec:
containers:
- command:
- /opt/iota/bin/iota-node
- /usr/local/bin/iota-node
- --config-path
- /opt/iota/config/iota-node.yaml
env:
Expand Down
Loading

0 comments on commit 0ac76d0

Please sign in to comment.