We created this layer for use in the wsgi-app charm, but we never actually started using that app in production. We have now moved most of our hosted environments over to Kubernetes, so we don't need to maintain that charm going forward.
However, I do believe that both the charm and this layer could be generally useful, so please let me, @nottrobin, know if you would like to take over this project.
A charm layer for extracting gzipped tarballs attached to the charm as Juju resources.
Include this layer in your charm by adding it to layer.yaml
in your charm root:
includes: ['layer:untar-resources', ...]
First, make sure your charm is specifying each of the resources you wish to manage in its metadata.yaml
:
resources:
{resource_name}:
type: file
filename: {filename}.tar.gz
description: "{description}"
Now create a untar-resources.yaml
file in your charm root to configure each .tar.gz
resource you wish to extract:
resources:
{resource_name}:
username: {username}
destination_path: {destination_path}
{resource_name_2}:
...
When the charm is built and deployed, resources can be attached using Juju:
juju attach {service_name} {resource_name}={path_to_file}.tar.gz
The untar-resources layer will:
- detect the new resource
- extract it into the configured
{destination_path}
- change ownership on the extracted files to
{username}
If a newer resource is attached the contents of {destination_path}
will be replaces, and a backup of the previous resource will be kept in {destination_path}.previous
. Older versions of resources will be descarded.
For an example implementation, see the Webteam's wsgi-app charm.