Gettin some help_

See #50
This commit is contained in:
3wc 2021-01-01 15:08:51 +02:00
parent ab1353603d
commit fff4b10a41

250
abra
View File

@ -510,11 +510,14 @@ sub_app_ls (){
help_app_list (){
echo "abra [options] app (list|ls) [--status] [--server=<server>]
List your exciting apps
List your exciting apps.
OPTIONS
--status Show whether apps are deployed (warning! slow!)
--server=<server> Filter to a specific server"
--server=<server> Filter to a specific server
POWERED BY (for --status)
docker stack ls"
}
sub_app_list (){
@ -588,7 +591,7 @@ sub_app_list (){
help_app_new (){
echo "abra [options] app new [--server=<server>] [--domain=<domain>] [--pass] [--auto] <type>
Create a new app of <type> (e.g. wordpress or custom-html)
Create a new app of <type> (e.g. wordpress or custom-html).
OPTIONS
--server=<server> Specify which server to use (default: prompt)
@ -669,15 +672,19 @@ sub_app_new (){
echo " abra app $APP_NAME deploy$(tput sgr0)"
}
###### .. app <domain> deploy
###### .. app deploy
help_app_deploy (){
echo "abra [options] app <domain> deploy [--skip-check]
Deploy app <domain> to the configured server
Deploy app <domain> to the configured server.
OPTIONS
--skip-check Don't check whether app definition is up-to-date first"
--skip-check Don't check whether app definition is up-to-date first
POWERED BY
docker stack deploy -c compose.yml <app>"
}
sub_app_deploy (){
load_instance
load_instance_env
@ -725,6 +732,15 @@ sub_app_deploy (){
}
###### .. app <domain> undeploy
help_app_undeploy (){
echo "abra [options] app <app> undeploy
Opposite of \`app <app> deploy\`; deactivate an app without deleting anything.
POWERED BY
docker stack rm <app>"
}
sub_app_undeploy (){
load_instance
load_instance_env
@ -735,7 +751,13 @@ sub_app_undeploy (){
docker stack rm "$STACK_NAME"
}
###### .. app <domain> config
###### .. app config
help_app_config (){
echo "abra [options] app <app> config
Open the app configuration in \$EDITOR."
}
sub_app_config (){
load_instance
@ -768,6 +790,12 @@ sub_app_config (){
}
###### .. app check
help_app_check (){
echo "abra [options] app <app> check
Make sure that all an app's required variables are set."
}
sub_app_check (){
load_instance
load_instance_env
@ -789,6 +817,15 @@ sub_app_check (){
}
###### .. app ps
help_app_ps (){
echo "abra [options] app <app> ps
Show <app>'s running containers.
POWERED BY
docker stack ps <app>"
}
sub_app_ps (){
load_instance
load_instance_env
@ -796,11 +833,24 @@ sub_app_ps (){
docker stack ps "$STACK_NAME"
}
###### .. app <domain> delete
###### .. app delete
help_app_rm (){
help_app_delete
}
sub_app_rm (){
sub_app_delete
}
help_app_delete (){
echo "abra [options] app <app> (rm|delete) [--force]
Delete local configuration for <app>.
OPTIONS
--force Live dangerously; skip prompt for confirmation"
}
sub_app_delete (){
load_instance
load_instance_env
@ -813,7 +863,15 @@ sub_app_delete (){
rm "$ENV_FILE"
}
###### .. app <domain> secret insert
###### .. app secret insert
help_app_secret_insert (){
echo "abra [options] app <app> secret insert <secret> <version> <data> [--pass]
Store <data> as a Docker secret called <secret>_<version>.
OPTIONS
--pass Save the secret in \`pass\` as well"
}
sub_app_secret_insert() {
load_instance
load_instance_env
@ -836,12 +894,27 @@ sub_app_secret_insert() {
fi
}
###### .. app <domain> secret delete
sub_app_secret_delete(){
sub_app_secret_rm
###### .. app secret delete
help_app_secret_rm (){
help_app_secret_delete
}
sub_app_secret_rm(){
sub_app_secret_delete
}
help_app_secret_delete (){
echo "abra [options] app <app> secret (delete|rm) (<secret>|--all) [--pass] [--force]
Remove <app>'s Docker secret <secret>.
OPTIONS
--pass Remove secret(s) from \`pass\` as well
--all Delete all secrets for <app>
--force Live dangerously; skip prompt for confirmation"
}
sub_app_secret_delete(){
load_instance
load_instance_env
@ -870,7 +943,17 @@ sub_app_secret_rm(){
done
}
###### .. app <domain> secret generate
###### .. app secret generate
help_app_secret_generate (){
echo "abra [options] app <app> secret generate <secret> <version> [<cmd>] [--pass]
Generate <secret>_<version> for <app> and store as a Docker secret.
OPTIONS
<cmd> Run <cmd> to generate secret (default: pwqgen)
--pass Save generated secrets in \`pass\`"
}
sub_app_secret_generate(){
load_instance
load_instance_env
@ -917,7 +1000,26 @@ sub_app_secret_auto(){
done
}
###### .. app <domain> run <args>...
###### .. app run
help_app_run (){
echo "abra [options] app <app> run [--no-tty] [--user=<user>] <service> <args>...
Run <args>... (often something like 'bash' or 'sh') in <app>'s <service>
container.
OPTIONS
--no-tty Don't allocate a TTY; sometimes running \`mysql\` enjoys this
--user=<user> Run as the UNIX user <user>, e.g. for running Wordpress-CLI
as www-data
EXAMPLES
abra wordpress_foo_bar run app bash
POWERED BY
CONTAINER_ID=\$(docker container ls -f ...)
docker exec \$CONTAINER_ID ..."
}
sub_app_run(){
load_instance
load_instance_env
@ -948,7 +1050,23 @@ sub_app_run(){
return
}
###### .. app <domain> logs <service> <args>...
###### .. app logs
help_app_logs (){
echo "abra [options] app <app> logs [<service>]
Show logs for <app>.
OPTIONS
<service> Only show logs for a specific service (default: combine all
services)
EXAMPLES
abra wordpress_foo_bar logs app
POWERED BY
docker service logs"
}
sub_app_logs (){
load_instance
load_instance_env
@ -978,7 +1096,29 @@ sub_app_logs (){
docker service logs "${STACK_NAME}_${SERVICE}" $LOGS_ARGS
}
###### .. app <domain> cp <src> <dst>
###### .. app cp
help_app_cp (){
echo "abra [options] app <app> cp <src> <dst>
Copy files to or from a running container.
One of <src> or <dst> must have the format <service>:<path>.
Copying multiple files is possible using \`tar\`, see EXAMPLES.
If <dst> is a file then it will be over-written, if it is a folder then <src>
will be copied into it.
EXAMPLES
abra customhtml_foo_bar_com cp index.html app:/usr/share/nginx/html/
tar cf - wp-content | abra wordpress_bar_bat_com cp - app:/var/www/html/
POWERED BY
CONTAINER_ID=\$(docker container ls -f ...)
docker cp \$CONTAINER_ID:<src> <dst>
docker cp \$CONTAINER_ID:<dst> <src>"
}
sub_app_cp() {
load_instance
load_instance_env
@ -1018,10 +1158,20 @@ sub_app_cp() {
#######################################
###### .. server ls
help_server_ls (){
help_server_list
}
sub_server_ls() {
sub_server_list
}
help_server_list (){
echo "abra [options] server (list|ls)
List locally-defined servers."
}
sub_server_list() {
get_servers
printf "%s servers:\n\n" "${#SERVERS[@]}"
@ -1030,7 +1180,17 @@ sub_server_list() {
done
}
###### .. server init <host>
###### .. server init
help_server_init (){
echo "abra [options] server init
Set up a server for Docker swarm joy.
POWERED BY
docker swarm init
docker network create ..."
}
sub_server_init() {
export DOCKER_CONTEXT="${abra__host_}"
@ -1040,7 +1200,19 @@ sub_server_init() {
docker network create --driver=overlay proxy --scope swarm || true
}
###### .. server <add> <host> [<username>] [<password>]
###### .. server add
help_server_add (){
echo "abra [options] server add <host> [<user>] [<port>]
Add a server, reachable on <host>.
OPTIONS
<user>, <port> SSH connection details
POWERED BY
docker context create ..."
}
sub_server_add() {
require_abra_dir
@ -1064,14 +1236,40 @@ sub_server_add() {
}
###### .. server <host> delete
help_server_rm (){
help_server_delete
}
sub_server_rm() {
sub_server_delete
}
help_server_delete (){
echo "abra [options] server <host> delete
Remove server <host>
POWERED BY
docker context rm ..."
}
sub_server_delete() {
docker context rm "$abra__host_"
}
###### .. server <host> apps
help_server_apps (){
echo "abra [options] server <host> apps [--status]
Alias for \`abra app ls --server=<host>.
OPTIONS
--status Show whether apps are deployed (warning! slow!)
POWERED BY (for --status)
docker stack ls"
}
sub_server_apps() {
abra___server="$abra__host_"
sub_app_list
@ -1082,16 +1280,32 @@ sub_server_apps() {
#######################################
###### .. upgrade
help_upgrade (){
echo "abra [options] upgrade
Upgrade abra itself, using the online installer script."
}
sub_upgrade() {
curl https://install.abra.autonomic.zone | bash
}
###### .. version
help_version (){
echo "abra [options] version
Show the installed version of abra (currently $ABRA_VERSION)."
}
sub_version() {
echo "$ABRA_VERSION"
}
###### .. help
help_help (){
echo "HEEEEEELP! 😱"
}
sub_help() {
SUBCOMMAND=$(IFS="_"; echo "${abra__subcommands_[*]}")
if [ -z "$SUBCOMMAND" ]; then