Update Citadel CLI (#73)

* fix: show status of all containers

* feat: allow restarting individual services

* feat: add short form alias

* fix: remove short form alias

* fix: update help msg
This commit is contained in:
Philipp Walter 2022-07-24 16:28:30 +02:00 committed by GitHub
parent 1d06c3c33b
commit 2d5949b140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 14 deletions

View File

@ -56,9 +56,9 @@ if [[ "$command" = "status" ]]; then
echo
if $long; then
docker container ls --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"
docker container ls --all --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"
else
docker container ls --format "table {{.Names}}\t{{.Status}}"
docker container ls --all --format "table {{.Names}}\t{{.Status}}"
fi
if [[ $(pgrep -f karen) ]]; then
@ -140,24 +140,29 @@ if [[ "$command" = "stop" ]]; then
exit
fi
# Restart Citadel
# Restart Citadel or individual services
if [[ "$command" = "restart" ]]; then
shift
# TODO: enable restarting services
# restart Docker containers
if [ ! -z ${1+x} ]; then
echo "Too many arguments."
echo "Usage: \`$CLI_NAME $command\`"
exit 1
docker restart $@ || {
echo "To see all installed services & apps use \`$CLI_NAME list\`"
echo "Usage: \`$CLI_NAME $command <service>\`"
exit 1
}
exit
fi
# restart Citadel
if $(is_managed_by_systemd); then
sudo systemctl restart $SERVICE_NAME
else
sudo $CITADEL_ROOT/scripts/stop
sudo $CITADEL_ROOT/scripts/start
fi
exit
fi
@ -177,6 +182,7 @@ fi
# List all installed services apps
if [[ "$command" = "list" ]]; then
# TODO: make this a bit nicer
echo 'karen'
docker ps --format "{{.Names}}"
exit

View File

@ -13,20 +13,20 @@ Flags:
-v, --version Show version information for this CLI
Commands:
status Check the status of all services
status [options] Check the status of all services
start Start the Citadel service
stop Stop the Citadel service safely
restart Restart the Citadel service
restart [service] Restart Citadel or individual services
reboot Reboot the system
shutdown Shutdown the system
update Update Citadel
update [options] Update Citadel
list List all installed services apps
run <service> "<command>" Run a command inside a container
set <command> Switch between Bitcoin & Lightning implementations
app <command> Install, update or restart apps
configure <service> Edit service & app configuration files
logs <service> Show logs for an app or service
debug View logs for troubleshooting
logs [service] Show logs for an app or service
debug [options] View logs for troubleshooting
EOF
}

2
setenv
View File

@ -12,4 +12,4 @@ alias bitcoin-cli="docker exec -it bitcoin bitcoin-cli"
alias docker-compose="sudo docker compose"
alias docker="sudo docker"
export BOS_DEFAULT_LND_PATH="/home/citadel/citadel/lnd"
export BOS_DEFAULT_LND_PATH="${CITADEL_ROOT}/lnd"