SlideShare a Scribd company logo
Rails Workshop 
@alexruperez
Create a new app 
rails -v 
rails new workshop --database=postgresql 
cd workshop
Gemfile 
gem 'rails_12factor' 
gem 'less-rails' 
gem 'twitter-bootstrap-rails' 
gem 'devise' 
gem 'therubyracer' (uncomment) 
gem 'unicorn' (uncomment)
Run the new app 
bundle install 
bundle exec rake db:create 
bundle exec rake db:migrate 
rails s
Generate devise models 
rails generate devise:install 
rails generate devise User 
Add ''config.action_mailer.default_url_options = 
{ host: 'localhost', port: 3000 }'' to config/ 
environments/development.rb 
bundle exec rake db:migrate
Apply Twitter Bootstrap 
rails generate bootstrap:install less 
rails g bootstrap:layout application 
rails generate scaffold_controller User 
Add ''before_action :authenticate_user!'' to app/controllers/ 
users_controller.rb 
rails g bootstrap:themed Users 
Add ''resources :users'' and ''root ‘users#index’'' to config/routes.rb
Upload to Heroku 
git init 
git add . 
git commit -am 'First commit' 
heroku git:remote -a YOUR_HEROKU_APP 
git push heroku master 
heroku run rake db:migrate
web.rb 
require 'sinatra' 
set :bind, '0.0.0.0' 
get '/' do 
"Hello world!" 
end
config.ru 
require './web' 
run Sinatra::Application
config/unicorn.rb 
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) 
timeout 15 
preload_app true 
before_fork do |server, worker| 
Signal.trap 'TERM' do 
puts 'Unicorn master intercepting TERM and sending myself QUIT instead' 
Process.kill 'QUIT', Process.pid 
end 
defined?(ActiveRecord::Base) and 
ActiveRecord::Base.connection.disconnect! 
end 
after_fork do |server, worker| 
Signal.trap 'TERM' do 
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' 
end 
defined?(ActiveRecord::Base) and 
ActiveRecord::Base.establish_connection 
end
Procfile 
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
Thanks! 
@alexruperez

More Related Content

PDF
All girlhacknight intro to rails
PPT
Deploying Rails Apps with Capistrano
PPTX
Heritrix REST API
PDF
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
PPTX
Java spring mysql without hibernate(2) (1)
PDF
決済サービスのSpring Bootのバージョンを2系に上げた話
PDF
Intro to Rack
All girlhacknight intro to rails
Deploying Rails Apps with Capistrano
Heritrix REST API
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Java spring mysql without hibernate(2) (1)
決済サービスのSpring Bootのバージョンを2系に上げた話
Intro to Rack

What's hot (20)

KEY
GPerf Using Jesque
PDF
Locarise,reagent and JavaScript Libraries
PDF
Neoito — React 101
PDF
JS Chicago Meetup 2/23/16 - Redux & Routes
PPTX
Ember components
PDF
Your first sinatra app
PDF
Remote Config REST API and Versioning
PDF
Redux Universal
PPTX
AWS CodeDeploy - basic intro
PPTX
Sufan presentation
PDF
1時間で作るマッシュアップサービス(関西版)
PPT
Windows Server AppFabric
PPTX
Getting started with k8
PPTX
SFNode 01-2018 - Aquarium control
PPT
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
PPTX
Creating asynchronous flows on AWS
PPTX
Offline First with Service Worker
PDF
clara-rules
PDF
Ansible Israel Kickoff Meetup
PDF
Virthualenvwrapper
GPerf Using Jesque
Locarise,reagent and JavaScript Libraries
Neoito — React 101
JS Chicago Meetup 2/23/16 - Redux & Routes
Ember components
Your first sinatra app
Remote Config REST API and Versioning
Redux Universal
AWS CodeDeploy - basic intro
Sufan presentation
1時間で作るマッシュアップサービス(関西版)
Windows Server AppFabric
Getting started with k8
SFNode 01-2018 - Aquarium control
C# Async on iOS and Android - Craig Dunn, Developer Evangelist at Xamarin
Creating asynchronous flows on AWS
Offline First with Service Worker
clara-rules
Ansible Israel Kickoff Meetup
Virthualenvwrapper
Ad

Similar to Gigigo Rails Workshop (20)

