Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy failing with "plugins/alternative_route.py: Not a directory" #2194

Closed
simonw opened this issue Sep 21, 2023 · 8 comments
Closed

Deploy failing with "plugins/alternative_route.py: Not a directory" #2194

simonw opened this issue Sep 21, 2023 · 8 comments
Labels

Comments

@simonw
Copy link
Owner

simonw commented Sep 21, 2023

https://github.com/simonw/datasette/actions/runs/6266449018/job/17017460074

CleanShot 2023-09-21 at 13 17 12@2x

This is a bit of a mystery, I don't think I've changed anything recently that could have broken this.

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

This looks to be the step that is failing:

- name: Set up the alternate-route demo
run: |
echo '
from datasette import hookimpl
@hookimpl
def startup(datasette):
db = datasette.get_database("fixtures2")
db.route = "alternative-route"
' > plugins/alternative_route.py
cp fixtures.db fixtures2.db

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

Maybe plugins/ does not exist? It should have been created by this line:

- name: Build fixtures.db
run: python tests/fixtures.py fixtures.db fixtures.json plugins --extra-db-filename extra_database.db

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

I think I see the problem - it's from here: b2ec871#diff-5dbc88d6e5c3615caf10e32a9d6fc6ff683f5b5814948928cb84c3ab91c038b6L770

The config and metadata Click options are the wrong way round:

datasette/tests/fixtures.py

Lines 785 to 786 in 80a9cd9

@click.argument("metadata", required=False)
@click.argument("config", required=False)

def cli(db_filename, config, metadata, plugins_path, recreate, extra_db_filename):

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

New error: "Error: Metadata should end with .json"

https://github.com/simonw/datasette/actions/runs/6266720924/job/17018265851

CleanShot 2023-09-21 at 13 31 08@2x

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

Correct usage is now:

python tests/fixtures.py fixtures.db fixtures-config.json fixtures-metadata.json \
  plugins --extra-db-filename extra_database.db
Test tables written to fixtures.db
- metadata written to fixtures-metadata.json
- config written to fixtures-config.json
  Wrote plugin: plugins/register_output_renderer.py
  Wrote plugin: plugins/view_name.py
  Wrote plugin: plugins/my_plugin.py
  Wrote plugin: plugins/messages_output_renderer.py
  Wrote plugin: plugins/sleep_sql_function.py
  Wrote plugin: plugins/my_plugin_2.py
Test tables written to extra_database.db

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

... which raises the challenge that datasette publish doesn't yet know what to do with a config file!

datasette publish cloudrun fixtures.db fixtures2.db extra_database.db \
-m metadata.json \
--plugins-dir=plugins \
--branch=$GITHUB_SHA \
--version-note=$GITHUB_SHA \
--extra-options="--setting template_debug 1 --setting trace_debug 1 --crossdb" \
--install 'datasette-ephemeral-tables>=0.2.2' \
--service "datasette-latest$SUFFIX" \
--secret $LATEST_DATASETTE_SECRET

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

I'm going to disable this bit of the deploy for the moment, which will break the demo linked to from https://simonwillison.net/2022/Dec/2/datasette-write-api/

- name: Make some modifications to metadata.json
run: |
cat fixtures.json | \
jq '.databases |= . + {"ephemeral": {"allow": {"id": "*"}}}' | \
jq '.plugins |= . + {"datasette-ephemeral-tables": {"table_ttl": 900}}' \
> metadata.json
cat metadata.json

@simonw
Copy link
Owner Author

simonw commented Sep 21, 2023

That worked

e4f8688 is the latest commit right now and https://latest.datasette.io/-/versions shows that as the deployed version.

@simonw simonw closed this as completed Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant