PostGIS

in the Open Cloud

writing portable open source mapping applications

with

Leaflet

and

OpenShift


bit.ly/1tpBqGA

http://ryanjarvinen.com/presentations/postgis-open-cloud

presented by

ryan jarvinen / @ryanj
Open Source Evangelist
at
Red Hat

ryanj@redhat.com

Agenda

  1. Open Cloud Overview
  2. Select a language and a lightweight web framwork
  3. Add Leaflet for client-side map interactions
  4. Build a simple API
  5. Install and configure PostgreSQL, PostGIS
  6. Use environment variables to keep your code clean
  7. Bootstrap your DB
  8. Launch your instant mapping solution
  9. Learn about tuning PG on OpenShift

the Cloud

"what is it made of?"

The cloud is:

  • hot air?
  • a series of tubes?
  • mostly cat photos

Infrastructure

as a service

inputs:

  • Hardware: racks, fiber, routers, storage, compute
  • Software: OpenStack, Eucalyptus, CloudStack, SaltStack


Result:

  • Easy on-demand Linux environments

Platform

as a service

inputs:

  • Hardware: IaaS
  • Software: SELinux, CGroups, Docker, HAProxy, ssh, git


Result:

  • Horizontally scalable application architectures on-demand

Providing standards-based, open source workflows that answer the question of:


"How do I

Build,

Host,

&

Scale

my solutions

on an

Open Cloud?"

Open platforms provide a peaceful environment for Developers AND Operations teams to work together in

  • Operations teams can help ensure system-wide stability and performance
  • Developers can quickly provision environments without waiting
  • The discussion shifts towards establishing great policies for scaling in response to demand

Terminology (Red Hat)

  • Broker – Management host, orchestration of Nodes
  • Node – Compute host containing Gears
  • Gear – Allocation of fixed memory, compute, and storage resources for running applications (SELinux, CGoups)
  • Cartridge – A technology, framework, or application: Python, Ruby, Javascript, PHP, Perl, Java/JEE, PG, MySQL, Jenkins, PHPMyAdmin, etc.

An Open Cartridge format

OpenShift Cartridge

cart developer's guide


OpenShift Release Schedule

Frameworks

Language-specific Dependencies

Automatic support for dependency resolution using standard packaging, native to each language:

gems (ruby), eggs (python), and npm modules (node.js)

Language-specific DB bindings

For nodejs:

npm install pg-query --save

brianc's pg-query module makes working with PG exceedingly simple

Just map your queries to their related callback functions.

Local development

Resolve dependencies:

npm install

Fire up a local server:

npm start

Launch Time!

Spin up a fresh app from the command line:

rhc app create myapp cart1 cart2 --from-code=http://github.com/user/repo.git

For our nodejs example:

rhc app create nodegis nodejs-0.10 postgres-9.2 --from-code=http://github.com/ryanj/restify-postGIS.git

Live Result


nodegis-shifter.rhcloud.com/

~ related content ~

Web Workflows for Launching Apps

Customizing OpenShift's Web-based App Creation Workflow


Open Source Ribbons for Launching Apps

Instant Hosting of Open Source Projects with GitHub-style Ribbons


Custom Domain Names and SSL

Domain Names and SSL in the OpenShift Web Console

Tuning PG

aka, where is my pg_hba.conf, and postgresql.conf?

Some PG tuning notes were recently posted in the OpenShift Online release announcement for April 2014

OPENSHIFT_POSTGRESQL_SHARED_BUFFERS
OPENSHIFT_POSTGRESQL_MAX_CONNECTIONS


More general tuning advice: https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server

Advanced configurations

  • Watch out for statistics collector issues in the pg-9.2 cart


Take a look at the latest from CrunchyData!

HA for PG by CrunchyData

See their release announcement for additional details: crunchydatasolutions.com


Including support for LB, geographic failover, Master-slave replication, and more!

Join the Community

Origin.ly

The Origin.ly Appication and Cartridge index

OpenShift Core Roadmap:

Check out the upstream source:
OpenShift Origin


Try our hosted solution (3 apps free):
OpenShift Online


Request an evaluation for:
OpenShift Enterprise

Thank You!

See my post on this topic for more info: Instant Mapping Applications with PostGIS and Nodejs


Link to these slides: bit.ly/1tpBqGA


See you next time!
  --ryanj