PDF
Infrastructure = code - 1 year later
PDF
20130528 solution linux_frousseau_nopain_webdev
PDF
Building and deploying React applications
PDF
Ruby On Rails Starter Kit
PPTX
React JS CONCEPT AND DETAILED EXPLANATION
PDF
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
PDF
Migrating Legacy Rails Apps to Rails 3
PPTX
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
PPTX
RoR guide_p1
PPTX
Rails Engine | Modular application
PDF
Deploying configurable frontend web application containers
PDF
Ruby on Rails - Introduction
PPT
Capistrano
PDF
How to dockerize rails application compose and rails tutorial
PDF
Love at first Vue
PPTX
Ruby on Rails + AngularJS + Twitter Bootstrap
PDF
Deploying a simple Rails application with AWS Elastic Beanstalk
KEY
Railsconf2011 deployment tips_for_slideshare
PDF
Node Summit 2018: Cloud Native Node.js
PDF
RoR 101: Session 5
Infrastructure = code - 1 year later
20130528 solution linux_frousseau_nopain_webdev
Building and deploying React applications
Ruby On Rails Starter Kit
React JS CONCEPT AND DETAILED EXPLANATION
RESTful API を Chalice で紐解く 〜 Python Serverless Microframework for AWS 〜
Migrating Legacy Rails Apps to Rails 3
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
RoR guide_p1
Rails Engine | Modular application
Deploying configurable frontend web application containers
Ruby on Rails - Introduction
Capistrano
How to dockerize rails application compose and rails tutorial
Love at first Vue
Ruby on Rails + AngularJS + Twitter Bootstrap
Deploying a simple Rails application with AWS Elastic Beanstalk
Railsconf2011 deployment tips_for_slideshare
Node Summit 2018: Cloud Native Node.js
RoR 101: Session 5
Ad

More from Alex Rupérez (10)

PDF
Iterando arquitecturas, creando herramientas | T3chFest
PDF
Desarrollando mogollón de apps a la vez... ¿en qué lío me he metido?
PDF
MADBike – Destapando la seguridad de BiciMAD (T3chFest 2017)
PDF
Gigigo Workshop - iOS Extensions
PPTX
Gigigo Ruby Workshop
PDF
Gigigo Workshop - Create an iOS Framework, document it and not die trying
PDF
iOS Sync Libraries
PDF
NSCoder Keynote - Multipeer Connectivity Framework
PDF
Magister of Entrepreneurship - Social Development
PDF
Gigigo Keynote - Geofences & iBeacons
Iterando arquitecturas, creando herramientas | T3chFest
Desarrollando mogollón de apps a la vez... ¿en qué lío me he metido?
MADBike – Destapando la seguridad de BiciMAD (T3chFest 2017)
Gigigo Workshop - iOS Extensions
Gigigo Ruby Workshop
Gigigo Workshop - Create an iOS Framework, document it and not die trying
iOS Sync Libraries
NSCoder Keynote - Multipeer Connectivity Framework
Magister of Entrepreneurship - Social Development
Gigigo Keynote - Geofences & iBeacons

Recently uploaded (20)

PPTX
UNIT 4 Total Quality Management .pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Geodesy 1.pptx...............................................
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
DOCX
573137875-Attendance-Management-System-original
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
UNIT 4 Total Quality Management .pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
OOP with Java - Java Introduction (Basics)
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
R24 SURVEYING LAB MANUAL for civil enggi
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Geodesy 1.pptx...............................................
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
573137875-Attendance-Management-System-original
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
CYBER-CRIMES AND SECURITY A guide to understanding
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks

Gigigo Rails Workshop

  • 2. Create a new app rails -v rails new workshop --database=postgresql cd workshop
  • 3. Gemfile gem 'rails_12factor' gem 'less-rails' gem 'twitter-bootstrap-rails' gem 'devise' gem 'therubyracer' (uncomment) gem 'unicorn' (uncomment)
  • 4. Run the new app bundle install bundle exec rake db:create bundle exec rake db:migrate rails s
  • 5. Generate devise models rails generate devise:install rails generate devise User Add ''config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }'' to config/ environments/development.rb bundle exec rake db:migrate
  • 6. Apply Twitter Bootstrap rails generate bootstrap:install less rails g bootstrap:layout application rails generate scaffold_controller User Add ''before_action :authenticate_user!'' to app/controllers/ users_controller.rb rails g bootstrap:themed Users Add ''resources :users'' and ''root ‘users#index’'' to config/routes.rb
  • 7. Upload to Heroku git init git add . git commit -am 'First commit' heroku git:remote -a YOUR_HEROKU_APP git push heroku master heroku run rake db:migrate
  • 8. web.rb require 'sinatra' set :bind, '0.0.0.0' get '/' do "Hello world!" end
  • 9. config.ru require './web' run Sinatra::Application
  • 10. config/unicorn.rb worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) timeout 15 preload_app true before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! end after_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' end defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
  • 11. Procfile web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb