simonw / datasette

An open source multi-tool for exploring and publishing data
https://datasette.io
Apache License 2.0
9.13k stars 653 forks source link

Improve Apache proxy documentation, link to demo #1524

Closed simonw closed 2 years ago

simonw commented 2 years ago

The latest demo is now live at https://datasette-apache-proxy-demo.fly.dev/prefix/fixtures/sortable?_facet=pk2

Originally posted by @simonw in https://github.com/simonw/datasette/issues/1519#issuecomment-974697824

I'm going to put out 0.59.3 bugfix release with this, but I'd like to first improve the documentation on https://docs.datasette.io/en/stable/deploying.html#apache-proxy-configuration to highlight the new demo.

simonw commented 2 years ago

I'm also going to extract the Apache config files from https://github.com/simonw/datasette/blob/250db8192cb8aba5eb8cd301ccc2a49525bc3d24/demos/apache-proxy/Dockerfile into a separate file to make it easier to read.

(The supervisor config needs to be dynamically constructed to include $DATASETTE_REF so I will leave it where it is.)

simonw commented 2 years ago

I pointed CNAME of datasette-apache-proxy-demo.datasette.io at datasette-apache-proxy-demo.fly.dev. using Vercel DNS:

image

Then I asked Fly to issue a LetsEncrypt certificate for that:

% flyctl certs create datasette-apache-proxy-demo.datasette.io
# About 53 seconds later:
% flyctl certs show datasette-apache-proxy-demo.datasette.io
The certificate for datasette-apache-proxy-demo.datasette.io has been issued.

Hostname                  = datasette-apache-proxy-demo.datasette.io

DNS Provider              = constellix

Certificate Authority     = Let's Encrypt

Issued                    = ecdsa,rsa

Added to App              = 53 seconds ago

Source                    = fly

https://datasette-apache-proxy-demo.datasette.io/ works now - I'll use that in the documentation.

simonw commented 2 years ago

New TIL: https://til.simonwillison.net/fly/custom-subdomain-fly

simonw commented 2 years ago

I noticed that http://datasette-apache-proxy-demo.datasette.io/ wasn't redirecting to https so I built a new plugin: https://github.com/simonw/datasette-redirect-to-https

% curl -i 'http://datasette-apache-proxy-demo.datasette.io/prefix/fixtures/no_primary_key' 
HTTP/1.1 301 Moved Permanently
date: Sat, 20 Nov 2021 23:22:50 GMT
server: Fly/51d150d (2021-11-19)
location: https://datasette-apache-proxy-demo.datasette.io/fixtures/no_primary_key
x-proxied-by: Apache2 Debian
transfer-encoding: chunked
via: 1.1 fly.io
fly-request-id: 01FMZTHTHVPC8BZY0625D7JV4B