feat: Complete Podman stack setup with working services

- Fixed service dependencies (removed bootstrap dependency for runtime services)
- Added landing service for documentation site at root path
- Moved web-app to /app path, landing to / path
- Fixed permission issues with lowercase 'z' SELinux context
- Added kraiken-lib compilation in txn-bot container
- Fixed TypeScript build for kraiken-lib with proper volumes
- Updated entrypoint scripts to handle npm installs properly
- Added locale fixes to Containerfiles
- Changed Caddy port from 80 to 8081 for external access
- Updated Docs link to point to local landing page

All services now working:
- Landing page at /
- Web app at /app/
- GraphQL at /graphql
- Transaction bot at /txn
- Anvil RPC at /rpc/anvil

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root 2025-09-24 12:10:41 +00:00
parent 18d63e14d7
commit ea27fcb722
10 changed files with 135 additions and 32 deletions

View file

@ -1,4 +1,7 @@
:80 { :80 {
route /app* {
reverse_proxy webapp:5173
}
route /graphql* { route /graphql* {
reverse_proxy ponder:42069 reverse_proxy ponder:42069
} }
@ -6,10 +9,12 @@
reverse_proxy ponder:42069 reverse_proxy ponder:42069
} }
route /rpc/anvil* { route /rpc/anvil* {
uri strip_prefix /rpc/anvil
reverse_proxy anvil:8545 reverse_proxy anvil:8545
} }
route /txn* { route /txn* {
uri strip_prefix /txn
reverse_proxy txn-bot:43069 reverse_proxy txn-bot:43069
} }
reverse_proxy frontend:5173 reverse_proxy landing:5174
} }

View file

@ -115,8 +115,14 @@ grant_recenter_access() {
} }
call_recenter() { call_recenter() {
log "Calling recenter()" local recenter_pk="$DEPLOYER_PK"
cast send --rpc-url "$ANVIL_RPC" --private-key "$DEPLOYER_PK" \ local recenter_addr="$DEPLOYER_ADDR"
if [[ -n "$TXNBOT_ADDRESS" ]]; then
recenter_pk="$TXNBOT_PRIVATE_KEY"
recenter_addr="$TXNBOT_ADDRESS"
fi
log "Calling recenter() via $recenter_addr"
cast send --rpc-url "$ANVIL_RPC" --private-key "$recenter_pk" \
"$LIQUIDITY_MANAGER" "recenter()" >>"$SETUP_LOG" 2>&1 "$LIQUIDITY_MANAGER" "recenter()" >>"$SETUP_LOG" 2>&1
} }

View file

@ -17,6 +17,9 @@ RUN apt-get update \
RUN useradd -m -u 1000 foundry RUN useradd -m -u 1000 foundry
USER foundry USER foundry
WORKDIR /home/foundry WORKDIR /home/foundry
ENV SHELL=/bin/bash
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN curl -L https://foundry.paradigm.xyz | bash \ RUN curl -L https://foundry.paradigm.xyz | bash \
&& /home/foundry/.foundry/bin/foundryup && /home/foundry/.foundry/bin/foundryup

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR=/workspace
LANDING_DIR=$ROOT_DIR/landing
cd "$LANDING_DIR"
echo "[landing-entrypoint] Installing dependencies..."
npm install --no-save --loglevel error 2>&1 || {
echo "[landing-entrypoint] npm install failed, trying with --force"
npm install --force --no-save --loglevel error
}
export CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING:-1}
export HOST=0.0.0.0
export PORT=${PORT:-5174}
exec npm run dev -- --host 0.0.0.0 --port 5174

View file

@ -6,6 +6,8 @@ RUN apt-get update \
USER node USER node
WORKDIR /workspace WORKDIR /workspace
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PATH="/workspace/node_modules/.bin:${PATH}" ENV PATH="/workspace/node_modules/.bin:${PATH}"
ENTRYPOINT ["dumb-init", "--"] ENTRYPOINT ["dumb-init", "--"]

View file

@ -11,9 +11,11 @@ while [[ ! -f "$CONTRACT_ENV" ]]; do
done done
cd "$PONDER_WORKDIR" cd "$PONDER_WORKDIR"
if [[ ! -d node_modules ]]; then echo "[ponder-entrypoint] Installing dependencies..."
npm install npm install --no-save --loglevel error 2>&1 || {
fi echo "[ponder-entrypoint] npm install failed, trying with --force"
npm install --force --no-save --loglevel error
}
export CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING:-1} export CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING:-1}
export HOST=0.0.0.0 export HOST=0.0.0.0

View file

