{"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877725193", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877725193, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcyNTE5Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-11T01:18:38Z", "updated_at": "2021-07-11T01:18:38Z", "author_association": "OWNER", "body": "Wrote up a TIL: https://til.simonwillison.net/nginx/proxy-domain-sockets", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877721003", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877721003, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcyMTAwMw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-11T00:21:19Z", "updated_at": "2021-07-11T00:21:19Z", "author_association": "OWNER", "body": "Documentation: https://docs.datasette.io/en/latest/deploying.html#nginx-proxy-configuration", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877717262", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877717262, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcxNzI2Mg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-10T23:37:54Z", "updated_at": "2021-07-10T23:37:54Z", "author_association": "OWNER", "body": "> I wonder if `--fd` is worth supporting too?\r\n\r\nI'm going to hold off on implementing this until someone asks for it.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877716993", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877716993, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcxNjk5Mw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-10T23:34:02Z", "updated_at": "2021-07-10T23:34:02Z", "author_association": "OWNER", "body": "Figured out an example nginx configuration. This in `nginx.conf`:\r\n\r\n daemon off;\r\n events {\r\n worker_connections 1024;\r\n }\r\n http {\r\n server {\r\n listen 8092;\r\n location / {\r\n proxy_pass http://datasette;\r\n proxy_set_header X-Real-IP $remote_addr;\r\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n }\r\n }\r\n upstream datasette {\r\n server unix:/tmp/datasette.sock;\r\n }\r\n }\r\n\r\nThen run `datasette --uds /tmp/datasette.sock`\r\n\r\nThen run nginx like this:\r\n\r\n nginx -c ./nginx.conf\r\n\r\nThen hits to `http://localhost:8092/` will be proxied to Datasette.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877716359", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877716359, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcxNjM1OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-10T23:24:58Z", "updated_at": "2021-07-10T23:24:58Z", "author_association": "OWNER", "body": "Apparently Windows 10 has Unix domain socket support: https://bugs.python.org/issue33408\r\n\r\n> Unix socket (AF_UNIX) is now avalible in Windows 10 (April 2018 Update). Please add Python support for it.\r\n> More details about it on https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/\r\n\r\nBut it's not clear if this is going to work. That same issue thread (the issue is still open) suggests using `hasattr(socket, 'AF_UNIX'))` to detect support in tests.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877716156", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877716156, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcxNjE1Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-10T23:22:21Z", "updated_at": "2021-07-10T23:22:21Z", "author_association": "OWNER", "body": "I don't have the Datasette test suite running on Windows yet, but I'd like it to run there some day - so ideally this test would be skipped if Unix domain sockets are not supported by the underlying operating system.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877715654", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877715654, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcxNTY1NA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-10T23:15:06Z", "updated_at": "2021-07-10T23:15:06Z", "author_association": "OWNER", "body": "I can run tests against it using `httpx`: https://www.python-httpx.org/advanced/#usage_1\r\n\r\n> ```pycon\r\n> >>> import httpx\r\n> >>> # Connect to the Docker API via a Unix Socket.\r\n> >>> transport = httpx.HTTPTransport(uds=\"/var/run/docker.sock\")\r\n> >>> client = httpx.Client(transport=transport)\r\n> >>> response = client.get(\"http://docker/info\")\r\n> ```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-877714698", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 877714698, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NzcxNDY5OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-10T23:01:37Z", "updated_at": "2021-07-10T23:01:37Z", "author_association": "OWNER", "body": "Can test this with:\r\n```\r\ncurl --unix-socket ${socket} -i \"http://localhost/\" \r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-876213177", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 876213177, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NjIxMzE3Nw==", "user": {"value": 80737, "label": "aslakr"}, "created_at": "2021-07-08T07:47:17Z", "updated_at": "2021-07-08T07:47:17Z", "author_association": "CONTRIBUTOR", "body": "> This sounds like a valuable feature for people running Datasette behind a proxy.\r\n\r\nYes, in some cases it is easer to use e.g. Apache's [ProxyPass Directive](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass) with Unix Domain Socket like `unix:/home/www.socket|http://localhost/whatever/`.\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-875742910", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 875742910, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NTc0MjkxMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-07T16:20:50Z", "updated_at": "2021-07-07T16:23:02Z", "author_association": "OWNER", "body": "I wonder if `--fd` is worth supporting too? Uvicorn documentation says that's useful for running under process managers, I'd want to understand exactly how to use that (and test it) before adding the feature though.\r\n\r\nhttps://www.uvicorn.org/settings/\r\n\r\nDocs on how to use a process manager: https://www.uvicorn.org/deployment/#supervisor", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-875741410", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 875741410, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NTc0MTQxMA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-07T16:18:50Z", "updated_at": "2021-07-07T16:18:50Z", "author_association": "OWNER", "body": "You could actually run Datasette like this today without modifications by running a thin Python script that imports from `datasette.app`, instantiates the ASGI app and passes that to `uvicorn.run` - but I like this as a supported feature too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-875740085", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 875740085, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NTc0MDA4NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-07T16:17:08Z", "updated_at": "2021-07-07T16:17:08Z", "author_association": "OWNER", "body": "Looks pretty easy to implement - here's a hint from Uvicorn source code: https://github.com/encode/uvicorn/blob/b5af1049e63c059dc750a450c807b9768f91e906/uvicorn/main.py#L368\r\n\r\nNeed to work out a simple pattern for testing this too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1388#issuecomment-875738149", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1388", "id": 875738149, "node_id": "MDEyOklzc3VlQ29tbWVudDg3NTczODE0OQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-07T16:14:29Z", "updated_at": "2021-07-07T16:14:29Z", "author_association": "OWNER", "body": "This sounds like a valuable feature for people running Datasette behind a proxy.", "reactions": "{\"total_count\": 2, \"+1\": 2, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 939051549, "label": "Serve using UNIX domain socket"}, "performed_via_github_app": null}