Add code to run bootstrap server
This commit is contained in:
parent
7ed76d9e3e
commit
d4c6db4997
10
docker-compose/docker-compose.yml
Normal file
10
docker-compose/docker-compose.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
version: "3"
|
||||
name: pybitmessage
|
||||
services:
|
||||
bootstrap:
|
||||
image: pybitmessage/bootstrap:latest
|
||||
build: ..
|
||||
ports:
|
||||
- 127.0.0.1::8444
|
||||
deploy:
|
||||
replicas: $THREADS
|
24
docker-compose/start-loadbalancer.sh
Executable file
24
docker-compose/start-loadbalancer.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
apt -y install curl jq ipvsadm
|
||||
|
||||
EXTIP=$(curl -s telnetmyip.com|jq -r .ip)
|
||||
THREADS=$(nproc --all)
|
||||
echo "THREADS=$THREADS" > .env
|
||||
|
||||
ipvsadm -C
|
||||
ipvsadm -A -t ${EXTIP}:8444 -s rr
|
||||
ipvsadm -A -t ${EXTIP}:8080 -s rr
|
||||
|
||||
docker compose up -d
|
||||
|
||||
for i in `seq 1 $THREADS`; do
|
||||
cont="pybitmessage-bootstrap-${i}"
|
||||
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $cont 2>/dev/null)
|
||||
[ -z "$IP" ] && continue
|
||||
echo "Adding $IP"
|
||||
ipvsadm -a -t ${EXTIP}:8444 -r ${IP}:8444 -m
|
||||
ipvsadm -a -t ${EXTIP}:8080 -r ${IP}:8444 -m
|
||||
done
|
||||
|
||||
ipvsadm -l
|
|
@ -3,13 +3,15 @@
|
|||
# Setup the environment for docker container
|
||||
APIUSER=${USER:-api}
|
||||
APIPASS=${PASSWORD:-$(tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo)}
|
||||
IP=$(hostname -i)
|
||||
|
||||
echo "\napiusername: $APIUSER\napipassword: $APIPASS"
|
||||
|
||||
sed -i -e "s|\(apiinterface = \).*|\10\.0\.0\.0|g" \
|
||||
sed -i -e "s|\(apiinterface = \).*|\1$IP|g" \
|
||||
-e "s|\(apivariant = \).*|\1json|g" \
|
||||
-e "s|\(apiusername = \).*|\1$APIUSER|g" \
|
||||
-e "s|\(apipassword = \).*|\1$APIPASS|g" \
|
||||
-e "s|\(bind = \).*|\1$IP|g" \
|
||||
-e "s|apinotifypath = .*||g" ${BITMESSAGE_HOME}/keys.dat
|
||||
|
||||
# Run
|
||||
|
|
Reference in New Issue
Block a user