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

Pass non-root user, pass observer display name, apply renaming #23

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ RUN python3 /repos/rosetta-docker-scripts/adjust_config.py --mode=main --file=/r
# ===== SECOND STAGE ======
FROM ubuntu:20.04

COPY --from=builder "/go/rosetta/cmd/rosetta" "/elrond/"
COPY --from=builder "/go/elrond-go/cmd/node/node" "/elrond/"
COPY --from=builder "/go/elrond-go/cmd/keygenerator/keygenerator" "/elrond/"
COPY --from=builder "/go/rosetta/cmd/rosetta" "/multiversx/"
COPY --from=builder "/go/elrond-go/cmd/node/node" "/multiversx/"
COPY --from=builder "/go/elrond-go/cmd/keygenerator/keygenerator" "/multiversx/"
COPY --from=builder "/lib/libwasmer_linux_amd64.so" "/lib/libwasmer_linux_amd64.so"
COPY --from=builder "/repos/elrond-config-devnet" "/elrond/config-devnet/"
COPY --from=builder "/repos/elrond-config-mainnet" "/elrond/config-mainnet/"
COPY --from=builder "/repos/rosetta-docker-scripts/entrypoint.sh" "/elrond/"
COPY --from=builder "/repos/elrond-config-devnet" "/multiversx/config-devnet/"
COPY --from=builder "/repos/elrond-config-mainnet" "/multiversx/config-mainnet/"
COPY --from=builder "/repos/rosetta-docker-scripts/entrypoint.sh" "/multiversx/"

EXPOSE 8080
WORKDIR /elrond
ENTRYPOINT ["/elrond/entrypoint.sh"]
WORKDIR /multiversx
ENTRYPOINT ["/multiversx/entrypoint.sh"]
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,39 @@ After running the command, you may need to log out from the user session and log
## Build the Docker image

```
docker image build --no-cache . -t elrond-rosetta:latest -f ./Dockerfile
docker image build --no-cache . -t multiversx-rosetta:latest -f ./Dockerfile
```

## Run the containers

Run on **devnet**:

```
docker compose --file ./docker-compose-devnet.yml --env-file ./devnet.env --project-name elrond-devnet up --detach
docker compose --file ./docker-compose-devnet.yml --env-file ./devnet.env --project-name multiversx-devnet up --detach
```

Run on **mainnet**:

```
docker compose --file ./docker-compose-mainnet.yml --env-file ./mainnet.env --project-name elrond-mainnet up --detach
docker compose --file ./docker-compose-mainnet.yml --env-file ./mainnet.env --project-name multiversx-mainnet up --detach
```

## Inspect logs

For devnet:

```
docker logs elrond-rosetta-observer-devnet --tail 100 --follow
docker logs elrond-rosetta-online-devnet --tail 100 --follow
docker logs elrond-rosetta-offline-devnet --tail 100 --follow
docker logs multiversx-rosetta-observer-devnet --tail 100 --follow
docker logs multiversx-rosetta-online-devnet --tail 100 --follow
docker logs multiversx-rosetta-offline-devnet --tail 100 --follow
```

For mainnet:

```
docker logs elrond-rosetta-observer-mainnet --tail 100 --follow
docker logs elrond-rosetta-online-mainnet --tail 100 --follow
docker logs elrond-rosetta-offline-mainnet --tail 100 --follow
docker logs multiversx-rosetta-observer-mainnet --tail 100 --follow
docker logs multiversx-rosetta-online-mainnet --tail 100 --follow
docker logs multiversx-rosetta-offline-mainnet --tail 100 --follow
```

## Update the Docker setup
Expand All @@ -77,23 +77,23 @@ git pull origin
Stop the running containers (devnet):

```
docker stop elrond-rosetta-observer-devnet
docker stop elrond-rosetta-online-devnet
docker stop elrond-rosetta-offline-devnet
docker stop multiversx-rosetta-observer-devnet
docker stop multiversx-rosetta-online-devnet
docker stop multiversx-rosetta-offline-devnet

# Or simply:
docker compose --project-name elrond-devnet down
docker compose --project-name multiversx-devnet down
```

Stop the running containers (mainnet):

```
docker stop elrond-rosetta-observer-mainnet
docker stop elrond-rosetta-online-mainnet
docker stop elrond-rosetta-offline-mainnet
docker stop multiversx-rosetta-observer-mainnet
docker stop multiversx-rosetta-online-mainnet
docker stop multiversx-rosetta-offline-mainnet

# Or simply:
docker compose --project-name elrond-mainnet down
docker compose --project-name multiversx-mainnet down
```

