deploy
status, install globally, rename run
This commit is contained in:
parent
86785b6aea
commit
ebb763518a
2
Makefile
2
Makefile
@ -4,7 +4,7 @@ dev_install:
|
||||
ln -s $(PWD)/abra ~/.local/bin
|
||||
|
||||
install:
|
||||
install abra $(HOME)/.local/bin/abra
|
||||
install abra /usr/bin/abra
|
||||
|
||||
get_yq:
|
||||
wget https://github.com/mikefarah/yq/releases/download/3.3.2/yq_linux_amd64 && \
|
||||
|
17
abra
17
abra
@ -10,7 +10,7 @@ sub_help(){
|
||||
echo "Usage: $PROGRAM_NAME <subcommand> [options]"
|
||||
echo ""
|
||||
echo "Subcommands:"
|
||||
echo " service_run SERVICE [CMD] run a command in the specified service's container"
|
||||
echo " run SERVICE [CMD] run a command in the specified service's container"
|
||||
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 " logs SERVICE tail logs from a deployed service"
|
||||
@ -33,10 +33,15 @@ sub_secret_generate(){
|
||||
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
|
||||
}
|
||||
|
||||
sub_service_run(){
|
||||
sub_run(){
|
||||
SERVICE=$1
|
||||
SH=${2:-/bin/sh}
|
||||
|
||||
if [ -z "$SERVICE" ]; then
|
||||
echo "Usage: $PROGRAM_NAME run SERVICE [CMD]"
|
||||
exit
|
||||
fi
|
||||
|
||||
CONTAINER=$(docker container ls --format "table {{.ID}},{{.Names}}" \
|
||||
| grep "${STACK_NAME}_${SERVICE}" | cut -d',' -f1)
|
||||
|
||||
@ -46,6 +51,8 @@ sub_service_run(){
|
||||
fi
|
||||
|
||||
docker exec -it "$CONTAINER" "$SH"
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
sub_deploy (){
|
||||
@ -64,7 +71,11 @@ sub_deploy (){
|
||||
* ) return;;
|
||||
esac
|
||||
|
||||
docker stack deploy -c "$COMPOSE" "$STACK_NAME"
|
||||
if docker stack deploy -c "$COMPOSE" "$STACK_NAME"; then
|
||||
echo "$(tput setaf 2)Yay! App should be available at https://${DOMAIN}$(tput sgr0)"
|
||||
else
|
||||
echo "$(tput setaf 1)Oh no! Something went wrong 😕 Check errors above$(tput sgr0)"
|
||||
fi
|
||||
}
|
||||
|
||||
sub_logs (){
|
||||
|
Loading…
Reference in New Issue
Block a user