Browse Source

Merge pull request #119 from Samourai-Wallet/feat_mydojo_builds_nocache

improve performances of dojo upgrades
enh_mydojo_install
kenshin samourai 5 years ago
committed by GitHub
parent
commit
0266f8f156
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .dockerignore
  2. 74
      docker/my-dojo/dojo.sh

3
.dockerignore

@ -1,3 +1,4 @@
node_modules
.git
private-tests
private-tests
docker/my-dojo/conf

74
docker/my-dojo/dojo.sh

@ -129,18 +129,37 @@ install() {
source "$DIR/install/install-scripts.sh"
launchInstall=1
auto=1
noLog=1
if [ "$1" = "--auto" ]; then
# Extract install options from arguments
if [ $# -gt 0 ]; then
for option in $@
do
case "$option" in
--auto ) auto=0 ;;
--nolog ) noLog=0 ;;
* ) break ;;
esac
done
fi
# Confirmation
if [ $auto -eq 0 ]; then
launchInstall=0
else
get_confirmation
launchInstall=$?
fi
# Installation
if [ $launchInstall -eq 0 ]; then
# Initialize the config files
init_config_files
# Build and start Dojo
docker_up --remove-orphans
if [ "$1" != "--nolog" ]; then
# Display the logs
if [ $noLog -eq 1 ]; then
logs
fi
fi
@ -191,24 +210,54 @@ upgrade() {
source "$DIR/install/upgrade-scripts.sh"
launchUpgrade=1
auto=1
noLog=1
noCache=1
if [ "$1" = "--auto" ]; then
# Extract upgrade options from arguments
if [ $# -gt 0 ]; then
for option in $@
do
case "$option" in
--auto ) auto=0 ;;
--nolog ) noLog=0 ;;
--nocache ) noCache=0 ;;
* ) break ;;
esac
done
fi
# Confirmation
if [ $auto -eq 0 ]; then
launchUpgrade=0
else
get_confirmation
launchUpgrade=$?
fi
# Upgrade Dojo
if [ $launchUpgrade -eq 0 ]; then
# Select yaml files
yamlFiles=$(select_yaml_files)
# Update config files
update_config_files
# Cleanup
cleanup
# Load env vars for compose files
source_file "$DIR/conf/docker-bitcoind.conf"
export BITCOIND_RPC_EXTERNAL_IP
eval "docker-compose $yamlFiles build --no-cache"
# Rebuild the images (with or without cache)
if [ $noCache -eq 0 ]; then
eval "docker-compose $yamlFiles build --no-cache"
else
eval "docker-compose $yamlFiles build"
fi
# Start Dojo
docker_up --remove-orphans
# Update the database
update_dojo_db
if [ "$1" != "--nolog" ]; then
# Display the logs
if [ $noLog -eq 1 ]; then
logs
fi
fi
@ -324,6 +373,9 @@ help() {
echo " "
echo " install Install your dojo."
echo " "
echo " Available options:"
echo " --nolog : do not display the logs after Dojo has been laucnhed."
echo " "
echo " logs [module] [options] Display the logs of your dojo. Use CTRL+C to stop the logs."
echo " "
echo " Available modules:"
@ -353,7 +405,11 @@ help() {
echo " "
echo " uninstall Delete your dojo. Be careful! This command will also remove all data."
echo " "
echo " upgrade Upgrade your dojo."
echo " upgrade [options] Upgrade your dojo."
echo " "
echo " Available options:"
echo " --nolog : do not display the logs after Dojo has been restarted."
echo " --nocache : rebuild the docker containers without reusing the cached layers."
echo " "
echo " version Display the version of dojo"
}
@ -400,7 +456,7 @@ case "$subcommand" in
clean
;;
install )
install $1
install "$@"
;;
logs )
module=$1; shift
@ -446,9 +502,9 @@ case "$subcommand" in
uninstall
;;
upgrade )
upgrade $1
upgrade "$@"
;;
version )
version
;;
esac
esac

Loading…
Cancel
Save