项目作者: LasLabs

项目描述 :
Docker Image for the LasLabs' Odoo Runbot Environment
高级语言: Python
项目地址: git://github.com/LasLabs/docker-runbot.git
创建时间: 2017-07-25T19:27:20Z
项目社区:https://github.com/LasLabs/docker-runbot

开源协议:Other

下载


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:

  1. version: '2'
  2. volumes:
  3. odoo-db-data:
  4. driver: local
  5. odoo-web-data:
  6. driver: local
  7. services:
  8. web:
  9. image: laslabs/runbot:latest
  10. restart: unless-stopped
  11. links:
  12. - postgresql:db
  13. volumes:
  14. - odoo-web-data:/var/lib/odoo
  15. - /var/run/docker.sock:/var/run/docker.sock
  16. tty: true
  17. privileged: true
  18. ports:
  19. - 10080:8069
  20. - 1800-2000:1800-2000
  21. environment:
  22. PGPASSWORD: 'odoo'
  23. PGUSER: 'odoo'
  24. ADMIN_PASSWORD: 'admin'
  25. postgresql:
  26. image: postgres:9.6-alpine
  27. restart: unless-stopped
  28. environment:
  29. PGDATA: /var/lib/postgresql/data/pgdata
  30. POSTGRES_PASSWORD: 'odoo'
  31. POSTGRES_USER: 'odoo'
  32. volumes:
  33. - 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:

  1. version: '2'
  2. volumes:
  3. odoo-db-data:
  4. driver: local
  5. odoo-web-data:
  6. driver: local
  7. services:
  8. web:
  9. image: laslabs/runbot:latest
  10. restart: unless-stopped
  11. links:
  12. - postgresql:db
  13. volumes:
  14. - odoo-web-data:/var/lib/odoo
  15. - /var/run/docker.sock:/var/run/docker.sock
  16. tty: true
  17. privileged: true
  18. environment:
  19. PGPASSWORD: odoo
  20. PGUSER: odoo
  21. ADMIN_PASSWORD: admin
  22. labels:
  23. traefik.enable: 'true'
  24. traefik.port: '8069'
  25. traefik.frontend.rule: 'Host: localhost;'
  26. postgresql:
  27. image: postgres:9.6-alpine
  28. restart: unless-stopped
  29. environment:
  30. PGDATA: '/var/lib/postgresql/data/pgdata'
  31. POSTGRES_PASSWORD: 'odoo'
  32. POSTGRES_USER: 'odoo'
  33. volumes:
  34. - odoo-db-data:/var/lib/postgresql/data/pgdata
  35. traefik:
  36. image: laslabs/runbot-traefik:latest
  37. stdin_open: true
  38. volumes:
  39. - /var/run/docker.sock:/var/run/docker.sock
  40. tty: true
  41. ports:
  42. - 80:80
  43. - 8080:8080
  44. command:
  45. - --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:

  1. version: '2'
  2. volumes:
  3. odoo-web-data:
  4. driver: rancher-nfs
  5. odoo-db-data:
  6. driver: rancher-nfs
  7. runbot-builds:
  8. driver: rancher-nfs
  9. runbot-ssh:
  10. driver: rancher-nfs
  11. services:
  12. install:
  13. image: laslabs/runbot:latest
  14. command: 'install-addons'
  15. links:
  16. - postgresql:db
  17. volumes:
  18. - odoo-web-data:/var/lib/odoo
  19. - /var/run/docker.sock:/var/run/docker.sock
  20. - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
  21. - runbot-ssh:/home/odoo/.ssh
  22. tty: true
  23. environment:
  24. PGPASSWORD: odoo
  25. PGUSER: odoo
  26. WITHOUT_DEMO: all
  27. cron:
  28. privileged: true
  29. image: laslabs/runbot:latest
  30. environment:
  31. PGPASSWORD: odoo
  32. PGUSER: odoo
  33. WAIT_NOHOST: install
  34. volumes:
  35. - odoo-web-data:/var/lib/odoo
  36. - /var/run/docker.sock:/var/run/docker.sock
  37. - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
  38. - runbot-ssh:/home/odoo/.ssh
  39. tty: true
  40. links:
  41. - postgresql:db
  42. command:
  43. - /usr/local/bin/odoo
  44. - --max-cron-threads=1
  45. - --workers=1
  46. - --limit-time-real=600
  47. - --limit-time-cpu=300
  48. postgresql:
  49. image: postgres:9.6-alpine
  50. hostname: db
  51. environment:
  52. PGDATA: /var/lib/postgresql/data/pgdata
  53. POSTGRES_PASSWORD: odoo
  54. POSTGRES_USER: odoo
  55. volumes:
  56. - odoo-db-data:/var/lib/postgresql/data/pgdata
  57. web:
  58. image: laslabs/runbot:latest
  59. environment:
  60. ADMIN_PASSWORD: admin
  61. PGPASSWORD: odoo
  62. PGUSER: odoo
  63. PROXY_MODE: 'true'
  64. WAIT_NOHOST: install
  65. volumes:
  66. - odoo-web-data:/var/lib/odoo
  67. - /var/run/docker.sock:/var/run/docker.sock
  68. - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
  69. tty: true
  70. links:
  71. - postgresql:db
  72. ports:
  73. - 8069
  74. command:
  75. - /usr/local/bin/odoo
  76. - --max-cron-threads=0
  77. - --workers=4
  78. - --no-database-list
  79. - --db-filter=prod
  80. labels:
  81. traefik.enable: 'true'
  82. traefik.port: '8069'
  83. traefik.frontend.rule: 'Host: runbot.example.com;'
  84. traefik.frontend.passHostHeader: 'true'
  85. traefik:
  86. image: laslabs/runbot-traefik:latest
  87. stdin_open: true
  88. volumes:
  89. - /var/run/docker.sock:/var/run/docker.sock
  90. tty: true
  91. ports:
  92. - 80:80
  93. - 8080:8080
  94. command:
  95. - --web
  96. longpolling:
  97. image: laslabs/runbot:latest
  98. environment:
  99. PGPASSWORD: odoo
  100. PGUSER: odoo
  101. PROXY_MODE: 'true'
  102. WAIT_NOHOST: install
  103. volumes:
  104. - odoo-web-data:/var/lib/odoo
  105. - /var/run/docker.sock:/var/run/docker.sock
  106. - runbot-builds:/opt/odoo/custom/src/odoo-extra/runbot/static
  107. tty: true
  108. links:
  109. - postgresql:db
  110. ports:
  111. - 8072
  112. command:
  113. - /usr/local/bin/odoo
  114. - --max-cron-threads=0
  115. - --workers=2
  116. labels:
  117. traefik.enable: 'true'
  118. traefik.port: '8072'
  119. traefik.frontend.rule: 'Host: localhost;PathPrefix:/longpolling'
  120. 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):

  1. environment:
  2. DOCKER_REGISTRY_DOCKERHUB_USERNAME: "dockerhub_username"
  3. DOCKER_REGISTRY_DOCKERHUB_PASSWORD: "Sup3rS3cur3"
  4. DOCKER_REGISTRY_EXAMPLE_HOSTNAME: "registry.example.com:8080"
  5. DOCKER_REGISTRY_EXAMPLE_USERNAME: "example_registry_username"
  6. 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.