Juju documentation

Configuring for Local Provider

Prerequisites

The local provider enables you to run Juju on a single system like your local computer or a single server. This way you can simply evaluate the software or service configurations, develop your own charms or run a single server system.

To do this, Juju uses the LXC Linux Container, which can be installed on your computer with the command:

sudo apt-get install lxc

Additionally the local provider needs MongoDB to be installed. This is done with the command:

            sudo apt-get install mongodb-server

In case of precise or quantal versions of Ubuntu, MongoDB has to be installed from a different repository. So in this case call

            sudo apt-add-repository ppa:juju/stable
            sudo apt-get update

beforehand. In case you're not sure take a look into the file /etc/lsb-release which identifies the series with the variable DISTRIB_CODENAME. If you're not running Ubuntu please consult your operating system distribution's documentation for instructions on installing the LXC userspace tools and the MongoDB server. Juju requires a MongoDB server built with SSL support.

The dependence on the LXC Linux Container shows that the local provider only runs on Linux systems. All steps above are also printed in case of any unsatisfied prerequisite.

Configuration

You should start by generating a generic configuration file for Juju, using the command:

juju generate-config

This will generate a file, environments.yaml, which will live in your ~/.juju/ directory (and will create the directory if it doesn't already exist).

Note: If you have an existing configuration, you can use juju generate-config --show to output the new config file, then copy and paste relevant areas in a text editor etc.

The generic configuration sections generated for the local provider will look something like this:

## https://juju.ubuntu.com/get-started/local/
local:
type: local
admin-secret: 772b9471131c6b5883475e3908156d32
#Override the directory that is used for the storage files and database.
#The default location is $JUJU_HOME.
# $JUJU_HOME defaults to ~/.juju
# root-dir: ~/.juju/local
# Override the storage port if you have multiple local providers, or if the
# default port is used by another program.
# storage-port: 8040
# Override the shared storage port if you have multiple local providers,
# or if the default port is used by another program.
# shared-storage-port: 8041

Running Juju with this configuration the storage files and the database will be located in the directory specified by the environment variable $JUJU_HOME, which defaults to ~/.juju/. By uncommenting and setting root-dir this location can be changed as well as the ports of the storage and the shared storage. This may be useful in the case of multiple parallel running local providers or conflicts with other programs on your system. Also when using encrypted home directories you have to set $JUJU_HOME or root-dir to point to a location outside your home directory.

Bootstrapping and Destroying

The usage of LXC Linux Containers enforces that bootstrapping and destroying of an environment are done as root. All other operations can be executed as non-root. E.g.

sudo juju bootstrap
juju deploy mysql
...
sudo juju destroy-environment