issue_comments

26 rows where issue = 459397625 sorted by updated_at descending

View and edit SQL

Suggested facets: reactions, created_at (date), updated_at (date)

author_association

issue

  • Documentation with recommendations on running Datasette in production without using Docker · 26
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue
614111094 https://github.com/simonw/datasette/issues/514#issuecomment-614111094 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDYxNDExMTA5NA== simonw 9599 2020-04-15T15:32:49Z 2020-04-15T15:32:49Z OWNER

Relevant: https://github.com/simonw/datasette-auth-github/issues/61

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
610186532 https://github.com/simonw/datasette/issues/514#issuecomment-610186532 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDYxMDE4NjUzMg== simonw 9599 2020-04-07T05:43:45Z 2020-04-07T05:43:45Z OWNER

I've run Datasette in production directly on Ubuntu with systemd in a few places now. I think I'm ready to turn this into real documentation.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
561494291 https://github.com/simonw/datasette/issues/514#issuecomment-561494291 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDU2MTQ5NDI5MQ== simonw 9599 2019-12-04T06:14:16Z 2019-12-04T06:14:16Z OWNER

I've been successfully running the systemd recipe above by Russs on a couple of projects. I shared some notes about what's been working for me here: https://gist.github.com/simonw/63797bb10bb74e615695edd8f850844f

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
539721880 https://github.com/simonw/datasette/issues/514#issuecomment-539721880 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUzOTcyMTg4MA== ipmb 319156 2019-10-08T22:00:03Z 2019-10-08T22:00:03Z NONE

If you are just using Nginx to open a reserved port, systemd can do that on its own. https://www.freedesktop.org/software/systemd/man/systemd.socket.html.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
509480062 https://github.com/simonw/datasette/issues/514#issuecomment-509480062 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwOTQ4MDA2Mg== simonw 9599 2019-07-09T04:15:11Z 2019-07-09T04:15:11Z OWNER

Running as root isn't ideal because it means that if there are any security vulnerabilities in Datasette an attacker could use them to execute any command they like as root on your machine.

I'm moderately confident there aren't any vulnerabilities like that, but I'm definite not 100% certain!

My recommendation is to run Datasette on 127.0.0.1 port 8001 and then have nginx proxy port 80 to it. See https://github.com/simonw/datasette/issues/514#issuecomment-504663201 for suggested nginx configuration.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
509431603 https://github.com/simonw/datasette/issues/514#issuecomment-509431603 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwOTQzMTYwMw== chrismp 7936571 2019-07-08T23:39:52Z 2019-07-08T23:39:52Z NONE

In datasette.service, I edited

User=chris

To...

User=root

It worked. I can access http://my-server.com. I hope this is safe. Thanks for all the help, everyone.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
509154312 https://github.com/simonw/datasette/issues/514#issuecomment-509154312 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwOTE1NDMxMg== JesperTreetop 4363711 2019-07-08T09:36:25Z 2019-07-08T09:40:33Z NONE

@chrismp: Ports 1024 and under are privileged and can usually only be bound by a root or supervisor user, so it makes sense if you're running as the user chris that port 8000 works but 80 doesn't.

See this generic question-and-answer and this systemd question-and-answer for more information about ways to skin this cat. Without knowing your specific circumstances, either extending those privileges to that service/executable/user, proxying them through something like nginx or indeed looking at what the nginx systemd job has to do to listen at port 80 all sound like good ways to start.

At this point, this is more generic systemd/Linux support than a Datasette issue, which is why a complete rando like me is able to contribute anything.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
505232675 https://github.com/simonw/datasette/issues/514#issuecomment-505232675 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNTIzMjY3NQ== chrismp 7936571 2019-06-25T00:43:12Z 2019-06-25T00:43:12Z NONE

Yep, that worked to get the site up and running at my-server.com:8000 but when I edited run-datasette.sh to contain this...

