In this tutorial I will learn you how to setup an Odoo.sh account, how to configure Odoo.sh and how to tests your code automatically with Odoo.sh.
In this example I will create a new account, create a new repository and add code to the Github repository in order to explain how Odoo.sh works.
1. Creating an Odoo.sh account
Go to odoo.sh and click on the “Sign in” button at the top:
When you click on the “Sign in button” you’ll get an authorize screen from Github. If you’re not yet logged in on Github it will ask you to login, if you’re already logged in on Github you’ll get the authorize screen. Click on “Authorize odoo”:
After you click on “Authorize odoo” Github will ask for additional permissions. Click on “Authorize Odoo” again to give the additional permissions. Because of these additional permissions Odoo.sh can follow all changes and handle it automatically for you.
Now Odoo will ask you to deploy your platform. Choose an existing repository if you want to use it or create a new one. In this tutorial I will create a new repository to show everything in detail. Choose a repository name. Next choose the Odoo version you want to test against and finally provide your enterprise (or partner) license. The hosting location is up to you. Finally click on “Deploy”:
Thats it! You’ve just registered your own Odoosh account and connected Github to Odoosh!
2. The Odoo.sh main screen
After you’ve clicked on “Deploy” you’ll now see the main screen of Odoo.sh.
In the left menu you will see the title “DEVELOPMENT”. Under this section you will see every branch you’ve made on this Github repository. If I would create a second branch named “11.0” I would see “11.0” and “master” in the left menu. At the top you’ll see a main menubar with the options “Branches”, “Builds”, “Status” and “Settings.
- The Branches tab opens the main page, from where you can see everything related to your branches. This includes the mails, shell access to the test instance and access to the logs.
- The Builds tab opens a page where you can see all your test instances. This is almost identical to the Odoo runbot (at runbot.odoo.com).
- The Status tab opens a page where you can see all the statistics of the Odoo.sh platform. It shows you the uptime and the status of all the servers.
- The Settings tab opens a page where you can configure advanced settings. You can add collaborators, set a project name (and URL), add submodules and much more.
Now open up your Github and go to your (just created) repository. Add a commit to the repository so that it contains some (new) code. In my example I will push a module to Github that contains an automated test so I can show you how tests work and what happens. If you’d like to do the same you can take my example module from Github. The moment that you make a commit to the Github repository Odoo.sh will detect this and it will start up a test environment because of the new commit. My Github after making a commit:
My Odoo.sh a few seconds after making this commit:
4. Checking the commit
Now switch back to Odoo.sh. After a few minutes your new commit will procude a new test instance that is ready and built. In my example I’ve deliberately added an error in my last commit so as a result you can see the test fail. When the test instance is done, typically after a few minutes, you’ll see the result in the main screen:
So now my test has failed it means I must have done something wrong. I’ve figured out what was wrong and I correct my test. After correcting this test I make a new commit to Github. After a few seconds you’ll see that Odoo.sh automatically detects and tests this new commit again:
5. Odoo.sh builds and test instances
Finally go to the builds page by clicking on “Builds” in the top menu bar. After you click on “Builds” you will see an overview of all your test instances and if they succeeded or not:
From this page you can directly connect to a test instance in order to test functionalities or ‘play’ with Odoo.
When a test has failed (such as “INIT: Add demo module wit…” in my screenshot) you can click on the exclamation icon, next to the connect button, to see why your instance has failed:
Tip: If you want to see the full log of the instance you can do this by clicking on the “…” icon at the top of a build and selecting “Logs”. From here you can download and view all logs. Alternatively you can also do this from the “Branches” page by clicking on the “Logs” menu.
As Odoo.sh is very big and has a lot of options I’ve decided to split the content in two tutorials. Because of this the first blog post, this one, is only about basic operations. You can find a second tutorial about how to configure public and private submodules here.
Odoo.sh is a very powerfull platform to use. Odoo has invested a lot of time into Odoo.sh and due to this it is an advanced system that allows you to quickly (and easily!) use test instances with Odoo. Thanks to Odoo.sh you no longer need your own runbot instance and complex hardware setup as you can get it all out of the box.