SlideShare a Scribd company logo
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
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 2/48
presented by
/ryan jarvinen @ryanj
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 3/48
Open Platforms Engineer
at
Red Hat
ryanj@redhat.com
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 4/48
AGENDA
1. Open Cloud Overview
2. Learn how to write for the Open Cloud
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 5/48
the Cloud
"what is it made of?"
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 6/48
The cloud is:
hot air?
a series of tubes?
mostly cat photos✓
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 7/48
INFRASTRUCTURE
Communications: fiber, switches, wireless
Storage and Compute: chips, servers, disks, databases
…
DevOps (and friction)
…
Software as a Service: Dropbox, Gmail
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 8/48
IAAS
Amazon EC2
RackSpace
Linode
BlueHost
* Many are VM / VPS-based services
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 9/48
BUILDING WITH POSTGRES NORMALLY LOOKS LIKE:
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 10/48
1. Install Apache with Mod_WSGI
2. Make sure we have all the Python extensions set so
Apache can see them
3. Configure firewall so that only http, https, and ssh are
available to outside world
4. Install Postgresql, and plugins
5. update PG_hba.conf, create db user, create db user
password, set up access privs, and a test account
6. Create DB, give user permissions to the DB
7. Set up a git repository and then figure out how to
structure and deploy
8. Now I can write code - hello world, then database
connection, then real app
9. Get it working with a public DNS
10. Now you are stuck maintaining the machine
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 11/48
OR - if your Ops team offers pre-built VMs:
1. Fill out a mile high stack of request forms for a VM
from Ops and wait
2. Then realize it's not configured properly, submit ticket
and wait
3. Repeat same information, and wait
4. Your ops person moves to a different group, GOTO
Line 1....
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 12/48
As a sysadmin:
1. We're busy keeping the site up, we'll need to provision
your VM later
2. Developers always want to try a new language or
datastore that they don't know how to install, let alone
manage
3. There is whole bunch of account creation and
lockdown for each VM. I'll need to give them Sudo or
they'll annoy me all the time
4. Each machine ends up with a wildly different config
5. Developers never give up the resources from their
VMs - spreadsheets and emails
6. If there is a security fix I need to go into each VM and
update it
7. I don't want to spend my time updating DNS tables
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 13/48
PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FOR
DEVS AND SYSADMINS
Operations can ensure stability and performance
Developers can self-provision environments without
waiting
The discussion shifts toward establishing policies for
scaling
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 14/48
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 15/48
PUBLIC / HOSTED PAAS
Heroku
EngineYard
Google App Engine
Amazon BeanStalk
* usually VM-based or proprietary application container
technologies
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 16/48
the public cloud
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 17/48
This all sounds great, but what about…
LOCK-IN?
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 18/48
THE OPEN CLOUD
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 19/48
IAAS
OpenStack
Eucalptus
CloudStack
Or, roll your own
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 20/48
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 21/48
OPEN PAAS
OpenShift
Cloud Foundry
Built around Containers
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 22/48
TRIUMPH OF THE OPEN CLOUD
When "Big Cloud" fails you, you can always decide to host
your own
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 23/48
TINYTINYRSS
Reusable, Redeployable code - host it anywhere
https://github.com/openshift-quickstart/tiny_tiny_rss-
openshift-quickstart
rhc app create rss php-5 postgresql-9 cron-1.4 --from-code=https:/
/github.com/openshift-quickstart/tiny_tiny_rss-openshift-quickstar
t.git
https://rss-shifter.rhcloud.com/
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 24/48
ADDING POSTGRES TO EXISTING APPLICATIONS:
done!
rhc cartridge add postgres-8.4
rhc cartridge add postgres-9.2
blog post: PostgreSQL 9.2 Comes to OpenShift
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 25/48
Or, while connected over ssh:
rhc app show rss
env | grep DB
OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgR
OPENSHIFT_POSTGRESQL_DB_SOCKET=/var/lib/openshift/523672f7e0b8cd02
d70003bc/postgresql/socket/
OPENSHIFT_POSTGRESQL_DB_HOST=127.7.8.130
OPENSHIFT_POSTGRESQL_DB_PID=/var/lib/openshift/523672f7e0b8cd02d70
003bc/postgresql/pid/postgres.pid
OPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6e
OPENSHIFT_POSTGRESQL_DB_URL=postgresql://adminpahue6e:lXcFVx4hIZgR
@127.7.8.130:5432
OPENSHIFT_POSTGRESQL_DB_PORT=5432
OPENSHIFT_POSTGRESQL_DB_LOG_DIR=/var/lib/openshift/523672f7e0b8cd0
2d70003bc/postgresql/log/
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 26/48
TERMINOLOGY (RED HAT)
Broker – Management host, orchestration of Nodes
Node – Compute host containing Gears
Gear – Allocation of fixed memory, compute, and
storage resources for running applications
Cartridge – A technology/framework (Python, Ruby,
Javascript, PHP, Perl, Java/JEE, PG, MySQL, etc.) for
application service dependencies
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 27/48
GEARS: SECURE AND EFFICIENT
,SELinux Cgroups
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 28/48
AN OPEN CARTRIDGE FORMAT
cart developer's guide
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 29/48
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 30/48
OPEN, AND WORKING IN THE UPSTREAM
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 31/48
WRITING APPS FOR THE OPEN CLOUD
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 32/48
TODO APP
(FLASK AND SQLALCHEMY)
https://github.com/shekhargulati/todo-flask-openshift-
quickstart
blog post: Build Your App on OpenShift Using Flask,
SQLAlchemy, and PostgreSQL 9.2
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 33/48
rhc app create -s task python-2.7 postgresql-9.2 --from-code=https
://github.com/shekhargulati/todo-flask-openshift-quickstart.git
http://task-shifter.rhcloud.com/
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 34/48
OPENSHIFT SCALING HOOKS
Setting a min and max scale from the command line
rhc cartridge-scale python-2.7 -a task --min 3 --max 5
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 35/48
SCALING WEB UI
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 36/48
HAPROXY SCALING HOOKS
Adding and removing instances / scaling up and down
HAProxy on / off switches
These hooks are available on the command line within
your gear, and via a REST API
haproxy_ctld --up
haproxy_ctld --down
haproxy_ctld_daemon start
haproxy_ctld_daemon stop
haproxy_ctld_daemon restart
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 37/48
HAPROXY WEB UI
http://$YOUR_APP_DNS/haproxy-status/
HAPROXY RAW DATA
http://$YOUR_APP_DNS/haproxy-status/;csv
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 38/48
LIVING IN THE CLOUDS
Code for America
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 39/48
ADOPT A CAUSE
This app should be using PostGIS for spatial queries:
https://github.com/openshift-quickstart/adopt-a-
hydrant-openshift-quickstart
blog post: More Spatial in Your Database with PostGIS
2.0
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 40/48
Persist configuration details,
while keeping your source clean:
rhc app create hydrant ruby-1.9 postgresql-8.4 --from=code=http://
github.com/ryanj/adopt-a-hydrant.git --env SECRET_TOKEN="YOUR_SECR
ET_TOKEN"
http://hydrant-shifter.rhcloud.com/
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 41/48
ENVIRONMENT VARIABLES
Listing your custom env vars:
Setting a variable:
Help with configuration:
cd hydrant
rhc env list
rhc env set SECRET_TOKEN="a1fdacc3b1d14d6a92ed1219ed304d02529f5350
85262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3"
rhc help env
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 42/48
DEPENDENCIES
Automatic support for dependency resolution using
standard packaging, native to each language:
(ruby), (python), and (node.js)gems eggs npm modules
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 43/48
ACTION HOOKS
1. enable postgis
2. bootstrap your db
https://github.com/ryanj/pg_parks/tree/master/.openshift/action_ho
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 44/48
BANNERS?
http://citibike-shifter.rhcloud.com/
rhc env set CITIBIKE_NEARBY_STATIONS="268,257,258" -a citibikes
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 45/48
DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 46/48
JOIN THE COMMUNITY
Meritocracy for our pull requests
Help with anything from core, quickstarts, and
cartridges, to small typo fixes in the command line tools
PEPs for major feature enhancements
Contribution Guidelines
Public Trello cards
Public Test plans
Public Bugzilla
Vote on Features
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 47/48
Check out the upstream source:
Try our hosted solution (3 apps free):
Request an evaluation for:
OpenShift Origin
OpenShift Online
OpenShift Enterprise
9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud
ryanjarvinen.com/presentations/pg_open_cloud/#/ 48/48
Thanks for following along! --ryanj
slides: http://bit.ly/1eddml6

