Companion library for PaaS app charmer.
Project description
PaaS App Charmer
Easily deploy and operate your Flask or Django applications and associated infrastructure, such as databases and ingress, using open source tooling. This lets you focus on creating applications for your users backed with the confidence that your operations are taken care of by world class tooling developed by Canonical, the creators of Ubuntu.
Have you ever created an application and then wanted to deploy it for your users only to either be forced to use a proprietary public cloud platform or manage the deployment and operations yourself? PaaS App Charmer will take your application and create an OCI image using Rockcraft and operations code using Charmcraft for you. The full suite of tools is open source so you can see exactly how it works and even contribute! After creating the app charm and image, you can then deploy your application into any Kubernetes cluster using Juju. Need a database? Using Juju you can deploy a range of popular open source databases, such as PostgreSQL or MySQL, and integrate them with your application with a few commands. Need an ingress to serve traffic? Use Juju to deploy and integrate a range of ingresses, such as Traefik, and expose your application to external traffic in seconds.
Getting Started
There are 2 requirements for the flask application:
- There is a
requirements.txt
file in the project root - The WSGI path is
app:app
Make sure that you have the latest/edge
version of Charmcraft and Rockcraft
installed:
sudo snap install charmcraft --channel latest/edge --classic
sudo snap install rockcraft --channel latest/edge --classic
Both have the flask-framework
profile to create the required files
and include the flask-framework
extension which will do all the hard
operational work for you and you just need to fill in some metadata in the
rockcraft.yaml
and charmcraft.yaml
files. To create the necessary files:
rockcraft init --profile flask-framework
mkdir charm
cd charm
charmcraft init --profile flask-framework
After packing the rock and charm using rockcraft pack
and charmcraft pack
and uploading the rock to a k8s registry, you can juju deploy your flask
application, integrate it with ingress and start serving traffic to your users!
Read the comprehensive getting started tutorial for more!
Additional resources:
- Tutorial to build a rock for a Flask application
- Charmcraft
flask-framework
reference - Charmcraft
flask-framework
how to guides - Rockcraft
flask-framework
reference
Contributing
Is there something missing from the PaaS App Charmer framework? PaaS App Charmer welcomes contributions! This section covers how to add a new integration and a new framework.
Add an Integration
There are a few recommended steps to add a new integration which we'll go through below.
- Please write a proposal on the charm topic on discourse. This should cover things like:
- The integration you intend add
- For each of the frameworks that PaaS App Charmer supports:
- The commonly used package(s) to make use of the integration
- The environment variables, configuration etc. that would be made available to the app
- An example for how to use the integration within an app
- The proposed implementation in
paas-app-charmer
. Take a look atcharm.py
forgunicorn
based frameworks for integration examples.
- Update the reference with the new integration
- Raise a pull request to this repository adding support for the integration.
- Add a commented entry for
requires
to all the relevant Charmcraft templates for the new integration
Add a Framework
There are a few recommended steps to add a new framework which we'll go through below.
- Please write a proposal on the charm topic on discourse. This should cover things like:
- The programming language and framework you are thinking of
- Create an example
rockcraft.yaml
file and build a working OCI image. To see an example forflask
, install Rockcraft and runrockcraft init --profile flask-framework
and runrockcraft expand-extensions
and inspect the output. - Create an example
charmcraft.yaml
file and build a working charm. To see an example forflask
, install Charmcraft and runcharmcraft init --profile flask-framework
and runcharmcraft expand-extensions
and inspect the output. - How the configuration options of the charm map to environment variables, configurations or another method of passing the information to the app
- The requirements and conventions for how users need to configure their app to work with PaaS App Charmer
- Which web server to use
- Raise a pull request to rockcraft adding a new extension and profile for the framework. This is the flask profile and extension. The OCI image should work standalone, not just with the charm for the framework.
- Raise a pull request to this repository adding a new parent class that can be used by the app charms. The following is the example for flask.
- Raise a pull request to charmcraft adding a new extension and profile for the framework. This is the flask profile and extension.
- Write a tutorial and reference documentation for the framework. As an example, this is the flask tutorial and reference documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for paas_app_charmer-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdf40e50a87dd69dadf783ff30362d2593de7b800f27dffad10455c6e9754949 |
|
MD5 | 18a176ddbb95dc4750c5d005020842ff |
|
BLAKE2b-256 | 705371637967235cac6c0dd98dc7249b52f9ad0b6a9820a84556986fa01be364 |