Add attempt at logs command

This commit is contained in:
Luke Murphy 2020-09-08 09:10:37 +02:00
parent c29ce5cdda
commit 9c89834d20
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

11
abra
View File

@ -13,6 +13,7 @@ sub_help(){
echo " service_run SERVICE [CMD] run a command in the specified service's container" echo " service_run SERVICE [CMD] run a command in the specified service's container"
echo " secret_generate SECRET VERSION generate a secret, store it in pass & as a Docker secret" echo " secret_generate SECRET VERSION 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 "" echo ""
echo "Make sure \$STACK_NAME is set (probably using direnv)" echo "Make sure \$STACK_NAME is set (probably using direnv)"
} }
@ -65,6 +66,16 @@ sub_deploy (){
docker stack deploy -c "$COMPOSE" "$STACK_NAME" docker stack deploy -c "$COMPOSE" "$STACK_NAME"
} }
sub_logs (){
SERVICE=$1
docker service logs "${STACK_NAME}_${SERVICE}" \
--follow \
--no-trunc \
--details \
--timestamps
}
subcommand=$1 subcommand=$1
case $subcommand in case $subcommand in
"" | "-h" | "--help") "" | "-h" | "--help")