
Or like this (Apache): ProxyPass / unix:/tmp/datasette.sock| Writing tests More importantly, it means you can configure nginx or Apache to proxy to the Datasette server like this (nginx):

I’ve added a new -uds option, so now you can run Datasette like this: datasette -uds /tmp/datasette.sock fixtures.dbĭatasette will “listen” on /tmp/datasette.sock-which means you can run requests via curl like so: curl -unix-socket /tmp/datasette.sock \
DOCKER UNIX DOMAIN SOCKET FULL
Implementing this in Datasetteĭatasette uses the excellent Uvicorn Python web server to serve traffic out of the box, and Uvicorn already includes support for UDS-so adding support to Datasette was pretty easy-here’s the full implementation. It turns out both nginx and Apache have the ability to proxy traffic to a Unix domain socket rather than to an HTTP port, which makes this a useful mechanism for running backend servers without attaching them to TCP ports. Plenty more examples in the Docker documentation if you click the ’HTTP’ tab. I’ve encountered these before with the Docker daemon, which listens on path /var/run/docker.sock and can be communicated with using curl like so: curl -unix-socket /var/run/docker.sock \ Unix domain sockets provide a mechanism whereby different processes on a machine can communicate with each over over a mechanism similar to TCP, but via a file path instead. I’ve not worked with these much before so it was a good opportunity to learn something new. This started out as a feature request from Aslak Raanes: #1388: Serve using UNIX domain socket. To learn more about docker-compose, see the documentation.A small enhancement to Datasette this week: I’ve added support for proxying via Unix domain sockets. It takes two parameters, the uid and the gui: 1 #!/usr/bin/bashħ 8 9 function main "Īt this point, all we have to do is use this Dockerfile. It will change the uid and gid for the uwsgi user inside the container. First, let's create a setup.sh script next to your Dockerfile.

In Unix each file has a owner and a group.

The question is, how do we fullfil these two requirements? First, let's explain how file ownership works.
