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.

Automation - fabric, django and more


Published on

Presentation about automation and slight look at Fabric and Django

Published in: Technology

Automation - fabric, django and more

  1. 1. Automation, Fabric and Django... ...or how to make our lives better
  2. 2. About meeng. Ilian Iliev● Web Developer for 8 years● Python/Django fan for 3 years● Ubuntu user for 2 years● Part of Cybert Arts Web Team●●●
  3. 3. Repetition"Repetition leads to boredom, boredom tohorrifying mistakes, horrifying mistakes to God-I-wish-I-was-still-bored" Will Larson
  4. 4. Automation● Daily tasks● Server setup● System update/maintenance tasks● New project creation● Deployment proceduresAll of the above on multiple stations all around the world cloud
  5. 5. Show me the Money or What we Gain Developers QAs Admins● easy deployment ● new build here and now ● less work● less mistakes ● automate smoke test ● move server setup in the● no more begging the process hands of the developers admins ● no more "make me a new build" requests ● focus only on specific problems
  6. 6. FabricFabric is a Python (2.5 or higher) library andcommand-line tool for streamlining the use ofSSH for application deployment or systemsadministration tasks.
  7. 7. Why Fabric● It is Python(Python is awesome)● It is simple● It is light● It is quick● It is useful
  8. 8. Simple Example ...from fabric.api import rundef host_type(): run(uname -s)#fab -H localhost, linuxbox host_type
  9. 9. ... and Advanced Onefrom fabric.api import sudodef add_user(user, make_sudoer = False): with settings(warn_only=True): result = sudo(useradd -m %s % (user)) if not result.failed: if make_sudoer: sudo(echo "%s ALL=(ALL) ALL" >> /etc/sudoers % user) password = generate_password() sudo(echo "%s:%s" | chpasswd % (user, password)) return password return False
  10. 10. PHP Web ApplicationsWeb Server PHP Files DB
  11. 11. Python Web ApplicationsWeb Server uWSGI Python App DB
  12. 12. The Tools● Ubuntu● Python● Fabric● Virtual environment● Django● Nginx● uWSGI● MySQL● GIT
  13. 13. Starting New Project1. Isolation - virtualenv2. Install required packages3. Custom settings - project template4. Database setup5. Nginx/uwsgi files creation
  14. 14. Your Box(in the Cloud)● VPS● OS Image● SSH
  15. 15. From pure box to working server1. Install required packages2. Setup database server3. Deploy application4. Run application5. Go to celebrate
  16. 16. Demofab -H <host> -f <fabfile location> startproject:<project_name>fab -H <host> -f <fabfile location> setup_serverfab -H <host> -f <fabfile location> deploy_project:<project_name>,<repo_url>
  17. 17. Links & CopyrightsFabric: scripts used during presentation: copyrights belongs to:●●●