@ -4,16 +4,59 @@ set -euo pipefail
ROOT_DIR=/workspace ROOT_DIR=/workspace
TXNBOT_ENV_FILE=$ROOT_DIR/tmp/podman/txnBot.env TXNBOT_ENV_FILE=$ROOT_DIR/tmp/podman/txnBot.env
BOT_DIR=$ROOT_DIR/services/txnBot BOT_DIR=$ROOT_DIR/services/txnBot
KRAIKEN_LIB_DIR=$ROOT_DIR/kraiken-lib
while [[ ! -f "$TXNBOT_ENV_FILE" ]]; do while [[ ! -f "$TXNBOT_ENV_FILE" ]]; do
echo "[txn-bot-entrypoint] waiting for env file" echo "[txn-bot-entrypoint] waiting for env file"
sleep 2 sleep 2
done done
cd "$BOT_DIR" # Build kraiken-lib first
echo "[txn-bot-entrypoint] Building kraiken-lib..."
cd "$KRAIKEN_LIB_DIR"
# Install dependencies if needed
if [[ ! -d node_modules ]]; then if [[ ! -d node_modules ]]; then
npm install echo "[txn-bot-entrypoint] Installing kraiken-lib dependencies..."
npm install --loglevel error
fi fi
# Install TypeScript if not present
if [[ ! -f node_modules/.bin/tsc ]]; then
echo "[txn-bot-entrypoint] Installing TypeScript..."
npm install --loglevel error typescript
fi
# Build TypeScript files (dist is now a volume, writable by node user)
echo "[txn-bot-entrypoint] Compiling TypeScript..."
if [[ ! -f dist/index.js ]]; then
echo "[txn-bot-entrypoint] Running tsc to compile kraiken-lib..."
./node_modules/.bin/tsc \
--outDir dist \
--declaration \
--module commonjs \
--target es2020 \
--skipLibCheck \
--esModuleInterop \
--allowSyntheticDefaultImports \
--resolveJsonModule \
src/index.ts src/helpers.ts src/subgraph.ts src/__generated__/graphql.ts 2>&1 | head -20 || {
echo "[txn-bot-entrypoint] TypeScript compilation had some issues, checking if files were created..."
}
# Verify the main file exists
if [[ ! -f dist/index.js ]]; then
echo "[txn-bot-entrypoint] ERROR: Failed to compile kraiken-lib"
exit 1
fi
fi
cd "$BOT_DIR"
echo "[txn-bot-entrypoint] Installing txn-bot dependencies..."
npm install --no-save --loglevel error 2>&1 || {
echo "[txn-bot-entrypoint] npm install failed, trying with --force"
npm install --force --no-save --loglevel error
}
export TXN_BOT_ENV_FILE="$TXNBOT_ENV_FILE" export TXN_BOT_ENV_FILE="$TXNBOT_ENV_FILE"
exec npm run start exec npm run start

View file

@ -15,18 +15,20 @@ done
source "$CONTRACT_ENV" source "$CONTRACT_ENV"
cd "$APP_DIR" cd "$APP_DIR"
if [[ ! -d node_modules ]]; then echo "[frontend-entrypoint] Installing dependencies..."
npm install npm install --no-save --loglevel error 2>&1 || {
fi echo "[frontend-entrypoint] npm install failed, trying with --force"
npm install --force --no-save --loglevel error
}
export VITE_DEFAULT_CHAIN_ID=${VITE_DEFAULT_CHAIN_ID:-31337} export VITE_DEFAULT_CHAIN_ID=${VITE_DEFAULT_CHAIN_ID:-31337}
export VITE_LOCAL_RPC_URL=${VITE_LOCAL_RPC_URL:-/rpc/anvil} export VITE_LOCAL_RPC_URL=${VITE_LOCAL_RPC_URL:-/app/rpc/anvil}
export VITE_LOCAL_RPC_PROXY_TARGET=${VITE_LOCAL_RPC_PROXY_TARGET:-http://anvil:8545} export VITE_LOCAL_RPC_PROXY_TARGET=${VITE_LOCAL_RPC_PROXY_TARGET:-http://anvil:8545}
export VITE_KRAIKEN_ADDRESS=$KRAIKEN export VITE_KRAIKEN_ADDRESS=$KRAIKEN
export VITE_STAKE_ADDRESS=$STAKE export VITE_STAKE_ADDRESS=$STAKE
export VITE_SWAP_ROUTER=$SWAP_ROUTER export VITE_SWAP_ROUTER=$SWAP_ROUTER
export VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK=${VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK:-/graphql} export VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK=${VITE_PONDER_BASE_SEPOLIA_LOCAL_FORK:-/app/graphql}
export VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK=${VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK:-/txn} export VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK=${VITE_TXNBOT_BASE_SEPOLIA_LOCAL_FORK:-/app/txn}
export CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING:-1} export CHOKIDAR_USEPOLLING=${CHOKIDAR_USEPOLLING:-1}
exec npm run dev -- --host 0.0.0.0 --port 5173 exec npm run dev -- --host 0.0.0.0 --port 5173 --base /app/

