HOW TO SETUP YOUR OWN RUNBOT SEINLET Nicolas, TECHNICAL CONSULTANT
SUMMARY 1 2 3 4 Introduction Deploy a runbot Configure runbot Create own module 5 Conclusion
Introduction What, Why, When, Who?
What? o Runbot is a continuous integration server o Runbot is an Odoo module o Runbot is a communication tool between functional and technical guys o Live preview with 2 databases (base, all) o Provide build status to GitHub
Why? o Automate test phase o Let test instances leaving o Ease communication between technical and functional guys o Easy to use, even for non-technical guys o Do not replace a Q&A on customer side o Other CI softwares exists and may be already used by technical team o Designed for Odoo by Odoo o Integrated with Git and GitHub
Who? Any member, functional or technical, member of a company which : o Deploy Odoo o Deploy custom module o Deploy custom theme And also : o Developper who wants to test a new module o Reviewer to check the commit o Functional to check a use case o Anybody to test a new app
When? o Since the very beginning of the process o Before every merge o For every functional test o For a new feature test
Deploy a runbot In four steps
Deploy PostgreSQL Step 1 Step 2 Step 3 Step 4 As runbot is an Odoo module, we need PostgreSQL As we'll have many instances of odoo running on the server, we must adapt the PostgreSQL configuration, # of connections, total allocated memory, user authentification, fsync=false,
Deploy Odoo Step 1 Step 2 Step 3 Step 4 o Install python libraries o Install Odoo 8 from the github repo o Install runbot from the odoo-extra github repo o Install any runbot custom module o Don't forget the dbfilter parameter
Add ssh keys for authentification Step 1 Step 2 Step 3 Step 4 Your runbot will need read access to all your repositories, as well as read access to the odoo repository o Generate an ssh key for the linux user running runbot o Add this key to the github, bitbucket, user o Give read access for this user to your repositories
External tools Step 1 Step 2 Step 3 Step 4 o DNS : redirect *.runbot.mycompany.com o NGINX : runbot is running on port 8080 o Fake SMTP server (MailCatcher,...) o Any external software you link to (ftp, edi,...)
Scale up Runbot db Runbot server PostgreSQL Test DB xxx Test DB xxx Runbot server PostgreSQL Test DB xxx Test DB xxx
Configure runbot And how it works
How it's made Server Repositories Branches Builds Jobs Scheduler Update repositories Create missing branches Self assign builds Advance jobs (base, all, run) Update NGINX config
Global parameters o Parameters are shared by all instances o Timeout vs Max CPU time o Runbot domain vs FQDN
Add authentication As runbot is generaly behind a public IP, it's better to create groups and users o Use groups per team, project,... o Add users in groups o Manage default user profile It's possible to use other authentication methods (nginx,...)
Add your first repo : Odoo o The easiest one o Necessary for other repositories o Find missing libraries o Check Nginx o Check smtp o Check dns o Check ssh access to GitHub o Check PostgreSQL config o Check system load
Add your first repo : Odoo
Add your own repo : petstore
Use branch name matching o 1. Same branch name o 2. Common ancestors (git merge-base) o 3. Name splitting on '-' character
o Always on top o No build skipped o Last build not killed Use sticky branches
Link to GitHub o Set GitHub token to use GitHub API o Bi directional link
Create own module for runbot Customize to fit your needs
A first simple custo o Official Odoo repo needed as fallback o Official Odoo repo is already build by Odoo s.a. o Official Odoo repo can be used to test new features o Only build sticky branches
Add a field, Override update_git
Test base Test all Restore customer DB A second one: add a job o Add a field for the db to restore o Restore the database over the existing xxx-all o Upgrade all modules on this database
Add a field, restore the db, do -u all
A harder one: code coverage o http://pypi.python.org/pypi/coverage o Code coverage measurement for Python by Ned Batchelder o When using coverage.py, need to be in instance folder for the.coverage creation o Produce HTML report o Link to the report in the runbot page o Choose which repository needs coverage
Launch a process in a dir
Run coverage
Produce report
Link in the webpage
Result
Conclusion
Your own runbot o Deployable on your own infrastructure o Linked to your GitHub account o Access to your repos o Part of the dev process o Easy to use for everyone o A communication tool o A dev tool o A quick test tool o Customizable to fit your needs o Source code : https://bitbucket.org/nseinlet/xperience2015
Thank You Let's integrate