{"database": "docs", "table": "sections", "is_view": false, "human_description_en": "where breadcrumbs contains \"Deploying Datasette\"", "rows": [["deploying:apache-proxy-configuration", "deploying", "apache-proxy-configuration", "Apache proxy configuration", "For  Apache , you can use the  ProxyPass  directive. First make sure the following lines are uncommented: \n                 LoadModule proxy_module lib/httpd/modules/mod_proxy.so\nLoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so \n                 Then add these directives to proxy traffic: \n                 ProxyPass /my-datasette/ http://127.0.0.1:8009/my-datasette/\nProxyPreserveHost On \n                 A live demo of Datasette running behind Apache using this proxy setup can be seen at  datasette-apache-proxy-demo.datasette.io/prefix/ . The code for that demo can be found in the  demos/apache-proxy  directory. \n                 Using  --uds  you can use Unix domain sockets similar to the nginx example: \n                 ProxyPass /my-datasette/ unix:/tmp/datasette.sock|http://localhost/my-datasette/ \n                 The  ProxyPreserveHost On  directive ensures that the original  Host:  header from the incoming request is passed through to Datasette. Datasette needs this to correctly assemble links to other pages using the  .absolute_url(request, path)  method.", "[\"Deploying Datasette\", \"Running Datasette behind a proxy\"]", "[{\"href\": \"https://httpd.apache.org/\", \"label\": \"Apache\"}, {\"href\": \"https://datasette-apache-proxy-demo.datasette.io/prefix/\", \"label\": \"datasette-apache-proxy-demo.datasette.io/prefix/\"}, {\"href\": \"https://github.com/simonw/datasette/tree/main/demos/apache-proxy\", \"label\": \"demos/apache-proxy\"}, {\"href\": \"https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypreservehost\", \"label\": \"ProxyPreserveHost On\"}]"], ["deploying:deploying-buildpacks", "deploying", "deploying-buildpacks", "Deploying using buildpacks", "Some hosting providers such as  Heroku ,  DigitalOcean App Platform  and  Scalingo  support the  Buildpacks standard  for deploying Python web applications. \n             Deploying Datasette on these platforms requires two files:  requirements.txt  and  Procfile . \n             The  requirements.txt  file lets the platform know which Python packages should be installed. It should contain  datasette  at a minimum, but can also list any Datasette plugins you wish to install - for example: \n             datasette\ndatasette-vega \n             The  Procfile  lets the hosting platform know how to run the command that serves web traffic. It should look like this: \n             web: datasette . -h 0.0.0.0 -p $PORT --cors \n             The  $PORT  environment variable is provided by the hosting platform.  --cors  enables CORS requests from JavaScript running on other websites to your domain - omit this if you don't want to allow CORS. You can add additional Datasette  Settings  options here too. \n             These two files should be enough to deploy Datasette on any host that supports buildpacks. Datasette will serve any SQLite files that are included in the root directory of the application. \n             If you want to build SQLite files or download them as part of the deployment process you can do so using a  bin/post_compile  file. For example, the following  bin/post_compile  will download an example database that will then be served by Datasette: \n             wget https://fivethirtyeight.datasettes.com/fivethirtyeight.db \n             simonw/buildpack-datasette-demo  is an example GitHub repository showing a Datasette configuration that can be deployed to a buildpack-supporting host.", "[\"Deploying Datasette\"]", "[{\"href\": \"https://www.heroku.com/\", \"label\": \"Heroku\"}, {\"href\": \"https://www.digitalocean.com/docs/app-platform/\", \"label\": \"DigitalOcean App Platform\"}, {\"href\": \"https://scalingo.com/\", \"label\": \"Scalingo\"}, {\"href\": \"https://buildpacks.io/\", \"label\": \"Buildpacks standard\"}, {\"href\": \"https://github.com/simonw/buildpack-datasette-demo\", \"label\": \"simonw/buildpack-datasette-demo\"}]"], ["deploying:deploying-fundamentals", "deploying", "deploying-fundamentals", "Deployment fundamentals", "Datasette can be deployed as a single  datasette  process that listens on a port. Datasette is not designed to be run as root, so that process should listen on a higher port such as port 8000. \n             If you want to serve Datasette on port 80 (the HTTP default port) or port 443 (for HTTPS) you should run it behind a proxy server, such as nginx, Apache or HAProxy. The proxy server can listen on port 80/443 and forward traffic on to Datasette.", "[\"Deploying Datasette\"]", "[]"], ["deploying:deploying-openrc", "deploying", "deploying-openrc", "Running Datasette using OpenRC", "OpenRC is the service manager on non-systemd Linux distributions like  Alpine Linux  and  Gentoo . \n             Create an init script at  /etc/init.d/datasette  with the following contents: \n             #!/sbin/openrc-run\n\nname=\"datasette\"\ncommand=\"datasette\"\ncommand_args=\"serve -h 0.0.0.0 /path/to/db.db\"\ncommand_background=true\npidfile=\"/run/${RC_SVCNAME}.pid\" \n             You then need to configure the service to run at boot and start it: \n             rc-update add datasette\nrc-service datasette start", "[\"Deploying Datasette\"]", "[{\"href\": \"https://www.alpinelinux.org/\", \"label\": \"Alpine Linux\"}, {\"href\": \"https://www.gentoo.org/\", \"label\": \"Gentoo\"}]"], ["deploying:deploying-proxy", "deploying", "deploying-proxy", "Running Datasette behind a proxy", "You may wish to run Datasette behind an Apache or nginx proxy, using a path within your existing site. \n             You can use the  base_url  configuration setting to tell Datasette to serve traffic with a specific URL prefix. For example, you could run Datasette like this: \n             datasette my-database.db --setting base_url /my-datasette/ -p 8009 \n             This will run Datasette with the following URLs: \n             \n                 \n                     http://127.0.0.1:8009/my-datasette/  - the Datasette homepage \n                 \n                 \n                     http://127.0.0.1:8009/my-datasette/my-database  - the page for the  my-database.db  database \n                 \n                 \n                     http://127.0.0.1:8009/my-datasette/my-database/some_table  - the page for the  some_table  table \n                 \n             \n             You can now set your nginx or Apache server to proxy the  /my-datasette/  path to this Datasette instance.", "[\"Deploying Datasette\"]", "[]"], ["deploying:deploying-systemd", "deploying", "deploying-systemd", "Running Datasette using systemd", "You can run Datasette on Ubuntu or Debian systems using  systemd . \n             First, ensure you have Python 3 and  pip  installed. On Ubuntu you can use  sudo apt-get install python3 python3-pip . \n             You can install Datasette into a virtual environment, or you can install it system-wide. To install system-wide, use  sudo pip3 install datasette . \n             Now create a folder for your Datasette databases, for example using  mkdir /home/ubuntu/datasette-root . \n             You can copy a test database into that folder like so: \n             cd /home/ubuntu/datasette-root\ncurl -O https://latest.datasette.io/fixtures.db \n             Create a file at  /etc/systemd/system/datasette.service  with the following contents: \n             [Unit]\nDescription=Datasette\nAfter=network.target\n\n[Service]\nType=simple\nUser=ubuntu\nEnvironment=DATASETTE_SECRET=\nWorkingDirectory=/home/ubuntu/datasette-root\nExecStart=datasette serve . -h 127.0.0.1 -p 8000\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target \n             Add a random value for the  DATASETTE_SECRET  - this will be used to sign Datasette cookies such as the CSRF token cookie. You can generate a suitable value like so: \n             $ python3 -c 'import secrets; print(secrets.token_hex(32))' \n             This configuration will run Datasette against all database files contained in the  /home/ubuntu/datasette-root  directory. If that directory contains a  metadata.yml  (or  .json ) file or a  templates/  or  plugins/  sub-directory those will automatically be loaded by Datasette - see  Configuration directory mode  for details. \n             You can start the Datasette process running using the following: \n             sudo systemctl daemon-reload\nsudo systemctl start datasette.service \n             You will need to restart the Datasette service after making changes to its  metadata.json  configuration or adding a new database file to that directory. You can do that using: \n             sudo systemctl restart datasette.service \n             Once the service has started you can confirm that Datasette is running on port 8000 like so: \n             curl 127.0.0.1:8000/-/versions.json\n# Should output JSON showing the installed version \n             Datasette will not be accessible from outside the server because it is listening on  127.0.0.1 . You can expose it by instead listening on  0.0.0.0 , but a better way is to set up a proxy such as  nginx  - see  Running Datasette behind a proxy .", "[\"Deploying Datasette\"]", "[]"], ["deploying:nginx-proxy-configuration", "deploying", "nginx-proxy-configuration", "Nginx proxy configuration", "Here is an example of an  nginx  configuration file that will proxy traffic to Datasette: \n                 daemon off;\n\nevents {\n  worker_connections  1024;\n}\nhttp {\n  server {\n    listen 80;\n    location /my-datasette {\n      proxy_pass http://127.0.0.1:8009/my-datasette;\n      proxy_set_header Host $host;\n    }\n  }\n} \n                 You can also use the  --uds  option to Datasette to listen on a Unix domain socket instead of a port, configuring the nginx upstream proxy like this: \n                 daemon off;\nevents {\n  worker_connections  1024;\n}\nhttp {\n  server {\n    listen 80;\n    location /my-datasette {\n      proxy_pass http://datasette/my-datasette;\n      proxy_set_header Host $host;\n    }\n  }\n  upstream datasette {\n    server unix:/tmp/datasette.sock;\n  }\n} \n                 Then run Datasette with  datasette --uds /tmp/datasette.sock path/to/database.db --setting base_url /my-datasette/ .", "[\"Deploying Datasette\", \"Running Datasette behind a proxy\"]", "[{\"href\": \"https://nginx.org/\", \"label\": \"nginx\"}]"]], "truncated": false, "filtered_table_rows_count": 7, "expanded_columns": [], "expandable_columns": [], "columns": ["id", "page", "ref", "title", "content", "breadcrumbs", "references"], "primary_keys": ["id"], "units": {}, "query": {"sql": "select id, page, ref, title, content, breadcrumbs, [references] from sections where :p0 in (select value from json_each([sections].[breadcrumbs])) order by id limit 101", "params": {"p0": "Deploying Datasette"}}, "facet_results": {"breadcrumbs": {"name": "breadcrumbs", "type": "array", "results": [{"value": "Deploying Datasette", "label": "Deploying Datasette", "count": 7, "toggle_url": "https://stable-docs.datasette.io/docs/sections.json?_facet_array=breadcrumbs", "selected": true}, {"value": "Running Datasette behind a proxy", "label": "Running Datasette behind a proxy", "count": 2, "toggle_url": "https://stable-docs.datasette.io/docs/sections.json?_facet_array=breadcrumbs&breadcrumbs__arraycontains=Deploying+Datasette&breadcrumbs__arraycontains=Running+Datasette+behind+a+proxy", "selected": false}], "hideable": true, "toggle_url": "/docs/sections.json?breadcrumbs__arraycontains=Deploying+Datasette", "truncated": false}}, "suggested_facets": [{"name": "breadcrumbs", "toggle_url": "https://stable-docs.datasette.io/docs/sections.json?_facet_array=breadcrumbs&breadcrumbs__arraycontains=Deploying+Datasette&_facet=breadcrumbs"}, {"name": "references", "toggle_url": "https://stable-docs.datasette.io/docs/sections.json?_facet_array=breadcrumbs&breadcrumbs__arraycontains=Deploying+Datasette&_facet=references"}], "next": null, "next_url": null, "private": false, "allow_execute_sql": true, "query_ms": 29.933665005955845}