Giter VIP home page Giter VIP logo

docker-runbot's Introduction

License: Apache 2.0 Build Status

Docker Runbot

This image provides a fully Dockerized Runbot environment.

Usage

Deploy

The easiest way to deploy this image is by using Docker Compose.

A simple compose file would look something like the below. This is a great one for testing Runbot locally:

version: '2'

volumes:
  odoo-db-data:
    driver: local
  odoo-web-data:
    driver: local

services:

  web:
    image: laslabs/runbot:latest
    restart: unless-stopped
    links:
      - postgresql:db
    volumes:
      - odoo-web-data:/var/lib/odoo
      - /var/run/docker.sock:/var/run/docker.sock
    tty: true
    privileged: true
    ports:
      - 10080:8069
      - 1800-2000:1800-2000

    environment:
      PGPASSWORD: 'odoo'
      PGUSER: 'odoo'
      ADMIN_PASSWORD: 'admin'

  postgresql:
    image: postgres:9.6-alpine
    restart: unless-stopped
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_PASSWORD: 'odoo'
      POSTGRES_USER: 'odoo'
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata

In the above example, Runbot is being exposed on port 10080 with no load balancer. The default Runbot port ranges are also exposed (1800-2000).

The following compose file can be used in order to launch Runbot behind a load balancer with a host rule for localhost. You will need to change it to a proper DNS name if not testing locally:

version: '2'

volumes:
  odoo-db-data:
    driver: local
  odoo-web-data:
    driver: local

services:

  web:
    image: laslabs/runbot:latest
    restart: unless-stopped
    links:
      - postgresql:db
    volumes:
      - odoo-web-data:/var/lib/odoo
      - /var/run/docker.sock:/var/run/docker.sock
    tty: true
    privileged: true
    environment:
      PGPASSWORD: odoo
      PGUSER: odoo
      ADMIN_PASSWORD: admin
    labels:
      traefik.enable: 'true'
      traefik.port: '8069'
      traefik.frontend.rule: 'Host: localhost;'

  postgresql:
    image: postgres:9.6-alpine
    restart: unless-stopped
    environment:
      PGDATA: '/var/lib/postgresql/data/pgdata'
      POSTGRES_PASSWORD: 'odoo'
      POSTGRES_USER: 'odoo'
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata

  traefik:
    image: laslabs/runbot-traefik:latest
    stdin_open: true
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    tty: true
    ports:
    - 80:80
    - 8080:8080
    command:
    - --web

In the above example, the load balancer is exposing Runbot and all of its builds on port 80. Port 8080 is the Traefik Web UI, which can be helpful for diagnosing issues.

The following is what a production deploy would look like. Make sure to adjust the traefik.frontend.rule for your environment, as well as change all passwords:

version: '2'
volumes:
  odoo-web-data:
    driver: rancher-nfs
  odoo-db-data:
    driver: rancher-nfs
  runbot-builds:
    driver: rancher-nfs
  runbot-ssh:
    driver: rancher-nfs
services:
  install:
    image: laslabs/runbot:latest
    command: 'install-addons'
    links:
    - postgresql:db
    volumes:
    - odoo-web-data:/var/lib/odoo
    - /var/run/docker.sock:/var/run/docker.sock
    - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
    - runbot-ssh:/home/odoo/.ssh
    tty: true
    environment:
      PGPASSWORD: odoo
      PGUSER: odoo
      WITHOUT_DEMO: all
  cron:
    privileged: true
    image: laslabs/runbot:latest
    environment:
      PGPASSWORD: odoo
      PGUSER: odoo
      WAIT_NOHOST: install
    volumes:
    - odoo-web-data:/var/lib/odoo
    - /var/run/docker.sock:/var/run/docker.sock
    - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
    - runbot-ssh:/home/odoo/.ssh
    tty: true
    links:
    - postgresql:db
    command:
    - /usr/local/bin/odoo
    - --max-cron-threads=1
    - --workers=1
    - --limit-time-real=600
    - --limit-time-cpu=300
  postgresql:
    image: postgres:9.6-alpine
    hostname: db
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_PASSWORD: odoo
      POSTGRES_USER: odoo
    volumes:
    - odoo-db-data:/var/lib/postgresql/data/pgdata
  web:
    image: laslabs/runbot:latest
    environment:
      ADMIN_PASSWORD: admin
      PGPASSWORD: odoo
      PGUSER: odoo
      PROXY_MODE: 'true'
      WAIT_NOHOST: install
    volumes:
    - odoo-web-data:/var/lib/odoo
    - /var/run/docker.sock:/var/run/docker.sock
    - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
    tty: true
    links:
    - postgresql:db
    ports:
    - 8069
    command:
    - /usr/local/bin/odoo
    - --max-cron-threads=0
    - --workers=4
    - --no-database-list
    - --db-filter=prod
    labels:
      traefik.enable: 'true'
      traefik.port: '8069'
      traefik.frontend.rule: 'Host: runbot.example.com;'
      traefik.frontend.passHostHeader: 'true'
  traefik:
    image: laslabs/runbot-traefik:latest
    stdin_open: true
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    tty: true
    ports:
    - 80:80
    - 8080:8080
    command:
    - --web
  longpolling:
    image: laslabs/runbot:latest
    environment:
      PGPASSWORD: odoo
      PGUSER: odoo
      PROXY_MODE: 'true'
      WAIT_NOHOST: install
    volumes:
    - odoo-web-data:/var/lib/odoo
    - /var/run/docker.sock:/var/run/docker.sock
    - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
    tty: true
    links:
    - postgresql:db
    ports:
    - 8072
    command:
    - /usr/local/bin/odoo
    - --max-cron-threads=0
    - --workers=2
    labels:
      traefik.enable: 'true'
      traefik.port: '8072'
      traefik.frontend.rule: 'Host: localhost;PathPrefix:/longpolling'
      traefik.frontend.passHostHeader: 'true'

The above compose is very similar to the production LasLabs one. It creates the following services:

  • postgresql - Database for the Runbot master
  • traefik - The almighty load balancer
  • install - Odoo instance that spawns before the other ones. Creates the initial database & installs initial addons, then shuts down. Can be discarded after initial use.
  • web - Web facing Runbot container
  • longpolling - Web facing Runbot longpolling container
  • cron - This is the Runbot cron worker, and actually performs the builds. Scale this for more build capacity.

Docker Registries

Sometimes logging into Docker registries can be required in order to allow custom Travis2Docker build images. In this case, the DOCKER_REGISTRY_ environment variables have been exposed.

The format of the docker registry variables is DOCKER_REGISTRY_NAME_OPTION where NAME is the canonical name for the Docker registry group, and OPTION is one of the following:

  • HOSTNAME - The hostname for the registry group. This is not required for Dockerhub.
  • USERNAME - The username for the registry group
  • PASSWORD - The password for the registry group

Following is an example of two registries (DOCKERHUB and EXAMPLE):

environment:
    DOCKER_REGISTRY_DOCKERHUB_USERNAME: "dockerhub_username"
    DOCKER_REGISTRY_DOCKERHUB_PASSWORD: "Sup3rS3cur3"
    DOCKER_REGISTRY_EXAMPLE_HOSTNAME: "registry.example.com:8080"
    DOCKER_REGISTRY_EXAMPLE_USERNAME: "example_registry_username"
    DOCKER_REGISTRY_EXAMPLE_PASSWORD: "apassword"

Environment Variables

The following environment variables are available for configuration of the Runbot container:

Name Default Description
ADMIN_PASSWORD admin Password for the Runbot database manager
UNACCENT true Search without accented characters
PGUSER odoo Username to database
PGPASSWORD odoopassword Password for the database
PGHOST db Hostname for the database server
PGDATABASE prod Database name to use for Runbot
PROXY_MODE false Set to true if Runbot is behind a load balancer
WITHOUT_DEMO all Demo data setting for Runbot
DOCKER_REGISTRY_X_USERNAME Username for logging into registry group X
DOCKER_REGISTRY_X_PASSWORD Password for logging into registry group X
DOCKER_REGISTRY_X_HOSTNAME Hostname for registry group X. Not required for DockerHub

Known Issues / Roadmap

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there to see if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.

Credits

Contributors

Maintainer

LasLabs Inc.

This module is maintained by LasLabs Inc.

docker-runbot's People

Contributors

lasley avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.