Merge ~mthaddon/charm-k8s-content-cache/+git/charm-k8s-content-cache:end-user into charm-k8s-content-cache:master

Proposed by Tom Haddon
Status: Merged
Approved by: Tom Haddon
Approved revision: d77fe39fce88fed2af4caff5e8af9428dc1955db
Merged at revision: 24de1bd9dc1d30f98ede2490e7efd778221013f6
Proposed branch: ~mthaddon/charm-k8s-content-cache/+git/charm-k8s-content-cache:end-user
Merge into: charm-k8s-content-cache:master
Diff against target: 120 lines (+52/-36)
2 files modified
README.md (+49/-33)
metadata.yaml (+3/-3)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
James Troup (community) Approve
Review via email: mp+395526@code.launchpad.net

Commit message

Update README to be more end-user focused, and point to discourse-based docs for more information

Description of the change

Update README to be more end-user focused, and point to discourse-based docs for more information

To post a comment you must log in.
Revision history for this message
James Troup (elmo) wrote :

Couple of high level comments and then some inline.

 1) I think there should be more prominence given to the fact that this cache is nginx powered? For better or worse, it's a globally recognised brand, we should trade on it.

 2) the updated README leads with our use case. I think you should lead with an example use case, and use our story later as evidence of this charms cachet (sorry, pun not intended but gleefully used)

Revision history for this message
Tom Haddon (mthaddon) wrote :

PTAL

Revision history for this message
James Troup (elmo) wrote :

Some comments inline, but in general, this LGTM and is definitely an improvement.

review: Approve
Revision history for this message
Tom Haddon (mthaddon) wrote :

Thanks for the feedback, all good comments.

Have tried using archive.local for "site" and "juju-external-hostname" but it's not quite working as expected. https://paste.ubuntu.com/p/k4Jgkpy24S/ is what I tried, but this gives me the following in nginx config:

proxy_set_header Host "archive.local";

This means the resources I was requesting previously don't exist (instead I see https://paste.ubuntu.com/p/jg3fjfJsky/ at the site root). Will ask for some feedback from Haw on this and figure out what's needed.

