yellow/Juju

Not logged in - Log In / Register

Juju Development Notes

Notes for getting started with Juju

cd $JUJUDIR
juju bootstrap -e local  # Assuming you called your LXC configuration in environments.yaml 'local'
juju deploy --repository=. local:buildbot-master
watch juju status  # wait for the state to be 'started'
juju expose buildbot-master

You should then be able to go to http:<local_ip_address>:8010 and see the buildbot page for pyflakes.

The IP address and port are available in the juju status output.

Working with larger EC2 instances

Building Launchpad requires that the machine have some decent memory, or else the installation will fail because of the kernel killing the process because of an OOM error. While askubuntu has some hints on getting Juju to use larger EC2 instances, it can still be confusing. Here are some step-by-steps that hopefully clarify things.

General notes

You currently must set your machine size generically for the entire cluster. You cannot specify that certain services should get certain machine sizes (and it doesn't *appear* to have made it in for 12.04, but we could be wrong).

http://askubuntu.com/questions/101005/how-to-specify-ec2-instance-types-for-different-services-in-a-charm

Oneiric

In your ~/.juju/environments.yaml, in the environment section that you want to modify (presumably with a "type: ec2" section), add these lines.

  default-instance-type: m1.large
  default-image-id: ami-6fa27506

Precise

Find the image you want to use, from http://uec-images.ubuntu.com/precise/current/ or http://uec-images.ubuntu.com/query/precise/server/daily.txt if Precise has not yet shipped. Once it has shipped, replace "current" with "released" in those URLs. You are looking for an amd64 image in your geographic area that is *not* "hvm". Juju seems to use "ebs" (elastic block store) instances by default, but as far as we can tell using "instance-store" images makes more sense for how juju uses these at this time.

In your ~/.juju/environments.yaml, in the environment section that you want to modify (presumably with a "type: ec2" section), add these lines.

  default-instance-type: m1.large
  default-image-id: AMI YOU FOUND GOES HERE

Notes for hacking on Juju

 $ ./test the.path.to.the.TestCase.and_test

Notes for working with Juju

Notes for working with Juju Charms

 $ juju set my-service option=$(uuencode /path/to/config/file)

(On the client)
root@ip-10-116-73-15:/# grep unit.hook.api /var/lib/juju/units/$UNITNAME/charm.log
2012-01-17 20:51:17,315: unit.hook.api@INFO: --> install
2012-01-17 20:51:20,588: unit.hook.api@INFO: Creating master in /tmp/buildbot
2012-01-17 20:51:23,539: unit.hook.api@INFO: <-- install
2012-01-17 20:51:24,883: unit.hook.api@INFO: --> config-changed
2012-01-17 20:51:25,561: unit.hook.api@INFO: Updating buildbot configuration.
2012-01-17 20:51:26,811: unit.hook.api@INFO: Config decoded and written.
2012-01-17 20:51:27,406: unit.hook.api@INFO: <-- config-changed
2012-01-17 20:51:28,793: unit.hook.api@INFO: --> start
2012-01-17 20:51:30,613: unit.hook.api@DEBUG: opened 8010/tcp
2012-01-17 20:51:31,258: unit.hook.api@INFO: <-- start

On LXC the log can be found on the client at  /var/log/juju/unit-$UNITNAME.log.

Upon setting a relation the hooks are called in this order:

Subsequent changes (via the partner calling relation-set results in -relation-changed being called once.

As a result, config-changed hooks shouldn't assume that a service has been started; they should check before restarting it.

/home/bac> ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 45 Jan 23 13:46 /etc/alternatives/java -> /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java*

Notes for creating Juju Charms

Getting reviews of reviews

If you want to write an internal-only charm, talk with the #juju folks first (m_3 told Gary 2012-01-27 to ping them in this case).

We want to become good writers and reviewers of charms. The Juju team has said they are willing to help us with this. To ask for reviews, do the following:

Debugging notes

LXC

You can see the Juju environment in the lxc by looking (cat) in the host at /proc/PID/environ, where PID is the PID of the machine agent (ps aux | grep machine should show it). The machine configures the containers with a base juju environment.

Look in your ~/.juju/environments.yaml for the data-dir configured for your lxc. Now look in the dir. It has lots of good logs for what is going on. $data-dir/$uid-$environmentname/units/master-customize.log has some good stuff in particular.

LXC + SSH fails

Juju packages built on r453 can prevent SSH from working with LXC. Looking at the end of the master-customize.log shows that the user 'ubuntu' already exists and the setting up of .ssh is skipped. You can still ssh to the unit but you'll be prompted for the ubuntu user's password (which is "ubuntu"). However debug-hooks will not work.

Juju fails due to config-get returning null

Updates to the juju packages can sometime lead to an inconsistent state within lxc where Juju loses its mind. The symptom is seeing a hook fail because calls to config-get return null when values should definitely be set.

If this happens, ensure you have juju-origin: pap in the local section of environments.yaml. If the problem persists blowing away the lxc cache rm -rf /var/cache/lxc has worked. Make sure everything is shut down first. Your next use of lxc will be slow as it has to repopulate the cache with downloaded packages.

Feedback notes

If anyone wants to, we can collaborate on feedback to give the juju devs here.

yellow/Juju (last edited 2012-02-22 16:54:40 by gary)