View file

@ -32,70 +32,92 @@ services:
dockerfile: containers/node-dev.Containerfile dockerfile: containers/node-dev.Containerfile
entrypoint: ["/workspace/containers/ponder-dev-entrypoint.sh"] entrypoint: ["/workspace/containers/ponder-dev-entrypoint.sh"]
volumes: volumes:
- .:/workspace:Z - .:/workspace:z
- ponder-node-modules:/workspace/services/ponder/node_modules - ponder-node-modules:/workspace/services/ponder/node_modules
working_dir: /workspace working_dir: /workspace
environment: environment:
- CHOKIDAR_USEPOLLING=1 - CHOKIDAR_USEPOLLING=1
depends_on: depends_on:
bootstrap: - anvil
condition: service_completed_successfully
expose: expose:
- "42069" - "42069"
restart: unless-stopped restart: unless-stopped
frontend: webapp:
build: build:
context: . context: .
dockerfile: containers/node-dev.Containerfile dockerfile: containers/node-dev.Containerfile
entrypoint: ["/workspace/containers/frontend-dev-entrypoint.sh"] entrypoint: ["/workspace/containers/webapp-dev-entrypoint.sh"]
volumes: volumes:
- .:/workspace:Z - .:/workspace:z
- frontend-node-modules:/workspace/web-app/node_modules - webapp-node-modules:/workspace/web-app/node_modules
working_dir: /workspace working_dir: /workspace
environment: environment:
- CHOKIDAR_USEPOLLING=1 - CHOKIDAR_USEPOLLING=1
depends_on: depends_on:
bootstrap: - anvil
condition: service_completed_successfully
expose: expose:
- "5173" - "5173"
restart: unless-stopped restart: unless-stopped
landing:
build:
context: .
dockerfile: containers/node-dev.Containerfile
entrypoint: ["/workspace/containers/landing-dev-entrypoint.sh"]
volumes:
- .:/workspace:z
- landing-node-modules:/workspace/landing/node_modules
working_dir: /workspace
environment:
- CHOKIDAR_USEPOLLING=1
depends_on:
- anvil
expose:
- "5174"
restart: unless-stopped
txn-bot: txn-bot:
build: build:
context: . context: .
dockerfile: containers/node-dev.Containerfile dockerfile: containers/node-dev.Containerfile
entrypoint: ["/workspace/containers/txn-bot-entrypoint.sh"] entrypoint: ["/workspace/containers/txn-bot-entrypoint.sh"]
volumes: volumes:
- .:/workspace:Z - .:/workspace:z
- txn-node-modules:/workspace/services/txnBot/node_modules - txn-node-modules:/workspace/services/txnBot/node_modules
- kraiken-node-modules:/workspace/kraiken-lib/node_modules
- kraiken-dist:/workspace/kraiken-lib/dist
working_dir: /workspace working_dir: /workspace
depends_on: depends_on:
bootstrap: - anvil
condition: service_completed_successfully - ponder
expose: expose:
- "43069" - "43069"
restart: unless-stopped restart: unless-stopped
caddy: caddy:
image: caddy:2.8 image: docker.io/library/caddy:2.8
volumes: volumes:
- ./containers/Caddyfile:/etc/caddy/Caddyfile:Z - ./containers/Caddyfile:/etc/caddy/Caddyfile:Z
ports: ports:
- "80:80" - "0.0.0.0:8081:80"
depends_on: depends_on:
anvil: anvil:
condition: service_started condition: service_started
ponder: ponder:
condition: service_started condition: service_started
frontend: webapp:
condition: service_started
landing:
condition: service_started condition: service_started
txn-bot: txn-bot:
condition: service_started condition: service_started
restart: unless-stopped restart: unless-stopped
volumes: volumes:
frontend-node-modules: webapp-node-modules:
landing-node-modules:
ponder-node-modules: ponder-node-modules:
txn-node-modules: txn-node-modules:
kraiken-node-modules:
kraiken-dist:

View file

@ -17,7 +17,7 @@
<RouterLink v-for="navbarRoute in navbarRoutes" :key="navbarRoute.name" :to="navbarRoute.path"> <RouterLink v-for="navbarRoute in navbarRoutes" :key="navbarRoute.name" :to="navbarRoute.path">
{{ navbarRoute.title }} {{ navbarRoute.title }}
</RouterLink> </RouterLink>
<a href="https://emberspirit007.github.io/KraikenLanding/#/docs/Introduction" target="_blank">Docs</a> <a href="/#/docs">Docs</a>
</nav> </nav>
<template v-if="!isMobile"> <template v-if="!isMobile">
<div class="vertical-line"></div> <div class="vertical-line"></div>