https://juju.ubuntu.com/docs/getting-started.html
https://juju.ubuntu.com/docs/user-tutorial.html
P.S: When you lunch an instance, be careful about the instance type. Except t1.micro, others will charge you money~~
I strongly suggest to add parameter after juju bootstrap and deploy command as follows:
--constraints "instance-type=m1.micro"
or execute this command:> juju set-constraints instance-type=t1.micro
For more info about this, please check out this document:
https://juju.ubuntu.com/docs/constraints.html
My environment is using EC2.
> vi .juju/environment.yaml
environments:
sample:
type: ec2
access-key: << your access key >>
secret-key: << your secret key >>
control-bucket: juju-0f3b4bce2d944893a74967016c98b903
admin-secret: 0d748130374946babe1f2531d77620d0
default-series: precise
ssl-hostname-verification: true
sample:
type: ec2
access-key: << your access key >>
secret-key: << your secret key >>
control-bucket: juju-0f3b4bce2d944893a74967016c98b903
admin-secret: 0d748130374946babe1f2531d77620d0
default-series: precise
ssl-hostname-verification: true
When you prepare your .juju/environment.yaml ready, you are able to do the following steps to try juju:
> juju bootstrap
> juju deploy wordpress
> juju deploy mysql
> juju add-relation mysql wordpress
> juju expose wordpress
After executing above commands, we can use "juju status" to see what we have now on Amazon EC2:
> juju status
2012-06-11 09:00:26,558 INFO Connecting to environment...
2012-06-11 09:00:43,657 INFO Connected to environment.
machines:
0:
agent-state: running
dns-name: ec2-23-22-111-234.compute-1.amazonaws.com
instance-id: i-30fa4a49
instance-state: running
1:
agent-state: running
dns-name: ec2-50-17-117-72.compute-1.amazonaws.com
instance-id: i-b055eac9
instance-state: running
2:
agent-state: running
dns-name: ec2-23-22-205-88.compute-1.amazonaws.com
instance-id: i-de52eda7
instance-state: running
services:
mysql:
charm: cs:precise/mysql-2
relations:
db:
- wordpress
units:
mysql/0:
agent-state: started
machine: 2
public-address: ec2-23-22-205-88.compute-1.amazonaws.com
wordpress:
charm: cs:precise/wordpress-1
exposed: true
relations:
db:
- mysql
units:
wordpress/0:
agent-state: started
machine: 1
open-ports:
- 80/tcp
public-address: ec2-50-17-117-72.compute-1.amazonaws.com
2012-06-11 09:01:18,809 INFO 'status' command finished successfully
From now on, we can check EC2 dashboard and see what instances are there ( it will be the same as the result of "juju status")
Because we do "expose" for wordpress, we have a public address ( ec2-50-17-117-72.compute-1.amazonaws.com) and it looks like as below:
Once you are done with an juju deployment, you need to terminate all running instances in order to stop paying for them.
> juju destroy-environment
WARNING: this command will destroy the 'sample' environment (type: ec2).
This includes all machines, services, data, and other resources. Continue [y/N]y
2012-06-11 09:53:03,181 INFO Destroying environment 'sample' (type: ec2)...
2012-06-11 09:53:10,018 INFO Waiting on 3 EC2 instances to transition to terminated state, this may take a while
2012-06-11 09:53:53,257 INFO 'destroy_environment' command finished successfully