Skip to content

Instantly share code, notes, and snippets.

@simonw
Last active July 13, 2020 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonw/c79319dac556088e1649bb6f51e691fe to your computer and use it in GitHub Desktop.
Save simonw/c79319dac556088e1649bb6f51e691fe to your computer and use it in GitHub Desktop.
Publishing a private Datasette instance to Heroku using datasette-auth-passwords

Publishing a private Datasette instance to Heroku using datasette-auth-passwords

Using this new plugin: https://github.com/simonw/datasette-auth-passwords

Create your database as usual, then create a metadata.json file that looks like this:

{
    "allow": {
        "id": "root"
    }
}

This specifies that only the root user can access the instance.

Create yourself a root password hash. You can do that by running the plugin locally (see its README) or you can use this online hosted version of the password tool instead: https://datasette-auth-passwords-demo.datasette.io/-/password-tool

Now publish to Heroku like this:

datasette publish heroku mydb.db \
  -m metadata.json \
  --install datasette-auth-passwords \
  --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...' \
  --name my-heroku-app

Now visit https://my-heroku-app.herokuapp.com/-/login to login.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment