SlideShare una empresa de Scribd logo
1 de 38
Toolbox of a Ruby team
Team Ro 
@Artto
The basics of development in a team 
● A code repository 
● Consistent development environment 
● Code quality and code style consistency 
● CI and deployment procedure 
● Error tracking 
● Communication
Issue tracking? 
● Jira 
● Pivotal Tracker 
● Trello
Development environment 
● No need for a virtual machine! 
● rvm 
● .env 
● Database - Postgres App 
● Pow
is a command-line tool which 
allows you to easily install, manage, and work 
with multiple ruby environments from 
interpreters to sets of gems.
Examples 
>rvm use 2.1.1 
>rvm gemset create rails4 
>rvm use 2.1.1@rails4 
>gem install … 
>bundle install …
.ruby-version, .ruby-gemset 
Specify the gemset name and ruby version by 
including these two files in the root folder of the 
Rails project.
.env 
Shim to load environment variables from .env 
into ENV in development. 
gem ‘dotenv-rails’
.env example 
FACEBOOK_API_KEY=f4c3b00kt3st 
GA_CODE=UA-546094580-1 
MAIL_HOSTNAME=example.com
Postgres.app 
The easiest way to get started with PostgreSQL on the Mac 
rake db:create db:migrate
Pow: Zero-configuration Rack server for Mac OS X 
$ cd ~/.pow 
$ ln -s /path/to/myapp 
Then just go to http://myapp.dev/ and POW, it’s 
running (or maybe you forgot to run bundle install)!
.powrc 
if [ -f "$rvm_path/scripts/rvm" ]; 
then 
source "$rvm_path/scripts/rvm" 
rvm use . 
fi
Development environment setup steps: 
>git clone [git repo] 
>cd newapp 
ruby-2.1.2 - #gemset created /Users/user/.rvm/gems/ruby-2.1.2@newapp 
ruby-2.1.2 - #generating newapp wrappers - please wait 
>bundle install 
… 
>rake db:create db:migrate 
… 
>cd ~/.pow 
>ln -s /path/to/newapp 
http://newap.dev/
Code style and consistency 
The Ruby and RoR community is strict when it 
comes to coding style and conventions! 
This is really helpful for teams working on 
projects, onboarding of new developers is easy.
Sublime Text settings 
For basic stuff, there’s these Sublime settings: 
● Auto-delete trailing whitespaces 
● Add newlines at the end of files 
This will save you a bunch of unnecessary headaches.
Mandatory Sublime Settings 
// Set to true to removing trailing whitespace on save 
"trim_trailing_white_space_on_save": true, 
// Set to true to ensure the last line of the file ends in a newline 
// character when saving 
"ensure_newline_at_eof_on_save": true,
Code quality 
● Code review! 
● Naforo - not currently maintained :( 
● Github pull requests - good enough
Pull Requests 
When merging feature branches into master, 
do it via pull requests - this provides good 
basics for code review.
Code repository 
● Git 
● When pulling from origin, do it using the -- 
rebase option, to avoid unnecessary merge 
commits 
● Don’t change merge commit messages! 
● Is it sometimes acceptable to do a force 
push, to make the repo cleaner?
CI and Deployment 
● Heroku - making it super simple, but has 
downsides 
● Mina and Capistrano 
● Circle CI
Easy to configure, runs tests, deploys code. 
Hooks up to github, so it all runs every time you 
push something into the repo. Deployment 
procedure descirbed in the circle.yml file.
Example circle.yml 
machine: 
services: 
- postgresql 
deployment: 
staging: 
branch: master 
commands: 
- '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow' 
- git push --force git@heroku.com:staging-theapp.git $CIRCLE_SHA1:master: 
timeout: 900 
- heroku run rake db:migrate --app staging-theapp 
- curl https://api.rollbar.com/api/1/deploy/ -F access_token=$RB_AT -F environment=staging -F 
revision=$(git log -n 1 --pretty=format:"%H") -F local_username=CircleCI
Example circle.yml 
production: 
branch: production 
commands: 
- '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow' 
- git push --force git@heroku.com:production-theapp.git $CIRCLE_SHA1:master: 
timeout: 900 
- heroku run rake db:migrate --app production-theapp 
- git config user.name "DLabs CircleCi" 
- git config user.email "ci@dlabs.si" 
- git tag -a $(date "+%Y%m%d%H%M")-production $CIRCLE_SHA1 -m "$(date "+%Y%m%d%H%M") deployed to 
production" 
- '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow' 
- git push git@github.com:dlabs/theapp.git --tags 
- curl https://api.rollbar.com/api/1/deploy/ -F access_token=$RB_ATP -F environment=production -F 
revision=$(git log -n 1 --pretty=format:"%H") -F local_username=CircleCI
Wonders of Heroku 
Super easy to deploy and scale your app. 
Just push into your Heroku app’s repo and it will set it up 
automatically. Use $$$liders to scale up your app! 
No static IP 
DNS is tricky (many DNS providers don’t offer CNAME 
domain records for root domains), if you need a static IP, 
you’ll need to set up your own proxy or use Proximo($$$).
$ bundle exec cap staging deploy 
$ bundle exec cap production deploy
Example Capistrano Task 
server 'example.com', roles: [:web, :app] 
server 'example.org', roles: [:db, :workers] 
desc "Report Uptimes" 
task :uptime do 
on roles(:all) do |host| 
execute :any_command, "with args", :here, "and here" 
info "Host #{host} (#{host.roles.to_a.join(', ')}):t#{capture(:uptime)}" 
end 
end
Really fast deployer and server automation tool 
“Mina works really fast because it’s a deploy Bash script 
generator. It generates an entire procedure as a Bash 
script and runs it remotely in the server”
Mina example deploy 
$ mina deploy --verbose 
-----> Creating the build path 
$ mkdir tmp/build-128293482394 
-----> Cloning the Git repository 
$ git clone https://github.com/nadarei/flipstack.git . -n --recursive 
Cloning... done. 
-----> Installing gem dependencies using Bundler 
$ bundle install --without development:test 
Using i18n (0.6.0) 
Using multi_json (1.0.4) 
... 
Your bundle is complete! It was installed to ./vendor/bundle 
-----> Moving to releases/4 
$ mv "./tmp/build-128293482394" "releases/4" 
-----> Symlinking to current 
$ ln -nfs releases/4 current 
-----> Launching 
$ cd releases/4 
$ sudo service nginx restart 
-----> Done. Deployed v4
Error Tracking 
Watch those overage fees!!! 
Also includes some handy performance metrics
WebHooks: 
● github pushes 
● CI - tests and deployment 
● code review notifications 
● error tracking 
Animated GIFs!
HipChat - Github
HipChat - Circle CI
HipChat - Error Tracking 
:(
HipChat - Cat Facts
?
Links 
http://rvm.io/ 
http://postgresapp.com/ 
http://pow.cx/ 
http://www.sublimetext.com/ 
https://circleci.com/ 
http://nadarei.co/mina/ 
http://capistranorb.com/ 
https://www.hipchat.com/ 
https://www.heroku.com/ 
https://rollbar.com 
https://appsignal.com/

Más contenido relacionado

La actualidad más candente

Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 
Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Žilvinas Kuusas
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to AnsibleDan Vaida
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
Using rbenv in Production
Using rbenv in ProductionUsing rbenv in Production
Using rbenv in ProductionNic Benders
 
Provisioning iOS CI Server with Ansible
Provisioning iOS CI Server with AnsibleProvisioning iOS CI Server with Ansible
Provisioning iOS CI Server with AnsibleShashikant Jagtap
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with ResqueNicolas Blanco
 
Introduction to ansible galaxy
Introduction to ansible galaxyIntroduction to ansible galaxy
Introduction to ansible galaxyIvan Serdyuk
 
DevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and WebminDevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and Webminpostrational
 
以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用Shengyou Fan
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the PipelinePuppet
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chefbridgetkromhout
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoHannes Hapke
 
GPerf Using Jesque
GPerf Using JesqueGPerf Using Jesque
GPerf Using Jesquectoestreich
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 

La actualidad más candente (20)

Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Capistrano 3 Deployment
Capistrano 3 DeploymentCapistrano 3 Deployment
Capistrano 3 Deployment
 
Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Using rbenv in Production
Using rbenv in ProductionUsing rbenv in Production
Using rbenv in Production
 
Provisioning iOS CI Server with Ansible
Provisioning iOS CI Server with AnsibleProvisioning iOS CI Server with Ansible
Provisioning iOS CI Server with Ansible
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
 
JavaScript Task Runners - Gulp & Grunt
JavaScript Task Runners - Gulp & GruntJavaScript Task Runners - Gulp & Grunt
JavaScript Task Runners - Gulp & Grunt
 
Introduction to ansible galaxy
Introduction to ansible galaxyIntroduction to ansible galaxy
Introduction to ansible galaxy
 
DevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and WebminDevOps tools for everyone - Vagrant, Puppet and Webmin
DevOps tools for everyone - Vagrant, Puppet and Webmin
 
以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用以 Laravel 經驗開發 Hyperf 應用
以 Laravel 經驗開發 Hyperf 應用
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the Pipeline
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
GPerf Using Jesque
GPerf Using JesqueGPerf Using Jesque
GPerf Using Jesque
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 

Destacado

Testiranje s capybaro
Testiranje s capybaroTestiranje s capybaro
Testiranje s capybaroArto Artnik
 
PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...
PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...
PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...nostradelboy
 
'Video for Business': Webvideos seminar at The Business Show 2013 - London
 'Video for Business': Webvideos seminar at The Business Show 2013 - London 'Video for Business': Webvideos seminar at The Business Show 2013 - London
'Video for Business': Webvideos seminar at The Business Show 2013 - LondonWeb Videos
 
Game Of Thrones - Fenomenologia dei Media
Game Of Thrones - Fenomenologia dei MediaGame Of Thrones - Fenomenologia dei Media
Game Of Thrones - Fenomenologia dei MediaFrancesca Tessaroli
 
χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)
χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)
χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)Ευαγγελία Τριανταφύλλου
 
