html_url,issue_url,id,node_id,user,user_label,created_at,updated_at,author_association,body,reactions,issue,issue_label,performed_via_github_app https://github.com/simonw/datasette/issues/272#issuecomment-504697742,https://api.github.com/repos/simonw/datasette/issues/272,504697742,MDEyOklzc3VlQ29tbWVudDUwNDY5Nzc0Mg==,9599,simonw,2019-06-22T20:55:59Z,2019-06-22T20:56:22Z,OWNER,"Getting this to work with both Sanic AND ASGI at the same time (via the classes described previously with an `--asgi` command-line option) is proving way trickier than I expected, mainly because of the complexity of [the current Datasette.app() method](https://github.com/simonw/datasette/blob/35429f90894321eda7f2db31b9ea7976f31f73ac/datasette/app.py#L545-L721). I'm going to drop the compatibility path for a bit and see if I can make progress on a pure-ASGI port.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",324188953,Port Datasette to ASGI, https://github.com/simonw/datasette/issues/514#issuecomment-504661909,https://api.github.com/repos/simonw/datasette/issues/514,504661909,MDEyOklzc3VlQ29tbWVudDUwNDY2MTkwOQ==,9599,simonw,2019-06-22T12:29:46Z,2019-06-22T12:29:46Z,OWNER,"I'm still trying to figure this out myself. I'm confident that running nginx on port 80 and using it to proxy traffic to Datasette is a sensible way to solve the port problem. As for running Datasette itself: the two options that seem best to me are some kind of Init.d service or running it under supervisord. I have to admit I haven't worked out the necessary incantation for either of those yet: the solitary instance I have that's not running as a Docker container is sitting in a ""screen"" instance for the moment!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504661990,https://api.github.com/repos/simonw/datasette/issues/514,504661990,MDEyOklzc3VlQ29tbWVudDUwNDY2MTk5MA==,9599,simonw,2019-06-22T12:30:47Z,2019-06-22T12:30:47Z,OWNER,A section in the Datasette docs that acts as recommendations plus a tutorial for running Datasette on a VPS without using a Docker would be excellent.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504662063,https://api.github.com/repos/simonw/datasette/issues/514,504662063,MDEyOklzc3VlQ29tbWVudDUwNDY2MjA2Mw==,9599,simonw,2019-06-22T12:31:58Z,2019-06-22T12:31:58Z,OWNER,This is also relevant to Datasette Library #417 ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504662904,https://api.github.com/repos/simonw/datasette/issues/514,504662904,MDEyOklzc3VlQ29tbWVudDUwNDY2MjkwNA==,45057,russss,2019-06-22T12:45:21Z,2019-06-22T12:45:39Z,CONTRIBUTOR,"On most modern Linux distros, systemd is the easiest answer. Example systemd unit file (save to `/etc/systemd/system/datasette.service`): ``` [Unit] Description=Datasette After=network.target [Service] Type=simple User= WorkingDirectory=/path/to/data ExecStart=/path/to/datasette serve -h 0.0.0.0 ./my.db Restart=on-failure [Install] WantedBy=multi-user.target ``` Activate it with: ```bash $ sudo systemctl daemon-reload $ sudo systemctl enable datasette $ sudo systemctl start datasette ``` Logs are best viewed using `journalctl -u datasette -f`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504662931,https://api.github.com/repos/simonw/datasette/issues/514,504662931,MDEyOklzc3VlQ29tbWVudDUwNDY2MjkzMQ==,9599,simonw,2019-06-22T12:45:47Z,2019-06-22T12:45:47Z,OWNER,I asked about this on Twitter and got a solid recommendation for systemd and this tutorial: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units - via https://twitter.com/sil/status/1142412145990221825,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504662987,https://api.github.com/repos/simonw/datasette/issues/514,504662987,MDEyOklzc3VlQ29tbWVudDUwNDY2Mjk4Nw==,9599,simonw,2019-06-22T12:46:39Z,2019-06-22T12:46:39Z,OWNER,... and @russss also suggested systemd 21 seconds before I posted that!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504663201,https://api.github.com/repos/simonw/datasette/issues/514,504663201,MDEyOklzc3VlQ29tbWVudDUwNDY2MzIwMQ==,9599,simonw,2019-06-22T12:49:56Z,2019-06-22T12:49:56Z,OWNER,"Here are some partial notes I have saved from an nginx configuration I've used in the past: ``` cat /etc/nginx/sites-available/default server { listen 80 default_server; listen [::]:80 default_server; location / { proxy_pass http://127.0.0.1:8001/; proxy_set_header Host $host; } ... ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504663390,https://api.github.com/repos/simonw/datasette/issues/514,504663390,MDEyOklzc3VlQ29tbWVudDUwNDY2MzM5MA==,9599,simonw,2019-06-22T12:52:27Z,2019-06-22T12:52:27Z,OWNER,This example is useful to - I like how it has a Makefile that knows how to set up systemd: https://github.com/pikesley/Queube,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504663766,https://api.github.com/repos/simonw/datasette/issues/514,504663766,MDEyOklzc3VlQ29tbWVudDUwNDY2Mzc2Ng==,45057,russss,2019-06-22T12:57:59Z,2019-06-22T12:57:59Z,CONTRIBUTOR,"> This example is useful to - I like how it has a Makefile that knows how to set up systemd: https://github.com/pikesley/Queube I wasn't even aware it was possible to add a systemd service at an arbitrary path, but it seems a little messy to me. Maybe worth noting that systemd does support [per-user services](https://wiki.archlinux.org/index.php/Systemd/User) which don't require root access. Cool but probably overkill for most people (especially when you're going to need root to listen on port 80 anyway, directly or via a reverse proxy).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504684709,https://api.github.com/repos/simonw/datasette/issues/514,504684709,MDEyOklzc3VlQ29tbWVudDUwNDY4NDcwOQ==,7936571,chrismp,2019-06-22T17:36:25Z,2019-06-22T17:36:25Z,NONE,"> WorkingDirectory=/path/to/data @russss, Which directory does this represent?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504684831,https://api.github.com/repos/simonw/datasette/issues/514,504684831,MDEyOklzc3VlQ29tbWVudDUwNDY4NDgzMQ==,45057,russss,2019-06-22T17:38:23Z,2019-06-22T17:38:23Z,CONTRIBUTOR,"> > WorkingDirectory=/path/to/data > > @russss, Which directory does this represent? It's the working directory (cwd) of the spawned process. In this case if you set it to the directory your data is in, you can use relative paths to the db (and metadata/templates/etc) in the `ExecStart` command.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504685187,https://api.github.com/repos/simonw/datasette/issues/514,504685187,MDEyOklzc3VlQ29tbWVudDUwNDY4NTE4Nw==,7936571,chrismp,2019-06-22T17:43:24Z,2019-06-22T17:43:24Z,NONE,"> > > WorkingDirectory=/path/to/data > > > > > > @russss, Which directory does this represent? > > It's the working directory (cwd) of the spawned process. In this case if you set it to the directory your data is in, you can use relative paths to the db (and metadata/templates/etc) in the `ExecStart` command. In my case, on a remote server, I set up a virtual environment in `/home/chris/Env/datasette`, and when I activated that environment I ran `pip install datasette`. My datasette project is in `/home/chris/datatsette-project`, so I guess I'd use that directory in the `WorkingDirectory` parameter? And the `ExecStart` parameter would be `/home/chris/Env/datasette/lib/python3.7/site-packages/datasette serve -h 0.0.0.0 my.db` I'm guessing? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504686266,https://api.github.com/repos/simonw/datasette/issues/514,504686266,MDEyOklzc3VlQ29tbWVudDUwNDY4NjI2Ng==,7936571,chrismp,2019-06-22T17:58:50Z,2019-06-23T21:21:57Z,NONE,"@russss Actually, here's what I've got in `/etc/systemd/system/datasette.service` ``` [Unit] Description=Datasette After=network.target [Service] Type=simple User=chris WorkingDirectory=/home/chris/digital-library ExecStart=/home/chris/Env/datasette/lib/python3.7/site-packages/datasette serve -h 0.0.0.0 databases/*.db --cors --metadata metadata.json Restart=on-failure [Install] WantedBy=multi-user.target ``` I ran: ``` $ sudo systemctl daemon-reload $ sudo systemctl enable datasette $ sudo systemctl start datasette ``` Then I ran: `$ journalctl -u datasette -f` Got this message. ``` Hint: You are currently not seeing messages from other users and the system. Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages. Pass -q to turn off this notice. -- Logs begin at Thu 2019-06-20 00:05:23 CEST. -- Jun 22 19:55:57 ns331247 systemd[16176]: datasette.service: Failed to execute command: Permission denied Jun 22 19:55:57 ns331247 systemd[16176]: datasette.service: Failed at step EXEC spawning /home/chris/Env/datasette/lib/python3.7/site-packages/datasette: Permission denied Jun 22 19:55:57 ns331247 systemd[16184]: datasette.service: Failed to execute command: Permission denied Jun 22 19:55:57 ns331247 systemd[16184]: datasette.service: Failed at step EXEC spawning /home/chris/Env/datasette/lib/python3.7/site-packages/datasette: Permission denied Jun 22 19:55:58 ns331247 systemd[16186]: datasette.service: Failed to execute command: Permission denied Jun 22 19:55:58 ns331247 systemd[16186]: datasette.service: Failed at step EXEC spawning /home/chris/Env/datasette/lib/python3.7/site-packages/datasette: Permission denied Jun 22 19:55:58 ns331247 systemd[16190]: datasette.service: Failed to execute command: Permission denied Jun 22 19:55:58 ns331247 systemd[16190]: datasette.service: Failed at step EXEC spawning /home/chris/Env/datasette/lib/python3.7/site-packages/datasette: Permission denied Jun 22 19:55:58 ns331247 systemd[16191]: datasette.service: Failed to execute command: Permission denied Jun 22 19:55:58 ns331247 systemd[16191]: datasette.service: Failed at step EXEC spawning /home/chris/Env/datasette/lib/python3.7/site-packages/datasette: Permission denied ``` When I go to the address for my server, I am met with the standard ""Welcome to nginx"" message: ``` Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx. ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/514#issuecomment-504690927,https://api.github.com/repos/simonw/datasette/issues/514,504690927,MDEyOklzc3VlQ29tbWVudDUwNDY5MDkyNw==,45057,russss,2019-06-22T19:06:07Z,2019-06-22T19:06:07Z,CONTRIBUTOR,"I'd rather not turn this into a systemd support thread, but you're trying to execute the package directory there. Your datasette executable is probably at `/home/chris/Env/datasette/bin/datasette`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459397625,Documentation with recommendations on running Datasette in production without using Docker, https://github.com/simonw/datasette/issues/516#issuecomment-504696610,https://api.github.com/repos/simonw/datasette/issues/516,504696610,MDEyOklzc3VlQ29tbWVudDUwNDY5NjYxMA==,9599,simonw,2019-06-22T20:36:57Z,2019-06-22T20:36:57Z,OWNER,"According to [the black documentation](https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=isort.cfg) the following config file is necessary to avoid isort and black getting into an edit war with each other: ``` [settings] multi_line_output=3 include_trailing_comma=True force_grid_wrap=0 use_parentheses=True line_length=88 ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459509126,Enforce import sort order with isort, https://github.com/simonw/datasette/issues/516#issuecomment-504696638,https://api.github.com/repos/simonw/datasette/issues/516,504696638,MDEyOklzc3VlQ29tbWVudDUwNDY5NjYzOA==,9599,simonw,2019-06-22T20:37:25Z,2019-06-22T20:38:42Z,OWNER,"This test added do `test_black.py` seems to do the trick: ```python @pytest.mark.parametrize(""path"", code_root.glob(""**/*.py"")) def test_isort(path): # Have to capture stdout because isort uses print() directly stdout = sys.stdout sys.stdout = io.StringIO() result = isort.SortImports(path, check=True) assert ( not result.incorrectly_sorted ), ""{} has incorrectly sorted imports, fix with 'isort -rc . && black .'"" sys.stdout = stdout ``` I'll rename `test_black.py` to `test_lint.py` to reflect that it now covers more forms of linting. Also needed: add `move_to_front(items, ""test_isort"")` to `conftest.py`. And add `isort` to `extras_require` in `setup.py`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459509126,Enforce import sort order with isort, https://github.com/simonw/datasette/issues/516#issuecomment-504697187,https://api.github.com/repos/simonw/datasette/issues/516,504697187,MDEyOklzc3VlQ29tbWVudDUwNDY5NzE4Nw==,9599,simonw,2019-06-22T20:46:35Z,2019-06-22T20:46:35Z,OWNER,I'm going to resist the temptation to do this until I've merged the `asgi` branch from #272 ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",459509126,Enforce import sort order with isort,