launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/README (about) 1 juju-core 2 ========= 3 4 juju is devops distilled. 5 6 Getting started 7 =============== 8 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` 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 28 This will add some PPAs to ensure that you can install the required 29 golang and mongodb-server versions for precise onwards, in addition to the 30 other dependencies. 31 32 33 Setting GOPATH 34 -------------- 35 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 40 41 go help gopath 42 43 Various conventions exist for naming the location of your `GOPATH`, but it should 44 exist, and be writable by you. For example 45 46 export GOPATH=${HOME}/work 47 mkdir $GOPATH 48 49 will define and create `$HOME/work` as your local `GOPATH`. The `go` tool itself 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 52 binaries, respectively. 53 54 Setting `GOPATH` correctly is critical when developing Go programs. Set and 55 export it as part of your login script. 56 57 Add `$GOPATH/bin` to your `PATH`, so you can run the go programs you install: 58 59 PATH="$PATH:$GOPATH/bin" 60 61 62 Getting juju-core 63 ================= 64 65 The easiest way to get the source for `juju-core` is to use the `go get` command. 66 67 go get -v launchpad.net/juju-core/... 68 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 73 74 go help get 75 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. 82 83 Building juju-core 84 ================== 85 86 go install -v launchpad.net/juju-core/... 87 88 Will build juju and install the binary commands into `$GOPATH/bin`. It is likely 89 if you have just completed the previous step to get the `juju-core` source, the 90 install process will produce no output, as the final executables are up-to-date. 91 92 Using juju-core 93 =============== 94 95 After following the steps above you will have the `juju` client installed in 96 `GOPATH/bin/juju`. You should ensure that this version of `juju` appears earlier 97 in your path than any packaged versions of `juju-core`, or older Python juju 98 commands. You can verify this using 99 100 which juju 101 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 104 provider because it uses LXC, which requires root privileges) 105 106 juju init 107 juju switch local 108 sudo juju 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}