-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·69 lines (60 loc) · 2.19 KB
/
start.sh
File metadata and controls
executable file
·69 lines (60 loc) · 2.19 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
#!/bin/bash
# Capx Mainnet Node Startup Script
# Supports both docker-compose and legacy docker run methods
source variables.sh
# Check if .env file exists for docker-compose method
if [ -f .env ]; then
export $(cat .env | grep -v '#' | sed 's/\r$//' | awk '/=/ {print $1}' )
fi
# Prefer docker-compose if available and configured
if [ -f docker-compose.yml ] && [ ! -z "$ETH_RPC_URL" ] && [ ! -z "$BEACON_RPC_URL" ]; then
echo "Starting Capx Mainnet node using docker-compose..."
docker-compose up -d
echo "Node started. View logs with: docker-compose logs -f capx-mainnet-node"
exit 0
fi
# Fall back to legacy method
echo "Starting Capx Mainnet node using legacy method..."
# Check for required environment variables
if [ -z "$ETH_RPC_URL" ]; then
echo "ERROR: ETH_RPC_URL not set. Please configure it in .env or variables.sh"
exit 1
fi
if [ -z "$BEACON_RPC_URL" ]; then
echo "ERROR: BEACON_RPC_URL not set. Please configure it in .env or variables.sh"
exit 1
fi
if [ -d $PERSISTENCE ]; then
echo "Directory exists: $(pwd)/$PERSISTENCE"
else
echo "Directory does not exist: $(pwd)/$PERSISTENCE"
echo "Creating..."
mkdir $PERSISTENCE
fi
CONTAINER_ID=$(docker container ls -f name=$FN_CONTAINER_NAME --all -q)
if [ -z $CONTAINER_ID ]; then
echo "Container for $FN_CONTAINER_NAME does not exist"
echo "Creating..."
docker run \
--detach \
--restart always \
--name $FN_CONTAINER_NAME \
--user $(id -u):$(id -g) \
--entrypoint /usr/local/bin/nitro \
--volume $(pwd)/$PERSISTENCE:/home/user/.arbitrum \
--volume $(pwd)/nodeConfig.json:/config/nodeConfig.json \
--publish $PORT_RPC:$PORT_RPC \
--publish $PORT_WS:$PORT_WS \
$DOCKER_REPO:$DOCKER_TAG \
--conf.file=/config/nodeConfig.json \
--execution.forwarding-target=$CAPX_WS_URL \
--node.feed.input.url=$CAPX_FEED_URL \
--node.data-availability.rest-aggregator.urls="$CAPX_DA_URL" \
--parent-chain.blob-client.beacon-url=$BEACON_RPC_URL \
--parent-chain.connection.url=$ETH_RPC_URL
else
echo "Container for $FN_CONTAINER_NAME exists: $CONTAINER_ID"
echo "Restarting..."
docker start $CONTAINER_ID
fi
echo "Node started. View logs with: docker logs -f $FN_CONTAINER_NAME"