More Related Content

Viewers also liked (20)

PDF
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
PostgresOpen
 
PDF
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
PostgresOpen
 
PDF
Keith Paskett - Postgres on ZFS @ Postgres Open
PostgresOpen
 
PDF
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
PostgresOpen
 
PDF
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
PostgresOpen
 
PDF
Islamabad PUG - 7th Meetup - performance tuning
Umair Shahid
 
PDF
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
PostgresOpen
 
PDF
Islamabad PUG - 7th meetup - performance tuning
Umair Shahid
 
PDF
Out of the box replication in postgres 9.4(pg confus)
Denish Patel
 
PDF
Steve Singer - Managing PostgreSQL with Puppet @ Postgres Open
PostgresOpen
 
PDF
Michael Bayer Introduction to SQLAlchemy @ Postgres Open
PostgresOpen
 
PDF
PoPostgreSQL Web Projects: From Start to FinishStart To Finish
elliando dias
 
PDF
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
PostgresOpen
 
PDF
Gbroccolo pgconfeu2016 pgnfs
Giuseppe Broccolo
 
PDF
PostgreSQL HA
haroonm
 
PDF
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
PostgresOpen
 
PDF
Geometria Projetiva
elliando dias
 
PDF
PostgreSQL replication from setup to advanced features.
Pivorak MeetUp
 
