-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #637 from oasisprotocol/ptrus/feature/docker-localnet
feat(localnet): Include Nexus and Explorer in localnet images
- Loading branch information
Showing
6 changed files
with
254 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
REACT_APP_BUILD_DATETIME=0 | ||
REACT_APP_BUILD_SHA=sha0000000000000000000000000000000000000 | ||
REACT_APP_BUILD_VERSION= | ||
REACT_APP_PRIVACY_POLICY=https://oasisprotocol.org/privacy-policy | ||
REACT_APP_ENABLE_OASIS_MATOMO_ANALYTICS=false | ||
REACT_APP_API=http://localhost:8547/v1/ | ||
REACT_APP_TESTNET_API=http://localhost:8547/v1/ | ||
REACT_APP_META_TITLE="Oasis Explorer - Localnet" | ||
REACT_APP_META_IMAGE="Oasis Explorer - OpenGraph Banner.png" | ||
REACT_APP_META_MANIFEST=app.webmanifest | ||
REACT_APP_META_FAVICON=favicon.svg | ||
REACT_APP_META_APPLE_ICON="Icon Blue 192.png" | ||
REACT_APP_META_DESC="Official explorer for the Oasis Network - Localnet" | ||
REACT_APP_SHOW_BUILD_BANNERS=true | ||
REACT_APP_FIXED_NETWORK=testnet | ||
REACT_APP_SHOW_FIAT_VALUES=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
analysis: | ||
source: &source_config | ||
custom_chain: | ||
history: | ||
records: | ||
- archive_name: eden | ||
genesis_height: 1 | ||
chain_context: {{CHAIN_CONTEXT}} | ||
runtime_start_rounds: | ||
{{PARATIME_NAME}}: 0 | ||
sdk_network: | ||
chain_context: {{CHAIN_CONTEXT}} | ||
rpc: unix:/serverdir/node/net-runner/network/client-0/internal.sock | ||
domination: | ||
symbol: TEST | ||
decimals: 9 | ||
paratimes: | ||
default: {{PARATIME_NAME}} | ||
all: | ||
{{PARATIME_NAME}}: | ||
id: 8000000000000000000000000000000000000000000000000000000000000000 | ||
denominations: | ||
"_": | ||
symbol: TEST | ||
decimals: 18 | ||
consensus_denomination: "_" | ||
nodes: | ||
eden: | ||
default: | ||
rpc: unix:/serverdir/node/net-runner/network/client-0/internal.sock | ||
ipfs: | ||
gateway: https://ipfs.io | ||
analyzers: | ||
consensus: | ||
from: 1 # Localnet genesis. | ||
{{PARATIME_NAME}}: | ||
from: 1 # Localnet genesis. | ||
consensus_accounts_list: | ||
interval: 30s | ||
evm_tokens_{{PARATIME_NAME}}: | ||
interval: 30s | ||
evm_nfts_{{PARATIME_NAME}}: | ||
interval: 30s | ||
evm_token_balances_{{PARATIME_NAME}}: | ||
interval: 30s | ||
evm_contract_code_{{PARATIME_NAME}}: | ||
interval: 30s | ||
evm_abi_{{PARATIME_NAME}}: | ||
interval: 30s | ||
validator_staking_history: | ||
from: 1 | ||
node_stats: | ||
interval: 1s | ||
layers: | ||
- consensus | ||
- {{PARATIME_NAME}} | ||
aggregate_stats: {} | ||
storage: | ||
backend: postgres | ||
endpoint: postgresql://postgres:postgres@localhost:5432/nexus?sslmode=disable | ||
migrations: file:///nexus-migrations | ||
|
||
server: | ||
source: *source_config | ||
endpoint: 0.0.0.0:8547 | ||
storage: | ||
endpoint: postgresql://postgres:postgres@localhost:5432/nexus?sslmode=disable | ||
backend: postgres | ||
|
||
log: | ||
level: {{LOG_LEVEL}} | ||
format: json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,57 @@ FROM golang:1.22.3 AS oasis-web3-gateway | |
COPY . /go/oasis-web3-gateway | ||
RUN cd oasis-web3-gateway && make && strip -S -x oasis-web3-gateway docker/common/oasis-deposit/oasis-deposit | ||
|
||
FROM ghcr.io/oasisprotocol/oasis-core-dev:stable-24.2.x AS oasis-core-dev | ||
|
||
# ARG NEXUS_VERSION=0.4.0 | ||
# RUN wget https://github.com/oasisprotocol/nexus/releases/download/v${NEXUS_VERSION}/oasis_nexus_${NEXUS_VERSION}_linux_amd64.tar.gz \ | ||
# && tar -zxvf oasis_nexus_${NEXUS_VERSION}_linux_amd64.tar.gz \ | ||
# && strip -S -x /oasis_nexus_${NEXUS_VERSION}_linux_amd64/nexus \ | ||
# && mv /oasis_nexus_${NEXUS_VERSION}_linux_amd64/nexus / \ | ||
# && rm -rf /oasis_nexus_${NEXUS_VERSION}_linux_amd64* && \ | ||
# # We also need to fetch the storage migrations. | ||
# git clone https://github.com/oasisprotocol/nexus.git nexus-git --branch v${NEXUS_VERSION} --depth 1 \ | ||
# && mv /nexus-git/storage/migrations /nexus-migrations \ | ||
# && rm -rf nexus-git | ||
ARG NEXUS_VERSION=main | ||
RUN git clone https://github.com/oasisprotocol/nexus.git nexus-git --depth 1 \ | ||
&& cd nexus-git \ | ||
&& git fetch --depth 1 origin ${NEXUS_VERSION} \ | ||
&& git checkout ${NEXUS_VERSION} \ | ||
&& go install github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
&& make codegen-go \ | ||
&& go build \ | ||
&& strip -S -x /nexus-git/nexus \ | ||
&& mv /nexus-git/nexus / \ | ||
&& mv /nexus-git/storage/migrations /nexus-migrations \ | ||
&& rm -rf /nexus-git | ||
|
||
# ARG EXPLORER_REPO=https://github.com/oasisprotocol/explorer.git | ||
# ARG EXPLORER_VERSION=v1.13.0 | ||
# TODO: update once some support for localnet is added: https://github.com/oasisprotocol/explorer/issues/1597 | ||
ARG EXPLORER_REPO=https://github.com/ptrus/explorer.git | ||
ARG EXPLORER_VERSION=1a78782e10fa266707a428c5fd8ba91966d588a1 | ||
COPY docker/common/explorer.env /nexus.env.production | ||
RUN git clone ${EXPLORER_REPO} explorer --depth 1 \ | ||
&& cd explorer \ | ||
&& git fetch origin ${EXPLORER_VERSION} --depth 1 \ | ||
&& git checkout FETCH_HEAD \ | ||
&& mv /nexus.env.production .env.production \ | ||
&& echo "REACT_APP_LOCALNET_EMERALD=true\nREACT_APP_LOCALNET_SAPPHIRE=false" >> .env.production \ | ||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | ||
&& apt install -y nodejs \ | ||
&& npm install -g yarn \ | ||
&& yarn install \ | ||
&& NODE_ENV=production yarn build | ||
|
||
|
||
# Build emerald-localnet | ||
FROM postgres:16-bookworm | ||
RUN apt update && apt install -y bash libseccomp2 unzip jq binutils curl wget && apt clean \ | ||
&& su -c "POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres /usr/local/bin/docker-entrypoint.sh postgres &" postgres \ | ||
# Explorer frontend deps. | ||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | ||
&& apt install -y nodejs && npm install -g serve \ | ||
# Install Envoy. | ||
&& curl -fsSL https://apt.envoyproxy.io/signing.key | gpg --dearmor -o /etc/apt/keyrings/envoy-keyring.gpg \ | ||
&& echo "deb [signed-by=/etc/apt/keyrings/envoy-keyring.gpg] https://apt.envoyproxy.io bookworm main" | tee /etc/apt/sources.list.d/envoy.list \ | ||
|
@@ -38,17 +85,25 @@ ENV ENVOY_CONFIG_FILE=/envoy.yml | |
ENV PARATIME_BINARY=/runtime.elf | ||
ENV KEYMANAGER_BINARY="" | ||
ENV OASIS_CLI_BINARY=/oasis | ||
ENV OASIS_NEXUS_BINARY=/nexus | ||
ENV OASIS_NEXUS_CONFIG_FILE=/nexus.yml | ||
ENV OASIS_NEXUS_MIGRATIONS=/nexus-migrations | ||
ENV OASIS_EXPLORER_DIR=/explorer | ||
|
||
ARG VERSION | ||
|
||
# oasis-web3-gateway binary, config, spinup-* scripts and staking_genesis.json. | ||
COPY --from=oasis-web3-gateway /go/oasis-web3-gateway/oasis-web3-gateway ${OASIS_WEB3_GATEWAY_BINARY} | ||
COPY --from=oasis-web3-gateway /go/oasis-web3-gateway/docker/common/oasis-deposit/oasis-deposit ${OASIS_DEPOSIT_BINARY} | ||
COPY docker/common/localnet.yml ${OASIS_WEB3_GATEWAY_CONFIG_FILE} | ||
COPY docker/common/nexus.yml ${OASIS_NEXUS_CONFIG_FILE} | ||
COPY docker/common/envoy.yml ${ENVOY_CONFIG_FILE} | ||
COPY docker/common/start.sh / | ||
COPY docker/common/wait-container-ready.sh / | ||
COPY tests/tools/* / | ||
COPY --from=oasis-core-dev /nexus ${OASIS_NEXUS_BINARY} | ||
COPY --from=oasis-core-dev /nexus-migrations ${OASIS_NEXUS_MIGRATIONS} | ||
COPY --from=oasis-core-dev /explorer/build ${OASIS_EXPLORER_DIR} | ||
|
||
# Create symbolic links for convenience. | ||
RUN ln -s ${OASIS_NODE_BINARY} ${OASIS_CLI_BINARY} /usr/local/bin | ||
|
@@ -80,11 +135,15 @@ RUN wget --quiet "https://github.com/oasisprotocol/oasis-core/releases/download/ | |
&& echo "${VERSION}" > /VERSION \ | ||
&& strip -S -x ${OASIS_NET_RUNNER_BINARY} ${OASIS_NODE_BINARY} ${OASIS_CLI_BINARY} | ||
|
||
# Explorer port. | ||
EXPOSE 80/tcp | ||
# Envoy proxy port. | ||
EXPOSE 8544/tcp | ||
# Web3 gateway http and ws ports. | ||
EXPOSE 8545/tcp | ||
EXPOSE 8546/tcp | ||
# Nexus port. | ||
EXPOSE 8547/tcp | ||
|
||
USER root | ||
ENTRYPOINT ["/start.sh"] |
Oops, something went wrong.