Adding two applications / tools into one charm


Hello ,

i’m new to Juju and I have one concern, Can I add two application or files into one charm ? so we can limited our usage for charms.



What your charm manages is entirely up to you as a charm author. However managing multiple application that have little or no correlation with each other is probably discouraged. It would get very difficult to maintain and use these charms after a while.

One of the Kibana charms for example sets up the Kibana dashboard and a NGINX reverse proxy in one charm.


There are two general approaches. The first is simpler, the second makes it easier to allow future charms to build off of your work.

First of all - a charm is a set of scripts that manages an application’s lifecycle. But that “application” might be a full service. Those scripts have full power to do whatever they want. So if you want to deploy multiple applications that work together to create a single service, that’s perfectly fine.

There are some layers, such as nginx, that make it easy to place your web application server behind NGINX without further configuration. NGINX won’t be visible in the Juju status output though.

Another approach is to use a bundle and interfaces. A bundle is a description of several charms that work together, written in declarative YAML format. Interfaces allow charms to say things like: “I provide a web server”, “I need to connect a PostgreSQL database”, “I need to talk to Redis”, “I provide PostgreSQL”*, etc.

Using bundles and interfaces is more complex, but has a steeper learning curve. I suggest doing everything in a single charm, then extending it out into multiple charms as your knowledge grows.

* This might not not actually be PostgreSQL, it might be a charm that looks to clients like PostgreSQL, such as pgbouncer.

The Juju Show #50 - June 5th 17:00GMT - Trust in bundles