Load per-stack commands from abra-commands.sh..
.. and add a new `abra run_args` command to allow adding arguments to `docker exec`.
This commit is contained in:
parent
8da3e7dfca
commit
b67d45e14d
23
abra
23
abra
@ -16,6 +16,10 @@ if type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed t
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f abra-commands.sh ]; then
|
||||||
|
. abra-commands.sh
|
||||||
|
fi
|
||||||
|
|
||||||
sub_help() {
|
sub_help() {
|
||||||
echo "Usage: $PROGRAM_NAME [-a STACK_NAME] <subcommand> [options]"
|
echo "Usage: $PROGRAM_NAME [-a STACK_NAME] <subcommand> [options]"
|
||||||
echo ""
|
echo ""
|
||||||
@ -24,8 +28,9 @@ sub_help(){
|
|||||||
echo " secret_generate SECRET VERSION [CMD] generate a secret, store it in pass & as a Docker secret"
|
echo " secret_generate SECRET VERSION [CMD] generate a secret, store it in pass & as a Docker secret"
|
||||||
echo " deploy [COMPOSE_FILE] let 'em rip"
|
echo " deploy [COMPOSE_FILE] let 'em rip"
|
||||||
echo " logs SERVICE tail logs from a deployed service"
|
echo " logs SERVICE tail logs from a deployed service"
|
||||||
|
echo " ... (custom commands)"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Make sure \$STACK_NAME is set (probably using direnv)"
|
echo "Make sure \$STACK_NAME is set using direnv or -a"
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_secret_generate(){
|
sub_secret_generate(){
|
||||||
@ -43,9 +48,11 @@ sub_secret_generate(){
|
|||||||
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
|
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_run(){
|
sub_run_args(){
|
||||||
SERVICE=$1
|
SERVICE=$1
|
||||||
SH=${2:-/bin/sh}
|
ARGS=$2
|
||||||
|
|
||||||
|
shift 2
|
||||||
|
|
||||||
if [ -z "$SERVICE" ]; then
|
if [ -z "$SERVICE" ]; then
|
||||||
echo "Usage: $PROGRAM_NAME run SERVICE [CMD]"
|
echo "Usage: $PROGRAM_NAME run SERVICE [CMD]"
|
||||||
@ -60,11 +67,19 @@ sub_run(){
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker exec -it "$CONTAINER" "$SH"
|
docker exec $ARGS -it "$CONTAINER" $@
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub_run(){
|
||||||
|
SERVICE=$1
|
||||||
|
|
||||||
|
shift
|
||||||
|
|
||||||
|
sub_run_args "$SERVICE" "" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
sub_deploy (){
|
sub_deploy (){
|
||||||
COMPOSE=${1:-compose.yml}
|
COMPOSE=${1:-compose.yml}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user