Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Danny Adair: The Full Monty - CI on OpenStack

Danny Adair: The Full Monty - CI on OpenStack

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Danny Adair:
The Full Monty - CI on OpenStack
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
@ Kiwi PyCon 2014 - Saturday, 13 Sep 2014 - Track 1
http://kiwi.pycon.org/

**Audience level**

Intermediate

**Description**

Are you continuously "integrating", or just running some unit tests inside a virtualenv?

Let's go the Full Monty with OpenStack!

Protagonists, in order of appearance: Gerrit, Jenkins, OpenStack, Puppet, Odoo (formerly OpenERP). Enjoy the ride!

**Abstract**

I'll show how we configured our CI tools to automatically build and destroy entire servers on OpenStack. We'll have Gerrit for code review, Jenkins for coordinating and monitoring the build process, OpenStack and its tools to build servers on their own subnet, Puppet for configuring said servers. The example project is an installation of Odoo (formely OpenERP) with a web server and PostgreSQL database.

At Catalyst, my team works with Odoo (formerly known as OpenERP), a modular Open Source suite of business applications. It has a very large and complex codebase and "Regression" is its middle name. It is under very active development on github, and customisations are generally brought in via plugins that override or extend default functionality. Basically, reasonable work on this requires continuous integration, it's not a luxury.

We could have a fat build server with multiple virtualenvs and multiple databases on the same PostgreSQL server, and just run some Python tests and be done with it. We could improve that with something like LXC, Vagrant etc. all happening on said build server. But why stop there - why not go all the way and create a more realistic setup? After all, another team is able to provide us with OpenStack. Let's go the Full Monty!

Let's go hog wild and create and destroy entire servers just for the purpose of testing. Let's have separate application and database servers, just like in production.

Let's also keep some servers alive for other purposes, e.g., user acceptance testing. Just sit in an IRC channel and after changes are committed for review, wait for a bot to post the URL of the newly built web server to click on. A nicely readable URL on a separate subdomain that is, of course!

As a bonus, I'll show how active upstream development on github fits into all this, and how your Ubuntu "Precise Pangolin" server can easily rehearse an upgrade to "Trusty Tahr".

**YouTube**

https://www.youtube.com/watch?v=265Sqo7cgbM

New Zealand Python User Group

September 13, 2014
Tweet

More Decks by New Zealand Python User Group

Other Decks in Programming

Transcript

  1. Presented by Danny W. Adair // Kiwi PyCon // 13

    Sep 2014 The Full Monty - CI on OpenStack
  2. Danny W. Adair • Python daily since 1999 • In

    New Zealand since 2001 (from Germany) • President of NZPUG • Manages “Python Community” on LinkedIn • Software Engineer at Catalyst IT • Building Odoo capability
  3. Talk Outline • Odoo is an Open Source ERP •

    It's big and scary and under active development • We need to customise it • Continuous Integration – Our setup • OpenStack cloud • Development workflow • Gotchas • Improvements • Questions
  4. Enterprise Resource Planning • Product planning, cost and development •

    Manufacturing or service delivery • Project Management • Human Resources • Marketing and Sales • Inventory Management • Shipping and Payment • Accounting Software for managing a business, usually a suite of integrated applications:
  5. Enterprise Resource Planning • Product planning, cost and development •

    Manufacturing or service delivery • Project Management • Human Resources • Marketing and Sales • Inventory Management • Shipping and Payment • Accounting Software for managing a business, usually a suite of integrated applications: “No size fits all”
  6. Open Source Business Models • Service & Expertise • Configuration

    • Customisation • Development • Hosting • Support / Maintenance • Not locked in to vendor (?)
  7. Odoo Statistics (Aug 2014) • 2,015,172 code lines in 260

    core modules (+ 312,116 comment lines, +284,157 blank lines) • 45.2% XML (1.18M lines) • 26.0% Python (0.68M lines) • 23.1% JavaScript (0.60M lines) • 4.0% CSS (0.10M lines) • ca. 200 commits / week
  8. Odoo Statistics (Aug 2014) • 2,015,172 code lines in 260

    core modules (+ 312,116 comment lines, +284,157 blank lines) • 45.2% XML (1.18M lines) • 26.0% Python (0.68M lines) • 23.1% JavaScript (0.60M lines) • 4.0% CSS (0.10M lines) • ca. 200 commits / week
  9. Continuous – Integration - Testing • Continuous Integration Merge dev

    copies into mainline several times a day • Integration Testing Combine modules and test as a group • Cloud provides servers quickly and easily, paid per hour • Perfect match to go the Full Monty
  10. Things we could do... Web & Application Server Database Server

    (Continuous...) • Regression Testing • Performance Testing • Load Testing • Scalability Testing
  11. Code Review: Gerrit and Jenkins Gerrit Jenkins +1 Verified +1

    Code Review master push merge “I don't want to review broken code”
  12. Code Review: Gerrit and Jenkins For your change to be

    merged into the main line: • Jenkins needs to say “yes” • Your peer needs to say “yes”
  13. Gotcha: Networking • Subnet just for CI servers • Access

    through VPN (one “floating IP”) • Routing (e.g. external VPN connections) • DNS (nice FQDNs for the transient servers) • We're building more than one server at a time!
  14. Build me a server 4. Get build instructions from repo

    3. SSH session (fabric) 2. Cloud init 1. Base image
  15. Build me a server 5. Run puppet configuration 4. Get

    build instructions from repo 3. SSH session (fabric) 2. Cloud init 1. Base image
  16. Build me a server 6. “Run my script” 5. Run

    puppet configuration 4. Get build instructions from repo 3. SSH session (fabric) 2. Cloud init 1. Base image
  17. Gotcha: Wait your turn • Wait for asynchronous tasks to

    finish • sshd ready (successful connection) • puppet ready (cert from puppet master)
  18. gerrit odoo odoo-build foobar odoo-ci foobar odoo.gerrit odoo-build.gerrit foobar.gerrit odooci-stack-suffix-app1

    odooci-stack-suffix-db1 odoo-build odoo-build odoo foobar foobar odoo odoo.github odoo
  19. Improvements 6. “Run my script” 5. Run puppet configuration 4.

    Get build instructions from repo 3. SSH session (fabric) 2. Cloud init 1. Base image