ODP
Logical replication with pglogical
Umair Shahid
 
PDF
On The Building Of A PostgreSQL Cluster
Srihari Sriraman
 
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
PostgresOpen
 
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
PostgresOpen
 
Keith Paskett - Postgres on ZFS @ Postgres Open
PostgresOpen
 
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
PostgresOpen
 
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
PostgresOpen
 
Islamabad PUG - 7th Meetup - performance tuning
Umair Shahid
 
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
PostgresOpen
 
Islamabad PUG - 7th meetup - performance tuning
Umair Shahid
 
Out of the box replication in postgres 9.4(pg confus)
Denish Patel
 
Steve Singer - Managing PostgreSQL with Puppet @ Postgres Open
PostgresOpen
 
Michael Bayer Introduction to SQLAlchemy @ Postgres Open
PostgresOpen
 
PoPostgreSQL Web Projects: From Start to FinishStart To Finish
elliando dias
 
Koichi Suzuki - Postgres-XC Dynamic Cluster Management @ Postgres Open
PostgresOpen
 
Gbroccolo pgconfeu2016 pgnfs
Giuseppe Broccolo
 
PostgreSQL HA
haroonm
 
Michael Paquier - Taking advantage of custom bgworkers @ Postgres Open
PostgresOpen
 
Geometria Projetiva
elliando dias
 
PostgreSQL replication from setup to advanced features.
Pivorak MeetUp
 
Logical replication with pglogical
Umair Shahid
 
On The Building Of A PostgreSQL Cluster
Srihari Sriraman
 

Similar to Ryan Jarvinen Open Shift Talk @ Postgres Open 2013 (20)

PPTX
Phone gap
Madhura Keskar
 
PDF
The Big Cloud native FaaS Lebowski
QAware GmbH
 
PPTX
Cloud Computing Presentation
Ashish Kumar Singh
 
PDF
WebAssembly - czy dzisiaj mi się to przyda do pracy?
Brainhub
 
PDF
CA Performance Manager Agility by using Docker Containers for Network Manag...
CA Technologies
 
PDF
DCEU 18: Developing with Docker Containers
Docker, Inc.
 
PDF
Building a data warehouse with Pentaho and Docker
Wellington Marinho
 
PDF
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
PDF
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
Olivier Destrebecq
 
PDF
PT-4142, Porting and Optimizing OpenMP applications to APU using CAPS tools, ...
AMD Developer Central
 
PPTX
[DSC DACH 23] Creating Production-Ready Shiny Apps - Mario Annau
DataScienceConferenc1
 
PDF
如何让开源软件用得更放心
Onward Security
 
PDF
Build and Manage Serverless APIs (APIDays Nordic, May 19th 2016)
3scale
 
PDF
Docker @ Data Science Meetup
Daniel Nüst
 
PDF
Sentiment Analysis using Big Data
Rajat Mittal
 
PDF
Using Docker For Development
Laura Frank Tacho
 
PDF
Concourse x Spinnaker #concourse_tokyo
Toshiaki Maki
 
PPTX
Release webinar architecture
BigData_Europe
 
