static site #2

Supports: bionic eoan xenial
Add to new model


The static-site charm installs and configured nginx for the hosting of static sites stored in remote Git repositories. No PHP, Python, Ruby can be run server side. Files such as HTML, JavaScript and images will be served directly to users unprocessed. Perfect for your blog generated by Jekyll, Hugo, Pelican or other static site generators. Store the resulting pages in a Git repository, and use this charm to deploy and update the code the Juju way.

Static Site Charm

This is an extremely simple charm designed at hosting static sites generated by tools like Jekyll, Pelican and Hugo (to name just a few).

It uses layer-git-deploy to handle checking out your site content from a Git Repository, once the content is cloned to the deployed static-site unit, nginx will be configured to serve that content.

After deploying this charm, simply set the repo option to a repository using the git syntax used when cloning a remote repostiory, i.e.:

juju config static-site repo=

If your website is stored on a private Git repository which requires authentication, you can either add username and password to the clone URI:

juju config static-site repo=

...or add a private key using the deploy-key option. This should ideally be a GitHub or GitLab deploy key which can not write to the repository, for security's sake. Where my-deploy-key.txt is a text file containing the SSH private key used to access the git repo -

juju config static-site repo=git+ssh:// juju config static-site deploy-key=$(cat my-deploy-key.txt)


Initially written and used by James Hebden of the Alchemy Charmers group.


(string) Commit or branch to update to
(string) Folder under the checked out repo which contains web content
(string) A deploy key is an SSH key that is stored on the server and grants access to a repository.
(string) The external URI of this site. Used to configure a related reverse proxy. Requires http:// or https:// to be provided, as this controls which frontend on the reverseproxy will be used (port 80 or 443 with TLS)
(string) Space separated list of extra deb packages to install.
(string) List of signing keys for install_sources package sources, per charmhelpers standard format (a yaml list of strings encoded as a string). The keys should be the full ASCII armoured GPG public keys. While GPG key ids are also supported and looked up on a keyserver, operators should be aware that this mechanism is insecure. null can be used if a standard package signing key is used that will already be installed on the machine, and for PPA sources where the package signing key is securely retrieved from Launchpad.
(string) List of extra apt sources, per charm-helpers standard format (a yaml list of strings encoded as a string). Each source may be either a line that can be added directly to sources.list(5), or in the form ppa:<user>/<ppa-name> for adding Personal Package Archives, or a distribution component to enable.
(boolean) This should be set to true to ensure that a deploy key is deployed if necessary
(string) The status of service-affecting packages will be set to this value in the dpkg database. Valid values are "install" and "hold".
(string) The repository to clone from, this is required