元智大學 原味市集.希望農場(報告)
元智大學 原味市集.希望農場(報告)元智大學 原味市集.希望農場(報告)
元智大學 原味市集.希望農場(報告)nehemiah0000
 
Libro de ejercicio word 2007
Libro de ejercicio word 2007Libro de ejercicio word 2007
Libro de ejercicio word 2007luchilita
 
Els cavalls
Els cavallsEls cavalls
Els cavallsilenia13
 

Destacado (10)

Getting started
Getting startedGetting started
Getting started
 
Testiranje s capybaro
Testiranje s capybaroTestiranje s capybaro
Testiranje s capybaro
 
PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...
PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...
PCI DSS v 2.0 - Don't Fall In. Short & high level presentation for the Ecomme...
 
'Video for Business': Webvideos seminar at The Business Show 2013 - London
 'Video for Business': Webvideos seminar at The Business Show 2013 - London 'Video for Business': Webvideos seminar at The Business Show 2013 - London
'Video for Business': Webvideos seminar at The Business Show 2013 - London
 
Game Of Thrones - Fenomenologia dei Media
Game Of Thrones - Fenomenologia dei MediaGame Of Thrones - Fenomenologia dei Media
Game Of Thrones - Fenomenologia dei Media
 
χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)
χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)
χριστουγεννα στο σπιτι_του_αη-βασιλη_αη_οκ____________ (1)
 
