Skip to content

Commit

Permalink
Merge pull request #15 from Samourai-Wallet/fix_issue_14
Browse files Browse the repository at this point in the history
fix issue #14
  • Loading branch information
kenshin-samourai committed Jun 21, 2019
2 parents 392cad0 + 681ae26 commit 7e5aa17
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
5 changes: 0 additions & 5 deletions docker/my-dojo/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,7 +38,6 @@ services:
volumes:
- data-nodejs:/data
depends_on:
- bitcoind
- db
networks:
dojonet:
Expand Down
42 changes: 30 additions & 12 deletions docker/my-dojo/dojo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -54,7 +61,8 @@ stop() {
sleep 15s
fi

docker-compose down
yamlFiles=$(select_yaml_files)
eval "docker-compose $yamlFiles down"
}

# Restart dojo
Expand All @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions docker/my-dojo/overrides/bitcoind.install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ services:
dojonet:
ipv4_address: 172.28.1.5

node:
depends_on:
- bitcoind

volumes:
data-bitcoind:

0 comments on commit 7e5aa17

Please sign in to comment.