Your SlideShare is downloading. ×
0
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Snakes on a Treadmill
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Snakes on a Treadmill

1,349

Published on

Using Chef for Continuous Deployment with Django.

Using Chef for Continuous Deployment with Django.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,349
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • The ones in red need to be created with directory resources, the rest are created for you.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Snakes on a TreadmillNoah Kantrowitz 2011-07-06
    • 2. Chef• Configuration management• Deployment logic?• Best practices! (mostly• Not all Ruby code, I promise
    • 3. Deploy Resource• Pull from source• Atomic updates via symlinks• Fast rollback• We all do this already, right?
    • 4. Deploy Resourcedeploy_revision /srv/myapp do repo git@github.com/coderanger/myapp branch release user www-dataend
    • 5. Folder Layout• /srv/myapp • /srv/myapp/shared • /srv/myapp/shared/releases • /srv/myapp/shared/releases/4faedb2ee... • /srv/myapp/shared/releases/9457be295... • ... • /srv/myapp/current
    • 6. Folder Layout• /srv/myapp • /srv/myapp/shared • /srv/myapp/shared/releases • /srv/myapp/shared/releases/4faedb2ee... • /srv/myapp/shared/releases/9457be295... • ... • /srv/myapp/current
    • 7. Resets purge_before_symlink []• Rails-specific defaults create_dirs_before_symlink []• :-( symlinks({}) symlink_before_migrate({})
    • 8. Symlinks template /srv/myapp/shared/settings_local.py do source settings_local.py.erb vars ... end• Put config files in shared• ‘path/in/shared’ => ‘path/in/app’ deploy_revision /srv/myapp do ...• symlink vs. before_migrate symlink_before_migrate( settings_local.py=>conf/settings_local.py ) end
    • 9. Migrations deploy_revision /srv/myapp do ... migrate true• Run migrations automatically migration_command /srv/myapp/shared/env/bin/python • Only on “master” machine? end /srv/myapp/current/manage.py syncdb --migrate migrate node[:roles].include? migrator
    • 10. Packages• before_migrate deploy_revision /srv/myapp do• before_symlink ... before_migrate /srv/myapp/shared/env/bin/pip install -r • before_restart end /srv/myapp/current/requirements.txt• after_restart
    • 11. NIH { "id": "myapp", "server_roles": [ "myapp" ], "type": { "myapp": [ "django" ] },• application::django "repository": "git@github.com:coderanger/myapp.git", "revision": {• http://ckbk.it/application }, "production": "release"• Data-driven deployment "databases": { "production": {• PyChef! "username": "db_user", "adapter": "postgres", "database": "production" } }, "owner": "www-data", "group": "www-data", "packages": { "curl": "7.19.5-1ubuntu2" },
    • 12. Other Cookbooks• python • pip packages • python_virtualenv• application::gunicorn• postgres• nginx
    • 13. Want More?• http://wiki.opscode.com/• http://community.opscode.com/cookbooks/• http://help.opscode.com/kb/otherhelp/build-a-django-stack• https://github.com/ericholscher/chef-django-example• My DjangoCon talk (hopefully!)
    • 14. PyChef• pip install pychef import chef• Reads knife.rb or client.rb api = chef.autoconfigure()• chef.Object(‘id’) bag = chef.DataBag(applications)• chef.Object.list() item = bag[myapp]• obj.save() item[revision][production] = v1.1• obj.delete() item.save()
    • 15. Search• Search(‘index’, ‘query’)• row.object import chef api = chef.autoconfigure() for row in chef.Search(node, role:myapp): print row.object[fqdn]
    • 16. T-Shirts and stickers!
    • 17. Noah Kantrowitz noah@opscode.com @kantrn

    ×