Skip to content

Commit 386a99f

Browse files
Add run prod elements.
1 parent f3c524e commit 386a99f

File tree

77 files changed

+7692
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+7692
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
vue/node_modules
22
vue/dist
33
release/
4+
build/
5+
prod-sim/*/config/addrbook.json
6+
prod-sim/*/config/write-file-atomic-*
7+
prod-sim/*/data/*
8+
!prod-sim/*/data/priv_validator_state.json
49
.idea/
510
.vscode/
611
.DS_Store

Dockerfile-standalone

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Faucet: docker build --target faucet
2+
FROM --platform=linux node:18.7-alpine AS cosmos-faucet
3+
4+
ENV COSMJS_VERSION=0.28.11
5+
6+
RUN npm install @cosmjs/faucet@${COSMJS_VERSION} --global --production
7+
8+
ENV FAUCET_CONCURRENCY=2
9+
ENV FAUCET_PORT=4500
10+
ENV FAUCET_GAS_PRICE=0.001stake
11+
# Prepared keys for determinism
12+
ENV FAUCET_MNEMONIC="zebra burden afford work power afraid field creek laugh govern upgrade project glue ceiling lounge mobile romance pear relief either panel expect eagle jacket"
13+
ENV FAUCET_ADDRESS_PREFIX=cosmos
14+
ENV FAUCET_TOKENS="stake, token"
15+
ENV FAUCET_CREDIT_AMOUNT_STAKE=100
16+
ENV FAUCET_CREDIT_AMOUNT_TOKEN=100
17+
ENV FAUCET_COOLDOWN_TIME=0
18+
19+
EXPOSE 4500
20+
21+
ENTRYPOINT [ "cosmos-faucet" ]
22+
23+
# Checkersd builder
24+
FROM --platform=linux golang:1.18.7-alpine AS builder
25+
26+
ENV CHECKERS_VERSION=main
27+
28+
RUN apk add --update --no-cache make git
29+
30+
WORKDIR /root
31+
RUN git clone --depth 1 --branch ${CHECKERS_VERSION} https://github.com/b9lab/checkers.git checkers
32+
33+
WORKDIR /root/checkers
34+
RUN go build -o ./build/checkersd ./cmd/checkersd/main.go
35+
36+
# Checkersd in production
37+
FROM --platform=linux alpine
38+
39+
COPY --from=builder /root/checkers/build/checkersd /usr/local/bin/checkersd
40+
41+
# This address corresponds to the mnemonic above
42+
ENV ALICE=cosmos1am3fnp5dd6nndk5jyjq9mpqh3yvt2jmmdv83xn
43+
44+
RUN mkdir -p /root/.checkers/keys
45+
46+
# This private key file corresponds to the mnemonic above
47+
RUN echo -----BEGIN TENDERMINT PRIVATE KEY----- > /root/.checkers/keys/encrypted-private-key-alice.txt
48+
RUN echo kdf: bcrypt >> /root/.checkers/keys/encrypted-private-key-alice.txt
49+
RUN echo salt: A67D88136A462383A2DD30727510DF59 >> /root/.checkers/keys/encrypted-private-key-alice.txt
50+
RUN echo type: secp256k1 >> /root/.checkers/keys/encrypted-private-key-alice.txt
51+
RUN echo >> /root/.checkers/keys/encrypted-private-key-alice.txt
52+
RUN echo 7gttUkxkpWxlI9tF0/vEYHvysmKTc/mG/aZ8dMF3u7a8xkPgVLa/Z75k/46nr0yN >> /root/.checkers/keys/encrypted-private-key-alice.txt
53+
RUN echo FP/h5zTVYoP8tMnvVLV0koVAOV4QQurD5C7l3N8= >> /root/.checkers/keys/encrypted-private-key-alice.txt
54+
RUN echo =qyP6 >> /root/.checkers/keys/encrypted-private-key-alice.txt
55+
RUN echo -----END TENDERMINT PRIVATE KEY----- >> /root/.checkers/keys/encrypted-private-key-alice.txt
56+
57+
RUN echo password | checkersd keys import alice /root/.checkers/keys/encrypted-private-key-alice.txt --keyring-backend test
58+
59+
RUN checkersd init checkers
60+
RUN sed -Ei 's/^enable-unsafe-cors = false/enable-unsafe-cors = true/g' /root/.checkers/config/app.toml
61+
RUN sed -Ei 's/^enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' /root/.checkers/config/app.toml
62+
RUN sed -Ei 's/^laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/g' /root/.checkers/config/config.toml
63+
RUN sed -Ei 's/^cors_allowed_origins = \[\]/cors_allowed_origins = \["\*"\]/g' /root/.checkers/config/config.toml
64+
RUN sed -Ei 's/^chain-id = .*$/chain-id = "checkers-1"/g' /root/.checkers/config/client.toml
65+
66+
RUN sed -Ei 's/"chain_id": "checkers"/"chain_id": "checkers-1"/g' /root/.checkers/config/genesis.json
67+
RUN checkersd add-genesis-account $ALICE 1000000000000000stake,1000000000000000token
68+
RUN checkersd gentx alice 10000000stake --keyring-backend test \
69+
--account-number 0 --sequence 0 --chain-id checkers-1 \
70+
--gas 1000000 --gas-prices 0.1stake
71+
RUN checkersd collect-gentxs
72+
73+
EXPOSE 26657
74+
75+
ENTRYPOINT [ "checkersd" ]

Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,29 @@ gen-protoc-ts:
3232
checkers/{}
3333

