Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jingweicb committed Jun 12, 2024
0 parents commit 17fe400
Show file tree
Hide file tree
Showing 7 changed files with 1,961 additions and 0 deletions.
95 changes: 95 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
FROM golang:1.21 as build
RUN \
apt update \
&& apt install -y \
bash \
git \
make \
gcc \
cmake \
jq \
curl \
wget \
build-essential \
ca-certificates \
npm \
unzip

# Add the direnv installation command here
RUN wget https://github.com/direnv/direnv/releases/download/v2.32.1/direnv.linux-amd64 -O /usr/local/bin/direnv && \
chmod +x /usr/local/bin/direnv

ARG REPO_URL=https://github.com/akash-network/node

# %%RELEASE_COMMIT_HASH%% ARM, PLEASE ENSURE THE RELEASE COMMIT HASH IS NEXT LINE
ARG COMMIT_HASH=f417f49214eafaf9181d258d429950d3591ae601
ARG RELEASE_TAG=v0.36.0

SHELL ["/usr/bin/bash", "-c"]

RUN git clone -n "${REPO_URL}" node \
&& cd node \
&& git checkout "${COMMIT_HASH}"

WORKDIR /go/node

RUN \
direnv allow /go/node \
&& cd /go/node \
&& eval "$(direnv export bash)" \
&& make bins


# ============
# Cosmovisor
# ============

FROM golang:1.21 AS cosmovisor-builder
RUN apt update && apt install -y bash clang tar wget musl-dev git make gcc bc ca-certificates

ARG GIT_REF=cosmovisor/v1.3.0
ARG REPO_URL=https://github.com/cosmos/cosmos-sdk
RUN git clone -n "${REPO_URL}" cosmos-sdk \
&& cd cosmos-sdk \
&& git fetch origin "${GIT_REF}" \
&& git reset --hard FETCH_HEAD

WORKDIR /go/cosmos-sdk/cosmovisor/

RUN go mod download
RUN make cosmovisor


###################
# Execution Stage #
###################
FROM ubuntu:22.04
RUN apt update && apt install jq lz4 -y cmake gcc make curl wget build-essential ca-certificates npm direnv

COPY --from=build /go/node/.cache/bin/* /usr/local/bin/
COPY --from=cosmovisor-builder /go/cosmos-sdk/cosmovisor/cosmovisor /usr/local/bin/

# TODO what is this
ARG USER_ID=1000
ARG GROUP_ID=1001
RUN useradd -m --uid ${USER_ID} akash && groupmod --gid ${GROUP_ID} akash && usermod -aG akash akash
RUN chown -R akash /home
USER akash

# will not enable auto-downloading of new binaries due to security concerns
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES false
# path of an existing configuration file to use
ENV CONFIG_PATH "/app/assets"
# The keyring backend type https://docs.cosmos.network/master/run-node/keyring.html
ENV SEID_KEYRING_BACKEND file

WORKDIR /app
USER root
# Copy config files templates
COPY scripts/assets/ /app/assets
COPY scripts/entrypoint.sh /entrypoint.sh

EXPOSE 30656 26657 1317 9090

RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
245 changes: 245 additions & 0 deletions scripts/assets/app-mainnet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml

###############################################################################
### Base Configuration ###
###############################################################################

# The minimum gas prices a validator is willing to accept for processing a
# transaction. A transaction's fees must meet the minimum of any denomination
# specified in this config (e.g. 0.25token1;0.0001token2).
minimum-gas-prices = "0.025uakt"

# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals
# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval'
pruning = "nothing"

# These are applied if and only if the pruning strategy is custom.
pruning-keep-recent = "0"
pruning-keep-every = "0"
pruning-interval = "0"

# HaltHeight contains a non-zero block height at which a node will gracefully
# halt and shutdown that can be used to assist upgrades and testing.
#
# Note: Commitment of state will be attempted on the corresponding block.
halt-height = 0

# HaltTime contains a non-zero minimum block time (in Unix seconds) at which
# a node will gracefully halt and shutdown that can be used to assist upgrades
# and testing.
#
# Note: Commitment of state will be attempted on the corresponding block.
halt-time = 0

# MinRetainBlocks defines the minimum block height offset from the current
# block being committed, such that all blocks past this offset are pruned
# from Tendermint. It is used as part of the process of determining the
# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates
# that no blocks should be pruned.
#
# This configuration value is only responsible for pruning Tendermint blocks.
# It has no bearing on application state pruning which is determined by the
# "pruning-*" configurations.
#
# Note: Tendermint block pruning is dependant on this parameter in conunction
# with the unbonding (safety threshold) period, state pruning and state sync
# snapshot parameters to determine the correct minimum value of
# ResponseCommit.RetainHeight.
min-retain-blocks = 0

# InterBlockCache enables inter-block caching.
inter-block-cache = true

# IndexEvents defines the set of events in the form {eventType}.{attributeKey},
# which informs Tendermint what to index. If empty, all events will be indexed.
#
# Example:
# ["message.sender", "message.recipient"]
index-events = []

# IavlCacheSize set the size of the iavl tree cache.
# Default cache size is 50mb.
iavl-cache-size = 781250

# IAVLDisableFastNode enables or disables the fast node feature of IAVL.
# Default is true.
iavl-disable-fastnode = true

###############################################################################
### Telemetry Configuration ###
###############################################################################

[telemetry]

# Prefixed with keys to separate services.
service-name = ""

# Enabled enables the application telemetry functionality. When enabled,
# an in-memory sink is also enabled by default. Operators may also enabled
# other sinks such as Prometheus.
enabled = false

# Enable prefixing gauge values with hostname.
enable-hostname = false

# Enable adding hostname to labels.
enable-hostname-label = false

# Enable adding service to labels.
enable-service-label = false

# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink.
prometheus-retention-time = 0

# GlobalLabels defines a global set of name/value label tuples applied to all
# metrics emitted using the wrapper functions defined in telemetry package.
#
# Example:
# [["chain_id", "cosmoshub-1"]]
global-labels = [
]

###############################################################################
### API Configuration ###
###############################################################################

[api]

# Enable defines if the API server should be enabled.
enable = false

# Swagger defines if swagger documentation should automatically be registered.
swagger = false

# Address defines the API server to listen on.
address = "tcp://0.0.0.0:1317"

# MaxOpenConnections defines the number of maximum open connections.
max-open-connections = 1000

# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds).
rpc-read-timeout = 10

# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds).
rpc-write-timeout = 0

# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes).
rpc-max-body-bytes = 1000000

# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
enabled-unsafe-cors = false

###############################################################################
### Rosetta Configuration ###
###############################################################################

[rosetta]

# Enable defines if the Rosetta API server should be enabled.
enable = false

# Address defines the Rosetta API server to listen on.
address = ":8080"

# Network defines the name of the blockchain that will be returned by Rosetta.
blockchain = "app"

# Network defines the name of the network that will be returned by Rosetta.
network = "network"

# Retries defines the number of retries when connecting to the node before failing.
retries = 3

# Offline defines if Rosetta server should run in offline mode.
offline = false

###############################################################################
### gRPC Configuration ###
###############################################################################

[grpc]

# Enable defines if the gRPC server should be enabled.
enable = true

# Address defines the gRPC server address to bind to.
address = "0.0.0.0:9090"

# MaxRecvMsgSize defines the max message size in bytes the server can receive.
# The default value is 10MB.
max-recv-msg-size = "10485760"

# MaxSendMsgSize defines the max message size in bytes the server can send.
# The default value is math.MaxInt32.
max-send-msg-size = "2147483647"

###############################################################################
### gRPC Web Configuration ###
###############################################################################

[grpc-web]

# GRPCWebEnable defines if the gRPC-web should be enabled.
# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op.
enable = true

# Address defines the gRPC-web server address to bind to.
address = "0.0.0.0:9091"

# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
enable-unsafe-cors = false


###############################################################################
### State Sync Configuration ###
###############################################################################

# State sync snapshots allow other nodes to rapidly join the network without replaying historical
# blocks, instead downloading and applying a snapshot of the application state at a given height.
[state-sync]

# snapshot-interval specifies the block interval at which local state sync snapshots are
# taken (0 to disable). Must be a multiple of pruning-keep-every.
snapshot-interval = 0

# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
snapshot-keep-recent = 2

###############################################################################
### Store / State Streaming ###
###############################################################################

[store]
streamers = []

[streamers]
[streamers.file]
keys = ["*", ]
write_dir = ""
prefix = ""

# output-metadata specifies if output the metadata file which includes the abci request/responses
# during processing the block.
output-metadata = "true"

# stop-node-on-error specifies if propagate the file streamer errors to consensus state machine.
stop-node-on-error = "true"

# fsync specifies if call fsync after writing the files.
fsync = "false"

###############################################################################
### Mempool ###
###############################################################################

[mempool]
# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool.
# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool.
# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount.
#
# Note, this configuration only applies to SDK built-in app-side mempool
# implementations.
max-txs = "5000"
Loading

0 comments on commit 17fe400

Please sign in to comment.