Skip to content

Commit

Permalink
Merge pull request #281 from arkeonetwork/fix/docker-on-localnet
Browse files Browse the repository at this point in the history
fix: localnet docker
  • Loading branch information
toshiSat authored Sep 14, 2024
2 parents 5c547a3 + b9490c9 commit cea0bf3
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Contains all the PRs that improved the code without changing the behaviors.
- Updated Docs
- Fixed Consumer in Directory Service
- Fixed Regression Export
- Fixed localnet docker
- updated the genesis file

# v1.0.0-Prerelease

Expand Down
61 changes: 61 additions & 0 deletions Dockerfile.localnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# Arkeo
#

ARG GO_VERSION="1.21"

#
# Build
#
FROM golang:${GO_VERSION} as builder

ARG GIT_VERSION
ARG GIT_COMMIT

ENV GOBIN=/go/bin
ENV GOPATH=/go
ENV CGO_ENABLED=0
ENV GOOS=linux

RUN go install github.com/jackc/tern/v2@latest

# Download go dependencies
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TAG=testnet
RUN make install

#
# Main
#
FROM ubuntu:lunar

# hadolint ignore=DL3008,DL4006
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
jq curl htop vim ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

# Copy the compiled binaries over.
COPY --from=builder /go/bin/sentinel /go/bin/arkeod /go/bin/indexer /go/bin/api /go/bin/tern /usr/bin/
COPY scripts /scripts

ARG TAG=testnet
ENV NET=$TAG

EXPOSE 1317

EXPOSE 26656

EXPOSE 26657

ENTRYPOINT ["scripts/genesis.sh"]

# default to fullnode
CMD ["arkeod", "start"]
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,15 @@ docker-build-cross:
--clean \
--snapshot

build-docker-localnet:
@docker build . --file Dockerfile.localnet -t ${IMAGE}:${TAG}

# localnet: build-docker
# IMAGE_TAG=$(SHORT_COMMIT)-$(IMAGE_ARCH) docker-compose -f docker-compose-localnet.yaml up

localnet: build-docker
IMAGE_TAG=$(SHORT_COMMIT)-$(IMAGE_ARCH) docker-compose -f docker-compose-localnet.yaml up

localnet: build-docker-localnet
IMAGE_TAG=${IMAGE}:${TAG} docker-compose -f docker-compose-localnet.yaml up
# ------------------------------ Testnet ------------------------------

install-testnet-binary:
Expand Down
19 changes: 12 additions & 7 deletions docker-compose-localnet.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
---
version: "3"

services:
node:
image: ghcr.io/arkeonetwork/arkeo-dev:${IMAGE_TAG}
image: ${IMAGE_TAG}
build:
context: .
dockerfile: Dockerfile.localnet # Ensure the Dockerfile is correctly referenced
entrypoint:
- sh
- /opt/genesis.sh
- bash
- -c
- |
./genesis.sh && \
arkeod start
ports:
- 9090:9090
- 1317:1317
- 26657:26657
- 26656:26656
volumes:
- ./scripts:/opt:z
working_dir: /opt
- ./scripts:/scripts:z
working_dir: /scripts
9 changes: 9 additions & 0 deletions scripts/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,18 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then
add_account "$BOB" $TOKEN 1000000000000000 # bob, 1m
add_claim_records "ARKEO" "$BOB" 1000 1000 1000 true

# Thorchain derived test addresses
add_account "tarkeo1dllfyp57l4xj5umqfcqy6c2l3xfk0qk6zpc3t7" $TOKEN 1000000000000000 # bob, 10m
add_claim_records "ARKEO" "ch" 1000 1000 1000 true
add_account "tarkeo1xrz7z3zwtpc45xm72tpnevuf3wn53re8q4u4nr" $TOKEN 1000000000000000
add_claim_records "ARKEO" "tarkeo1xrz7z3zwtpc45xm72tpnevuf3wn53re8q4u4nr" 1000 1000 1000 true

# add_claim_records "ARKEO" "{YOUR ARKEO ADDRESS}" 500000 500000 500000 true
# add_account "{YOUR ARKEO ADDRESS}" $TOKEN 1000000000000000

# add_claim_records "ETHEREUM" "{YOUR ETH ADDRESS}" 500000 600000 700000 true
add_claim_records "ETHEREUM" "0x92E14917A0508Eb56C90C90619f5F9Adbf49f47d" 500000 600000 700000 true


# enable CORs on testnet/localnet
sed -i 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' ~/.arkeo/config/app.toml
Expand All @@ -107,6 +115,7 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then
sed -i 's/"stake"/"uarkeo"/g' ~/.arkeo/config/genesis.json
sed -i 's/enable = false/enable = true/g' ~/.arkeo/config/app.toml
sed -i 's/127.0.0.1:26657/0.0.0.0:26657/g' ~/.arkeo/config/config.toml
sed -i 's/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' ~/.arkeo/config/app.toml

# Update the supply field in genesis.json using jq
jq --arg DENOM "$TOKEN" --arg AMOUNT "$TOTAL_SUPPLY" '.app_state.bank.supply = [{"denom": $DENOM, "amount": $AMOUNT}]' <~/.arkeo/config/genesis.json >/tmp/genesis.json
Expand Down

0 comments on commit cea0bf3

Please sign in to comment.