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

Add spatialite, switch to debian and local build #114

Merged
merged 1 commit into from Nov 17, 2017

Conversation

ingenieroariel
Copy link
Contributor

@ingenieroariel ingenieroariel commented Nov 17, 2017

Improves the Dockerfile to support spatial datasets, work with the local datasette code (Friendly with git tags and Dockerhub) and moves to slim debian, a small image easy to extend via apt packages for sqlite.

@simonw
Copy link
Owner

simonw commented Nov 17, 2017

Fantastic! Thank you very much.

@simonw simonw merged commit 8b4c600 into simonw:master Nov 17, 2017
1 check passed
simonw added a commit that referenced this pull request Nov 17, 2017
I tesed this by first building and running a container using the new
Dockerfile from #114:

    docker build .
    docker run -it -p 8001:8001 6c9ca7e29181 /bin/sh

Then I ran this inside the container itself:

    apt update && apt-get install wget -y \
        && wget http://www.gaia-gis.it/spatialite-2.3.1/test-2.3.sqlite.gz \
        && gunzip test-2.3.sqlite.gz \
        && mv test-2.3.sqlite test23.sqlite \
        && datasette -h 0.0.0.0 test23.sqlite

I visited this URL to confirm I got an error due to spatialite not being
loaded:

http://localhost:8001/test23-c88bc35?sql=select+ST_AsText%28Geometry%29+from+HighWays+limit+1

Then I checked that loading it with `--load-extension` worked correctly:

    datasette -h 0.0.0.0 test23.sqlite \
        --load-extension=/usr/lib/x86_64-linux-gnu/mod_spatialite.so

Then, finally, I tested it with the new environment variable option:

    SQLITE_EXTENSIONS=/usr/lib/x86_64-linux-gnu/mod_spatialite.so \
        datasette -h 0.0.0.0 test23.sqlite

Running it with an invalid environment variable option shows an error:

    $ SQLITE_EXTENSIONS=/usr/lib/x86_64-linux-gnu/blah.so datasette \
        -h 0.0.0.0 test23.sqlite
    Usage: datasette -h [OPTIONS] [FILES]...

    Error: Invalid value for "--load-extension": Path "/usr/lib/x86_64-linux-gnu/blah.so" does not exist.

Closes #112
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

Successfully merging this pull request may close these issues.

None yet

2 participants