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

Update references, pass current user to docker compose #16

Draft
wants to merge 6 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
47 changes: 31 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
FROM golang:1.17.6 as builder

ARG ROSETTA_TAG=v0.3.4
ARG ROSETTA_DOCKER_SCRIPTS_TAG=v0.2.1
ARG CONFIG_DEVNET_TAG=D1.3.48.0-hf-fix
ARG CONFIG_MAINNET_TAG=release-v1.3.48.0

# Clone repositories
WORKDIR /repos
RUN git clone https://github.com/ElrondNetwork/rosetta-docker-scripts.git --branch=v0.2.1 --depth=1
RUN git clone https://github.com/ElrondNetwork/elrond-config-devnet --branch=D1.3.48.0-hf-fix --depth=1
RUN git clone https://github.com/ElrondNetwork/elrond-config-mainnet --branch=v1.3.48.0 --depth=1
RUN git clone https://github.com/ElrondNetwork/rosetta-docker-scripts.git --branch=${DOCKER_SCRIPTS_TAG} --depth=1
RUN git clone https://github.com/ElrondNetwork/elrond-config-devnet --branch=${CONFIG_DEVNET_TAG} --single-branch --depth=1
RUN git clone https://github.com/ElrondNetwork/elrond-config-mainnet --branch=${CONFIG_MAINNET_TAG} --single-branch --depth=1

WORKDIR /go
RUN git clone https://github.com/ElrondNetwork/elrond-go.git --branch=v1.3.48 --depth=1
RUN git clone https://github.com/ElrondNetwork/rosetta.git --branch=v0.3.4 --depth=1
RUN git clone https://github.com/ElrondNetwork/elrond-go.git --branch=$(cat /workspace/elrond-config-devnet/binaryVersion | sed 's/tags\///') --single-branch elrond-go-devnet
RUN git clone https://github.com/ElrondNetwork/elrond-go.git --branch=$(cat /workspace/elrond-config-mainnet/binaryVersion | sed 's/tags\///') --single-branch elrond-go-mainnet
RUN git clone https://github.com/ElrondNetwork/rosetta.git --branch=${ROSETTA_TAG} --depth=1

# Build rosetta
WORKDIR /go/rosetta/cmd/rosetta
RUN go build

# Build node
WORKDIR /go/elrond-go/cmd/node
WORKDIR /go/elrond-go-devnet/cmd/node
RUN go build -i -v -ldflags="-X main.appVersion=$(git describe --tags --long --dirty --always)"
RUN cp /go/pkg/mod/github.com/!elrond!network/arwen-wasm-vm@$(cat /go/elrond-go-devnet/go.mod | grep arwen-wasm-vm | sed 's/.* //' | tail -n 1)/wasmer/libwasmer_linux_amd64.so /lib/libwasmer_linux_amd64.so

WORKDIR /go/elrond-go-mainnet/cmd/node
RUN go build -i -v -ldflags="-X main.appVersion=$(git describe --tags --long --dirty --always)"
RUN cp /go/pkg/mod/github.com/!elrond!network/arwen-wasm-vm@$(cat /go/elrond-go/go.mod | grep arwen-wasm-vm | sed 's/.* //' | tail -n 1)/wasmer/libwasmer_linux_amd64.so /lib/libwasmer_linux_amd64.so
RUN cp /go/pkg/mod/github.com/!elrond!network/arwen-wasm-vm@$(cat /go/elrond-go-mainnet/go.mod | grep arwen-wasm-vm | sed 's/.* //' | tail -n 1)/wasmer/libwasmer_linux_amd64.so /lib/libwasmer_linux_amd64.so

# Build key generator
WORKDIR /go/elrond-go/cmd/keygenerator
# TODO: For elrond-go v1.4.0 (upcoming), use the flag `--no-key` instead of using the keygenerator
WORKDIR /go/elrond-go-mainnet/cmd/keygenerator
RUN go build .

# Adjust configuration files
Expand All @@ -33,14 +44,18 @@ 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 node:
# We are sharing libwasmer among "elrond-go-devnet" and "elrond-go-mainnet" (no workaround on this yet - left as future work).
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" "/elrond/devnet/node/config/"
COPY --from=builder "/go/elrond-go-devnet/cmd/node/node" "/elrond/devnet/node/"
COPY --from=builder "/repos/elrond-config-mainnet" "/elrond/mainnet/node/config/"
COPY --from=builder "/go/elrond-go-mainnet/cmd/node/node" "/elrond/mainnet/node/"

# Copy rosetta:
COPY --from=builder "/go/rosetta/cmd/rosetta" "/elrond/"

# Copy keygenerator:
COPY --from=builder "/go/elrond-go-mainnet/cmd/keygenerator/keygenerator" "/elrond/keygenerator"

EXPOSE 8080
WORKDIR /elrond
ENTRYPOINT ["/elrond/entrypoint.sh"]
3 changes: 3 additions & 0 deletions devnet.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
BLOCKCHAIN_NAME=MultiversX
DOCKER_USER=1000:1000

OBSERVER_DISPLAY_NAME=""
OBSERVER_PUBKEY="PUBLIC_KEY_FROM_KEY_FILE"
OBSERVER_ACTUAL_SHARD=0
OBSERVER_PROJECTED_SHARD=0
GENESIS_BLOCK=b099dbc444824f5bc30bf194a071f43c8e2019ae6213a641f12974fa6a6db5fb
Expand Down
5 changes: 4 additions & 1 deletion docker-compose-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ services:
elrond-rosetta-observer-devnet:
ulimits:
nproc: 65535
user: ${DOCKER_USER}
image: elrond-rosetta:latest
container_name: elrond-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:
ipv4_address: 11.0.0.10

elrond-rosetta-online-devnet:
user: ${DOCKER_USER}
image: elrond-rosetta:latest
container_name: elrond-rosetta-online-devnet
ports:
Expand All @@ -29,6 +31,7 @@ services:
ipv4_address: 11.0.0.21

elrond-rosetta-offline-devnet:
user: ${DOCKER_USER}
image: elrond-rosetta:latest
container_name: elrond-rosetta-offline-devnet
ports:
Expand Down
5 changes: 4 additions & 1 deletion docker-compose-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ services:
elrond-rosetta-observer-mainnet:
ulimits:
nproc: 65535
user: ${DOCKER_USER}
image: elrond-rosetta:latest
container_name: elrond-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:
ipv4_address: 10.0.0.10

elrond-rosetta-online-mainnet:
user: ${DOCKER_USER}
image: elrond-rosetta:latest
container_name: elrond-rosetta-online-mainnet
ports:
Expand All @@ -29,6 +31,7 @@ services:
ipv4_address: 10.0.0.21

elrond-rosetta-offline-mainnet:
user: ${DOCKER_USER}
image: elrond-rosetta:latest
container_name: elrond-rosetta-offline-mainnet
ports:
Expand Down
3 changes: 3 additions & 0 deletions mainnet.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
BLOCKCHAIN_NAME=MultiversX
DOCKER_USER=1000:1000

OBSERVER_DISPLAY_NAME=""
OBSERVER_PUBKEY="PUBLIC_KEY_FROM_KEY_FILE"
OBSERVER_ACTUAL_SHARD=0
OBSERVER_PROJECTED_SHARD=0
GENESIS_BLOCK=165821a3407bd0d5916f9710e203bad788053443430e724b7847e086b175d9ab
Expand Down