This repository is used as a codebase for odoo v8.0 instances and the related setup tools (odoo-tools.sh). The master branch of this repo is always a deploy-able production ready branch.
This structure is going to change very soon!
The default latest stable branch is called master. The other branches in the github repository are either production branches starting with "int" or "ext" (intdadi, intdadirle, exthof) or development and bugfix branches (setuptools, fix1234, dev_wsd_templates) that will be merged back into the master branch.
- dev[description] or freename e.g.: devsetuptools = Development branches that will be merged into master (deleted after merge)
- fix[Issue Number] e.g.: fix1234 = Bug Fixes related to Github Issues (deleted after merge)
- int[rolloutlevel] e.g.: intdemo = Production Branches hosted on our servers (our servers - also our hosted ones e.g.: at abaton)
- ext[customer id] e.g.: exthofe = Production Branches hosted on customer servers (no control/payment for this servers from our side)
- master (default stable branch)
- intdadi
- intdadirl1
- intdevel
- exthofe
- fix1234 (deleted after merge)
- setuptools (deleted after merge)
- dev_website_sale_donate_newtemplating (deleted after merge)
The flow of fast-forward-branch-updates is always: master -> intdadi -> intdadirl1 - intdadirl2 Ext branches are normally not included in the update cycle. Therefore and to make FF possible merges or commits are never done directly in any "int" or "ext" branches Where int marks a server we pay (our own server) for and ext marks a server the custommer pays for (custommer server).
odoo-tools.sh backup
can create backups of odoo, etherpad and owncloud. If you are creating backups always include
the configuration files of the programm as a partial backup also and finally move all partial backups in a single zip or tgz archive.
Odoo backup example:
- Step 1: Odoo Database Backup o8_intdadi_dadi-odoo_db-2015_01_23_0154.zip
- Step 2: Odoo Config File Backup o8_intdadi_dadi-odoo_conf-2015_01_0156.tgz
- Step 3: Move both archives into the final backup archive o8_intdadi_dadi-odoo-2015_01_23_0156.zip
[instancename]-[progname]_[backuptype]-[YYYY]_[MM]_[DD]_[HHmm].[fileending]
e.g.: o8_intdadi_dadi-odoo_db-2015_01_23_0154.zip
- progname should be in [odoo|pad|cloud]
- backuptype must be in [db|conf|file]
- db = backup of a database (sql dump)
- conf = config files
- file = the rest ;) - file based backups
All backup parts must be moved into a final backup archive of the format:
[instancename]-[progname]-[YYYY]_[MM]_[DD]_[HHmm].[fileending]
- e.g.: o8_intdadi_dadi-odoo-2015_01_23_0154.tgz
If it is a cyclical backup e.g. weekly or daily the Date Part can be replaced like this:
[instancename]-[progname]-[YYYY]_week_[weeknumber].[fileending]
- e.g.: o8_intdadi_dadi-odoo-week_32.tgz
[instancename]-[progname]-[YYYY]_day_[monday].[fileending]
- e.g.: o8_intdadi_dadi-odoo-day_monday.tgz
- The branch determines the release (master=latest -> intdadi -> intdadirl1)
- All third party addons as well as odoo itself are linked as submodules and therefore tied with a specific commit
odoo-tools.sh is a simple setup script that is able to
- prepare an ubuntu 14.04 LTS server to run odoo v8 (libs, tools, settings)
- setup/download the odoo code base for odoo v8 from github
- newdb create a new odoo instance:
- linux user
- database creation
- postgres user
- server.conf und server.init
- etherpad
- owncloud
- nginx setup (match urls to instance via vhosts) and setup default URLs e.g.: ahch.datadialog.net, aswidget.ahch.datadialog.net, cloud.ahch.datadialog.net, pad.ahch.datadialog.net
- backup and logrotate cron jobs
- create and link custom-addons githup repository into the instance addons folder
- Install push-to-deploy workflow for updating the custom addons folder
- duplicatedb duplicate an instance (TODO!)
- update one or all instances to the latest master branch (TODO!)
- clone the server (VMWare)
- create new snapshot on the clone
- backup instances on the clone
- Try the update(s) on the clone (one by one) and if it all worked:
- Do the Updates on the production machine
- maintenancemode set one or all instances into maintenance mode (not reachable from the outside)
- backup one or all instances
- restore one or all instances (TODO!)
- ToDo: deploy addon(s) to one or more databases on the local server
HINT: db-tools.sh is used by odoo-tools.sh to backup and restore the database and data-dir of an instance.
This setup process will only work on a fresh install of Ubuntu 14.04 LTS. Make sure timezone is correct and the server has internet access!
ssh yourname@yourserver
sudo su
wget -O - https://raw.githubusercontent.com/OpenAT/odoo_v8.0/master/TOOLS/odoo-tools.sh > odoo-tools.sh
chmod 755 odoo-tools.sh
odoo-tools.sh prepare
Reboot the server!
# USAGE: odoo-tools.sh setup {TARGET_BRANCH}
odoo-tools.sh setup intdadi
This will create a new folder in /opt/odoo_v8.0 called intdadi.
HINT: You can run multiple branches on the same server! All the branches will use and increment the same counter-file for the Database-Port therefore no port collisions can happen between Instances of different branches! A maximum of 99 Instances are possible for all installed branches!
5.1) Create a new Github-Repository manually for the custom-addons-folder of the new instance:
- Create a new Github-Repository hosting the custom-addons of the instance:
- Where: https://github.com/OpenAT/
- Name: cu_{DATABASE_NAME} e.g.: cu_dadi (DATABASE_NAME should be the customer number e.g.: ahch or dadi)
- Create a webhook in the repository settings (https://github.com/OpenAT/cu_ahch/settings/hooks)
- Payload Url: e.g.: ahch.datadialog.net/cu_ahch
- Content Type: application/x-www-from-urlencoded
5.2) Create the Default DNS-Entries for the new instance:
- dadi.datadialog.net, *.dadi.datadialog.net
5.3) Install the new Instance:
# usage: odoo-tools.sh newdb {TARGET_BRANCH} {SUPER_PASSWORD} {DATABASE_NAME} {DOMAIN_NAME} [CUADDONSREPONAME]
odoo-tools.sh newdb intdadi admin dadi www.datadialog.net
- Test/open the new instance
- Install addon base_config
5.4) Save the installation summary in keepass!!!
5.5) Add the instance to the monitoring service
5.6) Ask the customer to set the correct DNS entries: www.datadialog.net, aswidget.www.datadialog.net, pad.www.datadialog.net, cloud.www.datadialog.net
To develop with this repo use this workflow:
# 1.) Clone the repo odoo_v8 branch master locally:
git clone -b master --recurse-submodules https://github.com/OpenAT/odoo_v8.0.git ${instance_dir}
# Check if the upstream (remote) is set correctly for the master branch
git branch -vv
git --set-upstream-to=https://github.com/OpenAT/odoo_v8.0.git master # creates remotes and origin
# 2.) Create and checkout a new branch:
git branch dev-ckeditor_advanced
git checkout dev-ckeditor_advanced
# 3.) Push your Branch to Github (so everybody knows what you are working on)
git commit
git push origin dev-ckeditor_advanced
# 4.) Do stuff and commit and push changes until ready:
git add [file or folders] # This tells git what to include in next commit
git commit -m "[ADD] Added README.md"
git push origin dev-ckeditor_advanced
# 5.) When ready with development
# - create pull request on github (at webpage) if wanted to discuss / review changes
# - Update master branch to latest
# - rebase dev-ckeditor_advanced on master
# - rebase dev-ckeditor_advanced submodules on master
# - merge dev-ckeditor_advanced in master with rebase
git fetch
git checkout master # NOW IN BRANCH master
git pull
git checkout dev-ckeditor_advanced # NOW IN BRANCH dev-ckeditor_advanced
git rebase master
git submodule update
git checkout master # NOW IN BRANCH master
git merge dev-ckeditor_advanced
git push origin master
Adding new Submodules to the repo:
# This is an example how to add a submodule:
git submodule add -b master https://github.com/ether/etherpad-lite.git etherpad-lite
# Ubdate all submodules
git submodule update --rebase --remote --recursive
This is for now only a placeholder but will describe the update process of a customer instance.
# Update Master
git checkout master
git pull
git submodule update
# Update Branch (Code Repo for a server in this case)
git checkout intdadi
git rebase master
git submodule update
git push origin intdadi
git checkout master
git pull
git submodule update --remote --rebase --recursive
git commit -am "[UPDATE] all submodules updated"
git push master
- Latest Dev Docu
- odoo v8 api guidelines
- Technical Memento
- eval many2many write
- WebApps Tutorial HBEE
- Forum how to's
- https://www.odoo.com/forum/help-1/question/how-can-i-save-load-my-own-configuration-settings-30123
- https://www.odoo.com/forum/help-1/question/how-can-i-create-own-config-for-my-custom-module-41981
- https://www.odoo.com/forum/help-1/question/is-it-possible-to-set-database-default-configuration-values-507
- https://doc.odoo.com/6.0/developer/5_16_data_serialization/xml_serialization/
- http://stackoverflow.com/questions/9377402/insert-into-many-to-many-openerp/9387447#9387447
- carddav for odoo
- http://odoohub.wordpress.com/2014/08/15/where-is-the-odoo-documentation/
- http://djpatelblog.blogspot.in/2014/09/odoo-new-api-recordsets.html
- server.conf db_filter= parameter