Thursday, December 08, 2016

Cloud PostGIS overview

Since not long ago I have been wondering about investigating a little bit the different cloud  PostgreSQL/PostGIS database providers (DBaaS) on the Internet.

Besides the interest for self-learning (say necesity), I was interested in the possibility of sharing test datasets for teaching/practicing purposes aimed at the students attending the geodatabase subject of the universitary master in information systems (MUSIGT) of the Public University of Navarre (UPNa).

My previous experience with HEROKU had been interesting but also limited to the provision of PostgreSQL instances, that is, without the PostGIS extension which can only be activated on the paying production plans, something off the limits of the current prospection.

In the past months I've been identifying several web pages that could be candidates to be considered and among them I found this entry in the OSGEO wiki which is specifically dedicated to this subject.

Among the different providers the one I have reviewed first is the Amazon RDS for PostgreSQL. All the Amazon's tech appeal in the form of a 12 month free trying period (if you don't overcome the level of service limits) will you let to test this service along others from the AWS platform... The thing is that I was not willing to acquire any type of commitment, not now nor after 12 months, and so, not without a bit of pity, I declined the proposal.

Next, I had a look to aiven, whose motto your database in the cloud, is pretty clarifying of where they are putting the focus on and of their specialization area. It looks good, with a variety of database paradigms represented by products as PosgreSQL (popular extensions included, among them PostGIS), Redis, InfluxDB, Apache Kafka, etc... deployed on the main platform service providers around the world (Google, Azure, DigitalOcean, UpCloud y Amazon AWS).

In this case there is not any free plan but you can take advantage of a 10$ bonus that you could spent in the more affordable plan called Hobbyist (1CPU, 1GB, 8GB storage, with a fee of aprox. 0.026 $/h, 19$ monthly estimate). Despite you don't have to give your credit card to have the test drive, I've left it aside by the moment for the already stated reasons.

There is another one that looks great: AcuGIS. I have nothing to say apart from the fact that I remains now in a high position of my task list. Maybe next time.

Last to be mentioned in this post and the one that I´ve been testing is QGIS Cloud.

QGIS Cloud

The name might suggest some kind of direct relation with the QGIS project but as far as I know this is an independent solution from the second. Leaving apart this little detail I must say that this is a solution that works and I have not found any problems during the test.

This provider offers a means of publishing your maps (QGIS made maps) through a web mapping application in the cloud. It also includes a data hosting service with PostgreSQL/PostGIS (preinstalled) databases (note that all the data used in the published maps should be first uploaded to this storage). The key aspect of this solution relies on the way all the map and data managament is done, based on the use of a QGIS plugin (that is, I think, the main explanation for the name of this product).

Once we have signed in the products page, and after installing the plugin we will be able to upload our maps and data through the plugin.

QGIS Cloud plugin for QGIS
As shown in the image, once logged we will be able to see the list of your DB instances, create new instances, know the used storage from the total available, upload  local data, manage maps, etc. Signing-in, installation and use are all quite easy and very clearly explained in the Quickstart page.

Along your data you will also have an instance of a OSM database ready to use in your maps.

At this moment two plans are offered: Free and Pro. With the Free plan you will be able to publish an unlimited number of maps (that will be publicly accessible to the world). Regarding to data storage: up to 5 PostGIS 2.0 DB instances, with a maximum total capacity of 50 MB and up to 10 concurrent DB connections. That is, a good set of features that are enough for experimental purposes.

QGIS Cloud as DBaaS

Perhaps we are not interested in the map publishing capacity and we would only like to use this service as a Cloud DB Service provider. This is perfectly possible. The only thing you will need to know is the DB connection details and use them from your favorite tool or application as you can read in this FAQ: PgAdmin, psql, QGIS... or any software that is able to connect to a PostgreSQL server.

We can find out the connection details from plugin's panel which shows the list of our database instances when you force the tooltip to appear (holding the mouse over each database name in the list).

It's worth to mention that when accessing from PgAdmin you  will have to specify the database name in the maintenance database parameter. It is also important to note thar in all cases SSL is required in the connection configuration. Have a look to this FAQ with examples.

Finally, I would like to say that I will not dare to evaluate the service's quality level as I can't manage all the aspects involved: the possible limitations of the Free plan or my own internet access. But I am sure that it will fulfill my current requirements.

Monday, December 05, 2016

PostGIS en la nuble

Hace tiempo que tenía apuntado investigar un poco sobre proveedores de servicios de bases de datos (DBaaS) PostgreSQL/PostGIS en la nube (o en el aire según cuño del filósofo Javier Echeverría Ezponda a quien reciéntemente tuvimos la oportunidad de disfrutar en el ciclo Diálogos mano a mano con el investigador de la Universidad Púbica de Navarra Humberto Bustince Sola).

Aparte del interés (necesidad) por aprender una solución de este tipo me serviría  para colgar juegos de datos de prueba para los alumnos de la asignatura de bases de datos geográficas (máster MUSIGT de la Universidad Pública de Navarra).

