From 60da61456ed3f44c5d6691ed7a55ecbe0dfff382 Mon Sep 17 00:00:00 2001 From: Chris McCormick Date: Thu, 14 Nov 2019 01:57:34 +0800 Subject: [PATCH] piku-bootstrap subcommand to install piku cli. (#121) * piku-bootstrap subcommand to install piku cli. Fixes #120 * Documenting new simpler install methods. --- README.md | 9 ++++----- piku-bootstrap | 13 +++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2ae666e..c4f6643 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,7 @@ To use `piku` you need a VPS, Raspberry Pi, or other server bootstrapped with `p Once you've got a fresh server, download the [piku-bootstrap](./piku-bootstrap) shell script onto your local machine and run it: ```shell -curl https://raw.githubusercontent.com/piku/piku/master/piku-bootstrap > piku-bootstrap && chmod 755 piku-bootstrap -./piku-bootstrap +curl https://piku.github.io/get | sh ``` The first time it is run `piku-bootstrap` will install itself into `~/.piku-bootstrap` on your local machine and set up a virtualenv there with the dependencies it requires. It will only need to do this once. @@ -44,7 +43,7 @@ The first time it is run `piku-bootstrap` will install itself into `~/.piku-boot The script will display a usage message and you can then bootstrap your server: ```shell -./piku-bootstrap yourserver.net +./piku-bootstrap root@yourserver.net ``` If you put the `piku-bootstrap` script on your `PATH` somewhere, you can use it again to provision other servers in the future. @@ -53,10 +52,10 @@ See below for instructions on [installing other custom dependencies](#installing ### `piku` client -To make life easier you can also download the [piku](./piku) helper shell script and install it on your local. +To make life easier you can also install the [piku](./piku) helper CLI. Install it into your path e.g. `~/bin` to run it from anywhere. ```shell -curl https://raw.githubusercontent.com/piku/piku/master/piku > piku && chmod 755 piku +./piku-bootstrap install-cli ~/bin ``` This shell script makes working with `piku` remotes a bit simpler. If you have a git remote called `piku` in the current folder it will infer the remote server and app name and insert those into the remote piku commands. This allows you do execute commands like the following on your running remote app: diff --git a/piku-bootstrap b/piku-bootstrap index 87b858b..7018efc 100755 --- a/piku-bootstrap +++ b/piku-bootstrap @@ -54,6 +54,7 @@ main() { echo echo "Usage:" echo " `basename $0` [USER@]HOST [PLAYBOOK] [ANSIBLE_ARGS...]" + echo " `basename $0` install-cli DESTINATION" echo " `basename $0` list-playbooks" echo " `basename $0` update" echo @@ -70,6 +71,9 @@ main() { echo " list-playbooks" echo " List available built-in playbooks." echo + echo " install-cli DESTINATION" + echo " Install the 'piku' CLI helper to e.g. ~/bin." + echo echo " update Pull the piku repo to get the latest playbooks." echo echo "Notes:" @@ -94,6 +98,15 @@ main() { cd "${REPO}" git pull ;; + install-cli) + if [ "$2" = "" ] + then + echo "Usage: piku-bootstrap install-cli ~/bin" + else + ln -s "${REPO}/piku" "$2" + echo "Installed piku cli to $2" + fi + ;; list-playbooks) ls "${REPO}/playbooks" ;;