Permalink
Browse files

Merge pull request #5 from mbruzek/2.0-update

Update cheatsheet for 1.x and 2.x commands, split out charm-tools.
  • Loading branch information...
2 parents ddaa20a + ec80a34 commit 54969cab67870d4940607a08da8554f9aa90a5fb @castrojo castrojo committed May 5, 2016
Showing with 363 additions and 89 deletions.
  1. +14 −89 README.md
  2. +53 −0 charm-tools_2.x.md
  3. +96 −0 juju_1.x.md
  4. +200 −0 juju_2.x.md
View
@@ -1,97 +1,22 @@
-# Juju Cheatsheet
+# Juju Cheatsheets
-Sometimes you don't have all day to figure stuff out, here's a TLDR of how to use Juju. Remember you can always `juju help` and then any of these subcommands to get the help for the command.
+Juju changed the subcommands on the major release boundary. These documents are
+a summary of Juju commands for the major releases. For more detailed
+information please refer to the
+[official documentation](https://jujucharms.com/docs).
-## Installing the PPA and all the goodies:
+Remember you can always `juju help` and then any of these subcommands to get the
+help for the specific command.
-- `sudo add-apt-repository ppa:juju/stable && sudo apt-get update && sudo apt-get install juju juju-local juju-quickstart charm-tools`
-- `juju quickstart -i` - prompts you for all your cloud credentials.
-- `juju bootstrap -v` - bootstrap a node (always -v so you can see what's going on, drop the -v when you get comfortable with juju, but juju bootstrap since 1.17.0 shows what's going on -v is really verbose at this point)
-- `juju debug-log` - open this in another terminal or tab, so you can see what juju is doing while you type other commands)
+## Juju 1.x
-## Using Juju
+The [1.x Juju cheatsheet](juju_1.x.md) covers the original Juju subcommands.
-- `juju deploy servicename alias`- deploy a service, alias is optional if you want to name it something. If you use aliases you need to refer to the service via the alias from then on:
+## Juju 2.x
- juju deploy mediawiki myawesomewiki
+The [2.x Juju cheatsheet](juju_2.x.md) covers the new Juju subcommands.
-- `juju add-unit servicename` - add a unit
-- `juju add-unit -n 10 servicename` - add 10 units.
-- `juju deploy servicename --to #` - deploy servicename to a specific machine #. Use 0 to deploy to the bootstrap node.
-- `juju status` - shows what's going on
-- `juju status servicename` - shows you what's going for a particular server
-- `juju ssh servicename/machine#` - ssh to a unit, get the # from juju status
-- `juju ssh machine#` - ssh to a machine number
-- `juju run "uname -a" --all` - Run a command (uname) on every instance. (1.17.2 and newer)
-
-## bundles
-
-- `juju quickstart bundle:~abentley/wiki-bundle/1/wiki` - Get the bundle address from jujucharms.com
-
-## Relations
-
-- `juju add-relation $service1 $service2` - relate two services
-- `juju destroy-relation $service1 $service2` - unrelate 2 services
-
-## Deploying to Containers, VMs, and metal
-
-- `juju deploy servicename --to lxc:10` - Deploy service to a container on machine #10
-- `juju deploy servicename --to kvm:10` - Deploy service to a KVM on machine #10
-- `juju deploy servicename --to 10` - Deploy service to the raw bare metal on machine #10
-- `juju deploy servicename --constraints instance-type=m1.small` - Deploy to certain AWS types.
-
-## Working with Units
-
-- `juju ssh servicename/#` - ssh to a specific machine # for a service.
-- `juju run --service servicename "uname -a"` - run a command on all machines of a service and return results to the console (useful!)
-- `juju scp file.sh servicename/0:/tmp` - copy file.sh to /tmp on node 0 of servicename.
-
-
-## Destroying Stuff
-
-- `juju destroy-environment $environment-name` - destroy an environment
-- `juju destroy-service $servicename` - destroy a service, DOES NOT REMOVE THE MACHINE, you need to follow up:
-- `juju destroy-machine` # - destroy machine #
-
-## Writing Charms/Bundles
-
-- `charm create foo` - create a blank charm template
-- `charm add tests` - add tests to an existing charm
-- `charm test -e $environment` - executes all tests found in the charm tests directory in specified environment (amazon, hp, etc.).
-- `charm add readme` - add a readme template to an existing charm
-- `charm proof` - lint for charms
-- `bundle proof` - lint for bundles
-- `juju debug-hooks` - debug mode for charm writing, this will ssh you into the units and fire off a tmux session to debug (totally awesome, use this).
-
-## Clean up
-
-- "I broke the local provider and need to start over" - http://askubuntu.com/questions/403618/how-do-i-clean-up-a-machine-after-using-the-local-provider
-- "There's a race somewhere and sometimes the unit doesn't come up" - `juju resolved $servicename --retry`
-
-## Other
-
-- Listing of all the charms: https://jujucharms.com/fullscreen/search/?text=
-- `juju status -e $environmentname` - show me the status of another environment
-- `juju switch $environmentname` - switch to a different environment
-- `juju add-machine` - add a blank machine that you can mess with
-- `juju ensure-availability` - Ensures the state server is HA (+3 nodes) - you only really need this in production.
-
-## Useful LXC commands
-
-`sudo lxc-ls --fancy` - show all the containers on your machine
-
-## Plugins
-
-Install plugins:
-
- git clone https://github.com/juju/plugins.git ~/.juju-plugins
- echo 'PATH=$PATH:$HOME/.juju-plugins' >> ~/.bash_profile
- source ~/.bash_profile
- juju help plugins
-
-Plugin Cheats:
-
-- `juju pprint` - prettier status, a must for large deployments
-- `juju clean` - reset and clean all LXC containers and the Juju local provider
-- `juju git-deploy https://github.com/charms/haproxy` - Deploy charms directly from a git repo.
+## charmtools 2.x
+The [2.x charm-tools cheatsheet](charm-tools_2.x.md) covers the charm
+subcommands.
View
@@ -0,0 +1,53 @@
+# charm-tools 2.x
+
+This is a summary of the 2.x charm-tools subcommands. For more detailed
+information refer to the [charm-tools documentation](https://jujucharms.com/docs/devel/tools-charm-tools).
+
+## Install charm-tools
+
+```sh
+sudo add-apt-repository -y ppa:juju/devel
+sudo add-apt-repository -y ppa:juju/stable
+sudo apt update -qq
+sudo apt install -y charm-tools
+```
+
+## charm-tools 2.x subcommands
+```
+add - add icon, readme, or tests to a charm
+attach - upload a file as a resource for a charm
+build - build a charm from layers and interfaces
+create - create a new charm
+grant - grant charm or bundle permissions
+help - show help on a command or other topic
+layers - inspect the layers of a built charm
+list - list charms for a given user name
+list-resources - display the resources for a charm in the charm store
+login - login to the charm store
+logout - logout from the charm store
+proof - perform static analysis on a charm or bundle
+publish - publish a charm or bundle
+pull - download a charm or bundle from the charm store
+pull-source - download the source code for a charm, layer, or interface
+push - push a charm or bundle into the charm store
+revoke - revoke charm or bundle permissions
+set - set charm or bundle extra-info, home page or bugs URL
+show - print information on a charm or bundle
+terms - lists terms owned by the user
+test - execute charm functional tests
+version - display tooling version information
+whoami - display jaas user id and group membership
+```
+
+## Using charm-tools
+
+##### `charm add`
+- `charm add tests` - Add things to an existing charm, such as icon, tests,
+readme (template).
+
+##### `charm attach`
+- `charm attach ~user/trusty/wordpress website-data ./foo.zip` - Upload a file
+as a resource for a charm.
+
+##### `charm build`
+- `charm build` - Build the layers and interfaces into a charm.
View
@@ -0,0 +1,96 @@
+# Juju 1.x Cheatsheet
+
+Sometimes you don't have all day to figure stuff out, here's a TLDR of how to use Juju. Remember you can always `juju help` and then any of these subcommands to get the help for the command.
+
+## Installing the PPA and all the goodies:
+
+- `sudo add-apt-repository ppa:juju/stable && sudo apt-get update && sudo apt-get install juju juju-local juju-quickstart charm-tools`
+- `juju quickstart -i` - prompts you for all your cloud credentials.
+- `juju bootstrap -v` - bootstrap a node (always -v so you can see what's going on, drop the -v when you get comfortable with juju, but juju bootstrap since 1.17.0 shows what's going on -v is really verbose at this point)
+- `juju debug-log` - open this in another terminal or tab, so you can see what juju is doing while you type other commands)
+
+## Using Juju
+
+- `juju deploy servicename alias`- deploy a service, alias is optional if you want to name it something. If you use aliases you need to refer to the service via the alias from then on:
+
+ juju deploy mediawiki myawesomewiki
+
+- `juju add-unit servicename` - add a unit
+- `juju add-unit -n 10 servicename` - add 10 units.
+- `juju deploy servicename --to #` - deploy servicename to a specific machine #. Use 0 to deploy to the bootstrap node.
+- `juju status` - shows what's going on
+- `juju status servicename` - shows you what's going for a particular server
+- `juju ssh servicename/machine#` - ssh to a unit, get the # from juju status
+- `juju ssh machine#` - ssh to a machine number
+- `juju run "uname -a" --all` - Run a command (uname) on every instance. (1.17.2 and newer)
+
+## bundles
+
+- `juju quickstart bundle:~abentley/wiki-bundle/1/wiki` - Get the bundle address from jujucharms.com
+
+## Relations
+
+- `juju add-relation $service1 $service2` - relate two services
+- `juju destroy-relation $service1 $service2` - unrelate 2 services
+
+## Deploying to Containers, VMs, and metal
+
+- `juju deploy servicename --to lxc:10` - Deploy service to a container on machine #10
+- `juju deploy servicename --to kvm:10` - Deploy service to a KVM on machine #10
+- `juju deploy servicename --to 10` - Deploy service to the raw bare metal on machine #10
+- `juju deploy servicename --constraints instance-type=m1.small` - Deploy to certain AWS types.
+
+## Working with Units
+
+- `juju ssh servicename/#` - ssh to a specific machine # for a service.
+- `juju run --service servicename "uname -a"` - run a command on all machines of a service and return results to the console (useful!)
+- `juju scp file.sh servicename/0:/tmp` - copy file.sh to /tmp on node 0 of servicename.
+
+
+## Destroying Stuff
+
+- `juju destroy-environment $environment-name` - destroy an environment
+- `juju destroy-service $servicename` - destroy a service, DOES NOT REMOVE THE MACHINE, you need to follow up:
+- `juju destroy-machine` # - destroy machine #
+
+## Writing Charms/Bundles
+
+- `charm create foo` - create a blank charm template
+- `charm add tests` - add tests to an existing charm
+- `charm test -e $environment` - executes all tests found in the charm tests directory in specified environment (amazon, hp, etc.).
+- `charm add readme` - add a readme template to an existing charm
+- `charm proof` - lint for charms
+- `bundle proof` - lint for bundles
+- `juju debug-hooks` - debug mode for charm writing, this will ssh you into the units and fire off a tmux session to debug (totally awesome, use this).
+
+## Clean up
+
+- "I broke the local provider and need to start over" - http://askubuntu.com/questions/403618/how-do-i-clean-up-a-machine-after-using-the-local-provider
+- "There's a race somewhere and sometimes the unit doesn't come up" - `juju resolved $servicename --retry`
+
+## Other
+
+- Listing of all the charms: https://jujucharms.com/fullscreen/search/?text=
+- `juju status -e $environmentname` - show me the status of another environment
+- `juju switch $environmentname` - switch to a different environment
+- `juju add-machine` - add a blank machine that you can mess with
+- `juju ensure-availability` - Ensures the state server is HA (+3 nodes) - you only really need this in production.
+
+## Useful LXC commands
+
+`sudo lxc-ls --fancy` - show all the containers on your machine
+
+## Plugins
+
+Install plugins:
+
+ git clone https://github.com/juju/plugins.git ~/.juju-plugins
+ echo 'PATH=$PATH:$HOME/.juju-plugins' >> ~/.bash_profile
+ source ~/.bash_profile
+ juju help plugins
+
+Plugin Cheats:
+
+- `juju pprint` - prettier status, a must for large deployments
+- `juju clean` - reset and clean all LXC containers and the Juju local provider
+- `juju git-deploy https://github.com/charms/haproxy` - Deploy charms directly from a git repo.
Oops, something went wrong.

0 comments on commit 54969ca

Please sign in to comment.