Browse Source

fix for #14

umbrel
kenshin-samourai 6 years ago
parent
commit
108c9b65dd
  1. 5
      docker/my-dojo/docker-compose.yaml
  2. 42
      docker/my-dojo/dojo.sh
  3. 5
      docker/my-dojo/overrides/bitcoind.install.yaml

5
docker/my-dojo/docker-compose.yaml

@ -19,10 +19,6 @@ services:
dojonet:
ipv4_address: 172.28.1.1
bitcoind:
image: "samouraiwallet/dojo-bitcoind:${DOJO_BITCOIND_VERSION_TAG}"
container_name: bitcoind
node:
image: "samouraiwallet/dojo-nodejs:${DOJO_NODEJS_VERSION_TAG}"
container_name: nodejs
@ -42,7 +38,6 @@ services:
volumes:
- data-nodejs:/data
depends_on:
- bitcoind
- db
networks:
dojonet:

42
docker/my-dojo/dojo.sh

@ -13,22 +13,29 @@ source_file "$DIR/conf/docker-bitcoind.conf"
source_file "$DIR/.env"
# Docker up
docker_up() {
# Select YAML files
select_yaml_files() {
source_file "$DIR/conf/docker-bitcoind.conf"
overrides=""
yamlFiles="-f $DIR/docker-compose.yaml"
if [ "$BITCOIND_INSTALL" == "on" ]; then
overrides="-f $DIR/overrides/bitcoind.install.yaml"
yamlFiles="$yamlFiles -f $DIR/overrides/bitcoind.install.yaml"
if [ "$BITCOIND_RPC_EXTERNAL" == "on" ]; then
overrides="$overrides -f $DIR/overrides/bitcoind.rpc.expose.yaml"
yamlFiles="$yamlFiles -f $DIR/overrides/bitcoind.rpc.expose.yaml"
export BITCOIND_RPC_EXTERNAL_IP
fi
fi
eval "docker-compose -f $DIR/docker-compose.yaml $overrides up $1 -d"
# Return yamlFiles
echo "$yamlFiles"
}
# Docker up
docker_up() {
yamlFiles=$(select_yaml_files)
eval "docker-compose $yamlFiles up $1 -d"
}
# Start
@ -54,7 +61,8 @@ stop() {
sleep 15s
fi
docker-compose down
yamlFiles=$(select_yaml_files)
eval "docker-compose $yamlFiles down"
}
# Restart dojo
@ -79,14 +87,16 @@ install() {
if [ $launchInstall -eq 0 ]; then
init_config_files
docker_up --remove-orphans
docker-compose logs --tail=0 --follow
logs
fi
}
# Delete everything
uninstall() {
docker-compose rm
docker-compose down
yamlFiles=$(select_yaml_files)
eval "docker-compose $yamlFiles down"
docker image rm samouraiwallet/dojo-db:"$DOJO_DB_VERSION_TAG"
docker image rm samouraiwallet/dojo-bitcoind:"$DOJO_BITCOIND_VERSION_TAG"
@ -131,12 +141,13 @@ upgrade() {
fi
if [ $launchUpgrade -eq 0 ]; then
yamlFiles=$(select_yaml_files)
update_config_files
cleanup
docker-compose build --no-cache
eval "docker-compose $yamlFiles build --no-cache"
docker_up --remove-orphans
update_dojo_db
docker-compose logs --tail=0 --follow
logs
fi
}
@ -169,6 +180,8 @@ logs_node() {
}
logs() {
source_file "$DIR/conf/docker-bitcoind.conf"
case $1 in
db )
docker-compose logs --tail=50 --follow db
@ -187,7 +200,12 @@ logs() {
logs_node $1 $2 $3
;;
* )
docker-compose logs --tail=0 --follow
yamlFiles=$(select_yaml_files)
services="nginx node tor db"
if [ "$BITCOIND_INSTALL" == "on" ]; then
services="$services bitcoind"
fi
eval "docker-compose $yamlFiles logs --tail=0 --follow $services"
;;
esac
}

5
docker/my-dojo/overrides/bitcoind.install.yaml

@ -26,5 +26,10 @@ services:
dojonet:
ipv4_address: 172.28.1.5
node:
depends_on:
- bitcoind
- db
volumes:
data-bitcoind:

Loading…
Cancel
Save