PDF
IBM Bluemix Hackathon Accelerator
gjuljo
 
PDF
How automated cloud infrastructure setups can help with Continuous Delivery
Edmund Siegfried Haselwanter
 
Phone gap
Madhura Keskar
 
The Big Cloud native FaaS Lebowski
QAware GmbH
 
Cloud Computing Presentation
Ashish Kumar Singh
 
WebAssembly - czy dzisiaj mi się to przyda do pracy?
Brainhub
 
CA Performance Manager Agility by using Docker Containers for Network Manag...
CA Technologies
 
DCEU 18: Developing with Docker Containers
Docker, Inc.
 
Building a data warehouse with Pentaho and Docker
Wellington Marinho
 
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
Olivier Destrebecq
 
PT-4142, Porting and Optimizing OpenMP applications to APU using CAPS tools, ...
AMD Developer Central
 
[DSC DACH 23] Creating Production-Ready Shiny Apps - Mario Annau
DataScienceConferenc1
 
如何让开源软件用得更放心
Onward Security
 
Build and Manage Serverless APIs (APIDays Nordic, May 19th 2016)
3scale
 
Docker @ Data Science Meetup
Daniel Nüst
 
Sentiment Analysis using Big Data
Rajat Mittal
 
Using Docker For Development
Laura Frank Tacho
 
Concourse x Spinnaker #concourse_tokyo
Toshiaki Maki
 
Release webinar architecture
BigData_Europe
 
IBM Bluemix Hackathon Accelerator
gjuljo
 
How automated cloud infrastructure setups can help with Continuous Delivery
Edmund Siegfried Haselwanter
 
Ad

Recently uploaded (20)

PPTX
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
PDF
Agentic Artificial Intelligence (AI) and its growing impact on business opera...
Alakmalak Technologies Pvt. Ltd.
 
PPTX
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
UiPath vs Other Automation Tools Meeting Presentation.pdf
Tracy Dixon
 
PPTX
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Trading Volume Explained by CIFDAQ- Secret Of Market Trends
CIFDAQ
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
PPTX
Top Managed Service Providers in Los Angeles
Captain IT
 
PPTX
Earn Agentblazer Status with Slack Community Patna.pptx
SanjeetMishra29
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PPTX
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
PDF
Market Wrap for 18th July 2025 by CIFDAQ
CIFDAQ
 
PDF
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PDF
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
PDF
Productivity Management Software | Workstatus
Lovely Baghel
 
python advanced data structure dictionary with examples python advanced data ...
sprasanna11
 
Agentic Artificial Intelligence (AI) and its growing impact on business opera...
Alakmalak Technologies Pvt. Ltd.
 
Lecture 5 - Agentic AI and model context protocol.pptx
Dr. LAM Yat-fai (林日辉)
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
UiPath vs Other Automation Tools Meeting Presentation.pdf
Tracy Dixon
 
Extensions Framework (XaaS) - Enabling Orchestrate Anything
ShapeBlue
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Trading Volume Explained by CIFDAQ- Secret Of Market Trends
CIFDAQ
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
Top Managed Service Providers in Los Angeles
Captain IT
 
Earn Agentblazer Status with Slack Community Patna.pptx
SanjeetMishra29
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
The Yotta x CloudStack Advantage: Scalable, India-First Cloud
ShapeBlue
 
Market Wrap for 18th July 2025 by CIFDAQ
CIFDAQ
 
CIFDAQ'S Token Spotlight for 16th July 2025 - ALGORAND
CIFDAQ
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Lecture A - AI Workflows for Banking.pdf
Dr. LAM Yat-fai (林日辉)
 
Productivity Management Software | Workstatus
Lovely Baghel
 
Ad

