hello juju #6
Description
An introductory charm for developers to learn how to write charms to make them easy to deploy.
Overview
This charm is intended to be used with Juju's Getting Started documentation.
Usage
Deploying hello-juju
:
juju deploy hello-juju
juju expose hello-juju
You can now access the application by connecting to the unit's public address field from the juju status
output:
juju status
> ...
> App Version Status Scale Charm Store Rev OS Notes
> hello-juju active 1 hello-juju local 0 ubuntu exposed
>
> Unit Workload Agent Machine Public address Ports Message
> hello-juju/0* active idle 0 <ip-address> 80/tcp
>
> Machine State DNS Inst id Series AZ Message
> 0 started <ip-address> <instance-id> bionic Running
Now from another computer, you'll be able to make HTTP requests to it.
curl <ip-address>
> Hello Juju!
If you don't have curl
, open your browser at <ip-address>
.
The charm also installs curl
on hello-juju/0
, so you could try that too.
juju ssh hello-juju/0
> ubuntu@<instance-id>:~$
curl localhost
> Hello Juju!
Endpoints supported
/
: returns the plain text stringHello Juju!\r\n\r\n
/greetings
: returns a JSON object with a count of the greetings that have been sent, e.g.{"greetings": 1}
Relating to other charms
Changing databases via pgsql
By default, hello-juju
uses a SQLite database.
When related to a charm that provides the pgsql
relation, hello-juju
will store its data there.
juju deploy postgresql
juju relate postgresql:db hello-juju
Scaling out
This charm is not able to be used with multiple units.
Project Information
hello-juju
charm is maintained by Canonical. Please create a post in our Discourse forum if you encounter any issues.
Configuration
- commit-or-branch
- (string) The commit hash or branch name used with the repo parameter.
- master
- deploy-key
- (string) SSH key to provide to the Git server to grant access to the repository. Only used when the key-required parameter is set to true.
- key-required
- (boolean) Whether the deploy-key should be used to access the repository indicated by the repo parameter.
- port
- (int) The port to listen on.
- 80
- repo
- (string) Where to deploy the underlying Flask application to deploy from. Must be a git repository. Works in conjunction with the commit-or-branch, deploy-key, and key-required parameters.
- https://github.com/juju/hello-juju