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.

Thanks

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.

1 Like

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.

Welcome to the community. (Although the post is old)

My advice is to start small as you learn how to develop charms. I have two examples from my own journey that might assist you.

I encourage you also to think about Who will be using your charm in the end. Apart from you that is. Juju have a concept for the operator called juju actions which allows you to create functionality to expose to those operators which makes the process of managing your application alot more consistent, safe and secure. I highly recommend you start early to at least play around with actions.

But first, get comfortable with the juju hooks.

Good luck and hope to see your work develop.