forked from graphprotocol/graph-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·42 lines (30 loc) · 985 Bytes
/
setup.sh
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
#!/usr/bin/env bash
set -e
if ! which docker 2>&1 > /dev/null; then
echo "Please install 'docker' first"
exit 1
fi
if ! which docker-compose 2>&1 > /dev/null; then
echo "Please install 'docker-compose' first"
exit 1
fi
if ! which jq 2>&1 > /dev/null; then
echo "Please install 'jq' first"
exit 1
fi
# Create the graph-node container
docker-compose up --no-start graph-node
# Start graph-node so we can inspect it
docker-compose start graph-node
# Identify the container ID
CONTAINER_ID=$(docker container ls | grep graph-node | cut -d' ' -f1)
# Inspect the container to identify the host IP address
HOST_IP=$(docker inspect "$CONTAINER_ID" | jq -r .[0].NetworkSettings.Networks[].Gateway)
echo "Host IP: $HOST_IP"
# Inject the host IP into docker-compose.yml
sed -i -e "s/host.docker.internal/$HOST_IP/g" docker-compose.yml
function stop_graph_node {
# Ensure graph-node is stopped
docker-compose stop graph-node
}
trap stop_graph_node EXIT