3434
install-and-gen-protoc-ts: download-cosmos-proto install-protoc-gen-ts gen-protoc-ts
35+
36+
build-linux:
37+
GOOS=linux GOARCH=amd64 go build -o ./build/checkersd-linux-amd64 ./cmd/checkersd/main.go
38+
GOOS=linux GOARCH=arm64 go build -o ./build/checkersd-linux-arm64 ./cmd/checkersd/main.go
39+
40+
do-checksum-linux:
41+
cd build && sha256sum \
42+
checkersd-linux-amd64 checkersd-linux-arm64 \
43+
> checkers-checksum-linux
44+
45+
build-linux-with-checksum: build-linux do-checksum-linux
46+
47+
build-darwin:
48+
GOOS=darwin GOARCH=amd64 go build -o ./build/checkersd-darwin-amd64 ./cmd/checkersd/main.go
49+
GOOS=darwin GOARCH=arm64 go build -o ./build/checkersd-darwin-arm64 ./cmd/checkersd/main.go
50+
51+
build-all: build-linux build-darwin
52+
53+
do-checksum-darwin:
54+
cd build && sha256sum \
55+
checkersd-darwin-amd64 checkersd-darwin-arm64 \
56+
> checkers-checksum-darwin
57+
58+
build-darwin-with-checksum: build-darwin do-checksum-darwin
59+
60+
build-with-checksum: build-linux-with-checksum build-darwin-with-checksum

prod-sim/Dockerfile-checkersd-alpine

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM --platform=linux golang:1.18.7-alpine AS builder
2+
3+
RUN apk update
4+
RUN apk add make
5+
6+
WORKDIR /original
7+
ADD . /original
8+
RUN go build -o ./build/checkersd ./cmd/checkersd/main.go
9+
10+
FROM --platform=linux alpine
11+
12+
ENV LOCAL=/usr/local
13+
14+
COPY --from=builder /original/build/checkersd ${LOCAL}/bin/checkersd
15+
16+
ENTRYPOINT [ "checkersd" ]

prod-sim/Dockerfile-checkersd-debian

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM --platform=linux debian:11-slim
2+
ARG BUILDARCH
3+
4+
ENV LOCAL=/usr/local
5+
6+
COPY build/checkersd-linux-${BUILDARCH} ${LOCAL}/bin/checkersd
7+
8+
ENTRYPOINT [ "checkersd" ]

