Skip to content

Commit 869cbcb

Browse files
authored
Fix: Docker compose exposes local node (#427)
1 parent 7adfdb5 commit 869cbcb

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ services:
3636
volumes:
3737
- "setup-data:/setup"
3838
- "node0-data:/root/.fetchd"
39-
39+
ports:
40+
- "26657:26657"
41+
- "26656:26656"
42+
- "1317:1317"
43+
- "9090:9090"
44+
4045
# networks:
4146
# localnet:
4247
# ipv4_address: 192.168.10.2
@@ -57,7 +62,6 @@ services:
5762
volumes:
5863
- "setup-data:/setup"
5964
- "node1-data:/root/.fetchd"
60-
6165
# networks:
6266
# localnet:
6367
# ipv4_address: 192.168.10.3

entrypoints/run-localnet-setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
FETCHD_CONFIG_ROOT = '/root/.fetchd/config'
1212
GENESIS_PATH = os.path.join(FETCHD_CONFIG_ROOT, 'genesis.json')
1313
GENTX_PATH = os.path.join(FETCHD_CONFIG_ROOT, 'gentx')
14-
14+
APP_TOML_PATH = os.path.join(FETCHD_CONFIG_ROOT, 'app.toml')
1515

1616
def create_genesis(chain_id: str):
1717
cmd = ['fetchd', 'init', 'setup-node', '--chain-id', chain_id]
1818
subprocess.check_call(cmd)
1919
replace_denom_cmd = ['sed', '-i', 's/stake/'+DENOM+'/g', GENESIS_PATH]
2020
subprocess.check_call(replace_denom_cmd)
21+
grpc_fix_cmd = ['sed','-i','s/localhost/0.0.0.0/', APP_TOML_PATH]
22+
subprocess.check_call(grpc_fix_cmd)
2123

2224
def get_validators():
2325
validators = set()

entrypoints/run-localnet.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ if [ ! -f /setup/genesis.json ]; then
6767
done
6868
fi
6969

70+
# ensure gRPC listens on 0.0.0.0, not localhost
71+
if [ -f "/root/.fetchd/config/app.toml" ]; then
72+
sed -i 's/localhost/0.0.0.0/g' /root/.fetchd/config/app.toml
73+
fi
74+
7075
# copy the generated genesis file
7176
cp /setup/genesis.json /root/.fetchd/config/genesis.json
7277

0 commit comments

Comments
 (0)