understanding juju charms

24
Understanding Juju Charms Demis Gomes <[email protected] > <[email protected]>

Upload: demis-gomes

Post on 15-Apr-2017

1.148 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Understanding  Juju Charms

Understanding Juju Charms

Demis Gomes<[email protected]>

<[email protected]>

Page 2: Understanding  Juju Charms

Apresentation Guide● What is Juju Charms?● Usage● Features● Weaknesses● How a charm works?● Conclusion

2

Page 3: Understanding  Juju Charms

What is Juju Charms?

No, this presentation don’t will talk about Juju Salimeni :’ (

It is about the Juju Charms tool! :) 3

Page 4: Understanding  Juju Charms

What is Juju Charms?Juju Charms is an open-source model for service-oriented architecture and service-oriented deployments [1]

With Juju, it is possible to model different services as for example, a web server, a database or a monitoring tool to relation them in ways that meet the proposed goals.

Juju allow deploy, maintain, configure, destroy and scale services in a Cloud environment.

Juju is made mainly in Go, with 99% of the code composed by this language

The ease to deploy and relate services, like a spell, give the tool’s name4

Page 5: Understanding  Juju Charms

What is Juju Charms?The services, called charms, are tools used by developers to create applications, how for example Hadoop, RabbitMQ, MySQL and others.

These charms are provided by community through the Charms Store, with some them being recommended because was made by the Juju’s reviewers group called charmers.

The main goal of Juju is reuse of common operational code in widely different environments[1] 5

Page 6: Understanding  Juju Charms

What is Juju Charms?Users and contributors

6

Page 7: Understanding  Juju Charms

Architecture

7

Page 8: Understanding  Juju Charms

ArchitectureJuju's environment is bootstraped on top of an IaaS or locally, creating the State-Service machine, whose manage other machines

The State-service fetches in Charms Store or in local repository (if passed by args) the charm to be deployed from the admin's request

State-service create a machine (VM or container, depends of IaaS) that contains an agent. This agent communicates with state-service, passing informations to it. The charm code runs in one unit, that can to be execute in one or more machines

The admin can manage the enviroment by Juju CLI or Juju GUI

8

Page 9: Understanding  Juju Charms

UsageCan be deployed in various IaaS providers or locally[2]

9

Page 10: Understanding  Juju Charms

UsageInstallation can be found in https://jujucharms.com/get-started

After installation:

To deploy a service[2]:

juju deploy wordpress

To relate it with MySQL:

juju deploy mysql

juju add-relation wordpresss mysql

10

Page 11: Understanding  Juju Charms

UsageTo add an unit:

juju add-unit wordpress

This way will be created a new istance of wordpress

To deploy a service with a machine with more resources

juju deploy wordpress --constraints=”mem=6G cpu-cores=4“

To deploy a service with different configuration

juju deploy --config myconfig.yaml mediawiki

It is necessary create the myconfig.yaml, showed in this link11

Page 12: Understanding  Juju Charms

UsageTo add an unit in a specific machine:

juju add-unit wordpress --to 2

Where “2” is the machine id

To change the config during the charm’s execution

juju set wordpress tuning=optimized

Where “tuning” is a config option and “optimized” a value that can be set to it.

To destroy a service:

juju destroy mysql 12

Page 13: Understanding  Juju Charms

UsageThere a tool called Juju GUI[3]

With it, is possible manage the charms by a Web GUI, facilitating the use of Juju

13

Page 14: Understanding  Juju Charms

Features● Deploy, model, scale and manage services in a easy way● Utilize a Web GUI to facilitate and manage in a intuitive mode● Not reinventing the wheel, utilizing code made for experts that resolve many

problems● Avoid dependencies problems in different machines, running the services

anywhere that Juju is installed● Configure the services anyway you want before or while the service is running● You can create a charm and contribute with the community● Easy to use, install and configure

14

Page 15: Understanding  Juju Charms

Weaknesses● No realize auto scaling● Limited to Ubuntu machines● Could be a tool like a IDE that facilitate charm’s development

15

Page 16: Understanding  Juju Charms

How a charm works?A charm is a Ubuntu machine, that can be created in few versions of Ubuntu. The machine can be a Virtual Machine or a container, and contains a code with the necessary logic to work.

This charm runs scripts in this machine that install and configure the service to be execute, beside define how the charm will be relation with other charms

The charm can provides a service, as a Web Server, or requires a service, like a database.

16

Page 17: Understanding  Juju Charms

How a charm works?

The basic structure of a charm’ s code, that will detail in the next slides.

17

Page 18: Understanding  Juju Charms

How a charm works?The basic structure of a charm’ s code

● config.yaml: composed by name, description and type of many configurations defined by charms' authors

● metadata.yaml: contains the charm’s name, description, summary, tags and the services required or provided by charm. Ex: Wordpress requires database and provides website

● icon.svg: charm’s icon● README.md: Despite in image the extension be

ex, is indicated the md extension because the text is fullfiled better in web. This file inform to the users how the charm works.

18

Page 19: Understanding  Juju Charms

How a charm works?● hooks dir: This directory contains the main

scripts that are executed when a charm is running. The directory is composed by:○ config-changed: this script runs when

a config is altered during the charm’s execution or a new config file is passed on deploy moment.

○ install: The script that install the required packages and configure the service;

19

○ start: simple script that starts the service

○ stop: stop the service;

Page 20: Understanding  Juju Charms

How a charm works?● hooks dir:

○ upgrade-charm: script that is called when a new version the charm is available and the user wish upgrade to the new version

○ relation-name...: scripts that run when a relation is made. The relation can be joined, departed, changed or broken. Some names of relation are database, website, load-balancer, nfs, etc...

20

Page 21: Understanding  Juju Charms

How a charm works?An example relation occurs between Wordpress and MySQL. The Wordpress requires MySQL as database, and runs the script db-relation-departed when connects with MySQL charm. This link contains the script.

How MySQL provides a database, MySQL charm runs the script db-relation-joined to create a database and configure the Wordpress acess to it. The code can be acessed here.

A bundle is a set of charms with caracteristics and relations well defined. The example above can be a bundle example.

21

Page 23: Understanding  Juju Charms

ConclusionJuju is a orchestration tool that allows to model service-oriented architectures, can run in many IaaS providers

It reuse the code and implement environments easily and quickly, without configuration issues or dependencies between machines

Allow manage, configure, build relations and scale out charms, but not provides autoscaling and is limited to services that run in Ubuntu

Create charms also can be very useful, and is cool to contribute with community

23

Page 24: Understanding  Juju Charms

References1. About Juju. https://jujucharms.com/docs/stable/about-juju. Acessed in

11/09/2015.2. Introduction. https://jujucharms.com/docs/stable/getting-started. Acessed in

15/09/2015.3. What is the GUI? https://jujucharms.com/docs/stable/howto-gui-management.

Acessed in 16/09/2015.

24