“Maas and Juju on LXD and ZFS – part 4/4”

ubuntu-16-04-lts

UBUNTU JUJU

In order to setup Juju we need to make some steps and requirements:

  • Deploy a Charm

Applications themselves are deployed either as ‘charms’ or as ‘bundles’. Charms are singular applications, such as Haproxy or PostgreSQL, whereas bundles are a curated collection of charms and their relationships. Bundles are ideal for deploying OpenStack, for instance, or Kubernetes.

1 STEP – ADD A NEW NODE TO JUJU MODEL

At this point we can adding the new machine to our model, the command is the following:

$: juju add-machine --model jujulab

after few second our container list will be that

$: lxc list

+---------------+---------+--------------------+------+------------+-----------+
|     NAME      |  STATE  |        IPV4        | IPV6 |    TYPE    | SNAPSHOTS |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-juju   | RUNNING | 10.20.40.41 (eth0) |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-maas   | STOPPED |                    |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+
| juju-1d0c27-0 | RUNNING | 10.20.40.28 (eth0) |      | PERSISTENT | 0         | 
+---------------+---------+--------------------+------+------------+-----------+

To change the name of that container we need to run the following commands:

$: lxc exec juju-1d0c27-0 bash
$: sudo nano /etc/hostname

and change that from juju-1de061-0 to xenial-juju. then 

$: exit
$: lxc stop juju-1d0c27-0
$: lxc move juju-1d0c27-0 xenial-vnode01

Our new container list will be that

$: lxc list

+---------------+---------+--------------------+------+------------+-----------+
|     NAME      |  STATE  |        IPV4        | IPV6 |    TYPE    | SNAPSHOTS |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-juju   | RUNNING | 10.20.40.41 (eth0) |      | PERSISTENT  | 0         |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-maas   | STOPPED |                    |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-vnode01| RUNNING | 10.20.40.28 (eth0) |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+

3 STEP – DEPLOY A CHARM ON OUR NEW LXC CONTAINER (NODE)

Using the gui is very easy to deploy an application (charm) on our node. For our lab we will use as service MySQL Database.

click on “Add to Canvas”

screen-shot-2017-02-07-at-15-59-00

Drag and drop the service on node

then commit changes

run the Deploy

screen-shot-2017-02-07-at-15-59-22

waiting the end of the task, when it’ll be finished we’ll have that situation

screen-shot-2017-02-07-at-16-00-16

at the end our charm is deployed on our node and in juju status will see that.

$: juju status --model jujulab
Model      Controller          Cloud/Region  Version
jujulab  maaslab-controller  maaslab       2.0.2
App    Version  Status  Scale  Charm  Store       Rev  OS      Notes
mysql  5.7.17   active      1  mysql  jujucharms   56  ubuntu 
Unit      Workload  Agent  Machine  Public address  Ports     Message
mysql/0*  active    idle   0        10.20.81.96     3306/tcp  Ready
Machine  State    DNS          Inst id             Series  AZ
0        started  10.20.81.96  manual:10.20.81.96  xenial 
Relation  Provides  Consumes  Type
cluster   mysql     mysql     peer

Once deployed, we need to log in as root MySQL User at the MySQL console

$: juju switch jujulab

then

$: juju ssh mysql/0

then

ubuntu@vnode00: sudo apt update
ubuntu@vnode00: sudo apt dist-update

then

ubuntu@vnode00: mysql -u root -p`sudo cat /var/lib/mysql/mysql.passwd
mysql>

the end…..

<- part 3/4


“cya to the next 1…. Njoy !”
bye dakj

Disclaimer: All the tutorials included on this site are performed in a lab environment to simulate a real world production scenario. As everything is done to provide the most accurate steps to date, we take no responsibility if you implement any of these steps in a production environment.

“We learn from our mistakes”

Advertisements