simonw / simonw/datasette

Datasette on docker with SWAG as reverse proxy?

Open
#2,256 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.5k
Forks
904
Avg merge
4d 17h
Merged PRs (30d)
18

Description

Since I've switched to SWAG (from linuxserver.io) for my reverse proxy needs, including managing letsencrypt certificates, I tried to build a proxy configuration file for Datasette. The relevant part of my docker-compose.yml file is

  datasette:
    image: datasetteproject/datasette
    container_name: datasette
    ports:
      - "8001:8001"
    volumes:
      - /home/me/Docker/Datasette:/mnt

and the datasette.subdomain.conf file is

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name datasette.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app datasette;
        set $upstream_port 8001;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}

This sort of setup works fine with some other containers. Note that I have already set up a datasette subdomain with my domain name registrar.

However, my attempts to access the subdomain result in the nginx "502 Bad Gateway" error.

When I investigate swag/keys/cert.crt with openssl, one of the DNS subdomains listed is indeed datasette.mysite.org. (Where mysite.org is the stand in for my real site name.)

Anyway, if anybody has got docker+datasette+SWAG working, I'd love to know how it was done! I installed Datasette locally, and I liked it very much. But I would like to offer the database and its search facilities to others; thus on my remote VPS. Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the provided docker-compose.yml and datasette.subdomain.conf, then reproduce the 502 Bad Gateway response through the Datasette subdomain. Check the connection between SWAG and the Datasette container; done means the subdomain successfully serves the Datasette instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, nginx, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.