I’ve looked at many of docs/examples plus searched github for example charmcraft.yaml files. Many of them install the app itself from a public github repo or, in one of the examples, a snap. I remain confused on the right/best way to package up a Python web application and deploy it on Juju.
- Python web applications come in different flavors
- No setup.py or pyproject.toml file, not intended to be “built”, requirements.txt for dependencies
-
Can still be “built”, but not intended to be fully pip installable:
pip install -e .
to get sourcecode dir into virtualenv, requirements.txt like deps - Fully pip installable: requirements in setup.py or pyproject.toml, etc.
- Let’s also assume that our application source code is private, not something publicly accessible. And since it lives right there on our disk, we don’t want to have to get juju authentication to read it from github during the build process. We’d like everything the app needs to run to come right from the same project folder the app is in and be fully uploaded with the rest of the charm.
Given the above, how do we get our application’s source and whatever other file based resources it might need (images, css, etc.) into the charm? Then, how do we get those items to the right place during the install step of the charm?
I’ve seen a few options:
- Put the app in the
src
directory and it will be added into the charm.- There could be other files I want to include that don’t live in
src
. - I don’t want to re-organize my project to package it into a charm.
- What I’d really like is for the charm to live at /charm and the app otherwise just look like a Python app.
- There could be other files I want to include that don’t live in
- Use parts and the python plugin
- It seems like this doesn’t work for apps like #1 above?
- Use parts and dump plugin to include the application’s source code directory
- There are files being included that don’t need to be
In all the cases I’m not sure how to get the files out of the charm in the install step even once I get them into the charm.
Thanks.