← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:charm-assets-http-interface into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:charm-assets-http-interface into launchpad:master.

Commit message:
charm/launchpad-assets: Add http interface support

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/444384

Since this charm is fairly simple and only exposes a single port, we can just let the `ols-http` layer do most of the work.  The only downside is that this involves renaming the `port_assets` configuration key to `port`, but that just means we'll need to change the configuration key in the Mojo spec when updating the charm revision.

I added the most minimal possible `/_status/check` URL to support `ols-http`'s `nrpe` relation.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-assets-http-interface into launchpad:master.
diff --git a/charm/launchpad-assets/config.yaml b/charm/launchpad-assets/config.yaml
index bab57b5..dd00954 100644
--- a/charm/launchpad-assets/config.yaml
+++ b/charm/launchpad-assets/config.yaml
@@ -3,7 +3,7 @@ options:
     type: string
     description: Domain name for this instance.
     default: "launchpad.test"
-  port_assets:
+  port:
     type: int
     description: Port for the assets website.
     default: 8009
diff --git a/charm/launchpad-assets/layer.yaml b/charm/launchpad-assets/layer.yaml
index 4410c41..53a6ccf 100644
--- a/charm/launchpad-assets/layer.yaml
+++ b/charm/launchpad-assets/layer.yaml
@@ -1,5 +1,6 @@
 includes:
   - layer:launchpad-payload
+  - layer:ols-http
   - interface:apache-website
 repo: https://git.launchpad.net/launchpad
 options:
@@ -9,3 +10,6 @@ options:
       - python3-convoy
   launchpad-payload:
     build_target: build
+  ols:
+    service_name: launchpad-assets
+    tarball_payload_name: launchpad
diff --git a/charm/launchpad-assets/reactive/launchpad-assets.py b/charm/launchpad-assets/reactive/launchpad-assets.py
index dce1243..2612611 100644
--- a/charm/launchpad-assets/reactive/launchpad-assets.py
+++ b/charm/launchpad-assets/reactive/launchpad-assets.py
@@ -92,7 +92,7 @@ def send_apache_website():
     # interface-apache incorrectly sets `modules`, not `site_modules`.  Work
     # around this.
     apache.set_remote(site_modules="headers proxy proxy_http")
-    apache.send_ports([config["port_assets"]])
+    apache.send_ports([config["port"]])
     apache.send_enabled()
     hookenv.status_set("active", "Ready")
     set_flag("service.apache-configured")
diff --git a/charm/launchpad-assets/templates/vhost.conf.j2 b/charm/launchpad-assets/templates/vhost.conf.j2
index b16fabb..75c6dfc 100644
--- a/charm/launchpad-assets/templates/vhost.conf.j2
+++ b/charm/launchpad-assets/templates/vhost.conf.j2
@@ -1,4 +1,4 @@
-<VirtualHost *:{{ port_assets }}>
+<VirtualHost *:{{ port }}>
     ServerName assets.{{ domain }}
 
     ErrorLog /var/log/apache2/assets.{{ domain }}-error.log
@@ -39,5 +39,10 @@
         Require all granted
     </LocationMatch>
     AliasMatch "^/favicon\.(?:ico|gif|png)$" "/srv/launchpad/code/lib/canonical/launchpad/images/launchpad.png"
+
+    <Location "/_status/check">
+        Require all granted
+    </Location>
+    Alias "/_status/check" "/dev/null"
 </VirtualHost>