Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm too cheap to pay for EC2, and I don't have enough servers to set up my own openstack, how do I configure juju to use Linux Containers (LXC) on something like my laptop?

share|improve this question

2 Answers

up vote 32 down vote accepted

Note that this currently works on older version of Juju (.6 and ,7) and does NOT yet work on Juju 2.x. These instructions are for Juju .7.

First install Juju and some dependencies it needs:

sudo add-apt-repository ppa:juju/pkgs
sudo apt-get update
sudo apt-get install lxc apt-cacher-ng libzookeeper-java zookeeper juju

After installing it, you may have to reboot (I had to else libvirt couldn't create the network bridge indicating it was already in use).

After that you might get error for SSH authorized/public key not found. ERROR SSH authorized/public key not found.

ssh-keygen -t rsa

First configure your environment local environment:

In ~/.juju/environments.yaml, add a section for type "local" (if the file ~/.juju/environments.yaml does not exist, run juju bootstrap to create the file - you will get an error, but the file will be created):

environments:
  sample:
    type: local
    control-bucket: juju-a14dfae3830142d9ac23c499395c2785999
    admin-secret: 6608267bbd6b447b8c90934167b2a294999
    data-dir: /home/jorge/whatever
    default-series: precise

The data-dir is going to be where the containers and stuff will keep their data. As far as I can tell control-bucket just needs to be a unique, syntactically valid Amazon S3 bucket name like a subdomain name, and admin-secret can be whatever you want. After this you can then:

juju bootstrap

The first time this runs it might take a bit, as it's doing a netinstall for the container, it's around a 300 megabyte download. Subsequent bootstraps should be much quicker. You deploy charms from the charm store using the following commands:

juju deploy mysql
juju deploy wordpress
juju add-relation wordpress mysql

When it's deployed juju should return something like this in status:

machines:
  0: {dns-name: localhost, instance-id: local}
services:
  mysql:
    charm: local:precise/mysql-11
    relations: {db: wordpress}
    units:
      mysql/0:
        machine: 0
        public-address: 192.168.122.137
        relations:
          db: {state: up}
        state: started
  wordpress:
    charm: local:precise/wordpress-31
    relations: {db: mysql}
    units:
      wordpress/0:
        machine: 0
        public-address: 192.168.122.166
        relations:
          db: {state: up}
        state: started
2011-10-11 18:44:32,268 INFO 'status' command finished successfully

Expose your service with:

juju expose wordpress

In this example, navigating the browser to 192.168.122.166 should take you to the wordpress configuration page.

Enabling logging option.

juju debug-log

It will be good to open this in a separate terminal and see what juju is doing behind the curtain.

References:

share|improve this answer
I'd like to add that for people with more than one environment setup in the yaml file, you select the environment by passing -e <environment_name> to select which one to use. – mfisch Nov 21 '12 at 5:01

When I ran

juju bootstrap

I got this error message

from txaws.client.ssl import VerifyContextFactory
ImportError: No module named ssl

My operating system was Ubuntu 10.04.4 LTS. I read something about JuJu being supported in Ubuntu 12 LTS so I upgraded to Ubuntu 12 LTS. Then I started getting this error

ssh authorized/public key not found

Even though I had generated the public keys. What I had to do was copy my public key to the ~/.ssh/ folder as "id_dsa.pub" after reading this post about updating the juju tutorial

cp ~/.ssh/authorized_keys ~/.ssh/id_dsa.pub
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.