Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Deploy like a Pro
Damián Serrano Thode
@dsthode
MalagaMakers GeekBeers (20150115)
What is deployment?
Copy source files to the server
What is deployment?
Copy source files to the server
Not just that!
What is deployment?
✔
Optimize assets
What is deployment?
✔
Optimize assets
✔
Run database migrations
What is deployment?
✔
Optimize assets
✔
Run database migrations
✔
Restart dependent services
What is deployment?
✔
Optimize assets
✔
Run database migrations
✔
Restart dependent services
Provide rollback functionality
What is deployment?
Optimize assets
Optimize assets
Enter Grunt → http://gruntjs.com
Optimize assets
Combine and minify javascript
Optimize assets
Combine and minify javascript
You can use grunt-contrib-uglify
Optimize assets
Preprocess, combine and minify styles
Optimize assets
Preprocess, combine and minify styles
You can use grunt-contrib-sass &
grunt-contrib-cssmin
Optimize assets
Optimize and combine images
Optimize assets
Optimize and combine images
You can use grunt-spritesmith &
grunt-contrib-imagemin
Optimize assets
Optimize and combine font files
(SVG only)
Optimize assets
Optimize and combine font files (SVG only)
You can use the same grunt-contrib-imagemin
Database
migrations,
deployment &
rollback
Enter Capistrano → http://capistranorb.com
“A remote server automation and
deployment tool written in Ruby.”
“Capistrano is written in Ruby, but it can
easily be use...
Run “cap install” on your project folder
Capfile defines requirements for your deployment tasks→
config/deploy.rb shared configuration for all the stages→
config/d...
Lots of tasks off-the-shelf that integrate with the Ruby on
Rails framework
bundler, assets, migrations, Passenger, etc......
Sample Capfile
Sample config/deploy.rb
Sample config/deploy/production.rb
Different roles available:
app, web, db
Also, you can define several servers at once, eg:
Available tasks
Deployment
Run 'cap <stage> deploy' on your console
Deployment flow
Rollback
Run 'cap <stage> deploy:rollback' on your console
Rollback flow
You can attach to any step to run custom commands using
'before' and 'after' from Capistrano DSL, eg:
Not a Rails shop?
You might need manual work creating your recipes,
although there is some hope in certain cases:
capistra...
Where to go from here?
Infrastructure management tools like Chef or Puppet for
server provisioning
Continuous integration ...
Talk deployed
Questions?
Damián Serrano Thode
@dsthode
MalagaMakers GeekBeers (20150115)
Deploy like a pro!
Deploy like a pro!
Upcoming SlideShare
Loading in …5
×

Deploy like a pro!

1,627 views

Published on

The slides for a talk given at MalagaMakers Geekbeers on 2015-01-15 http://malagamakers.com
The talk was about deployment and glossed about assets preparation using Grunt and an introduction to deployment using Capistrano

Published in: Software
  • Be the first to comment

  • Be the first to like this

Deploy like a pro!

  1. 1. Deploy like a Pro Damián Serrano Thode @dsthode MalagaMakers GeekBeers (20150115)
  2. 2. What is deployment?
  3. 3. Copy source files to the server What is deployment?
  4. 4. Copy source files to the server Not just that! What is deployment?
  5. 5. ✔ Optimize assets What is deployment?
  6. 6. ✔ Optimize assets ✔ Run database migrations What is deployment?
  7. 7. ✔ Optimize assets ✔ Run database migrations ✔ Restart dependent services What is deployment?
  8. 8. ✔ Optimize assets ✔ Run database migrations ✔ Restart dependent services Provide rollback functionality What is deployment?
  9. 9. Optimize assets
  10. 10. Optimize assets Enter Grunt → http://gruntjs.com
  11. 11. Optimize assets Combine and minify javascript
  12. 12. Optimize assets Combine and minify javascript You can use grunt-contrib-uglify
  13. 13. Optimize assets Preprocess, combine and minify styles
  14. 14. Optimize assets Preprocess, combine and minify styles You can use grunt-contrib-sass & grunt-contrib-cssmin
  15. 15. Optimize assets Optimize and combine images
  16. 16. Optimize assets Optimize and combine images You can use grunt-spritesmith & grunt-contrib-imagemin
  17. 17. Optimize assets Optimize and combine font files (SVG only)
  18. 18. Optimize assets Optimize and combine font files (SVG only) You can use the same grunt-contrib-imagemin
  19. 19. Database migrations, deployment & rollback
  20. 20. Enter Capistrano → http://capistranorb.com
  21. 21. “A remote server automation and deployment tool written in Ruby.” “Capistrano is written in Ruby, but it can easily be used to deploy any language.”
  22. 22. Run “cap install” on your project folder
  23. 23. Capfile defines requirements for your deployment tasks→ config/deploy.rb shared configuration for all the stages→ config/deploy/*.rb defines multiple stage deployment→ lib/capistrano/tasks where your custom tasks are defined→
  24. 24. Lots of tasks off-the-shelf that integrate with the Ruby on Rails framework bundler, assets, migrations, Passenger, etc... You just need to include the gems in your Gemfile and uncomment the require in the Capfile
  25. 25. Sample Capfile
  26. 26. Sample config/deploy.rb
  27. 27. Sample config/deploy/production.rb
  28. 28. Different roles available: app, web, db Also, you can define several servers at once, eg:
  29. 29. Available tasks
  30. 30. Deployment Run 'cap <stage> deploy' on your console
  31. 31. Deployment flow
  32. 32. Rollback Run 'cap <stage> deploy:rollback' on your console
  33. 33. Rollback flow
  34. 34. You can attach to any step to run custom commands using 'before' and 'after' from Capistrano DSL, eg:
  35. 35. Not a Rails shop? You might need manual work creating your recipes, although there is some hope in certain cases: capistrano-node-deploy Node.js apps→ capistrano-virtualenv virtualenv python apps→ capistrano-django Django apps→ capistrano-go Go apps→ Caveat emptor! Might be old, untested or unsuitable
  36. 36. Where to go from here? Infrastructure management tools like Chef or Puppet for server provisioning Continuous integration hooks for automated deployment to staging servers
  37. 37. Talk deployed Questions? Damián Serrano Thode @dsthode MalagaMakers GeekBeers (20150115)

×