OpenAT / odoo_v8.0

odoo Version 8.0
6 stars 8 forks source link

odoo_v8.0 Code Base

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.

WARNING

This structure is going to change very soon!

CONVENTIONS

Branches:

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.

Branch Names

Examples of Branch Names on github:

Branch Updates (Deployment) for the odoo codebase:

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).

Backup Filename Convention

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:

Convention for backup parts file names:

[instancename]-[progname]_[backuptype]-[YYYY]_[MM]_[DD]_[HHmm].[fileending] e.g.: o8_intdadi_dadi-odoo_db-2015_01_23_0154.zip

Convention for the final backup file name:

All backup parts must be moved into a final backup archive of the format:

If it is a cyclical backup e.g. weekly or daily the Date Part can be replaced like this:

GOALS

One Codebase (github repository) for all instances

Simple setup and maintenance through odoo-tools.sh

odoo-tools.sh is a simple setup script that is able to

HINT: db-tools.sh is used by odoo-tools.sh to backup and restore the database and data-dir of an instance.

SETUP

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!

1.) Be Root ;)

ssh yourname@yourserver
sudo su

2.) get odoo-tools.sh

wget -O - https://raw.githubusercontent.com/OpenAT/odoo_v8.0/master/TOOLS/odoo-tools.sh > odoo-tools.sh
chmod 755 odoo-tools.sh

3.) Prepare the Ubuntu Server

odoo-tools.sh prepare

Reboot the server!

4.) Setup the odoo_v8.0 codebase (=branch):

# 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.) Create a new Instance:

5.1) Create a new Github-Repository manually for the custom-addons-folder of the new instance:

5.2) Create the Default DNS-Entries for the new instance:

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

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

DEVELOPMENT

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

UPDATE OF AN INSTANCE (and its DBs)

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

Update of all Submodules of branch master

git checkout master
git pull
git submodule update --remote --rebase --recursive
git commit -am "[UPDATE] all submodules updated"
git push master

DOCUMENTATION

odoo v8

Configuration (res.config) related

Other odoo Tools and Docs

XMLRPC, ErpPeek, Connector ...

git, git workflow and github

Odoo Setup in Ubuntu 14.04 LTS

Python, PIP, VirtualEnv

BASH Scripting

Java Script