Browse Source

Merge pull request #11 from Samourai-Wallet/feat_mydojo_cleanup

clean-up
umbrel
kenshin samourai 6 years ago
committed by GitHub
parent
commit
5d55db6f4e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      doc/DOCKER_setup.md
  2. 27
      docker/my-dojo/dojo.sh
  3. 4
      docker/my-dojo/install/upgrade-scripts.sh

2
doc/DOCKER_setup.md

@ -163,6 +163,8 @@ Available commands:
bitcoin-cli Launch a bitcoin-cli console for interacting with bitcoind RPC API. bitcoin-cli Launch a bitcoin-cli console for interacting with bitcoind RPC API.
clean Free disk space by deleting docker dangling images and images of previous versions.
install Install your Dojo. install Install your Dojo.
logs [module] [options] Display the logs of your Dojo. Use CTRL+C to stop the logs. logs [module] [options] Display the logs of your Dojo. Use CTRL+C to stop the logs.

27
docker/my-dojo/dojo.sh

@ -12,7 +12,7 @@ source_file() {
source_file "$DIR/conf/docker-bitcoind.conf" source_file "$DIR/conf/docker-bitcoind.conf"
source_file "$DIR/.env" source_file "$DIR/.env"
# Docker up # Docker up
docker_up() { docker_up() {
source_file "$DIR/conf/docker-bitcoind.conf" source_file "$DIR/conf/docker-bitcoind.conf"
@ -97,6 +97,26 @@ uninstall() {
docker volume prune docker volume prune
} }
# Clean-up (remove old docker images)
del_images_for() {
# $1: image name
# $2: most recent version of the image (do not delete this one)
docker image ls | grep "$1" | sed "s/ \+/,/g" | cut -d"," -f2 | while read -r version ; do
if [ "$2" != "$version" ]; then
docker image rm "$1:$version"
fi
done
}
clean() {
docker image prune
del_images_for samouraiwallet/dojo-db "$DOJO_DB_VERSION_TAG"
del_images_for samouraiwallet/dojo-bitcoind "$DOJO_BITCOIND_VERSION_TAG"
del_images_for samouraiwallet/dojo-nodejs "$DOJO_NODEJS_VERSION_TAG"
del_images_for samouraiwallet/dojo-nginx "$DOJO_NGINX_VERSION_TAG"
del_images_for samouraiwallet/dojo-tor "$DOJO_TOR_VERSION_TAG"
}
# Upgrade # Upgrade
upgrade() { upgrade() {
source "$DIR/install/upgrade-scripts.sh" source "$DIR/install/upgrade-scripts.sh"
@ -183,6 +203,8 @@ help() {
echo " " echo " "
echo " bitcoin-cli Launch a bitcoin-cli console allowing to interact with your full node through its RPC API." echo " bitcoin-cli Launch a bitcoin-cli console allowing to interact with your full node through its RPC API."
echo " " echo " "
echo " clean Free disk space by deleting docker dangling images and images of previous versions."
echo " "
echo " install Install your dojo." echo " install Install your dojo."
echo " " echo " "
echo " logs [module] [options] Display the logs of your dojo. Use CTRL+C to stop the logs." echo " logs [module] [options] Display the logs of your dojo. Use CTRL+C to stop the logs."
@ -255,6 +277,9 @@ case "$subcommand" in
help ) help )
help help
;; ;;
clean )
clean
;;
install ) install )
install $1 install $1
;; ;;

4
docker/my-dojo/install/upgrade-scripts.sh

@ -61,5 +61,7 @@ cleanup() {
################# #################
# Remove deprecated bitcoin.conf file # Remove deprecated bitcoin.conf file
rm ./bitcoin/bitcoin.conf if [ -f ./bitcoin/bitcoin.conf ]; then
rm ./bitcoin/bitcoin.conf
fi
} }

Loading…
Cancel
Save