Skip to content

Commit

Permalink
parameterized images with different default configs
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed Nov 18, 2024
1 parent 016c82e commit 8492a12
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 6 deletions.
76 changes: 74 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,78 @@ steps:
- echo "$PASS" | docker login -u "$USER" --password-stdin https://oci.hack.bg
- export IMAGE="$NAME:$(cat BRANCH | tr '/' '_' | tr '\n' ' ')"
- 'printf "Name: $NAME\nImage: $IMAGE\n"'

# Pull previous layers from cache
- docker pull "$IMAGE" || true
- docker build --network=host --cache-to=type=inline --cache-from="$IMAGE" -t "$IMAGE" .
- docker push "$IMAGE"

# Default image
- docker build --push --network=host --cache-to=type=inline --cache-from="$IMAGE" -f Dockerfile -t "$IMAGE" .

# Parameterized images:
- export PARAMETERIZED="--push --network=host --cache-to=type=inline --cache-from="$IMAGE" -f Dockerfile.parameterized"


# Image that connects to all known peers directly
- export VARIANT="$IMAGE-all-direct"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@namada-peer.mandragora.io:26656,tcp://05309c2cce2d163027a47c662066907e89cd6b99@74.50.93.254:26656,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@64.118.250.82:46656,tcp://75825cae136729aaf519ad62684b9b796c5593fd@138.197.133.118:26656 .
# Image that connects to all known peers throgh green proxy with default config
- export VARIANT="$IMAGE-all-green"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@node-out-green:26666,tcp://05309c2cce2d163027a47c662066907e89cd6b99@node-out-green:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@node-out-green:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@node-out-green:26669 .
# Image that connects to all known peers throgh blue proxy with default config
- export VARIANT="$IMAGE-all-blue"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@node-out-blue:26666,tcp://05309c2cce2d163027a47c662066907e89cd6b99@node-out-blue:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@node-out-blue:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@node-out-blue:26669 .
# Image that connects to Mandragora peer directly
- export VARIANT="$IMAGE-mandragora-direct"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@namada-peer.mandragora.io:26656 .
# Image that connects to Mandragora peer throgh green proxy with default config
- export VARIANT="$IMAGE-mandragora-green"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@node-out-green:26666 .
# Image that connects to Mandragora peer throgh blue proxy with default config
- export VARIANT="$IMAGE-mandragora-blue"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@node-out-blue:26666 .
# Image that connects to Tududes peers directly
- export VARIANT="$IMAGE-tududes-direct"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://05309c2cce2d163027a47c662066907e89cd6b99@74.50.93.254:26656,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@64.118.250.82:46656,tcp://75825cae136729aaf519ad62684b9b796c5593fd@138.197.133.118:26656 .
# Image that connects to Tududes peers throgh green proxy with default config
- export VARIANT="$IMAGE-tududes-green"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://05309c2cce2d163027a47c662066907e89cd6b99@node-out-green:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@node-out-green:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@node-out-green:26669 .
# Image that connects to Tududes peers throgh blue proxy with default config
- export VARIANT="$IMAGE-tududes-blue"
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://05309c2cce2d163027a47c662066907e89cd6b99@node-out-blue:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@node-out-blue:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@node-out-blue:26669 .
35 changes: 35 additions & 0 deletions Dockerfile.parameterized
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ghcr.io/anoma/namada:v0.45.1 AS namada

# Install system dependencies
USER root
RUN apt update \
&& apt install -y vim curl wget unzip procps simpleproxy jq less iputils-ping iproute2 tcpdump strace
RUN cd /tmp \
&& wget https://github.com/denoland/deno/releases/download/v1.46.3/deno-x86_64-unknown-linux-gnu.zip \
&& unzip deno-x86_64-unknown-linux-gnu.zip \
&& mv deno /usr/local/bin \
&& rm deno-x86_64-unknown-linux-gnu.zip

# Configure node
USER namada
ENV NAMADA_NETWORK_CONFIGS_SERVER="https://testnet.namada-dryrun.tududes.com/configs"
ENV CHAIN_ID="namada-dryrun.abaaeaf7b78cb3ac"
ENV DATA_DIR="/home/namada/.local/share/namada/$CHAIN_ID"
ENV WASM_DIR="$DATA_DIR/wasm"
ENV CONFIG_DIR="$DATA_DIR/config.toml"
RUN namadac utils join-network --chain-id $CHAIN_ID --wasm-dir $WASM_DIR
RUN sed -i.bak "s#^log_level *=.*#log_level = \"debug\"#" $CONFIG_DIR
RUN sed -i.bak "s#^laddr = \"tcp://127.0.0.1:26657\"#laddr = \"tcp://0.0.0.0:26657\"#" $CONFIG_DIR
ARG PEERS
ENV PEERS=${PEERS}
RUN echo "Configuring persistent_peers: $PEERS"
RUN sed -i.bak "s#^persistent_peers *=.*#persistent_peers = \"$PEERS\"#" $CONFIG_DIR
#RUN sed -ie "s#^seeds *=.*#seeds = \"tcp://836a25b5c465352adf17430135888689b9a0f1d6@namada-seed-housefire.mandragora.io:21656\"#" $CONFIG_DIR
#ADD addrbook.json $DATA_DIR/cometbft/config/addrbook.json

# Install control script
ADD deno.json deno.lock deps.js /
RUN deno cache --import-map=/deno.json --lock=/deno.lock deps.js
ADD lib.js services.js control.js control_status.js control_in.js control_node.js control_out.js control_out_proxy.js /
ENTRYPOINT [ "/bin/bash" ]
CMD [ "-c", "/control.js" ]
8 changes: 4 additions & 4 deletions control_out_proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ async function main () {
HOST: '0.0.0.0',
PORT: '25552',
CONFIG: [
['26666', '65.108.193.224:26656' ].join('='),
['26667', '74.50.93.254:26656' ].join('='),
['26668', '64.118.250.82:46656' ].join('='),
['26669', '138.197.133.118:26656'].join('='),
['26666', '65.108.193.224:26656' ].join('='), // namada-peer.mandragora.io (11e59922aa59989811fdb3bc1e22b85cbbe5a14e)
['26667', '74.50.93.254:26656' ].join('='), // tududes #1 (05309c2cce2d163027a47c662066907e89cd6b99)
['26668', '64.118.250.82:46656' ].join('='), // tududes #2 (2bf5cdd25975c239e8feb68153d69c5eec004fdb)
['26669', '138.197.133.118:26656'].join('='), // tududes #3 (75825cae136729aaf519ad62684b9b796c5593fd)
].join(',')
})
run(HOST, PORT, parseConfig(CONFIG))
Expand Down

0 comments on commit 8492a12

Please sign in to comment.