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

ubuntu-16-04-lts

UBUNTU JUJU 

In this moment we’ll have on our physical host both LXD and ZFS environment installed, and Maas, now we can see the procedure to install Juju services. In order to install Juju and Juju Gui we need to make some steps and requirements:

  • Install JUJU
  • Create a Controller for new environment;
  • Deploy the Application (JUJU Gui)

1 STEP – INSTALL JUJU

on our virtual host we can launch the following command to install JUJU

$: sudo apt-add-repository -y ppa:juju/stable
$: sudo apt update $: sudo apt-get dist-upgrade 

then let’s start with the installation

$: sudo apt-get install juju

2 STEP – CREATE A LXD CONTROLLER FOR JUJU

See this link to understand the functionality of the controller in JUJU

https://jujucharms.com/docs/2.0/controllers

Juju needs of a controller instance to manage our models and the juju bootstrapcommand is used to create one. This command expects a name (for referencing this controller) and a cloud to use. The LXD ‘cloud’ is known as ‘localhost’ to Juju. For our LXD localhost cloud, we will make a controller called ‘lxd-controller’:

$: juju bootstrap lxd lxd-ctr --debug
Creating Juju controller "lxd-ctr" on localhost/localhost
Bootstrapping model "controller"
Starting new instance for initial controller
Launching instance
 - juju-507b62-0d      
Installing Juju agent on bootstrap instance
Preparing for Juju GUI 2.1.8 release installation
Waiting for address
Attempting to connect to fd1b:8791:9376:4cdd:216:3eff:fe3f:cd79:22
Attempting to connect to 10.215.221.176:22
sudo: unable to resolve host juju-507b62-0
Logging to /var/log/cloud-init-output.log on remote host
Running apt-get update
Running apt-get upgrade
Installing package: curl
Installing package: cpu-checker
Installing package: bridge-utils
Installing package: cloud-utils
Installing package: cloud-image-utils
Installing package: tmux
Fetching tools: curl -sSfw 'tools from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s ' --retry 10 -o $bin/tools.tar.gz <[https://streams.canonical.com/juju/tools/agent/2.0-beta12/juju-2.0-beta12-xenial-amd64.tgz]>
Bootstrapping Juju machine agent
Starting Juju machine agent (jujud-machine-0)
Bootstrap agent installed
Waiting for API to become available: upgrade in progress (upgrade in progress)
Waiting for API to become available: upgrade in progress (upgrade in progress)
Waiting for API to become available: upgrade in progress (upgrade in progress)
Bootstrap complete, lxd-test now available.

in case we received an error like that:

12:37:11 ERROR cmd supercommand.go:458 failed to bootstrap model: subprocess encountered error code 1

the original post is reported here

http://askubuntu.com/questions/847593/error-on-lxd-container-while-we-install-juju-gui-ver-2-0

JUJU take the wrong IP address for LXD node. When the container is RUNNING you can go inside the container

$: lxc list
+---------------+---------+--------------------+------+------------+-----------+
|     NAME      |  STATE  |        IPV4        | IPV6 |    TYPE    | SNAPSHOTS |
+---------------+---------+--------------------+------+------------+-----------+
| juju-1de061-0 | RUNNING | 10.20.40.26 (eth0) |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-maas   | RUNNING | 10.20.40.39 (eth0) |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+
$:  lxc exec juju-1de061-0 bash

then do this :

$: iptables -t nat -A OUTPUT -d 10.20.40.254 -p tcp --dport 8443 -j DNAT --to-destination 10.20.40.27:8443

where  10.20.40.27 is the IP of the our virtual host. the following command shows us both containers

$: lxc list
+---------------+---------+--------------------+------+------------+-----------+
|     NAME      |  STATE  |        IPV4        | IPV6 |    TYPE    | SNAPSHOTS |
+---------------+---------+--------------------+------+------------+-----------+
| juju-1de061-0 | RUNNING | 10.20.40.26 (eth0) |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+
| xenial-maas   | RUNNING | 10.20.40.39 (eth0) |      | PERSISTENT | 0         |
+---------------+---------+--------------------+------+------------+-----------+

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

$: sudo nano /etc/hostname

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

$: exit
$: lxc stop juju-1de061-0
$: lxc move juju-1de061-0 xenial-juju

Once the process has completed we can check that the controller has been created:

$: juju list-controllers 

This will return a list of the controllers known to Juju, which at the moment is the one we just created:

CONTROLLER        MODEL    USER         CLOUD/REGION
lxd-ctr*         default  admin@local  localhost/localhost

We can check on how far Juju has got by running the command:

$: juju status
Model    Controller   Cloud/Region         Version
default  lxd-ctr  localhost/localhost  2.0.1
App  Version  Status  Scale  Charm  Store  Rev  OS  Notes
Unit  Workload  Agent  Machine  Public address  Ports  Message
Machine  State  DNS  Inst id  Series  AZ

3 STEP – RUN JUJU GUI

Once the container is running, on hosts file of VM Host we need to add the following lines to resolve hosts names

$: sudo nano /etc/hosts

add these lines

#Ubuntu 16.04Lts LXD-ZFS with MAAS & JUJU - Bridge
10.20.40.27     lxd

#Container for Ubuntu MAAS      
10.20.40.39     xenial-maas
#Container for Ubuntu JUJU      
10.20.40.26     xenial-juju

run the following command to active the gui

$: juju gui
Opening the Juju GUI in your browser.
Couldn't find a suitable web browser!
Set the BROWSER environment variable to your desired browser.
If it does not open, open this URL:
https://10.20.81.115:17070/gui/6ac598d4-0f9d-47e9-870a-53854b2f9b6a/

then

$: juju gui --show-credentials
Opening the Juju GUI in your browser.
If it does not open, open this URL:
https://10.20.40.42:17070/gui/28a15508-29a9-4ad9-80b0-d846710b6214/
Username: admin
Password: xxxxxxxxx
Couldn't find a suitable web browser!
Set the BROWSER environment variable to your desired browser.

use that credentials to make the login in Juju Gui

 

also this how-to at moment is completed..

<- part 1/4” . 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s