Skip to content

Instantly share code, notes, and snippets.

@Krazybug
Last active February 28, 2022 18:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krazybug/c1bc4bc49e2a34d06279e60054cdab6b to your computer and use it in GitHub Desktop.
Save Krazybug/c1bc4bc49e2a34d06279e60054cdab6b to your computer and use it in GitHub Desktop.
CALISHOT's deployment guide

CALISHOT deployment instructions

You need a recent installation of python (3.x)

  1. Install poetry, datasette and its plugins
poetry new calishot
poetry shell
poetry add datasette
poetry add datasette-json-html
poetry add datasette-pretty-json

You can eventually install it with virtualenv/pip if you don't want to use poetry:

python -m venv calishot
. ./calishot/bin/activate
pip install datasette
pip install datasette-json-html
pip install datasette-pretty-json
  1. Prepare the calishot settings:

Download the sqlite db file to the same directory and then

cat <<EOF > metadata.json 
{
    "databases": {
      "index": {
        "tables": {
            "summary": {
                "sort": "title",
                "searchmode": "raw"
            }
        }
      }
    }
  }
EOF

You can now run a local test:

datasette serve index.db --config sql_time_limit_ms:10000 --config allow_download:off --config max_returned_rows:2000  --config num_sql_threads:10 --metadata met
adata.json

Open your browser to http://localhost:8001/ and check the result.

  1. Now you're ready to publish :)

Install heroku-cli then :

heroku login

datasette publish heroku index.db -n calishot-3 --install=datasette-json-html --install=datasette-pretty-json --extra-options="--config sql_time_limit_ms:10000 -
-config allow_download:off --config num_sql_threads:10 --config max_returned_rows:500" --metadata metadata.json

Tadaaaaaa !

@zsKengren
Copy link

Can you please clarify where to get the sqlite db?

@Krazybug
Copy link
Author

Krazybug commented Jul 2, 2020

Sorry, this cookbook was shared for people who proposed to participate in mirroring calishot.
You need to star with a list fo sites and then generate this db with this script : https://github.com/Krazybug/calishot
Instructions are in the installation.md file.

I will release a more decent version of this program someday

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