From b1a99d06be4d210d0e016f0a7804199347f572f5 Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 11 Nov 2022 12:33:49 +0300 Subject: [PATCH 01/10] static release make rule added --- Dockerfile.builder | 72 ++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 22 +++++++++++++- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.builder diff --git a/Dockerfile.builder b/Dockerfile.builder new file mode 100644 index 000000000..370165d0f --- /dev/null +++ b/Dockerfile.builder @@ -0,0 +1,72 @@ +# syntax=docker/dockerfile:1 + +ARG GO_VERSION="1.19" +ARG RUNNER_IMAGE="gcr.io/distroless/static" + +# -------------------------------------------------------- +# Builder +# -------------------------------------------------------- + +FROM golang:${GO_VERSION}-alpine as builder + +ARG GIT_VERSION +ARG GIT_COMMIT +ARG BUILD_TAGS +ARG ENABLED_PROPOSALS + +RUN apk add --no-cache \ + ca-certificates \ + build-base \ + linux-headers + +# Download go dependencies +WORKDIR /neutron +COPY go.mod go.sum ./ +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + go mod download + +# Cosmwasm - Download correct libwasmvm version +RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \ + wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \ + -O /lib/libwasmvm_muslc.a && \ + # verify checksum + wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ + sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1) + +# Copy the remaining files +COPY . . + +# Build neutrond binary +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + go build \ + -mod=readonly \ + -tags "netgo,ledger,muslc" \ + -ldflags "-X github.com/cosmos/cosmos-sdk/version.Name="neutron" \ + -X github.com/cosmos/cosmos-sdk/version.AppName="neutrond" \ + -X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \ + -X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \ + -X github.com/cosmos/cosmos-sdk/version.BuildTags='${BUILD_TAGS}' \ + -X github.com/neutron-org/neutron/app.EnableSpecificProposals=${ENABLED_PROPOSALS} \ + -w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ + -trimpath \ + -o /neutron/build/neutrond \ + /neutron/cmd/neutrond + +# -------------------------------------------------------- +# Runner +# -------------------------------------------------------- + +FROM ${RUNNER_IMAGE} + +COPY --from=builder /neutron/build/neutrond /bin/neutrond + +ENV HOME /neutron +WORKDIR $HOME + +EXPOSE 26656 +EXPOSE 26657 +EXPOSE 1317 + +ENTRYPOINT ["neutrond"] \ No newline at end of file diff --git a/Makefile b/Makefile index ffe2dee45..89231b116 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ LEDGER_ENABLED ?= true SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') BINDIR ?= $(GOPATH)/bin SIMAPP = ./app +ENABLED_PROPOSALS := MigrateContract,SudoContract,UpdateAdmin,ClearAdmin,PinCodes,UnpinCodes +GO_VERSION=1.19 # for dockerized protobuf tools DOCKER := $(shell which docker) @@ -58,7 +60,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=neutron \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \ - -X "github.com/neutron-org/neutron/app.EnableSpecificProposals=MigrateContract,SudoContract,UpdateAdmin,ClearAdmin,PinCodes,UnpinCodes" + -X "github.com/neutron-org/neutron/app.EnableSpecificProposals=$(ENABLED_PROPOSALS)" ifeq ($(WITH_CLEVELDB),yes) ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb @@ -80,6 +82,24 @@ else go build -mod=readonly $(BUILD_FLAGS) -o build/neutrond ./cmd/neutrond endif +build-static-linux-amd64: go.sum $(BUILDDIR)/ + $(DOCKER) buildx create --name neutronbuilder || true + $(DOCKER) buildx use neutronbuilder + $(DOCKER) buildx build \ + --build-arg GO_VERSION=$(GO_VERSION) \ + --build-arg GIT_VERSION=$(VERSION) \ + --build-arg GIT_COMMIT=$(COMMIT) \ + --build-arg BUILD_TAGS=$(build_tags_comma_sep) \ + --build-arg ENABLED_PROPOSALS=$(ENABLED_PROPOSALS) \ + --platform linux/amd64 \ + -t neutron-amd64 \ + --load \ + -f Dockerfile.builder . + $(DOCKER) rm -f neutronbinary || true + $(DOCKER) create -ti --name neutronbinary neutron-amd64 + $(DOCKER) cp neutronbinary:/bin/neutrond $(BUILDDIR)/neutrond-linux-amd64 + $(DOCKER) rm -f neutronbinary + install: go.sum go install -mod=readonly $(BUILD_FLAGS) ./cmd/neutrond From fffd8ae5357f17ffa2ebaf430a0ab0eb3f1a4100 Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 11 Nov 2022 12:52:16 +0300 Subject: [PATCH 02/10] added BUILDDIR --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 89231b116..b7bd414cc 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ BINDIR ?= $(GOPATH)/bin SIMAPP = ./app ENABLED_PROPOSALS := MigrateContract,SudoContract,UpdateAdmin,ClearAdmin,PinCodes,UnpinCodes GO_VERSION=1.19 +BUILDDIR ?= $(CURDIR)/build # for dockerized protobuf tools DOCKER := $(shell which docker) From 205621e96c1db7c29d665d2e41b42d671fc7179d Mon Sep 17 00:00:00 2001 From: swelf Date: Wed, 19 Apr 2023 11:59:29 +0300 Subject: [PATCH 03/10] updated Dockerfile --- Dockerfile.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index 370165d0f..b436a8735 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -32,7 +32,7 @@ RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && -O /lib/libwasmvm_muslc.a && \ # verify checksum wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ - sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1) + sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1) # Copy the remaining files COPY . . From a3e62e38c24d490479f0e991ba5b236275cbae76 Mon Sep 17 00:00:00 2001 From: swelf Date: Fri, 21 Apr 2023 19:01:10 +0300 Subject: [PATCH 04/10] go version updated --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7b09c74d9..23454b20a 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') BINDIR ?= $(GOPATH)/bin SIMAPP = ./app ENABLED_PROPOSALS := MigrateContract,SudoContract,UpdateAdmin,ClearAdmin,PinCodes,UnpinCodes -GO_VERSION=1.19 +GO_VERSION=1.20.0 BUILDDIR ?= $(CURDIR)/build # for dockerized protobuf tools From d51a15ba7ff0ab02931292f86cb08a8326bd4182 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 25 Apr 2023 11:35:56 +0300 Subject: [PATCH 05/10] updated makefile --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7c124942a..dc5c64022 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ **NOTE: current version is a WIP.** ## Requirements -* Go 1.18 +* Go 1.20 * Ignite Cli * Hermes IBC Relayer @@ -22,7 +22,7 @@ For current CCV modules support there is not any suitable version of hermes, so ```shell git clone https://github.com/informalsystems/hermes.git cd hermes -git checkout 7defaf067dbe6f60588518ea1619f228d38ac48d +git checkout v1.4.0 cargo build --release --bin hermes ``` @@ -36,12 +36,12 @@ make install ### Bootstrap two chains and create an IBC connection -In order to bootstrap two chains it is required to clone gaiad v7.0.3 next to `neutron` repository and install it. +In order to bootstrap two chains it is required to clone gaiad v8.0.1 next to `neutron` repository and install it. ```shell git clone https://github.com/cosmos/gaia.git cd gaia -git checkout v7.0.3 +git checkout v8.0.1 make install ``` From 669eeffd62d3eaa52f9c286076b36c085f5f3a33 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 25 Apr 2023 11:39:59 +0300 Subject: [PATCH 06/10] updated hermes section --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc5c64022..81abd6518 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,12 @@ curl https://get.ignite.com/cli! | bash ``` ### How to install Hermes IBC Relayer +Install binary +``` +cargo install --version 1.4.0 ibc-relayer-cli --bin hermes --locked +``` -For current CCV modules support there is not any suitable version of hermes, so you need to build it by yourself. - +or install from sources ```shell git clone https://github.com/informalsystems/hermes.git cd hermes From 9e02cedccca1463e9f4b7a982710e1b80be830bb Mon Sep 17 00:00:00 2001 From: swelf Date: Wed, 26 Apr 2023 11:35:53 +0300 Subject: [PATCH 07/10] updated gaiad version in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81abd6518..47127cf36 100644 --- a/README.md +++ b/README.md @@ -39,12 +39,12 @@ make install ### Bootstrap two chains and create an IBC connection -In order to bootstrap two chains it is required to clone gaiad v8.0.1 next to `neutron` repository and install it. +In order to bootstrap two chains it is required to clone gaiad v9.0.3 next to `neutron` repository and install it. ```shell git clone https://github.com/cosmos/gaia.git cd gaia -git checkout v8.0.1 +git checkout v9.0.3 make install ``` From f2ca370c9bc3ba919b5b1daadbd0b88872964a37 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 2 May 2023 15:14:28 +0300 Subject: [PATCH 08/10] cleared readme --- README.md | 97 +++---------------------------------------------------- 1 file changed, 4 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 47127cf36..cd4baf1f4 100644 --- a/README.md +++ b/README.md @@ -1,102 +1,13 @@ ![Neutron](https://github.com/neutron-org/neutron-docs/blob/1db1e92098c915ae8ad4defc0bd30ef549175201/static/img/neutron_wide_logo.png) # Neutron - -**NOTE: current version is a WIP.** - -## Requirements -* Go 1.20 -* Ignite Cli -* Hermes IBC Relayer - -### How to install Ignite CLI - -```shell -curl https://get.ignite.com/cli! | bash -``` - -### How to install Hermes IBC Relayer -Install binary -``` -cargo install --version 1.4.0 ibc-relayer-cli --bin hermes --locked -``` - -or install from sources -```shell -git clone https://github.com/informalsystems/hermes.git -cd hermes -git checkout v1.4.0 -cargo build --release --bin hermes -``` - -## Build and Install Neutron Zone - -```shell -make install -``` - -## Run local testnet node instances connected via IBC - -### Bootstrap two chains and create an IBC connection - -In order to bootstrap two chains it is required to clone gaiad v9.0.3 next to `neutron` repository and install it. - -```shell -git clone https://github.com/cosmos/gaia.git -cd gaia -git checkout v9.0.3 -make install -``` - -after that you can turn back into `neutron` directory and run: - -```shell -make init -``` - -### Start relayer - -```shell -make start-rly -``` - -## Generate proto - -```shell -ignite generate proto-go -``` - -## Running with docker - -Build the image: -```shell -make build-docker-image -``` - -After the image is built, you can start/stop with: -```shell -make start-docker-container -make stop-docker-container -``` - -## Running with docker + relayer - -```shell -ssh-add ./.ssh/id_rsa -make start-cosmopark -make stop-cosmopark -``` - -Make sure you delete node image if you use the whole thing in dev purposes -```shell -@docker rmi neutron-node -``` - ## Documentation -You can check the documentation here: https://neutron-org.github.io/neutron-docs/ +You can check the documentation here: https://docs.neutron.org/ + +## Build -> Note: we are going to open & deploy the docs soon. +You can check out the build instructions here: https://docs.neutron.org/neutron/build ## Examples From ff91f6b3a8fda261ea22bfafae77a5a44451737b Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 2 May 2023 18:19:58 +0300 Subject: [PATCH 09/10] fixed go (static builder) version --- Dockerfile.builder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index b436a8735..c51c550d5 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG GO_VERSION="1.19" +ARG GO_VERSION="1.20.0" ARG RUNNER_IMAGE="gcr.io/distroless/static" # -------------------------------------------------------- From 4633135c25b501cbfaaa0a7a2f3e1032fe64b107 Mon Sep 17 00:00:00 2001 From: swelf Date: Tue, 2 May 2023 18:24:30 +0300 Subject: [PATCH 10/10] updated proposals list --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 477bc2a78..a3a08263d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LEDGER_ENABLED ?= true SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') BINDIR ?= $(GOPATH)/bin SIMAPP = ./app -ENABLED_PROPOSALS := MigrateContract,SudoContract,UpdateAdmin,ClearAdmin,PinCodes,UnpinCodes +ENABLED_PROPOSALS := SudoContract,UpdateAdmin,ClearAdmin,PinCodes,UnpinCodes GO_VERSION=1.20.0 BUILDDIR ?= $(CURDIR)/build