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

Cloudrun not loading SpatiaLite module? #21

Closed
jsfenfen opened this issue Oct 21, 2020 · 3 comments
Closed

Cloudrun not loading SpatiaLite module? #21

jsfenfen opened this issue Oct 21, 2020 · 3 comments

Comments

@jsfenfen
Copy link

jsfenfen commented Oct 21, 2020

I've been unable to publish a cluster map to google cloudrun even though essentially the same command runs locally. Specifically, I'm getting "Error: It looks like you're trying to load a SpatiaLite database without first loading the SpatiaLite module."

Am trying to follow the cloudrun publish example here.

That example does not use a "--load-extension" argument, but maybe it is needed? The one thing I can think of is that somehow the location isn't being set correctly on cloudrun? A different example noted that it was running in a docker container locally--is it possible that using --install=datasette-cluster-map gets misconfigured if you're not in docker? I'm running on mac os x locally, I'm a bit unclear on how packaging works...

This is the publish command I'm using:

datasette publish cloudrun --install=datasette-cluster-map --metadata=metadata.json --template-dir=custom_templates nursing_home_compare/Nursing_Homes.db --service=nh

From the google cloud logs

Showing logs for last 1 hour starting at 10/21/20, 10:40 AM.
Default
2020-10-21 11:40:14.454 PDT
Usage: datasette serve [OPTIONS] [FILES]...
Default
2020-10-21 11:40:14.454 PDT
Default
2020-10-21 11:40:14.454 PDT
Error: It looks like you're trying to load a SpatiaLite database without first loading the SpatiaLite module.
Default
2020-10-21 11:40:14.454 PDT
Default
2020-10-21 11:40:14.454 PDT
Read more: https://docs.datasette.io/en/stable/spatialite.html
Warning
2020-10-21 11:40:16.885 PDT
Container called exit(2)

This is the local log traceback:

Traceback (most recent call last):
File "/Users/jacob/.pyenv/versions/irw-accountability-3-7-3/bin/datasette", line 11, in <module>
  load_entry_point('datasette==0.50.2+6.gf3a087a.dirty', 'console_scripts', 'datasette')()
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/click/core.py", line 829, in __call__
  return self.main(*args, **kwargs)
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/click/core.py", line 782, in main
  rv = self.invoke(ctx)
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
  return ctx.invoke(self.callback, **ctx.params)
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/click/core.py", line 610, in invoke
  return callback(*args, **kwargs)
File "/Users/jacob/.pyenv/versions/3.7.3/envs/irw-accountability-3-7-3/lib/python3.7/site-packages/datasette/publish/cloudrun.py", line 142, in cloudrun
  shell=True,
File "/Users/jacob/.pyenv/versions/3.7.3/lib/python3.7/subprocess.py", line 347, in check_call
  raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gcloud run deploy --allow-unauthenticated --platform=managed --image gcr.io/datasette-hosting/datasette nh' returned non-zero exit status 1.
@jsfenfen
Copy link
Author

D'oh! This can be fixed by adding the --spatialite flag to the publish command. Which I noticed in the code here: https://github.com/simonw/datasette/blob/main/datasette/publish/cloudrun.py#L28 !

Hey @simonw I'm closing this but think this is probably a documentation issue -- probably the flag should be added to cloudrun publication invocation here: https://github.com/simonw/datasette-cluster-map#installation ? I'd add a PR but am a lil iffy if I'm right.

@simonw
Copy link
Owner

simonw commented Oct 22, 2020

This is covered in the publish Cloud Run docs in the main Datasette documentation - since datasette-cluster-map doesn't (yet) do anything special with SpatiaLite I'm happy to leave it undocumented here for the moment, but that will change if I implement #2 here.

@jsfenfen
Copy link
Author

Ahhhhh! I think I was acting under the impression that spatialite was required for cluster mapping to work. So I installed it and stuff was breaking because I hadn't enabled it. But now that I look more carefully it doesn't seem to be required, I just wanted spatial queries to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants