-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
118 lines (102 loc) · 4.61 KB
/
Dockerfile
File metadata and controls
118 lines (102 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Base image
FROM ubuntu:24.04
# Information
LABEL maintainer="Slow Ninja <info@slow.ninja>"
# Variables
ENV DEBIAN_FRONTEND=noninteractive \
STRUCTS_PATH="/root/.structs" \
STRUCTS_REACTOR_SHARE="/root/reactor_share" \
STRUCTS_REACTOR_BACKUP="/root/reactor_backup" \
STRUCTS_CHAIN_ID="structstestnet-111" \
STRUCTS_NETWORK_VERSION="112b" \
STRUCTS_MONIKER="UnknownGuild" \
STRUCTSD_HOST="structsd" \
STRUCTS_VALIDATOR_INITIAL_STAKING_AMOUNT="50000000" \
STRUCTS_VALIDATOR_IDENTITY="UnknownDroid" \
STRUCTS_GUILD_WEBSITE="https://playstructs.com" \
STRUCTS_GUILD_CONTACT="UnknownDroidLeader" \
STRUCTS_VALIDATOR_COMMISSION_RATE="0.1" \
STRUCTS_VALIDATOR_MAX_RATE="0.2" \
STRUCTS_VALIDATOR_MAX_CHANGE_RATE="0.01" \
STRUCTS_VALIDATOR_MIN_SELF_DELEGATION="1" \
STRUCTS_INDEXER_PG_CONNECTION="" \
STRUCTSD_ARGUMENTS="--log_level info" \
# Cosmovisor / upgrade settings
STRUCTS_GENESIS_BRANCH="111b" \
STRUCTS_UPGRADE_NAME="v0.16.0" \
STRUCTS_UPGRADE_VERSION="0.16.0" \
STRUCTS_UPGRADE_SHA256="14a251a01fe51b76afd0896befdacff43873337a5e12c8673d6a30014a2a385f" \
COSMOVISOR_VERSION="v1.7.0" \
DAEMON_NAME="structsd" \
DAEMON_HOME="/root/.structs" \
DAEMON_RESTART_AFTER_UPGRADE="true" \
DAEMON_ALLOW_DOWNLOAD_BINARIES="false" \
UNSAFE_SKIP_BACKUP="true"
# Install packages
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
git \
curl \
ca-certificates \
postgresql-client \
jq \
nano \
&& \
rm -rf /var/lib/apt/lists/*
# Install Go 1.24.1
RUN curl -LO https://go.dev/dl/go1.24.1.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz && \
rm go1.24.1.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:/root/go/bin:${PATH}"
# Put this file into place so that the ignite command does not
# get stuck waiting for input
RUN mkdir /root/.ignite
COPY config/anon_identity.json /root/.ignite/anon_identity.json
# Install ignite
RUN curl -L -o ignite.tar.gz https://github.com/ignite/cli/releases/download/v28.8.2/ignite_28.8.2_linux_amd64.tar.gz && \
tar -xzvf ignite.tar.gz && \
mv ignite /usr/bin/
# Install cosmovisor (pinned to a release line that supports cosmos-sdk v0.53.x)
RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@${COSMOVISOR_VERSION} && \
install -m 0755 /root/go/bin/cosmovisor /usr/local/bin/cosmovisor && \
cosmovisor version || true
# Expose ports
EXPOSE 26656
EXPOSE 26657
EXPOSE 1317
# Build the genesis (pre-upgrade) binary from the requested branch.
# Cosmovisor will run this until height 385730 when x/upgrade signals "v0.16.0".
RUN mkdir -p /opt/structs/cosmovisor/genesis/bin && \
git clone https://github.com/playstructs/structsd.git -b ${STRUCTS_GENESIS_BRANCH} && \
cd structsd && \
ignite chain build && \
install -m 0755 /root/go/bin/structsd /opt/structs/cosmovisor/genesis/bin/structsd && \
/opt/structs/cosmovisor/genesis/bin/structsd version || true
# Stage the official upgrade binary (v0.16.0). We bake the same artifact
# referenced in the on-chain governance proposal so the in-container binary
# is byte-identical to what the rest of the network ran.
RUN mkdir -p /opt/structs/cosmovisor/upgrades/${STRUCTS_UPGRADE_NAME}/bin /tmp/upgrade && \
curl -fsSL -o /tmp/upgrade/structsd.tar.gz \
https://github.com/playstructs/structsd/releases/download/${STRUCTS_UPGRADE_NAME}/structsd-${STRUCTS_UPGRADE_VERSION}-linux-amd64.tar.gz && \
echo "${STRUCTS_UPGRADE_SHA256} /tmp/upgrade/structsd.tar.gz" | sha256sum -c - && \
tar -xzf /tmp/upgrade/structsd.tar.gz -C /tmp/upgrade && \
UPGRADE_BIN="$(find /tmp/upgrade -type f -name structsd ! -path '*.tar.gz' | head -n1)" && \
test -n "${UPGRADE_BIN}" && \
install -m 0755 "${UPGRADE_BIN}" /opt/structs/cosmovisor/upgrades/${STRUCTS_UPGRADE_NAME}/bin/structsd && \
/opt/structs/cosmovisor/upgrades/${STRUCTS_UPGRADE_NAME}/bin/structsd version || true && \
rm -rf /tmp/upgrade
# Keep a stable `structsd` on PATH for utility scripts (reactor-create.sh,
# indexer-insert-genesis.sh, ad-hoc CLI calls). It points at the genesis
# binary; cosmovisor manages the live daemon separately.
RUN ln -sf /opt/structs/cosmovisor/genesis/bin/structsd /usr/bin/structsd
RUN mkdir -p $STRUCTS_PATH && \
mkdir -p $STRUCTS_REACTOR_SHARE && \
mkdir -p $STRUCTS_REACTOR_BACKUP && \
mkdir -p /root/scripts && \
mkdir -p /root/config
COPY scripts/ /root/scripts/
RUN chmod a+x /root/scripts/*
COPY config/ /root/config/
# Run Structs (cosmovisor handles the v0.16.0 swap at height 385730)
CMD [ "bash", "/root/scripts/start.sh" ]