48
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 1/48 PG OPEN CLOUD Portable PG applications http://bit.ly/1eddml6 http://ryanjarvinen.com/presentations/pg_open_cloud

Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

Embed Size (px)

Citation preview

Page 1: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 148

PG OPEN CLOUDPortable PG applications

httpbitly1eddml6

httpryanjarvinencompresentationspg_open_cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 248

presented by

ryan jarvinen ryanj

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 348

Open Platforms Engineerat

Red Hat

ryanjredhatcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 448

AGENDA1 Open Cloud Overview2 Learn how to write for the Open Cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 548

the Cloudwhat is it made of

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 648

The cloud ishot aira series of tubesmostly cat photos

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 2: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 248

presented by

ryan jarvinen ryanj

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 348

Open Platforms Engineerat

Red Hat

ryanjredhatcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 448

AGENDA1 Open Cloud Overview2 Learn how to write for the Open Cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 548

the Cloudwhat is it made of

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 648

The cloud ishot aira series of tubesmostly cat photos

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 3: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 348

Open Platforms Engineerat

Red Hat

ryanjredhatcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 448

AGENDA1 Open Cloud Overview2 Learn how to write for the Open Cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 548

the Cloudwhat is it made of

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 648

The cloud ishot aira series of tubesmostly cat photos

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 4: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 448

AGENDA1 Open Cloud Overview2 Learn how to write for the Open Cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 548

the Cloudwhat is it made of

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 648

The cloud ishot aira series of tubesmostly cat photos

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 5: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 548

the Cloudwhat is it made of

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 648

The cloud ishot aira series of tubesmostly cat photos

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 6: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 648

The cloud ishot aira series of tubesmostly cat photos

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 7: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 748

INFRASTRUCTURECommunications fiber switches wirelessStorage and Compute chips servers disks databaseshellipDevOps (and friction)hellipSoftware as a Service Dropbox Gmail

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 8: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 848

IAASAmazon EC2RackSpaceLinodeBlueHost

Many are VM VPS-based services

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 9: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 948

BUILDING WITH POSTGRES NORMALLY LOOKS LIKE

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 10: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1048

1 Install Apache with Mod_WSGI2 Make sure we have all the Python extensions set so

Apache can see them3 Configure firewall so that only http https and ssh are

available to outside world4 Install Postgresql and plugins5 update PG_hbaconf create db user create db user

password set up access privs and a test account6 Create DB give user permissions to the DB7 Set up a git repository and then figure out how to

structure and deploy8 Now I can write code - hello world then database

connection then real app9 Get it working with a public DNS

10 Now you are stuck maintaining the machine

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 11: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1148

OR - if your Ops team offers pre-built VMs

1 Fill out a mile high stack of request forms for a VMfrom Ops and wait

2 Then realize its not configured properly submit ticketand wait

3 Repeat same information and wait4 Your ops person moves to a different group GOTO

Line 1

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 12: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1248

As a sysadmin

1 Were busy keeping the site up well need to provisionyour VM later

2 Developers always want to try a new language ordatastore that they dont know how to install let alonemanage

3 There is whole bunch of account creation andlockdown for each VM Ill need to give them Sudo ortheyll annoy me all the time

4 Each machine ends up with a wildly different config5 Developers never give up the resources from their

VMs - spreadsheets and emails6 If there is a security fix I need to go into each VM and

update it7 I dont want to spend my time updating DNS tables

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 13: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1348

PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FORDEVS AND SYSADMINS

Operations can ensure stability and performanceDevelopers can self-provision environments withoutwaitingThe discussion shifts toward establishing policies forscaling

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 14: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1448

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 15: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1548

PUBLIC HOSTED PAASHerokuEngineYardGoogle App EngineAmazon BeanStalk

usually VM-based or proprietary application containertechnologies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 16: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1648

the public cloud

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 17: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1748

This all sounds great but what abouthellip

LOCK-IN

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 18: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1848

THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 19: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 1948

IAASOpenStackEucalptusCloudStackOr roll your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 20: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2048

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 21: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2148

OPEN PAASOpenShiftCloud Foundry

Built around Containers

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 22: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2248

TRIUMPH OF THE OPEN CLOUDWhen Big Cloud fails you you can always decide to host

your own

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 23: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2348

TINYTINYRSSReusable Redeployable code - host it anywhere

httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstart

rhc app create rss php-5 postgresql-9 cron-14 --from-code=httpsgithubcomopenshift-quickstarttiny_tiny_rss-openshift-quickstartgit

httpsrss-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 24: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2448

ADDING POSTGRES TO EXISTING APPLICATIONS

done

rhc cartridge add postgres-84

rhc cartridge add postgres-92

blog post PostgreSQL 92 Comes to OpenShift

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 25: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2548

Or while connected over ssh

rhc app show rss

env | grep DB

OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgROPENSHIFT_POSTGRESQL_DB_SOCKET=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlsocketOPENSHIFT_POSTGRESQL_DB_HOST=12778130OPENSHIFT_POSTGRESQL_DB_PID=varlibopenshift523672f7e0b8cd02d70003bcpostgresqlpidpostgrespidOPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6eOPENSHIFT_POSTGRESQL_DB_URL=postgresqladminpahue6elXcFVx4hIZgR127781305432OPENSHIFT_POSTGRESQL_DB_PORT=5432OPENSHIFT_POSTGRESQL_DB_LOG_DIR=varlibopenshift523672f7e0b8cd02d70003bcpostgresqllog

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 26: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2648

TERMINOLOGY (RED HAT)Broker ndash Management host orchestration of NodesNode ndash Compute host containing GearsGear ndash Allocation of fixed memory compute andstorage resources for running applicationsCartridge ndash A technologyframework (Python RubyJavascript PHP Perl JavaJEE PG MySQL etc) forapplication service dependencies

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 27: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2748

GEARS SECURE AND EFFICIENT

SELinux Cgroups

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 28: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2848

AN OPEN CARTRIDGE FORMAT

cart developers guide

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 29: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 2948

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 30: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3048

OPEN AND WORKING IN THE UPSTREAM

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 31: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3148

WRITING APPS FOR THE OPEN CLOUD

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 32: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3248

TODO APP(FLASK AND SQLALCHEMY)

httpsgithubcomshekhargulatitodo-flask-openshift-quickstart

blog post Build Your App on OpenShift Using FlaskSQLAlchemy and PostgreSQL 92

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 33: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3348

rhc app create -s task python-27 postgresql-92 --from-code=httpsgithubcomshekhargulatitodo-flask-openshift-quickstartgit

httptask-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 34: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3448

OPENSHIFT SCALING HOOKSSetting a min and max scale from the command linerhc cartridge-scale python-27 -a task --min 3 --max 5

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 35: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3548

SCALING WEB UI

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 36: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3648

HAPROXY SCALING HOOKSAdding and removing instances scaling up and down

HAProxy on off switches

These hooks are available on the command line withinyour gear and via a REST API

haproxy_ctld --up

haproxy_ctld --down

haproxy_ctld_daemon start

haproxy_ctld_daemon stop

haproxy_ctld_daemon restart

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 37: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3748

HAPROXY WEB UIhttp$YOUR_APP_DNShaproxy-status

HAPROXY RAW DATAhttp$YOUR_APP_DNShaproxy-statuscsv

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 38: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3848

LIVING IN THE CLOUDSCode for America

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 39: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 3948

ADOPT A CAUSE

This app should be using PostGIS for spatial queries

httpsgithubcomopenshift-quickstartadopt-a-hydrant-openshift-quickstart

blog post More Spatial in Your Database with PostGIS20

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 40: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4048

Persist configuration details while keeping your source clean

rhc app create hydrant ruby-19 postgresql-84 --from=code=httpgithubcomryanjadopt-a-hydrantgit --env SECRET_TOKEN=YOUR_SECRET_TOKEN

httphydrant-shifterrhcloudcom

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 41: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4148

ENVIRONMENT VARIABLESListing your custom env vars

Setting a variable

Help with configuration

cd hydrantrhc env list

rhc env set SECRET_TOKEN=a1fdacc3b1d14d6a92ed1219ed304d02529f535085262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3

rhc help env

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 42: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4248

DEPENDENCIESAutomatic support for dependency resolution using

standard packaging native to each language

(ruby) (python) and (nodejs)gems eggs npm modules

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 43: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4348

ACTION HOOKS1 enable postgis2 bootstrap your db

httpsgithubcomryanjpg_parkstreemasteropenshiftaction_hooks

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 44: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4448

BANNERShttpcitibike-shifterrhcloudcom

rhc env set CITIBIKE_NEARBY_STATIONS=268257258 -a citibikes

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 45: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4548

DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 46: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4648

JOIN THE COMMUNITYMeritocracy for our pull requestsHelp with anything from core quickstarts andcartridges to small typo fixes in the command line toolsPEPs for major feature enhancementsContribution GuidelinesPublic Trello cardsPublic Test plansPublic BugzillaVote on Features

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 47: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4748

Check out the upstream source

Try our hosted solution (3 apps free)

Request an evaluation for

OpenShift Origin

OpenShift Online

OpenShift Enterprise

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6

Page 48: Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

92113 Writing portable postgreSQL-backed applications for the Open Cloud

ryanjarvinencompresentationspg_open_cloud 4848

Thanks for following along --ryanj

slides httpbitly1eddml6