~axwalk/juju-core/lp1303195-manual-ubuntuuser-bash

701.2.1 by Dave Cheney
Added README
1
juju-core
2
=========
3
4
juju is devops distilled.
5
6
Getting started
7
===============
8
701.2.3 by Dave Cheney
responding to review feedback
9
`juju-core` is written in Go (http://golang.org), a modern, compiled, statically
10
typed, concurrent language. This document describes how to build `juju-core`
1614.2.1 by Michael Nelson
Update and simplify README
11
from source.
12
13
If you are looking for binary releases of `juju-core`, they are
14
available from the Juju stable PPA, `https://launchpad.net/~juju/+archive/stable`,
15
and can be installed with:
16
17
    sudo apt-add-repository ppa:juju/stable
18
    sudo apt-get update
19
    sudo apt-get install juju
20
21
22
Installing prerequisites
23
------------------------
24
25
You can use `make install-dependencies` or, if you prefer to install
26
them manually, check the Makefile target.
27
2194.1.1 by Jesse Meek
fixed typo
28
This will add some PPAs to ensure that you can install the required
1614.2.1 by Michael Nelson
Update and simplify README
29
golang and mongodb-server versions for precise onwards, in addition to the
30
other dependencies.
31
701.2.1 by Dave Cheney
Added README
32
33
Setting GOPATH
34
--------------
35
701.2.3 by Dave Cheney
responding to review feedback
36
When working with the source of Go programs, you should define a path within
37
your home directory (or other workspace) which will be your `GOPATH`. `GOPATH`
38
is similar to Java's `CLASSPATH` or Python's `~/.local`. `GOPATH` is documented
39
online at `http://golang.org/pkg/go/build/` and inside the `go` tool itself
701.2.1 by Dave Cheney
Added README
40
41
    go help gopath
42
701.2.3 by Dave Cheney
responding to review feedback
43
Various conventions exist for naming the location of your `GOPATH`, but it should
44
exist, and be writable by you. For example
701.2.1 by Dave Cheney
Added README
45
46
    export GOPATH=${HOME}/work
47
    mkdir $GOPATH
48
701.2.3 by Dave Cheney
responding to review feedback
49
will define and create `$HOME/work` as your local `GOPATH`. The `go` tool itself
701.2.4 by Dave Cheney
final tweaks
50
will create three subdirectories inside your `GOPATH` when required; `src`, `pkg`
51
and `bin`, which hold the source of Go programs, compiled packages and compiled
803.2.2 by Jeroen Vermeulen
Make the addition to PATH stand out a bit more.
52
binaries, respectively.
701.2.1 by Dave Cheney
Added README
53
803.2.1 by Jeroen Vermeulen
The 'go env' check doesn't seem to work.
54
Setting `GOPATH` correctly is critical when developing Go programs. Set and
55
export it as part of your login script.
701.2.1 by Dave Cheney
Added README
56
803.2.2 by Jeroen Vermeulen
Make the addition to PATH stand out a bit more.
57
Add `$GOPATH/bin` to your `PATH`, so you can run the go programs you install:
58
59
    PATH="$PATH:$GOPATH/bin"
60
701.2.1 by Dave Cheney
Added README
61
62
Getting juju-core
63
=================
64
701.2.3 by Dave Cheney
responding to review feedback
65
The easiest way to get the source for `juju-core` is to use the `go get` command.
701.2.1 by Dave Cheney
Added README
66
67
    go get -v launchpad.net/juju-core/...
68
701.2.3 by Dave Cheney
responding to review feedback
69
This command will checkout the source of `juju-core` and inspect it for any unmet
70
Go package dependencies, downloading those as well. `go get` will also build and
71
install `juju-core` and its dependencies. To checkout without installing, use the
72
`-d` flag. More details on the `go get` flags are available using
701.2.1 by Dave Cheney
Added README
73
74
    go help get
75
701.2.3 by Dave Cheney
responding to review feedback
76
At this point you will have the bzr working copy of the `juju-core` source at
77
`$GOPATH/launchpad.net/juju-core`. The source for any dependent packages will
78
also be available inside `$GOPATH`. You can use `bzr pull`, or the less convenient
79
`go get -u launchpad.net/juju-core/...` to update the source from time to time.
80
If you want to know more about contributing to `juju-core`, please read the
81
`CONTRIBUTING` companion to this file.
701.2.1 by Dave Cheney
Added README
82
83
Building juju-core
84
==================
85
86
    go install -v launchpad.net/juju-core/...
87
701.2.3 by Dave Cheney
responding to review feedback
88
Will build juju and install the binary commands into `$GOPATH/bin`. It is likely
701.2.4 by Dave Cheney
final tweaks
89
if you have just completed the previous step to get the `juju-core` source, the
701.2.3 by Dave Cheney
responding to review feedback
90
install process will produce no output, as the final executables are up-to-date.
701.2.1 by Dave Cheney
Added README
91
92
Using juju-core
93
===============
94
701.2.3 by Dave Cheney
responding to review feedback
95
After following the steps above you will have the `juju` client installed in
701.2.4 by Dave Cheney
final tweaks
96
`GOPATH/bin/juju`. You should ensure that this version of `juju` appears earlier
701.2.3 by Dave Cheney
responding to review feedback
97
in your path than any packaged versions of `juju-core`, or older Python juju
701.2.4 by Dave Cheney
final tweaks
98
commands. You can verify this using
99
100
    which juju
701.2.1 by Dave Cheney
Added README
101
1614.2.3 by Michael Nelson
Added --upload-tools back, and noted the use of sudo with local bootstrap.
102
You should be able to bootstrap a local environment now with the following
103
(Note: the use of sudo for bootstrap here is only required for the local
1614.2.4 by Michael Nelson
Stable PPA for mongodb-server and better comment about sudo.
104
provider because it uses LXC, which requires root privileges)
1614.2.1 by Michael Nelson
Update and simplify README
105
106
    juju init
107
    juju switch local
108
    sudo juju bootstrap
1614.2.3 by Michael Nelson
Added --upload-tools back, and noted the use of sudo with local bootstrap.
109
110
111
--upload-tools
112
--------------
113
114
The `juju` client program, and the juju 'tools' are deployed in lockstep. When a
115
release of `juju-core` is made, the compiled tools matching that version of juju
116
are extracted and uploaded to a known location. This consumes a release version
117
number, and implies that no tools are available for the next, development, version
118
of juju. Therefore, when using the development version of juju you will need to
119
pass an additional flag, `--upload-tools` to instruct the `juju` client to build
120
a set of tools from source and upload them to the environment as part of the
121
bootstrap process.
122
123
    juju bootstrap -e your-environment --upload-tools {--debug}
2303.2.4 by JuanJo Ciarlante
add 'make install-etc' target, document it at README
124
125
Installing bash completion for juju
126
===================================
127
128
    make install-etc
129
130
Will install Bash completion for `juju` cli to
131
`/etc/bash_completion.d/juju-core` It does dynamic completion for commands
2303.2.6 by JuanJo Ciarlante
doc touches, and a minor fix for _juju_completion_cache_rm
132
requiring service, unit or machine names (like e.g. juju status <service>,
2303.2.4 by JuanJo Ciarlante
add 'make install-etc' target, document it at README
133
juju ssh <instance>, juju terminate-machine <machine#>, etc),
2303.2.6 by JuanJo Ciarlante
doc touches, and a minor fix for _juju_completion_cache_rm
134
by parsing cached `juju status` output for speedup. It also does
2303.2.4 by JuanJo Ciarlante
add 'make install-etc' target, document it at README
135
command flags completion by parsing `juju help ...` output.