Flink / dokku-psql-single-container

Plugin for dokku that provides a Postgresql server in a single container
MIT License
51 stars 9 forks source link

PostGIS? #3

Closed sglebs closed 9 years ago

sglebs commented 9 years ago

Thank you for this plugin!

I wanted to have the same thing but with PostGIS support. If I am not mistaken, all I need to do is override the docker image in your functions file, right? So, a few considerations:

1) can you use an env var for the postgre docker image and fallback to your current hardcoded value? This would allow people like me to use PostGIS without having to fork your project just to change your functions file.

2) any recommendations on a good PostGIS docker image? There are so many, and I am not sure they would all be compatible with your plugin. Example: https://github.com/kartoza/docker-postgis

Thanks!

Flink commented 9 years ago

Hi Marcio!

Thank you for your input. Yes it’s a good idea to be able to provide a different PG image, I was thinking to do something like that :)

I don’t have a recommendation for PostGIS at the moment, the only thing needed to work with this plugin is to have a docker image with the same behavior than the postgres one. I will try to find more info on this though.

sglebs commented 9 years ago

I created a fork and I am using it to investigate. If I get it working I will update this ticket here and then we can decide how to proceed. Sounds good?

sglebs commented 9 years ago

fyi I will try kartoza/postgis first, hardcoded.

Flink commented 9 years ago

Yes it sounds good, thanks :)

sglebs commented 9 years ago

I am doing it with https://github.com/Flink/dokku-psql-single-container

The initial attempt failed:

Marcio-Marchinis-MacBook-Pro-Silver:core-server mqm$ ssh dokku@10.10.10.10 postgis:create core-server
-----> Creating database core-server
createdb: database creation failed: ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT:  Use the same encoding as in the template database, or use template0 as template.
ERROR:  database "core_server" does not exist
-----> Setting config vars for core-server
Marcio-Marchinis-MacBook-Pro-Silver:core-server mqm$ 

I will google etc and see where it leads me.

sglebs commented 9 years ago

I had to patch commands like http://www.wetware.co.nz/2010/07/error-new-encoding-utf8-is-incompatible-with-the-encoding-of-the-template-database-sql_ascii/

createdb -E utf8 -T template0

Now it ran. Let's see if the DB is GIS-enabled...

Flink commented 9 years ago

From this discussion https://github.com/docker-library/postgres/issues/30 it seems that https://github.com/appropriate/docker-postgis could be a good PostGIS image. It’s based on the official docker image so maybe it won’t have the issues you had.

Flink commented 9 years ago

Just made a commit to handle the alternative docker image :) I also tried (really quickly) the PostGIS image from https://registry.hub.docker.com/u/mdillon/postgis/ and I didn’t have any issue to run the PG server.

sglebs commented 9 years ago

To make PostGIS work out-of-the-box, the extensions have to be imported:

postgres=# create extension postgis; CREATE EXTENSION postgres=# create extension fuzzystrmatch; CREATE EXTENSION postgres=# create extension postgis_tiger_geocoder; CREATE EXTENSION postgres=# create extension postgis_topology; CREATE EXTENSION

I guess one could leave these steps for the user to manually execute (unlike Heroku does, but like Amazon RDS does - http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS)

Flink commented 9 years ago

Ok thank you for the infos :) It’s also possible to do something like this:

echo "create extension postgis; create extension fuzzystrmatch; create extension postgis_tiger_geocoder; create extension postgis_topology;" | dokku psql:admin_console