Mi experiencia previa con HEROKU había sido interesante pero se limitaba a la provisión de instancias de PostgreSQL, es decir, sin poder disfrutar de la extensión PostGIS al estar ésta última únicamente disponible en los planes (suscripciones) de producción, es decir, de pago, fuera del alcance de la prospección.

Llevo un tiempo identificando una serie de páginas que podrían ser interesantes entre las que cabe destacar la página de la wiki de OSGEO específicamente dedicada a este tema y que recoge las principales opciones existentes.

El primero de los dos proveedores que he revisado es Amazon RDS para PostgreSQL. Todo el tech appeal de Amazon en forma de una prueba gratuita de 12 meses (siempre que no se superen ciertos niveles de servicio) en la que poder probar este servicio y otros de la plataforma AWS... Como no me apetecía adquirir ningún compromiso, aunque éste fuese a 12 meses vista, con cierta pena, he declinado el ofrecimiento.
El siguiente proveedor que he estado consultando es aiven, cuyo lema your database in the cloud, es bastante clarificador de su enfoque y especialziación. Pinta muy bien, ofrece distintos servicios de bases de datos de los distintos paradigmas existentes, tales como PostgreSQL (incluidas las extensiones más populares, entre ellas PostGIS), Redis, InfluxDB, Apache Kafka, etc.., desplegados sobre distintos proveedores de servicios (Google, Azure, DigitalOcean, UpCloud y Amazon AWS).

En este caso no hay suscripción gratuita o de prueba pero sí un bono de 10$ de prueba que podríamos aplicar al plan más económico Hobbyist (1CPU, 1GB, 8GB de almacenamiento, con una tarifa rondando los 0.026 $/h, estimado mensual de 19$). Aunque para probar no piden "Visa", lo aparco.

Otro que también pinta muy bien es AcuGIS que por el momento pasa a engordar mi lista de tareas pendientes.

El último que voy a mencionar en este post y que he probado es QGIS Cloud. Así es, el nombre despista un poco, y la verdad que se podría decir que parece un poco oportunista...

QGIS Cloud

... y aun a riesgo de equivocarme yo diría que efectivamente lo es ya que no encuentro ninguna relación entre este proveedor y el proyecto QGIS. Dejando este detalle a un lado es una solución que funciona y he podido probar sin ningún problema.

El sistema ofrece un mecanismo para almacenar datos en la nube, así como para publicar mapas online que utilizan dichos datos (todos los datos de nuestros mapas que no sean servicios remotos deberemos subirlos al almacén PostGIS). La particularidad del sistema radica en el modo que se gestionan las operaciones, que no es de otra manera que a través de un plugin de QGIS (y entiendo que de ahí viene el nombre).

Una vez nos hayamos registrado en su página web y hayamos instalado el plugin en QGIS podremos subir nuestros mapas y datos mediante el plugin.

Plugin QGIS Cloud para QGIS
Como puede apreciarse en la imagen, una vez nos hemos autenticado podemos ver las BBDD que tenemos creadas, el espacio consumido, crear nuevas instancias de BD, subir datos, gestionar mapas, etc. El proceso de alta e instalación y uso es muy sencillo y está perfectamente explicado en el Quickstart. Mientras escribía este post he visto que hay un pequeño tutorial reciente en mappingGIS que explica lo mismo de manera más somera.

Actualmente se ofrecen dos planes Free y Pro. El plan Free permite la publicación ilimitada de mapas (públicos). En lo relativo a almacenamiento de datos: hasta 5 instancias de bases de datos PostGIS 2.0, con un espacio máximo total de 50MB y un número máximo de 10 conexiones concurrentes por base de datos. Lo cual, sobra decirlo, lo hace muy interesante para experimentar.

QGIS Cloud como DBaaS

Es posible, como sería mi caso en este momento, que no estemos interesados en publicar mapas y que lo único que nos interese es utilizar el servicio de bases de datos en la nube. Esto es perfectamente posible. Para ello basta con conocer los detalles de la conexión a nuestras bases de datos y utilizar la herramienta que deseemos tal y como se explica en las FAQ: PgAdmin, psql, QGIS... o cualquier software capaz de conectarse a un servidor PostgreSQL.

Los datos de conexión los podremos obtener del plugin, donde se muestra el nombre de la BD en el listado, que a su vez coincide con el nombre de usuario de la conexión. La contraseña la podremos ver en el tooltip que se muestra al posicionar el cursor sobre cada BD en el listado (algo incómodo pero no imposible). El host y puerto, los tenemos también en el tooltip y en las FAQ, así como un par de pantallazos de ejemplo para conectar desde QGIS y PgAdmin (debemos explicitar la instancia de BD en la conexión). En todos los casos es requerido el uso de SSL en la conexión.

Para terminar quiero comentar que no estoy en disposición de hacer valoraciones de calidad/nivel de servicio al no poder controlar todas las variables: limitaciones del plan gratuito, la velocidad de mi acceso a internet, etc., pero creo que para los fines que me proponía servirá. Espero que también para quien haya tenido a bien tragarse este ladrillo. ;)