Ryan Jarvinen Open Shift Talk @ Postgres Open 2013

  • 1. 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
  • 2. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 2/48 presented by /ryan jarvinen @ryanj
  • 3. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 3/48 Open Platforms Engineer at Red Hat ryanj@redhat.com
  • 4. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 4/48 AGENDA 1. Open Cloud Overview 2. Learn how to write for the Open Cloud
  • 5. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 5/48 the Cloud "what is it made of?"
  • 6. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 6/48 The cloud is: hot air? a series of tubes? mostly cat photos✓
  • 7. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 7/48 INFRASTRUCTURE Communications: fiber, switches, wireless Storage and Compute: chips, servers, disks, databases … DevOps (and friction) … Software as a Service: Dropbox, Gmail
  • 8. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 8/48 IAAS Amazon EC2 RackSpace Linode BlueHost * Many are VM / VPS-based services
  • 9. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 9/48 BUILDING WITH POSTGRES NORMALLY LOOKS LIKE:
  • 10. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 10/48 1. Install Apache with Mod_WSGI 2. Make sure we have all the Python extensions set so Apache can see them 3. Configure firewall so that only http, https, and ssh are available to outside world 4. Install Postgresql, and plugins 5. update PG_hba.conf, create db user, create db user password, set up access privs, and a test account 6. Create DB, give user permissions to the DB 7. Set up a git repository and then figure out how to structure and deploy 8. Now I can write code - hello world, then database connection, then real app 9. Get it working with a public DNS 10. Now you are stuck maintaining the machine
  • 11. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 11/48 OR - if your Ops team offers pre-built VMs: 1. Fill out a mile high stack of request forms for a VM from Ops and wait 2. Then realize it's not configured properly, submit ticket and wait 3. Repeat same information, and wait 4. Your ops person moves to a different group, GOTO Line 1....
  • 12. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 12/48 As a sysadmin: 1. We're busy keeping the site up, we'll need to provision your VM later 2. Developers always want to try a new language or datastore that they don't know how to install, let alone manage 3. There is whole bunch of account creation and lockdown for each VM. I'll need to give them Sudo or they'll annoy me all the time 4. Each machine ends up with a wildly different config 5. Developers never give up the resources from their VMs - spreadsheets and emails 6. If there is a security fix I need to go into each VM and update it 7. I don't want to spend my time updating DNS tables
  • 13. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 13/48 PLATFORMS PROVIDE A PEACEFUL ENVIRONMENT FOR DEVS AND SYSADMINS Operations can ensure stability and performance Developers can self-provision environments without waiting The discussion shifts toward establishing policies for scaling
  • 14. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 14/48
  • 15. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 15/48 PUBLIC / HOSTED PAAS Heroku EngineYard Google App Engine Amazon BeanStalk * usually VM-based or proprietary application container technologies
  • 16. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 16/48 the public cloud
  • 17. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 17/48 This all sounds great, but what about… LOCK-IN?
  • 18. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 18/48 THE OPEN CLOUD
  • 19. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 19/48 IAAS OpenStack Eucalptus CloudStack Or, roll your own
  • 20. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 20/48
  • 21. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 21/48 OPEN PAAS OpenShift Cloud Foundry Built around Containers
  • 22. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 22/48 TRIUMPH OF THE OPEN CLOUD When "Big Cloud" fails you, you can always decide to host your own
  • 23. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 23/48 TINYTINYRSS Reusable, Redeployable code - host it anywhere https://github.com/openshift-quickstart/tiny_tiny_rss- openshift-quickstart rhc app create rss php-5 postgresql-9 cron-1.4 --from-code=https:/ /github.com/openshift-quickstart/tiny_tiny_rss-openshift-quickstar t.git https://rss-shifter.rhcloud.com/
  • 24. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 24/48 ADDING POSTGRES TO EXISTING APPLICATIONS: done! rhc cartridge add postgres-8.4 rhc cartridge add postgres-9.2 blog post: PostgreSQL 9.2 Comes to OpenShift
  • 25. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 25/48 Or, while connected over ssh: rhc app show rss env | grep DB OPENSHIFT_POSTGRESQL_DB_PASSWORD=lXcFVx4hIZgR OPENSHIFT_POSTGRESQL_DB_SOCKET=/var/lib/openshift/523672f7e0b8cd02 d70003bc/postgresql/socket/ OPENSHIFT_POSTGRESQL_DB_HOST=127.7.8.130 OPENSHIFT_POSTGRESQL_DB_PID=/var/lib/openshift/523672f7e0b8cd02d70 003bc/postgresql/pid/postgres.pid OPENSHIFT_POSTGRESQL_DB_USERNAME=adminpahue6e OPENSHIFT_POSTGRESQL_DB_URL=postgresql://adminpahue6e:lXcFVx4hIZgR @127.7.8.130:5432 OPENSHIFT_POSTGRESQL_DB_PORT=5432 OPENSHIFT_POSTGRESQL_DB_LOG_DIR=/var/lib/openshift/523672f7e0b8cd0 2d70003bc/postgresql/log/
  • 26. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 26/48 TERMINOLOGY (RED HAT) Broker – Management host, orchestration of Nodes Node – Compute host containing Gears Gear – Allocation of fixed memory, compute, and storage resources for running applications Cartridge – A technology/framework (Python, Ruby, Javascript, PHP, Perl, Java/JEE, PG, MySQL, etc.) for application service dependencies
  • 27. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 27/48 GEARS: SECURE AND EFFICIENT ,SELinux Cgroups
  • 28. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 28/48 AN OPEN CARTRIDGE FORMAT cart developer's guide
  • 29. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 29/48
  • 30. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 30/48 OPEN, AND WORKING IN THE UPSTREAM
  • 31. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 31/48 WRITING APPS FOR THE OPEN CLOUD
  • 32. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 32/48 TODO APP (FLASK AND SQLALCHEMY) https://github.com/shekhargulati/todo-flask-openshift- quickstart blog post: Build Your App on OpenShift Using Flask, SQLAlchemy, and PostgreSQL 9.2
  • 33. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 33/48 rhc app create -s task python-2.7 postgresql-9.2 --from-code=https ://github.com/shekhargulati/todo-flask-openshift-quickstart.git http://task-shifter.rhcloud.com/
  • 34. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 34/48 OPENSHIFT SCALING HOOKS Setting a min and max scale from the command line rhc cartridge-scale python-2.7 -a task --min 3 --max 5
  • 35. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 35/48 SCALING WEB UI
  • 36. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 36/48 HAPROXY SCALING HOOKS Adding and removing instances / scaling up and down HAProxy on / off switches These hooks are available on the command line within your gear, and via a REST API haproxy_ctld --up haproxy_ctld --down haproxy_ctld_daemon start haproxy_ctld_daemon stop haproxy_ctld_daemon restart
  • 37. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 37/48 HAPROXY WEB UI http://$YOUR_APP_DNS/haproxy-status/ HAPROXY RAW DATA http://$YOUR_APP_DNS/haproxy-status/;csv
  • 38. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 38/48 LIVING IN THE CLOUDS Code for America
  • 39. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 39/48 ADOPT A CAUSE This app should be using PostGIS for spatial queries: https://github.com/openshift-quickstart/adopt-a- hydrant-openshift-quickstart blog post: More Spatial in Your Database with PostGIS 2.0
  • 40. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 40/48 Persist configuration details, while keeping your source clean: rhc app create hydrant ruby-1.9 postgresql-8.4 --from=code=http:// github.com/ryanj/adopt-a-hydrant.git --env SECRET_TOKEN="YOUR_SECR ET_TOKEN" http://hydrant-shifter.rhcloud.com/
  • 41. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 41/48 ENVIRONMENT VARIABLES Listing your custom env vars: Setting a variable: Help with configuration: cd hydrant rhc env list rhc env set SECRET_TOKEN="a1fdacc3b1d14d6a92ed1219ed304d02529f5350 85262a90c39f072ef6de0ee9fe3a3d0194f02a2a8eb3" rhc help env
  • 42. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 42/48 DEPENDENCIES Automatic support for dependency resolution using standard packaging, native to each language: (ruby), (python), and (node.js)gems eggs npm modules
  • 43. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 43/48 ACTION HOOKS 1. enable postgis 2. bootstrap your db https://github.com/ryanj/pg_parks/tree/master/.openshift/action_ho
  • 44. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 44/48 BANNERS? http://citibike-shifter.rhcloud.com/ rhc env set CITIBIKE_NEARBY_STATIONS="268,257,258" -a citibikes
  • 45. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 45/48 DISTRIBUTED MULTI-CLOUD FEDERATED APPLICATIONS
  • 46. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 46/48 JOIN THE COMMUNITY Meritocracy for our pull requests Help with anything from core, quickstarts, and cartridges, to small typo fixes in the command line tools PEPs for major feature enhancements Contribution Guidelines Public Trello cards Public Test plans Public Bugzilla Vote on Features
  • 47. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 47/48 Check out the upstream source: Try our hosted solution (3 apps free): Request an evaluation for: OpenShift Origin OpenShift Online OpenShift Enterprise
  • 48. 9/21/13 Writing portable postgreSQL-backed applications for the Open Cloud ryanjarvinen.com/presentations/pg_open_cloud/#/ 48/48 Thanks for following along! --ryanj slides: http://bit.ly/1eddml6