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

add cosmovisor #35

Merged
merged 5 commits into from
Apr 2, 2022
Merged
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
20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# docker build -t plugchain .
# Server:

#从 golang:alpine 映像开始构建镜像。
FROM golang:alpine AS build-env

#指定维护者信息
# MAINTAINER

# 安装最低限度的必要依赖项
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev jq
RUN sed -i 's/https/http/' /etc/apk/repositories \
&& apk add --no-cache $PACKAGES
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2

#设置工作目录
WORKDIR /code
WORKDIR /plugchain

#将 . 项目中的当前目录复制到 . 镜像中的工作目录。
COPY . .

RUN GOPROXY=https://goproxy.io make install
#设置代理
ENV GOPROXY=https://proxy.golang.com.cn,direct

#编译程序
RUN make install

RUN cd cosmovisor && make install && cd -

#暴露端口
# EXPOSE 26656

# CMD ["plugchaind"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/make -f

AppVersion ?= $(shell echo $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`) | sed 's/^v//')
AppVersion ?= $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
LEDGER_ENABLED ?= true
Expand Down
4 changes: 4 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@ func New(

app.SetEndBlocker(app.EndBlocker)

app.RegisterUpgradePlan("v1.2", &store.StoreUpgrades{}, func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
return app.mm.GetVersionMap(), nil
})

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(err.Error())
Expand Down
1 change: 1 addition & 0 deletions cosmovisor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/cosmovisor
84 changes: 84 additions & 0 deletions cosmovisor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!--
Guiding Principles:

Changelogs are for humans, not machines.
There should be an entry for every single version.
The same types of changes should be grouped.
Versions and sections should be linkable.
The latest version comes first.
The release date of each version is displayed.
Mention whether you follow Semantic Versioning.

Usage:

Change log entries are to be added to the Unreleased section under the
appropriate stanza (see below). Each entry should ideally include a tag and
the Github issue reference in the following format:

* (<tag>) \#<issue-number> message

The issue numbers will later be link-ified during the release process so you do
not have to worry about including a link manually, but you can if you wish.

Types of changes (Stanzas):

"Features" for new features.
"Improvements" for changes in existing functionality.
"Deprecated" for soon-to-be removed features.
"Bug Fixes" for any bug fixes.
"Client Breaking" for breaking Protobuf, gRPC and REST routes used by end-users.
"CLI Breaking" for breaking CLI commands.
"API Breaking" for breaking exported APIs used by developers building on SDK.
Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

## [Unreleased]
<!-- NOTE: when creating a new release, update cosmovisor/cmd/cosmovisor/cmd/version.go:Version -->

## v1.1.0 2022-10-02

### Features

* [\#10285](https://github.com/cosmos/cosmos-sdk/pull/10316) Added `run` command to run the associated app.
* [\#10533](https://github.com/cosmos/cosmos-sdk/pull/10649) Added environmental variable `DAEMON_BACKUP_DIR` to allow node to set a custom backup directory.

### Features

* [\#10649](https://github.com/cosmos/cosmos-sdk/pull/10649) Customize backup directory. When `DAEMON_BACKUP_DIR` env variable is set, cosmovisor will backup the app data directory in that directory before running the update.

### Deprecated

* [\#10285](https://github.com/cosmos/cosmos-sdk/pull/10316) Running `cosmovisor` without the `run` argument.

### Bug Fixes

* [\#10458](https://github.com/cosmos/cosmos-sdk/pull/10458) Fix version when using 'go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/[email protected]' to install cosmovisor.

## v1.0.0 2021-09-30

### Features

* [\#8590](https://github.com/cosmos/cosmos-sdk/pull/8590) File watcher for cosmovisor. Instead of parsing logs from stdin and stderr, we watch the `<DAEMON_HOME>/data/upgrade-info.json` file updates using polling mechanism.
* [\#9999](https://github.com/cosmos/cosmos-sdk/pull/10103) Added `version` command that returns the cosmovisor version and the application version.
* [\#9973](https://github.com/cosmos/cosmos-sdk/pull/10056) Added support for pre-upgrade command in Cosmovisor to be called before the binary is upgraded. Added new environmental variable `DAEMON_PREUPGRADE_MAX_RETRIES` that holds the maximum number of times to reattempt pre-upgrade before failing.
* [\#10126](https://github.com/cosmos/cosmos-sdk/pull/10229) Added `help`.

### Improvements

* [\#10018](https://github.com/cosmos/cosmos-sdk/pull/10018) Strict boolean argument parsing: cosmovisor will fail if user will not set correctly a boolean variable. Correct values are: "true", "false", "" (not setting) - all case not sensitive.
* [\#10036](https://github.com/cosmos/cosmos-sdk/pull/10036) Improve logs when downloading the binary.
* [\#10217](https://github.com/cosmos/cosmos-sdk/pull/10217) Replacing logging to use zerolog.

### CLI Breaking

* [\#10128](https://github.com/cosmos/cosmos-sdk/pull/10128) Change default value of `DAEMON_RESTART_AFTER_UPGRADE` to `true`.

## v0.1 2021-08-06

This is the first release and we started this changelog on 2021-07-01. See the [README](https://github.com/cosmos/cosmos-sdk/blob/release/cosmovisor/v0.1.x/cosmovisor/CHANGELOG.md) file for the full list of features.

## Features

* [\#9652](https://github.com/cosmos/cosmos-sdk/pull/9652) Add backup option for cosmovisor.
8 changes: 8 additions & 0 deletions cosmovisor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/make -f

all: install

install:
go build -o $(GOPATH)/bin/ ./cmd/cosmovisor

.PHONY: all install
Loading