Skip to content

Instantly share code, notes, and snippets.

@yelizariev
Last active June 16, 2019 07:50
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yelizariev/5f397c671289aec1d6b5 to your computer and use it in GitHub Desktop.
Save yelizariev/5f397c671289aec1d6b5 to your computer and use it in GitHub Desktop.
Odoo Runbot. Obsolete. Use this repo instead: https://github.com/it-projects-llc/odoo-runbot-docker
### instruction to run via docker
# install docker ( https://docs.docker.com/engine/installation/ubuntulinux/ )
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list # ubuntu 14.04
apt-get update
apt-get purge lxc-docker
apt-cache policy docker-engine
apt-get install linux-image-extra-$(uname -r) # ubuntu 14.04
apt-get install docker-engine
# install nginx on your host server
apt-get install nginx
# and add to configs from runbot.conf and odoo_params.conf file
cd /some/path/
git clone https://github.com/yelizariev/runbot-addons.git # 8.0 branch
git clone https://github.com/odoo/odoo-extra.git # master branch
# we use 9.5 due to postgres bug: https://github.com/odoo/odoo/issues/8585
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db-9.5 postgres:9.5
# put openerp-server.conf file to /path/to/config/
# * change admin_password if you on production
# replace /path/to/ to your paths
docker run \
-v /path/to/odoo-extra/runbot:/mnt/extra-addons/runbot \
-v /path/to/runbot-addons:/mnt/runbot-addons \
-v /path/to/config/:/etc/odoo \
-h runbot.local \
-p 18069:8069 \
-p 8080:8080 \
--name odoo-runbot --link db-9.5:db \
-t odoo:8
# if you need to change something in docker run configuration, you have stop container and then remove it:
# docker rm odoo-runbot
# attach to container and follow instructions from configure-runbot.sh
docker exec -i --user=root -t odoo-runbot /bin/bash
# to stop/start odoo use commands:
docker stop db-9.5
docker start db-9.5
docker stop odoo-runbot
docker start -a odoo-runbot
# create database "runbot" at http://localhost:18069/web/database/manager
# follow insturctions from runbot-database.md
# to work with database connect to db docker and run psql:
# docker exec -i -t db /bin/bash
# psql template1 odoo
# TODO. After restarting docker, you need to trigger hook:
# runbot.example.com:18069/runbot/hook/1
# it's required to reload nginx
apt-get update
apt-get install -y python-matplotlib emacs-nox git net-tools tree python-pip file nginx python-dev sudo htop locales locales-all postfix wget fonts-dejavu
# (for postfix use "Internet site" setting)
# TODO run postfix via linked docker (e.g. https://github.com/ccnmtl/postfix-docker)
# For a while you need to start postfix manually after each docker start
/etc/init.d/postfix start
pip install gevent psycogreen
#update werkzeug to make phantomjs work. See http://odoo-development.readthedocs.io/en/latest/dev/tests/js.html#regular-phantom-js-tests
pip install werkzeug --upgrade
# fix access issue with nginx
service nginx reload
service nginx start
service nginx stop
chown odoo:odoo -R /var/log/nginx
# grant access to work dir
chown odoo:odoo -R /mnt/extra-addons/runbot/static/
# install phantomjs, e.g.
# https://gist.github.com/julionc/7476620
wget https://gist.github.com/julionc/7476620/raw/e8f36f2a2d616720983e8556b49ec21780c96f0c/install_phantomjs.sh
# check script before running.
sed -i 's/phantomjs-1.9.8/phantomjs-2.1.1/' install_phantomjs.sh
less install_phantomjs.sh
sh install_phantomjs.sh
#
# /etc/init
description "docker db"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
/usr/bin/docker start -a db
end script
# /lib/systemd/system
[Unit]
Description=DB container
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a db
ExecStop=/usr/bin/docker stop -t 2 db
[Install]
WantedBy=local.target
# /etc/init
description "docker runbot"
start on filesystem and started docker-db
stop on runlevel [!2345]
respawn
script
/usr/bin/docker start -a odoo-runbot
end script
# /lib/systemd/system
[Unit]
Description=Runbot container
Requires=docker.service docker-db.service
After=docker-db.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a odoo-runbot
ExecStop=/usr/bin/docker stop -t 2 odoo-runbot
[Install]
WantedBy=local.target
# put this to /etc/nginx/odoo_params.conf
charset utf-8;
location = /favicon.ico {
return 404;
}
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#proxy_redirect http:// https://;
proxy_read_timeout 600s;
client_max_body_size 100m;
[options]
addons_path = /mnt/extra-addons,/usr/lib/python2.7/dist-packages/openerp/addons,/mnt/runbot-addons
data_dir = /var/lib/odoo
; auto_reload = True
admin_passwd = admin
; csv_internal_sep = ,
; db_maxconn = 64
; db_name = runbot
; db_template = template1
dbfilter = ^runbot$
; debug_mode = False
; email_from = False
; limit_memory_hard = 2684354560
; limit_memory_soft = 2147483648
; limit_request = 8192
; limit_time_cpu = 60
; limit_time_real = 120
; list_db = True
; log_db = False
; log_handler = [':INFO']
; log_level = info
; logfile = None
; longpolling_port = 8072
; max_cron_threads = 2
; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False
; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False
; workers = 0
; xmlrpc = True
; xmlrpc_interface =
; xmlrpc_port = 8069
; xmlrpcs = True
; xmlrpcs_interface =
; xmlrpcs_port = 8071
  • install runbot_custom

For each repository create runbot.repo record:

  • Repository -- https link, e.g. https://github.com/yelizariev/addons-dev.git
  • Mode -- Hook (for odoo repo - Disabled)
  • Nginx -- Yes (for odoo repo - No)
  • Github token -- (see github.md)
  • Extra dependencies -- Odoo and other repos
  • Install updated modules -Yes (for odoo repo - No)
  • Other modules to install automatically - None
  • save record

For private repository:

  • Repository -- use ssh link, e.g. git@github.com:yelizariev/addons-yelizariev.git

  • Configure ssh keys

    • connect to docker as odoo:

    docker exec -i --user=odoo -t odoo-runbot-9.5 /bin/bash

# nginx config (/etc/nginx/sites-enabled/)
server {
listen 80;
server_name .runbot.local;
include odoo_params.conf;
location / {
proxy_pass http://localhost:8080;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment