Application Modelling

with

Juju and JAAS

Tim Penhey

@howbazaar

What we'll cover

  • What is Application Modelling
  • How does Juju help
  • Introduction to JAAS

Application Modelling

What do we model?

Self-contained

Application

What do we model?

Self-contained

Application

Configuration

Software is Complicated

  • Most software starts quite simple
  • Complexity grows over time as components are added
  • Components often need to be configured to work together

A Simple Example

Django Application

  • Web application using Django
  • PostgreSQL database

Django Application

  • For the database, django needs
    • Database credentials
    • Database created for the application
    • Connection URL - where is the DB server

Production Deployment

  • Web application using Django
  • PostgreSQL database
  • gunicorn as an efficient WSGI HTTP Server
  • nginx as efficient static file server

Gunicorn

  • Python environment
  • WSGI configuration
  • Port to listen on

Nginx

  • Hostname
  • Static files path extension
  • Static files file location
  • Port to forward non-static calls to

Scale Out

  • Highly available database - 2 or 3 nodes
  • Multiple web application servers
  • HA proxy

Extend and Monitor

  • Add celery for asynchronous tasks
  • Now we need redis or rabbitMQ
  • Monitor with nagios

Juju

Encapsulated DevOps

  • Installation and configuration
  • Relationship management
  • Operational activities

A Charm

  • It is just a ZIP file
  • Metadata defined in YAML
  • Hooks are executed at specific times of change

Installation and Configuration

  • install, config-changed, and upgrade-charm
  • start, stop, update-status
  • leader-elected, leader-settings-changed

Relationship Management

  • Relations between software using agreed "protocols"
  • For example, "pgsql" for PostgreSQL information
  • Protocol goes something like this:
    • django establishes relationship with postgresql
    • django says my app is "foo"
    • postgresql creates a database "foo", a user "fooish" and a password, and sets these values
    • django picks up those settings and saves them for its configuration

Operational Activities

  • A charm can also define any number of named actions
  • These actions can be invoked by an operator at any time
  • For example:
    • backup / restore
    • quiesce
    • update content

Cloud Abstraction

  • Juju also abstracts the cloud being used
  • Supports public clouds:
    • AWS, Azure, GCE, Openstack, Joyent, VMware, Oracle cloud
  • Specialist clouds
    • MAAS, LXD

Modelling Requirements

  • Some software has more defined needs
    • High IOPS
    • GPU
    • Attached storage
  • Networks
    • Extra layer 2 devices, VLANs, subnets
    • Spaces - multiple connected subnets with same ingress and egress rules, e.g. DMZ

JAAS

Juju As A Service

JAAS

  • Operated by Canonical
  • Easily create models in multiple clouds or regions
  • Central pane to view

Live Demo Time

Application Modelling

By Tim Penhey

Application Modelling

  • 933