#!/bin/bash
/home/chris/Env/datasette/bin/datasette serve -h 0.0.0.0 -p 80 /home/chris/digital-library/databases/*.db --cors --metadata /home/chris/digital-library/metadata.json

I got this error.

Jun 25 02:42:41 ns331247 run-datasette.sh[747]: [2019-06-25 02:42:41 +0200] [752] [INFO] Goin' Fast @ http://0.0.0.0:80
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: [2019-06-25 02:42:41 +0200] [752] [ERROR] Unable to start server
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: Traceback (most recent call last):
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/loop.pyx", line 1111, in uvloop.loop.Loop._create_server
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/handles/tcp.pyx", line 89, in uvloop.loop.TCPServer.bind
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/handles/streamserver.pyx", line 95, in uvloop.loop.UVStreamServer._fatal_error
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/handles/tcp.pyx", line 87, in uvloop.loop.TCPServer.bind
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/handles/tcp.pyx", line 26, in uvloop.loop.__tcp_bind
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: PermissionError: [Errno 13] Permission denied
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: During handling of the above exception, another exception occurred:
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: Traceback (most recent call last):
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "/home/chris/Env/datasette/lib/python3.7/site-packages/sanic/server.py", line 591, in serve
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:     http_server = loop.run_until_complete(server_coroutine)
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/loop.pyx", line 1684, in create_server
Jun 25 02:42:41 ns331247 run-datasette.sh[747]:   File "uvloop/loop.pyx", line 1116, in uvloop.loop.Loop._create_server
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: PermissionError: [Errno 13] error while attempting to bind on address ('0.0.0.0', 80): permission denied
Jun 25 02:42:41 ns331247 run-datasette.sh[747]: [2019-06-25 02:42:41 +0200] [752] [INFO] Server Stopped
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
505061703 https://github.com/simonw/datasette/issues/514#issuecomment-505061703 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNTA2MTcwMw== simonw 9599 2019-06-24T15:31:25Z 2019-06-24T15:31:25Z OWNER

I'm suspicious of the wildcard. Does it work if you do the following?

ExecStart=/home/chris/Env/datasette/bin/datasette serve -h 0.0.0.0 /home/chris/digital-library/databases/actual-database.db --cors --metadata /home/chris/digital-library/metadata.json

If that does work then it means the ExecStart line doesn't support bash wildcard expansion. You'll need to create a separate script like this:

#!/bin/bash
/home/chris/Env/datasette/bin/datasette serve -h 0.0.0.0 /home/chris/digital-library/databases/*.db --cors --metadata /home/chris/digital-library/metadata.json

Then save that as /home/chris/digital-library/run-datasette.sh and try this:

ExecStart=/home/chris/digital-library/run-datasette.sh
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504998302 https://github.com/simonw/datasette/issues/514#issuecomment-504998302 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDk5ODMwMg== chrismp 7936571 2019-06-24T12:57:19Z 2019-06-24T12:57:19Z NONE

Same error when I used the full path.

On Sun, Jun 23, 2019 at 18:31 Simon Willison notifications@github.com
wrote:

I suggest trying a full path in ExecStart like this:

ExecStart=/home/chris/Env/datasette/bin/datasette serve -h 0.0.0.0
/home/chris/digital-library/databases/*.db --cors --metadata metadata.json

That should eliminate the chance of some kind of path confusion.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/simonw/datasette/issues/514?email_source=notifications&email_token=AB4RUOZESVC5ZI2AZFJJD2TP372UJA5CNFSM4H2VJCSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYLISIY#issuecomment-504793379,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB4RUO243SPJ7YSWJU7YKF3P372UJANCNFSM4H2VJCSA
.

--
Chris Persaud
ChrisPersaud.com

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504793379 https://github.com/simonw/datasette/issues/514#issuecomment-504793379 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDc5MzM3OQ== simonw 9599 2019-06-23T22:31:29Z 2019-06-23T22:31:48Z OWNER

I suggest trying a full path in ExecStart like this:

ExecStart=/home/chris/Env/datasette/bin/datasette serve -h 0.0.0.0 /home/chris/digital-library/databases/*.db --cors --metadata /home/chris/digital-library/metadata.json

That should eliminate the chance of some kind of path confusion.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504789231 https://github.com/simonw/datasette/issues/514#issuecomment-504789231 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDc4OTIzMQ== chrismp 7936571 2019-06-23T21:35:33Z 2019-06-23T21:35:33Z NONE

@russss

Thanks, just one more thing.

I edited datasette.service:

[Unit]
Description=Datasette
After=network.target

[Service]
Type=simple
User=chris
WorkingDirectory=/home/chris/digital-library
ExecStart=/home/chris/Env/datasette/bin/datasette serve -h 0.0.0.0 databases/*.db --cors --metadata metadata.json
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then ran:

$ sudo systemctl daemon-reload
$ sudo systemctl enable datasette
$ sudo systemctl start datasette

But the logs from journalctl show this datasette error:

Jun 23 23:31:41 ns331247 datasette[1771]: Error: Invalid value for "[FILES]...": Path "databases/*.db" does not exist.
Jun 23 23:31:44 ns331247 datasette[1778]: Usage: datasette serve [OPTIONS] [FILES]...
Jun 23 23:31:44 ns331247 datasette[1778]: Try "datasette serve --help" for help.

But the databases directory does exist in the directory specified by WorkingDirectory. Is this a datasette problem or did I write something incorrectly in the .service file?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504686266 https://github.com/simonw/datasette/issues/514#issuecomment-504686266 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY4NjI2Ng== chrismp 7936571 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504690927 https://github.com/simonw/datasette/issues/514#issuecomment-504690927 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY5MDkyNw== russss 45057 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504685187 https://github.com/simonw/datasette/issues/514#issuecomment-504685187 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY4NTE4Nw== chrismp 7936571 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504684831 https://github.com/simonw/datasette/issues/514#issuecomment-504684831 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY4NDgzMQ== russss 45057 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504684709 https://github.com/simonw/datasette/issues/514#issuecomment-504684709 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY4NDcwOQ== chrismp 7936571 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504663766 https://github.com/simonw/datasette/issues/514#issuecomment-504663766 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2Mzc2Ng== russss 45057 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 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504663390 https://github.com/simonw/datasette/issues/514#issuecomment-504663390 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MzM5MA== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504663201 https://github.com/simonw/datasette/issues/514#issuecomment-504663201 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MzIwMQ== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504662987 https://github.com/simonw/datasette/issues/514#issuecomment-504662987 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2Mjk4Nw== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504662931 https://github.com/simonw/datasette/issues/514#issuecomment-504662931 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MjkzMQ== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504662904 https://github.com/simonw/datasette/issues/514#issuecomment-504662904 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MjkwNA== russss 45057 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=<username>
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:

$ 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504662063 https://github.com/simonw/datasette/issues/514#issuecomment-504662063 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MjA2Mw== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504661990 https://github.com/simonw/datasette/issues/514#issuecomment-504661990 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MTk5MA== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625
504661909 https://github.com/simonw/datasette/issues/514#issuecomment-504661909 https://api.github.com/repos/simonw/datasette/issues/514 MDEyOklzc3VlQ29tbWVudDUwNDY2MTkwOQ== simonw 9599 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
}
Documentation with recommendations on running Datasette in production without using Docker 459397625

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Query took 25.991ms · About: github-to-sqlite