develop and deploy your mobile api with rails, nginx, unicorn and capistrano

40
Develop and Deploy Your Mobile API with Capistrano, Unicorn, Ruby on Rails & Nginx @errazudin

Upload: errazudin-ishak

Post on 20-Jun-2015

1.106 views

Category:

Technology


1 download

DESCRIPTION

So you are building your awesome sites and apps that you want it to be accessible on all smartphone, tablet and desktop devices. Definitely you need a proper backend and application programming interface (API), among others to allow these software components to interact with your core application brain. This session will try to discuss how you could develop your API with the magical Ruby on Rails, run it with mystical Unicorn and Nginx, and managed your deployment via Capistrano. Yes people, we're living in a world full of APIs.

TRANSCRIPT

Page 1: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Develop and Deploy Your Mobile API with Capistrano, Unicorn, Ruby on Rails & Nginx

@errazudin

Page 2: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Develop and Deploy Your Mobile API with Capistrano, Unicorn, Ruby on Rails & Nginx

Wait.. What kind of title is this?

Page 3: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Develop and Deploy Your Mobile API with CURN

@errazudin

Page 4: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Agenda

What on earth..For what reason..So how to do that..Ok, now what..Summary

Page 5: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

About Me

Solutions ArchitectAny-Stack-Dev-Ops…about.me/errazudin

Page 6: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Agenda

What on earth..For what reason..So how to do that..Ok, now what..Summary

Page 7: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

What on earth

Page 8: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

What on earth

Page 9: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

What on earth..

Page 10: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

What on earth

Page 11: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

What (else) on earth

Page 12: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Develop and Deploy Your Mobile API with CURN+RedisVagrantMysqlElasticsearch+

EverythingUnderTheSky?

@errazudin

Wait.. This Talk Should Be...

Page 13: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Agenda

What on earth..For what reason..So how to do that..Ok, now what..Summary

Page 14: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

For what reason

Production

Staging/UAT

Development

Page 15: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

For what reason

Development

Page 16: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

"Programmers are like vampires. They're frequently up all night, paler than death itself, and generally afraid of being exposed to daylight. Oh yes, and they tend think of themselves (or at least their code) as immortal." - www.codinghorror.com

Page 17: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

System Administrators are like werewolves. They may look outwardly ordinary, but are incredibly strong, mostly invulnerable to stuf that would kill regular people -- and prone to strange transformations during a moon "outage". - www.codinghorror.com

Page 18: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Developers <3 Sysadmin

Page 19: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

For what reason

Staging/UAT

Page 20: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

For what reason

Production

Page 21: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Agenda

What on earth..For what reason..So how to do that..Ok, now what..Summary

Page 22: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

So how to do that

Portable work environments

VirtualBox, Vmware, etc

Support provisioning tools eg. Chef, Puppet

“vagrant up” and you're ready to fly

Page 23: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Still not convinced?

$ vagrant box add base http://files.vagrantup.com/lucid32.box

$ vagrant init

$ vagrant up

Page 24: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

So how to do that

“vagrant ssh” and install your stuf manually

package the greatest vagrant box

..and share within your team!

.. or use automated provisioning

Page 25: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Yay! It's ready, so what are you waiting for dude?

Page 26: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

The API

Used by the various mobile devices (iPhone, Android and Blackberry smartphones) to communicate with the server

All communications over https

Each request includes authorisation token

Responses are in JSON

Page 27: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

The API

Fb login

Example API calls: login, create user, get user, get photo, update photo, checkin, messaging, etc

Page 28: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Agenda

What on earth..For what reason..So how to do that..Ok, now what..Summary

Page 29: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Remember this?

Production

Staging/UAT

Development

Page 30: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Ok, Now What

Production

Staging/UAT

Page 31: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Ok, Now What

StagingEC2, S3, RDS, SES, SSL

Page 32: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Ok, Now What

ProductionEC2, S3, RDS, SES, ELB, SSL, Route53, Pingdom

Page 33: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Agenda

What on earth..For what reason..So how to do that..Ok, now what..Summary

Page 34: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Don’t pick a tool because <someone> uses it.

Page 35: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Evaluate options based on requirements

Page 36: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

It's good to learn from the big boys..

Page 37: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

..but <that-tech> isn't for every application :)

Page 38: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

References

http://unicorn.bogomips.org/

http://rubyonrails.org/

https://rubygems.org/

http://www.capistranorb.com/

http://nimbleworks.co.uk/blog/apis-for-mobile-applications/http://nginx.org/

http://www.elasticsearch.org

Page 39: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Moving forward..

http://puma.io

http://nadarei.co/mina/

https://puppetlabs.com

http://aws.amazon.com/opsworks/

http://lucene.apache.org/solr/

Page 40: Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano

Thank you

@[email protected]

Thank you