119724447 παρουσιαση-για-τους-σεισμους
119724447 παρουσιαση-για-τους-σεισμους119724447 παρουσιαση-για-τους-σεισμους
119724447 παρουσιαση-για-τους-σεισμους
 
元智大學 原味市集.希望農場(報告)
元智大學 原味市集.希望農場(報告)元智大學 原味市集.希望農場(報告)
元智大學 原味市集.希望農場(報告)
 
Libro de ejercicio word 2007
Libro de ejercicio word 2007Libro de ejercicio word 2007
Libro de ejercicio word 2007
 
Els cavalls
Els cavallsEls cavalls
Els cavalls
 

Similar a Toolbox of a Ruby Team

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Deepak Garg
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!cloudbring
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
The Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptThe Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptDocker, Inc.
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Halil Kaya
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabSoftware Guru
 
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMAlexander Shopov
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesHiroshi SHIBATA
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment TacticsIan Barber
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 
TIAD 2016 : Migrating 100% of your production services to containers
TIAD 2016 : Migrating 100% of your production services to containersTIAD 2016 : Migrating 100% of your production services to containers
TIAD 2016 : Migrating 100% of your production services to containersThe Incredible Automation Day
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with PuppetKris Buytaert
 

Similar a Toolbox of a Ruby Team (20)

