Skip to content

Instantly share code, notes, and snippets.

@moylop260
Last active October 27, 2022 01:41
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save moylop260/c1d2fe1ccc9c009e6d8d to your computer and use it in GitHub Desktop.
Save moylop260/c1d2fe1ccc9c009e6d8d to your computer and use it in GitHub Desktop.

How to install runbot_travis2docker module from scratch

  1. Install docker
  2. Create OS "runbot" user.
  • useradd -d /home/runbot -m -s /bin/bash -p runbotpwd runbot && usermod -aG docker runbot
  • su - runbot
  1. Clone all repositories
# Run as runbot user:
mkdir -p ~/instance
git clone git@github.com:Vauxoo/runbot-addons.git -b 11.0 ~/instance/dependencies/runbot-addons
git clone git@github.com:Vauxoo/runbot.git -b 11.0-vauxoo ~/instance/dependencies/odoo-extra
git clone git@github.com:odoo/odoo.git -b 11.0 ~/instance/odoo
  1. Install dependencies apt and pip packages
# Run as root user:
apt-get install -y python-pip python-dev python-lxml \
    libsasl2-dev libldap2-dev libssl-dev \
    libjpeg-dev \
    python-matplotlib \
    nodejs npm node-less
ln -sf /usr/sbin/node /usr/bin/node
sed -i '/lxml/d' /home/runbot/instance/odoo/requirements.txt
pip install -r /home/runbot/instance/odoo/requirements.txt
pip install -U travis2docker simplejson
npm install -g less-plugin-clean-css

locale-gen fr_FR \
  && locale-gen en_US.UTF-8 \
  && dpkg-reconfigure locales \
  && update-locale LANG=en_US.UTF-8 \
  && update-locale LC_ALL=en_US.UTF-8 \
  && ln -s /usr/share/i18n/SUPPORTED /var/lib/locales/supported.d/all \
  && locale-gen \
  && echo 'LANG="en_US.UTF-8"' > /etc/default/locale
  1. Install and configure postgresql
# Run as root user:
apt-get install -y postgresql-9.3 postgresql-contrib-9.3 postgresql-common postgresql-server-dev-9.3
su - postgres -c "psql -c  \"CREATE ROLE runbot LOGIN PASSWORD 'runbotpwd' SUPERUSER INHERIT CREATEDB CREATEROLE;\""

# Run as runbot user:
createdb runbot
  1. Configure odoo and start it
# Run as runbot user:
echo -e "[options]\naddons_path=${HOME}/instance/dependencies/runbot-addons,\n    ${HOME}/instance/dependencies/odoo-extra,\n    ${HOME}/instance/odoo/addons,\n    ${HOME}/instance/odoo/openerp/addons\ndb_name = runbot\ndbfilter = runbot" | tee -a ~/.openerp_serverrc
# ~/instance/odoo/odoo.py -i runbot_travis2docker --test-enable  # If you want test it
~/instance/odoo/odoo.py -i runbot_travis2docker --without-demo=all
  1. Configure nginx, dns and host
  • Create follow site configuration /etc/nginx/sites-enabled/site-runbot.conf
upstream runbot {
    server 127.0.0.1:8080 weight=1 max_fails=3 fail_timeout=200m;
}

server {
    listen 80;
    server_name ~^(.*)\.runbot\.YOUR_DNS_HOST\.com$ runbot.YOUR_DNS_HOST.com;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        send_timeout 200m;
        proxy_read_timeout 200m;
        proxy_connect_timeout 200m;
        proxy_pass    http://runbot;
    }
}
  • Restart nginx server to load new site configuration /etc/init.d/nginx restart

  • Set the dns as hostname echo runbot.YOUR_DNS_HOST.com > /etc/hostname or apt-get install -y systemd-services && hostnamectl set-hostname runbot.YOUR_DNS_HOST.com

  1. Configure ssh keys
  • Github require /home/runbot/.ssh/id_rsa keys to clone private repositories more info here
  • Add to known hosts git servers ssh-keyscan github.com >> ${HOME}/.ssh/known_hosts && ssh-keyscan launchpad.net >> ${HOME}/.ssh/known_hosts && ssh-keyscan bitbucket.org >> ${HOME}/.ssh/known_hosts && ssh-keyscan gitlab.com >> ${HOME}/.ssh/known_hosts && ssh-keyscan git.vauxoo.com >> ${HOME}/.ssh/known_hosts
  1. Download the big image for runbot_travis2docker
  • Run docker pull vauxoo/odoo-80-image-shippable-auto to save time in runbot execution.
  1. Configure setting of runbot
  • Open in browser http://YOUR_DNS/web and go to menu:settings/runbot and set your values.

NOTE: For new version of docker configure task=infinity to fix systemctl error Running in 75818fbb42af rpc error: code = 2 desc = "containerd: container did not start before the specified timeout"

echo """
[Service]
TasksMax=infinity
""" > /etc/systemd/system/docker.service.d/docker.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment