Added changes to entrypoint.sh for frontend to take in IP of backend container for RPC connection
This commit is contained in:
parent
a162ab19f3
commit
b7d99fcd08
29
README.md
29
README.md
@ -15,17 +15,20 @@ docker build -f Dockerfile -t vivekteega/blockbook:1.0.0 .
|
||||
|
||||
docker volume create blockbook
|
||||
|
||||
# Run backend in "it" mode
|
||||
docker run -it --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 vivekteega/blockbook:1.0.0 backend
|
||||
docker network create blockbook
|
||||
|
||||
# Run backend in daemon mode
|
||||
docker run -d --mount source=blockbook,target=/ -p 38366:38366 -p 8066:8066 vivekteega/blockbook:1.0.0 backend
|
||||
# Run backend in "it" mode for testing
|
||||
docker run -it --name blockbook-backend --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 --network=blockbook vivekteega/blockbook:1.0.0 backend
|
||||
|
||||
# Run frontend in "it" mode
|
||||
docker run -it --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 vivekteega/blockbook:1.0.0 frontend
|
||||
# Run backend in daemon mode for production
|
||||
docker run -d --name blockbook-backend --mount source=blockbook,target=/opt -p 38366:38366 -p 8066:8066 --network=blockbook vivekteega/blockbook:1.0.0 backend
|
||||
|
||||
# Run frontend in it mode
|
||||
docker run -d --mount source=blockbook,target=/ -p 9166:9166 -p 9066:9066 vivekteega/blockbook:1.0.0 frontend
|
||||
|
||||
# Run frontend in "it" mode for testing
|
||||
docker run -it --name blockbook-frontend --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 --network=blockbook vivekteega/blockbook:1.0.0 frontend 172.20.0.2
|
||||
|
||||
# Run frontend in daemon mode for production
|
||||
docker run -d --name blockbook-frontend --mount source=blockbook,target=/opt -p 9166:9166 -p 9066:9066 --network=blockbook vivekteega/blockbook:1.0.0 frontend 172.20.0.2
|
||||
```
|
||||
|
||||
## Building & running backend image
|
||||
@ -39,13 +42,3 @@ docker run -it --mount source=blockbook,target=/opt/coins -p vivekteega/blockboo
|
||||
|
||||
docker run -d --mount source=blockbook,target=/opt/coins -p 38366:38366 -p 8066:8066 vivekteega/blockbook-backend:1.0.0
|
||||
```
|
||||
|
||||
## Building & running frontend image
|
||||
|
||||
```
|
||||
docker build -t vivekteega/blockbook-frontend:1.0.0 -f Dockerfile_frontend .
|
||||
|
||||
docker run -it --mount source=blockbook,target=/opt/coins -p 9166:9166 -p 9066:9066 vivekteega/blockbook-frontend:1.0.0
|
||||
|
||||
docker run -d --mount source=blockbook,target=/opt/coins -p 9166:9166 -p 9066:9066 vivekteega/blockbook-frontend:1.0.0
|
||||
```
|
||||
|
||||
@ -1,9 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Function to update config file
|
||||
update_config_file() {
|
||||
local config_path=$1
|
||||
local new_ip=$2
|
||||
if [ -n "$new_ip" ]; then
|
||||
echo "Updating config file: $config_path with IP: $new_ip"
|
||||
# Replace IP address in the config file
|
||||
sed -i "s/127.0.0.1/$new_ip/g" "$config_path"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"frontend")
|
||||
echo "Running frontend command"
|
||||
if [ -z "$2" ]; then
|
||||
echo "Missing parameter: new_ip for frontend"
|
||||
exit 1
|
||||
fi
|
||||
new_ip=$2
|
||||
echo "Running frontend command with IP: $new_ip"
|
||||
update_config_file "/opt/coins/blockbook/flo/config/blockchaincfg.json" "$new_ip"
|
||||
cd /opt/coins/blockbook/flo
|
||||
exec /opt/coins/blockbook/flo/bin/blockbook -blockchaincfg=/opt/coins/blockbook/flo/config/blockchaincfg.json -datadir=/opt/coins/data/flo/blockbook/db -sync -internal=:9066 -public=:9166 -certfile=/opt/coins/blockbook/flo/cert/blockbook -explorer= -log_dir=/opt/coins/blockbook/flo/logs -dbcache=1073741824
|
||||
;;
|
||||
@ -14,7 +31,7 @@ case "$1" in
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $1"
|
||||
echo "Usage: $0 {frontend|backend}"
|
||||
echo "Usage: $0 {frontend new_ip|backend}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Loading…
Reference in New Issue
Block a user