This version of the doc is no longer supported. Please check out the stable docs for the latest in Juju.

Environment Variables

Juju Client

These variables are available on the juju client in order to change its default behavior.

  • JUJU_ENV

    Juju has three ways it will check, in descending order, to determine the current environment:

    1. Check to see if JUJU_ENV is set.

      JUJU_ENV=local
      
    2. Read $JUJU_HOME/current-environment, which is set by juju switch $environment

    3. Read $JUJU_HOME/environments.yaml and use the default environment.
  • JUJU_HOME

    The path to juju's configuration files.

    JUJU_HOME=~/.juju
    
  • JUJU_REPOSITORY

    This allows you to set the repository that Juju looks for charms in. This can also be done by passing --repository=/path/to/charms when executing juju deploy.

    For example, if you are running juju in a Vagrant virtual machine, you could set JUJU_REPOSITORY to your shared folder:

    export JUJU_REPOSITORY=/vagrant
    juju deploy local:series/charm
    
  • JUJU_LOGGING_CONFIG

    This setting takes effect on an environment only at bootstrap time. In stable Juju releases, agents are started with logging set to WARNING, and units are set to INFO. Development releases are set to DEBUG globally. Post bootstrap, on a running environment you can change the logging options to be more or less verbose. For example:

    juju set-environment logging-config "juju=DEBUG; unit=WARNING"
    

Unit

These variables are available to charms during hook execution.

  • JUJU_API_ADDRESSES

    A space-separated list of API servers.

    JUJU_API_ADDRESSES="10.0.3.1:17070"
    
  • JUJU_AGENT_SOCKET

    The socket that the Unit Agent uses to communicate with individual Units. JUJU_AGENT_SOCKET="@/var/lib/juju/agents/unit-postgresql-0/agent.socket"

  • JUJU_CONTEXT_ID

    Used by juju to communicate to ask a running agent to execute a command on juju's behalf. JUJU_CONTEXT_ID="postgresql/0:db-relation-joined:34317605475203611"

  • JUJU_DEBUG

    The temporary directory where juju debug-hooks is spawned from.

    JUJU_DEBUG="/tmp/tmp.vGQlc2bTcV"
    
  • JUJU_ENV_NAME

    The human-friendly name of the current environment.

    JUJU_ENV_NAME="local"
    
  • JUJU_ENV_UUID

    The unique identifier of the juju environment.

    JUJU_ENV_UUID="2c0896ce-fd6c-4647-8540-26f848e061f9"
    
  • JUJU_HOOK_NAME

    The name of the hook being executed.

    JUJU_HOOK_NAME="db-relation-joined"
    
  • JUJU_RELATION

    The relation name being executed.

    JUJU_RELATION="db"
    
  • JUJU_RELATION_ID

    The ID of the relation being executed.

    JUJU_RELATION_ID="db:20"
    
  • JUJU_REMOTE_UNIT

    The name of the current related unit.

    JUJU_REMOTE_UNIT="reddit/0"
    
  • JUJU_UNIT_NAME

    The name of the local unit being executed.

    JUJU_UNIT_NAME="postgresql/0"