prod-sim/Dockerfile-tmkms-alpine

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM --platform=linux rust:1.64.0-alpine AS builder
2+
3+
RUN apk update
4+
RUN apk add libusb-dev=1.0.26-r0 musl-dev git
5+
6+
ENV LOCAL=/usr/local
7+
ENV RUSTFLAGS=-Ctarget-feature=+aes,+ssse3
8+
ENV TMKMS_VERSION=v0.12.2
9+
10+
WORKDIR /root
11+
RUN git clone --branch ${TMKMS_VERSION} https://github.com/iqlusioninc/tmkms.git
12+
WORKDIR /root/tmkms
13+
RUN cargo build --release --features=softsign
14+
15+
FROM --platform=linux alpine
16+
17+
COPY --from=builder /root/tmkms/target/release/tmkms ${LOCAL}/bin
18+
19+
ENTRYPOINT [ "tmkms" ]

prod-sim/Dockerfile-tmkms-debian

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM --platform=linux rust:1.64.0 AS builder
2+
3+
RUN apt-get update
4+
RUN apt-get install libusb-1.0-0-dev --yes
5+
6+
ENV LOCAL=/usr/local
7+
ENV RUSTFLAGS=-Ctarget-feature=+aes,+ssse3
8+
ENV TMKMS_VERSION=v0.12.2
9+
10+
WORKDIR /root
11+
RUN git clone --branch ${TMKMS_VERSION} https://github.com/iqlusioninc/tmkms.git
12+
WORKDIR /root/tmkms
13+
RUN cargo build --release --features=softsign
14+
15+
FROM --platform=linux debian:11-slim
16+
17+
COPY --from=builder /root/tmkms/target/release/tmkms ${LOCAL}/bin
18+
19+
ENTRYPOINT [ "tmkms" ]

prod-sim/desk-alice/config/app.toml

+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# This is a TOML config file.
2+
# For more information, see https://github.com/toml-lang/toml
3+
4+
###############################################################################
5+
### Base Configuration ###
6+
###############################################################################
7+
8+
# The minimum gas prices a validator is willing to accept for processing a
9+
# transaction. A transaction's fees must meet the minimum of any denomination
10+
# specified in this config (e.g. 0.25token1;0.0001token2).
11+
minimum-gas-prices = "0upawn"
12+
13+
# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals
14+
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
15+
# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals
16+
# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval'
17+
pruning = "default"
18+
19+
# These are applied if and only if the pruning strategy is custom.
20+
pruning-keep-recent = "0"
21+
pruning-keep-every = "0"
22+
pruning-interval = "0"
23+
24+
# HaltHeight contains a non-zero block height at which a node will gracefully
25+
# halt and shutdown that can be used to assist upgrades and testing.
26+
#
27+
# Note: Commitment of state will be attempted on the corresponding block.
28+
halt-height = 0
29+
30+
# HaltTime contains a non-zero minimum block time (in Unix seconds) at which
31+
# a node will gracefully halt and shutdown that can be used to assist upgrades
32+
# and testing.
33+
#
34+
# Note: Commitment of state will be attempted on the corresponding block.
35+
halt-time = 0
36+
37+
# MinRetainBlocks defines the minimum block height offset from the current
38+
# block being committed, such that all blocks past this offset are pruned
39+
# from Tendermint. It is used as part of the process of determining the
40+
# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates
41+
# that no blocks should be pruned.
42+
#
43+
# This configuration value is only responsible for pruning Tendermint blocks.
44+
# It has no bearing on application state pruning which is determined by the
45+
# "pruning-*" configurations.
46+
#
47+
# Note: Tendermint block pruning is dependant on this parameter in conunction
48+
# with the unbonding (safety threshold) period, state pruning and state sync
49+
# snapshot parameters to determine the correct minimum value of
50+
# ResponseCommit.RetainHeight.
51+
min-retain-blocks = 0
52+
53+
# InterBlockCache enables inter-block caching.
54+
inter-block-cache = true
55+
56+
# IndexEvents defines the set of events in the form {eventType}.{attributeKey},
57+
# which informs Tendermint what to index. If empty, all events will be indexed.
58+
#
59+
# Example:
60+
# ["message.sender", "message.recipient"]
61+
index-events = []
62+
63+
# IavlCacheSize set the size of the iavl tree cache.
64+
# Default cache size is 50mb.
65+
iavl-cache-size = 781250
66+
67+
###############################################################################
68+
### Telemetry Configuration ###
69+
###############################################################################
70+
71+
[telemetry]
72+
73+
# Prefixed with keys to separate services.
74+
service-name = ""
75+
76+
# Enabled enables the application telemetry functionality. When enabled,
77+
# an in-memory sink is also enabled by default. Operators may also enabled
78+
# other sinks such as Prometheus.
79+
enabled = false
80+
81+
# Enable prefixing gauge values with hostname.
82+
enable-hostname = false
83+
84+
# Enable adding hostname to labels.
85+
enable-hostname-label = false
86+
87+
# Enable adding service to labels.
88+
enable-service-label = false
89+
90+
# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink.
91+
prometheus-retention-time = 0
92+
93+
# GlobalLabels defines a global set of name/value label tuples applied to all
94+
# metrics emitted using the wrapper functions defined in telemetry package.
95+
#
96+
# Example:
97+
# [["chain_id", "cosmoshub-1"]]
98+
global-labels = [
99+
]
100+
101+
###############################################################################
102+
### API Configuration ###
103+
###############################################################################
104+
105+
[api]
106+
107+
# Enable defines if the API server should be enabled.
108+
enable = false
109+
110+
# Swagger defines if swagger documentation should automatically be registered.
111+
swagger = false
112+
113+
# Address defines the API server to listen on.
114+
address = "tcp://0.0.0.0:1317"
115+
116+
# MaxOpenConnections defines the number of maximum open connections.
117+
max-open-connections = 1000
118+
119+
# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds).
120+
rpc-read-timeout = 10
121+
122+
# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds).
123+
rpc-write-timeout = 0
124+
125+
# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes).
126+
rpc-max-body-bytes = 1000000
127+
128+
# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
129+
enabled-unsafe-cors = false
130+
131+
###############################################################################
132+
### Rosetta Configuration ###
133+
###############################################################################
134+
135+
[rosetta]
136+
137+
# Enable defines if the Rosetta API server should be enabled.
138+
enable = false
139+
140+
# Address defines the Rosetta API server to listen on.
141+
address = ":8080"
142+
143+
# Network defines the name of the blockchain that will be returned by Rosetta.
144+
blockchain = "app"
145+
146+
# Network defines the name of the network that will be returned by Rosetta.
147+
network = "network"
148+
149+
# Retries defines the number of retries when connecting to the node before failing.
150+
retries = 3
151+
152+
# Offline defines if Rosetta server should run in offline mode.
153+
offline = false
154+
155+
###############################################################################
156+
### gRPC Configuration ###
157+
###############################################################################
158+
159+
[grpc]
160+
161+
# Enable defines if the gRPC server should be enabled.
162+
enable = true
163+
164+
# Address defines the gRPC server address to bind to.
165+
address = "0.0.0.0:9090"
166+
167+
###############################################################################
168+
### gRPC Web Configuration ###
169+
###############################################################################
170+
171+
[grpc-web]
172+
173+
# GRPCWebEnable defines if the gRPC-web should be enabled.
174+
# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op.
175+
enable = true
176+
177+
# Address defines the gRPC-web server address to bind to.
178+
address = "0.0.0.0:9091"
179+
180+
# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
181+
enable-unsafe-cors = false
182+
183+
###############################################################################
184+
### State Sync Configuration ###
185+
###############################################################################
186+
187+
# State sync snapshots allow other nodes to rapidly join the network without replaying historical
188+
# blocks, instead downloading and applying a snapshot of the application state at a given height.
189+
[state-sync]
190+
191+
# snapshot-interval specifies the block interval at which local state sync snapshots are
192+
# taken (0 to disable). Must be a multiple of pruning-keep-every.
193+
snapshot-interval = 0
194+
195+
# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
196+
snapshot-keep-recent = 2
197+
198+
[wasm]
199+
# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
200+
query_gas_limit = 300000
201+
# This is the number of wasm vm instances we keep cached in memory for speed-up
202+
# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally
203+
lru_size = 0

0 commit comments

Comments
 (0)