Revision history for this message
Haw Loeung (hloeung) wrote :
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 24de1bd9dc1d30f98ede2490e7efd778221013f6

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/README.md b/README.md
2index ddca31c..6d9b631 100644
3--- a/README.md
4+++ b/README.md
5@@ -1,50 +1,66 @@
6-# charm-k8s-content-cache
7+# Content Cache Operator
8
9-## Description
10+A Juju charm for deploying and managing a content cache.
11
12-Deploy content caching layer into K8s.
13+## Overview
14
15-## Usage
16-
17-To deploy this charm into a k8s model:
18-
19- juju deploy cs:~content-cache-charmers/content-cache-k8s --config site=mysite.local --config backend=http://mybackend.local:80
20-
21-And then you can test the deployment with:
22+A service for caching content, built on top of [Nginx](https://www.nginx.com/)
23+configurable to cache any http or https web site. Tuning options include
24+cache storage size, maximum request size to cache and cache validity duration.
25
26- curl --resolve mysite.local:80:<ingress IP> http://mysite.local
27+This service was developed to provide front-end caching for web sites run by
28+Canonical's IS team, and to reduce the need for third-party CDNs by providing
29+high-bandwidth access to web sites via this caching front-end. Currently used
30+for a number of services including [the Snap Store](https://snapcraft.io/store),
31+the majority of Canonical's web properties including [ubuntu.com](https://ubuntu.com) and
32+[canonical.com](https://canonical.com), and [Ubuntu Extended Security Maintenance](https://ubuntu.com/security/esm).
33
34-### Scale Out Usage
35+This Kubernetes-based version is built using the same approach, and can be
36+used as a front-end caching service in a situation where your Kubernetes
37+cluster and its ingress controllers have a fast connection to the Internet.
38
39-Just run `juju scale-application <application name> 3`.
40-
41-## Using a Custom Image
42-
43-Build the docker image:
44+## Usage
45
46- git clone https://git.launchpad.net/charm-k8s-content-cache
47- cd charm-k8s-content-cache/docker
48- docker build . -t myimage:v<revision>
49- docker tag myimage:v<revision> localhost:32000/myimage:v<revision>
50- docker push localhost:32000/myimage:v<revision>
51+For details on using Kubernetes with Juju [see here](https://juju.is/docs/kubernetes), and for
52+details on using Juju with MicroK8s for easy local testing [see here](https://juju.is/docs/microk8s-cloud).
53
54-Then, to use your new image, either replace the `deploy` step above with
55+To deploy this charm into a k8s model, with sample configuration set up to
56+cache `archive.ubuntu.com` on `archive.local`:
57
58- juju deploy cs:~content-cache-charmers/content-cache-k8s --config image_path=localhost:32000/myimage:v<revision> --config site=mysite.local --config backend=http://mybackend.local:80
59+ juju deploy cs:~content-cache-charmers/content-cache-k8s \
60+ --config site=archive.local \
61+ --config backend=http://archive.ubuntu.com:80 \
62+ --config juju-external-hostname=archive.local
63+ juju expose content-cache
64
65-Or, if you have already deployed content-cache:
66+And then you can test the deployment with:
67
68- juju config content-cache image_path=localhost:32000/myimage:v<revision>
69+ # Set this to to the "Address" value in the "App" section of `juju status`
70+ APP_IP=10.152.183.117
71
72-## Developing
73+First let's request a resource with headers that will allow us to cache (with
74+sample output):
75
76-To build the charm locally, just run `charmcraft build`. You can then deploy
77-using:
78+ curl -v --resolve archive.local:80:${APP_IP} http://archive.local/ubuntu/dists/focal/Contents-i386.gz -o /dev/null 2>&1 | grep 'X-Cache-Status'
79+ # < X-Cache-Status: MISS from juju-87625f-hloeung-13 (content-cache-56bbcd79d6-h8dk2)
80+ # First result is a cache MISS
81+ curl -v --resolve archive.local:80:${APP_IP} http://archive.local/ubuntu/dists/focal/Contents-i386.gz -o /dev/null 2>&1 | grep 'X-Cache-Status'
82+ # < X-Cache-Status: HIT from juju-87625f-hloeung-13 (content-cache-56bbcd79d6-h8dk2)
83+ # Second result is a cache HIT
84
85- juju deploy ./content-cache.charm
86+And now let's request a resource which has headers telling us not to cache:
87
88-To run lint against the code, run `make lint`.
89+ # Verify cache control headers on the upstream resource
90+ curl -v http://archive.ubuntu.com/ubuntu/dists/focal/Release 2>&1 | grep 'Cache-Control'
91+ # output: < Cache-Control: max-age=0, proxy-revalidate
92+ # And now perform the requests through the content-caching service
93+ curl -v --resolve archive.local:80:${APP_IP} http://archive.local/ubuntu/dists/focal/Release -o /dev/null 2>&1 | grep 'X-Cache-Status'
94+ # < X-Cache-Status: MISS from juju-87625f-hloeung-13 (content-cache-56bbcd79d6-h8dk2)
95+ # First result is a cache MISS
96+ curl -v --resolve archive.local:80:${APP_IP} http://archive.local/ubuntu/dists/focal/Release -o /dev/null 2>&1 | grep 'X-Cache-Status'
97+ # < X-Cache-Status: MISS from juju-87625f-hloeung-13 (content-cache-56bbcd79d6-h8dk2)
98+ # Second result still a cache MISS
99
100-## Testing
101+---
102
103-Just run `make unittest`.
104+For more details, [see here](https://charmhub.io/content-cache)
105diff --git a/metadata.yaml b/metadata.yaml
106index dacd17e..7facfdc 100644
107--- a/metadata.yaml
108+++ b/metadata.yaml
109@@ -1,8 +1,8 @@
110 name: content-cache
111 description: |
112- Useful for providing local mirrors of HTTP servers and building
113- content delivery networks (CDN).
114+ A service providing local caches of HTTP servers and useful for building content delivery networks (CDN).
115 summary: |
116- Content caching charm for Kubernetes
117+ A service providing local caches of HTTP servers and useful for building content delivery networks (CDN).
118+docs: https://discourse.charmhub.io/t/content-cache-documentation-overview/3992
119 series: [kubernetes]
120 min-juju-version: 2.8.0 # charm storage in state

Subscribers

People subscribed via source and target branches