The project allows to deploy your own runbot for your odoo repositories.
First of all you need to install docker engine: https://docs.docker.com/engine/installation/ubuntulinux/
Simplified instruction can be found here: https://github.com/it-projects-llc/install-odoo
Install nginx on your host server
apt-get install nginx
Then add configs for nginx:
-
- update
server_name
if needed
- update
Restart nginx.
docker run -e MAILNAME=runbot.local --name postfix -d itprojectsllc/postfix-docker
Run (create) postgres docker (we use 9.5 due to postgres bug )
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db-9.5 postgres:9.5
Run (create) runbot container (change runbot.local
to your host)
docker run \
-h runbot.local \
-p 18069:8069 \
-p 8080:8080 \
-v /SOME/PATH/var-lib-odoo:/var/lib/odoo \
-v /SOME/PATH/odoo-extra:/mnt/odoo-extra \
--link db-9.5:db \
--link postfix:postfix \
--name odoo-runbot \
-t itprojectsllc/odoo-runbot-docker
Note. If you need to change something in docker run configuration (e.g. fix host name), you have stop container and then remove it:
docker rm odoo-runbot
ODOO_MASTER_PASS=`< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-12};echo;`
docker exec -i -u root -t odoo-runbot sed -i "s/; admin_passwd = admin/admin_passwd = $ODOO_MASTER_PASS/" /etc/odoo/openerp-server.conf
docker restart odoo-runbot
echo "password: $ODOO_MASTER_PASS"
Create personal access token https://github.com/settings/tokens
For each repository create Webhook:
- link: http://runbot.local:18069/runbot/hook/misc-addons where misc-addons is a nickname of your runbot.repo record.
- Content Type: application/x-www-form-urlencoded
- Which events would you like to trigger this webhook?: Send me everything.
Create database with a name runbot
via the link:
http://runbot.local:18069/web/database/manager
Then install module runbot_custom
.
Now, For each repository create runbot.repo record:
- Repository: https link, e.g. https://github.com/it-projects-llc/misc-addons.git
- Mode:
Hook
(for odoo repo -Disabled
) - Nginx:
Yes
(for odoo repo -No
) - Github token: access token
- Extra dependencies: Odoo and other repos
- Other modules to install automatically:
Repository modules (excluding dependencies)
(for odoo repo -None
) - Nickname -- string to be used in urls
Notes for private repository:
-
Repository: use ssh link, e.g.
[email protected]:it-projects-llc/misc-addons.git
-
Configure ssh keys
-
connect to docker as odoo:
docker exec -i --user=odoo -t odoo-runbot /bin/bash
-
generate key
ssh-keygen -t rsa -b 4096 -C "runbot deployment key for private repo"
-
add deployments keys to repo https://developer.github.com/guides/managing-deploy-keys/
-
try clone manually once
cd /tmp/
git clone [email protected]:it-projects-llc/misc-addons.git
-
Pylint support:
- create a repo with config file pylint, e.g. https://github.com/it-projects-llc/pylint-conf/blob/master/pylint-conf/pylint.cfg
- create runbot.repo record for it
- on your repo, where you want to use pylint checks:
- add the repo with pylint config to dependencies
- set checkbox Check pylint
- specify path in Pylint conf path, e.g. pylint-conf/pylint.cfg
- set Pylint extra parameters to --load-plugins=pylint_odoo -f parseable
See below
For any manipulation inside odoo-runbot container you need to connect to it:
docker exec -i --user=root -t odoo-runbot /bin/bash
docker stop odoo-runbot && docker stop db-9.5 && docker start db-9.5 && docker start -a odoo-runbot
Connect to runbot container and install requiremnts, e.g.
wget -q -O- https://raw.githubusercontent.com/it-projects-llc/odoo-saas-tools/8.0/requirements.txt | pip install
docker exec -i --user=root -t odoo-runbot git -C /mnt/runbot-addons/ pull