[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
The Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptThe Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build Script
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
 
Docker as development environment
Docker as development environmentDocker as development environment
Docker as development environment
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
TIAD 2016 : Migrating 100% of your production services to containers
TIAD 2016 : Migrating 100% of your production services to containersTIAD 2016 : Migrating 100% of your production services to containers
TIAD 2016 : Migrating 100% of your production services to containers
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 

Toolbox of a Ruby Team

  • 1. Toolbox of a Ruby team
  • 3. The basics of development in a team ● A code repository ● Consistent development environment ● Code quality and code style consistency ● CI and deployment procedure ● Error tracking ● Communication
  • 4. Issue tracking? ● Jira ● Pivotal Tracker ● Trello
  • 5. Development environment ● No need for a virtual machine! ● rvm ● .env ● Database - Postgres App ● Pow
  • 6. is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
  • 7. Examples >rvm use 2.1.1 >rvm gemset create rails4 >rvm use 2.1.1@rails4 >gem install … >bundle install …
  • 8. .ruby-version, .ruby-gemset Specify the gemset name and ruby version by including these two files in the root folder of the Rails project.
  • 9. .env Shim to load environment variables from .env into ENV in development. gem ‘dotenv-rails’
  • 10. .env example FACEBOOK_API_KEY=f4c3b00kt3st GA_CODE=UA-546094580-1 MAIL_HOSTNAME=example.com
  • 11. Postgres.app The easiest way to get started with PostgreSQL on the Mac rake db:create db:migrate
  • 12. Pow: Zero-configuration Rack server for Mac OS X $ cd ~/.pow $ ln -s /path/to/myapp Then just go to http://myapp.dev/ and POW, it’s running (or maybe you forgot to run bundle install)!
  • 13. .powrc if [ -f "$rvm_path/scripts/rvm" ]; then source "$rvm_path/scripts/rvm" rvm use . fi
  • 14. Development environment setup steps: >git clone [git repo] >cd newapp ruby-2.1.2 - #gemset created /Users/user/.rvm/gems/ruby-2.1.2@newapp ruby-2.1.2 - #generating newapp wrappers - please wait >bundle install … >rake db:create db:migrate … >cd ~/.pow >ln -s /path/to/newapp http://newap.dev/
  • 15. Code style and consistency The Ruby and RoR community is strict when it comes to coding style and conventions! This is really helpful for teams working on projects, onboarding of new developers is easy.
  • 16. Sublime Text settings For basic stuff, there’s these Sublime settings: ● Auto-delete trailing whitespaces ● Add newlines at the end of files This will save you a bunch of unnecessary headaches.
  • 17. Mandatory Sublime Settings // Set to true to removing trailing whitespace on save "trim_trailing_white_space_on_save": true, // Set to true to ensure the last line of the file ends in a newline // character when saving "ensure_newline_at_eof_on_save": true,
  • 18. Code quality ● Code review! ● Naforo - not currently maintained :( ● Github pull requests - good enough
  • 19. Pull Requests When merging feature branches into master, do it via pull requests - this provides good basics for code review.
  • 20. Code repository ● Git ● When pulling from origin, do it using the -- rebase option, to avoid unnecessary merge commits ● Don’t change merge commit messages! ● Is it sometimes acceptable to do a force push, to make the repo cleaner?
  • 21. CI and Deployment ● Heroku - making it super simple, but has downsides ● Mina and Capistrano ● Circle CI
  • 22. Easy to configure, runs tests, deploys code. Hooks up to github, so it all runs every time you push something into the repo. Deployment procedure descirbed in the circle.yml file.
  • 23. Example circle.yml machine: services: - postgresql deployment: staging: branch: master commands: - '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow' - git push --force git@heroku.com:staging-theapp.git $CIRCLE_SHA1:master: timeout: 900 - heroku run rake db:migrate --app staging-theapp - curl https://api.rollbar.com/api/1/deploy/ -F access_token=$RB_AT -F environment=staging -F revision=$(git log -n 1 --pretty=format:"%H") -F local_username=CircleCI
  • 24. Example circle.yml production: branch: production commands: - '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow' - git push --force git@heroku.com:production-theapp.git $CIRCLE_SHA1:master: timeout: 900 - heroku run rake db:migrate --app production-theapp - git config user.name "DLabs CircleCi" - git config user.email "ci@dlabs.si" - git tag -a $(date "+%Y%m%d%H%M")-production $CIRCLE_SHA1 -m "$(date "+%Y%m%d%H%M") deployed to production" - '[[ ! -s "$(git rev-parse --git-dir)/shallow" ]] || git fetch --unshallow' - git push git@github.com:dlabs/theapp.git --tags - curl https://api.rollbar.com/api/1/deploy/ -F access_token=$RB_ATP -F environment=production -F revision=$(git log -n 1 --pretty=format:"%H") -F local_username=CircleCI
  • 25. Wonders of Heroku Super easy to deploy and scale your app. Just push into your Heroku app’s repo and it will set it up automatically. Use $$$liders to scale up your app! No static IP DNS is tricky (many DNS providers don’t offer CNAME domain records for root domains), if you need a static IP, you’ll need to set up your own proxy or use Proximo($$$).
  • 26. $ bundle exec cap staging deploy $ bundle exec cap production deploy
  • 27. Example Capistrano Task server 'example.com', roles: [:web, :app] server 'example.org', roles: [:db, :workers] desc "Report Uptimes" task :uptime do on roles(:all) do |host| execute :any_command, "with args", :here, "and here" info "Host #{host} (#{host.roles.to_a.join(', ')}):t#{capture(:uptime)}" end end
  • 28. Really fast deployer and server automation tool “Mina works really fast because it’s a deploy Bash script generator. It generates an entire procedure as a Bash script and runs it remotely in the server”
  • 29. Mina example deploy $ mina deploy --verbose -----> Creating the build path $ mkdir tmp/build-128293482394 -----> Cloning the Git repository $ git clone https://github.com/nadarei/flipstack.git . -n --recursive Cloning... done. -----> Installing gem dependencies using Bundler $ bundle install --without development:test Using i18n (0.6.0) Using multi_json (1.0.4) ... Your bundle is complete! It was installed to ./vendor/bundle -----> Moving to releases/4 $ mv "./tmp/build-128293482394" "releases/4" -----> Symlinking to current $ ln -nfs releases/4 current -----> Launching $ cd releases/4 $ sudo service nginx restart -----> Done. Deployed v4
  • 30. Error Tracking Watch those overage fees!!! Also includes some handy performance metrics
  • 31. WebHooks: ● github pushes ● CI - tests and deployment ● code review notifications ● error tracking Animated GIFs!
  • 32.
  • 35. HipChat - Error Tracking :(
  • 36. HipChat - Cat Facts
  • 37. ?
  • 38. Links http://rvm.io/ http://postgresapp.com/ http://pow.cx/ http://www.sublimetext.com/ https://circleci.com/ http://nadarei.co/mina/ http://capistranorb.com/ https://www.hipchat.com/ https://www.heroku.com/ https://rollbar.com https://appsignal.com/