Re-build the images as described above, then run the containers again.
4 changes: 4 additions & 0 deletions devnet.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
BLOCKCHAIN_NAME=MultiversX
# Specify a non-root user (recommended)
DOCKER_USER=1000:1000

# Observer name will be visible on Explorer
OBSERVER_DISPLAY_NAME=""
OBSERVER_ACTUAL_SHARD=0
OBSERVER_PROJECTED_SHARD=0
GENESIS_BLOCK=b099dbc444824f5bc30bf194a071f43c8e2019ae6213a641f12974fa6a6db5fb
Expand Down
31 changes: 17 additions & 14 deletions docker-compose-devnet.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
version: '3'

services:
elrond-rosetta-observer-devnet:
rosetta-observer-devnet:
ulimits:
nproc: 65535
image: elrond-rosetta:latest
container_name: elrond-rosetta-observer-devnet
user: ${DOCKER_USER}
image: multiversx-rosetta:latest
container_name: multiversx-rosetta-observer-devnet
ports:
- "${PORT_OBSERVER}:8080"
- "${PORT_P2P}:37373"
volumes:
- ${DATA_FOLDER_OBSERVER}:/data
command: start-observer network=devnet --destination-shard-as-observer=${OBSERVER_ACTUAL_SHARD} --log-save --log-level=${LOG_LEVEL} --log-logger-name --rest-api-interface=0.0.0.0:8080 --working-directory=/data --validator-key-pem-file=/data/observerKey.pem --serialize-snapshots --disable-consensus-watchdog
command: start-observer network=devnet --destination-shard-as-observer=${OBSERVER_ACTUAL_SHARD} --display-name=${OBSERVER_DISPLAY_NAME} --log-save --log-level=${LOG_LEVEL} --log-logger-name --rest-api-interface=0.0.0.0:8080 --working-directory=/data --validator-key-pem-file=/data/observerKey.pem --serialize-snapshots --disable-consensus-watchdog
networks:
elrond-rosetta-devnet:
multiversx-rosetta-devnet:
ipv4_address: 11.0.0.10

elrond-rosetta-online-devnet:
image: elrond-rosetta:latest
container_name: elrond-rosetta-online-devnet
multiversx-rosetta-online-devnet:
user: ${DOCKER_USER}
image: multiversx-rosetta:latest
container_name: multiversx-rosetta-online-devnet
ports:
- "${PORT_ROSETTA_ONLINE}:8080"
volumes:
- ${DATA_FOLDER_ROSETTA_ONLINE}:/data
command: start-rosetta --port 8080 --observer-http-url=http://11.0.0.10:8080 --blockchain=${BLOCKCHAIN_NAME} --network-id=D --network-name=devnet --num-shards=3 --observer-actual-shard=${OBSERVER_ACTUAL_SHARD} --observer-projected-shard=${OBSERVER_PROJECTED_SHARD} --genesis-block=${GENESIS_BLOCK} --genesis-timestamp=${GENESIS_TIMESTAMP} --first-historical-epoch=${FIRST_HISTORICAL_EPOCH} --num-historical-epochs=${NUM_HISTORICAL_EPOCHS} --native-currency=EGLD --logs-folder=/data
networks:
elrond-rosetta-devnet:
multiversx-rosetta-devnet:
ipv4_address: 11.0.0.21

elrond-rosetta-offline-devnet:
image: elrond-rosetta:latest
container_name: elrond-rosetta-offline-devnet
multiversx-rosetta-offline-devnet:
user: ${DOCKER_USER}
image: multiversx-rosetta:latest
container_name: multiversx-rosetta-offline-devnet
ports:
- "${PORT_ROSETTA_OFFLINE}:8080"
volumes:
- ${DATA_FOLDER_ROSETTA_OFFLINE}:/data
command: start-rosetta --port 8080 --offline --observer-http-url=http://nowhere.localhost.local --blockchain=${BLOCKCHAIN_NAME} --network-id=D --network-name=devnet --num-shards=3 --observer-actual-shard=${OBSERVER_ACTUAL_SHARD} --observer-projected-shard=${OBSERVER_PROJECTED_SHARD} --genesis-block=${GENESIS_BLOCK} --genesis-timestamp=${GENESIS_TIMESTAMP} --first-historical-epoch=${FIRST_HISTORICAL_EPOCH} --num-historical-epochs=${NUM_HISTORICAL_EPOCHS} --native-currency=EGLD --logs-folder=/data
networks:
elrond-rosetta-devnet:
multiversx-rosetta-devnet:
ipv4_address: 11.0.0.22

networks:
elrond-rosetta-devnet:
multiversx-rosetta-devnet:
ipam:
config:
- subnet: 11.0.0.0/24
31 changes: 17 additions & 14 deletions docker-compose-mainnet.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
version: '3'

services:
elrond-rosetta-observer-mainnet:
multiversx-rosetta-observer-mainnet:
ulimits:
nproc: 65535
image: elrond-rosetta:latest
container_name: elrond-rosetta-observer-mainnet
user: ${DOCKER_USER}
image: multiversx-rosetta:latest
container_name: multiversx-rosetta-observer-mainnet
ports:
- "${PORT_OBSERVER}:8080"
- "${PORT_P2P}:37373"
volumes:
- ${DATA_FOLDER_OBSERVER}:/data
command: start-observer network=mainnet --destination-shard-as-observer=${OBSERVER_ACTUAL_SHARD} --log-save --log-level=${LOG_LEVEL} --log-logger-name --rest-api-interface=0.0.0.0:8080 --working-directory=/data --validator-key-pem-file=/data/observerKey.pem
command: start-observer network=mainnet --destination-shard-as-observer=${OBSERVER_ACTUAL_SHARD} --display-name=${OBSERVER_DISPLAY_NAME} --log-save --log-level=${LOG_LEVEL} --log-logger-name --rest-api-interface=0.0.0.0:8080 --working-directory=/data --validator-key-pem-file=/data/observerKey.pem
networks:
elrond-rosetta-mainnet:
multiversx-rosetta-mainnet:
ipv4_address: 10.0.0.10

elrond-rosetta-online-mainnet:
image: elrond-rosetta:latest
container_name: elrond-rosetta-online-mainnet
multiversx-rosetta-online-mainnet:
user: ${DOCKER_USER}
image: multiversx-rosetta:latest
container_name: multiversx-rosetta-online-mainnet
ports:
- "${PORT_ROSETTA_ONLINE}:8080"
volumes:
- ${DATA_FOLDER_ROSETTA_ONLINE}:/data
command: start-rosetta --port 8080 --observer-http-url=http://10.0.0.10:8080 --blockchain=${BLOCKCHAIN_NAME} --network-id=1 --network-name=mainnet --num-shards=3 --observer-actual-shard=${OBSERVER_ACTUAL_SHARD} --observer-projected-shard=${OBSERVER_PROJECTED_SHARD} --genesis-block=${GENESIS_BLOCK} --genesis-timestamp=${GENESIS_TIMESTAMP} --first-historical-epoch=${FIRST_HISTORICAL_EPOCH} --num-historical-epochs=${NUM_HISTORICAL_EPOCHS} --native-currency=EGLD --logs-folder=/data
networks:
elrond-rosetta-mainnet:
multiversx-rosetta-mainnet:
ipv4_address: 10.0.0.21

elrond-rosetta-offline-mainnet:
image: elrond-rosetta:latest
container_name: elrond-rosetta-offline-mainnet
multiversx-rosetta-offline-mainnet:
user: ${DOCKER_USER}
image: multiversx-rosetta:latest
container_name: multiversx-rosetta-offline-mainnet
ports:
- "${PORT_ROSETTA_OFFLINE}:8080"
volumes:
- ${DATA_FOLDER_ROSETTA_OFFLINE}:/data
command: start-rosetta --port 8080 --offline --observer-http-url=http://nowhere.localhost.local --blockchain=${BLOCKCHAIN_NAME} --network-id=1 --network-name=mainnet --num-shards=3 --observer-actual-shard=${OBSERVER_ACTUAL_SHARD} --observer-projected-shard=${OBSERVER_PROJECTED_SHARD} --genesis-block=${GENESIS_BLOCK} --genesis-timestamp=${GENESIS_TIMESTAMP} --first-historical-epoch=${FIRST_HISTORICAL_EPOCH} --num-historical-epochs=${NUM_HISTORICAL_EPOCHS} --native-currency=EGLD --logs-folder=/data
networks:
elrond-rosetta-mainnet:
multiversx-rosetta-mainnet:
ipv4_address: 10.0.0.22

networks:
elrond-rosetta-mainnet:
multiversx-rosetta-mainnet:
ipam:
config:
- subnet: 10.0.0.0/24
4 changes: 4 additions & 0 deletions mainnet.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
BLOCKCHAIN_NAME=MultiversX
# Specify a non-root user (recommended)
DOCKER_USER=1000:1000

# Observer name will be visible on Explorer
OBSERVER_DISPLAY_NAME=""
OBSERVER_ACTUAL_SHARD=0
OBSERVER_PROJECTED_SHARD=0
GENESIS_BLOCK=165821a3407bd0d5916f9710e203bad788053443430e724b7847e086b175d9ab
Expand Down