Skip to content

Commit

Permalink
clean up control services
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed Nov 22, 2024
1 parent e071222 commit 3685754
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 182 deletions.
12 changes: 6 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ steps:
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@green-node-out:26666,tcp://05309c2cce2d163027a47c662066907e89cd6b99@green-node-out:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@green-node-out:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@green-node-out:26669 .
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@green-sync-proxy:26666,tcp://05309c2cce2d163027a47c662066907e89cd6b99@green-sync-proxy:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@green-sync-proxy:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@green-sync-proxy: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@blue-node-out:26666,tcp://05309c2cce2d163027a47c662066907e89cd6b99@blue-node-out:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@blue-node-out:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@blue-node-out:26669 .
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@blue-sync-proxy:26666,tcp://05309c2cce2d163027a47c662066907e89cd6b99@blue-sync-proxy:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@blue-sync-proxy:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@blue-sync-proxy:26669 .
# Image that connects to Mandragora peer directly
Expand All @@ -77,14 +77,14 @@ steps:
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@green-node-out:26666 .
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@green-sync-proxy: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@blue-node-out:26666 .
--build-arg PEERS=tcp://11e59922aa59989811fdb3bc1e22b85cbbe5a14e@blue-sync-proxy:26666 .
# Image that connects to Tududes peers directly
Expand All @@ -99,11 +99,11 @@ steps:
- echo "Building $VARIANT"
- >+
docker build $PARAMETERIZED -t "$VARIANT"
--build-arg PEERS=tcp://05309c2cce2d163027a47c662066907e89cd6b99@green-node-out:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@green-node-out:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@green-node-out:26669 .
--build-arg PEERS=tcp://05309c2cce2d163027a47c662066907e89cd6b99@green-sync-proxy:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@green-sync-proxy:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@green-sync-proxy: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@blue-node-out:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@blue-node-out:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@blue-node-out:26669 .
--build-arg PEERS=tcp://05309c2cce2d163027a47c662066907e89cd6b99@blue-sync-proxy:26667,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@blue-sync-proxy:26668,tcp://75825cae136729aaf519ad62684b9b796c5593fd@blue-sync-proxy:26669 .
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ RUN sed -i.bak "s#^laddr = \"tcp://127.0.0.1:26657\"#laddr = \"tcp://0.0.0.0:266
# 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 /
ADD lib.js services.js status.js rpc_proxy.js control_node.js sync_proxy.js /
ENTRYPOINT [ "/bin/bash" ]
CMD [ "-c", "/control.js" ]
2 changes: 1 addition & 1 deletion Dockerfile.parameterized
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ RUN sed -i.bak "s#^persistent_peers *=.*#persistent_peers = \"$PEERS\"#" $CONFIG
# 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 /
ADD lib.js services.js status.js rpc_proxy.js control_node.js sync_proxy.js /
ENTRYPOINT [ "/bin/bash" ]
CMD [ "-c", "/control.js" ]
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@ available during sync (see [`anoma/namada#3810`](https://github.com/anoma/namada
<td><code>control_node.js</code></td>
<td>⚠️ <b>Internal only</b></td>
<td>No</td>
<td>Manages the Namada node. <b>MUST run in isolated network (no Internet access except through <code>node-in</code> and <code>node-out</code>).</b>
Parses node log; when epoch increments, <code>node</code> messages <code>node-out</code>
<td>Manages the Namada node. <b>MUST run in isolated network (no Internet access except through <code>rpc-proxy</code> and <code>sync-proxy</code>).</b>
Parses node log; when epoch increments, <code>node</code> messages <code>sync-proxy</code>
to pause the sync.</td>
</tr>
<tr>
<td><code>node-in</code></td>
<td><code>control_in.js</code></td>
<td><code>rpc-proxy</code></td>
<td><code>rpc_proxy.js</code></td>
<td>Internal, External</td>
<td>⚠️ <b>Yes</b></td>
<td>Allows connections from indexer to node.</td>
</tr>
<tr>
<td><code>node-out</code></td>
<td><code>control_out.js</code></td>
<td><code>sync-proxy</code></td>
<td><code>sync_proxy.js</code></td>
<td>Internal, External</td>
<td>⚠️ <b>Yes</b></td>
<td>Allows connections from node to peers. By pausing the contained proxy,
node sync is paused, so that the indexer can catch up.</td>
</tr>
<tr>
<td><code>node-status</code></td>
<td><code>control_status.js</code></td>
<td><code>status.js</code></td>
<td>Internal, External</td>
<td>No</td>
<td>Manages the other three. When indexing has caught up, Undexer tells <code>node-status</code>
to resume sync, and <code>node-status</code> tells <code>node-out</code> to restart the proxy.</td>
to resume sync, and <code>node-status</code> tells <code>sync-proxy</code> to restart the proxy.</td>
</tr>
</tbody>
</table>

Note that `node-in` and `node-out` require an init process in the container
Note that `rpc-proxy` and `sync-proxy` require an init process in the container
(`docker run --init`, or `init: true` in `docker-compose.yml`) so that Docker
is able to reap the zombie processes that are created when the internal
`simpleproxy` is killed by the managing script.
Expand Down Expand Up @@ -91,9 +91,9 @@ services:
image: ghcr.io/hackbg/undexer:v4
restart: unless-stopped
depends_on: { postgres: { condition: service_healthy } }
environment: { RPC_URL: "http://node-in:26657" }
node-in:
entrypoint: /control_in.js
environment: { RPC_URL: "http://rpc-proxy:26657" }
rpc-proxy:
entrypoint: /rpc_proxy.js
networks: [ external, internal ]
image: ghcr.io/hackbg/namada-for-undexer:main
init: true
Expand All @@ -103,8 +103,8 @@ services:
networks: [ internal ]
image: ghcr.io/hackbg/namada-for-undexer:main
restart: unless-stopped
node-out:
entrypoint: /control_out.js
sync-proxy:
entrypoint: /sync_proxy.js
networks: [ external, internal ]
image: ghcr.io/hackbg/namada-for-undexer:main
init: true
Expand Down
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pprof_laddr = ""
laddr = "tcp://0.0.0.0:26656"
external_address = ""
seeds = ""
persistent_peers = "tcp://05309c2cce2d163027a47c662066907e89cd6b99@node-out:26656,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@node-out:26657,tcp://75825cae136729aaf519ad62684b9b796c5593fd@node-out:26658"
persistent_peers = "tcp://05309c2cce2d163027a47c662066907e89cd6b99@sync-proxy:26656,tcp://2bf5cdd25975c239e8feb68153d69c5eec004fdb@sync-proxy:26657,tcp://75825cae136729aaf519ad62684b9b796c5593fd@sync-proxy:26658"
upnp = false
addr_book_file = "config/addrbook.json"
addr_book_strict = false
Expand Down
92 changes: 0 additions & 92 deletions control.js

This file was deleted.

2 changes: 1 addition & 1 deletion control_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function main () {
PORT: "25551",
NAMADA: "namadan",
CHAIN_ID: "namada-dryrun.abaaeaf7b78cb3ac",
NODE_OUT: "http://node-out:25552"
NODE_OUT: "http://sync-proxy:25552"
})
const service = new NamadaService(NAMADA, CHAIN_ID)
service.events.addEventListener('request-pause', async () => {
Expand Down
28 changes: 0 additions & 28 deletions control_out.js

This file was deleted.

36 changes: 0 additions & 36 deletions control_out_multi.js

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions control_status.js → status.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function main () {
const { HOST, PORT, IN, NODE, OUT } = environment({
HOST: "0.0.0.0",
PORT: "25555",
IN: "http://node-in:25550",
NODE: "http://node:25551",
OUT: "http://node-out:25552",
IN: "http://rpc-proxy:25550",
OUT: "http://sync-proxy:25552",
})
const checkStatus = url => fetchJSON(url)
.then(x=>({running: x}))
Expand Down
File renamed without changes.

0 comments on commit 3685754

Please sign in to comment.