diff --git a/README.md b/README.md
index fd6899c4..32ee7ace 100644
--- a/README.md
+++ b/README.md
@@ -76,8 +76,18 @@ Note:
- --limit-time-real-cron is important to ensure that cron has enough time to build docker images and clone repos the first time. It may be reduced to a lower value later (600 is advised).
- --limit-memory-* is not mandatory, but fetching odoo on multiple remote with only 2Gib may result in a failure of the fetch command. If git fails to create async thread or run out of memory, increasing memory limit may be a good idea. *cf. odoo-bin --help for more info.*
+This is an example command line, starting runbot in worker mode is advised.
You may want to configure a service or launch odoo in a screen depending on your preferences.
+You also may need to configure nginx depending on your preferences
+
+```
+server {
+ listen 443 default;
+ location / { proxy_pass http://127.0.0.1:8069; }
+ ...
+}
+```
### Configuration
*Note: Runbot is optimized to run commit discovery and build scheduling on different hosts to allow load share on different machines. This basic configuration will show how to run runbot on a single machine, a less-tested use case*
@@ -137,7 +147,6 @@ Acces the runbot settings and tweak the default parameters.
- The *number of worker* is the default number of parallel testing builds per machine. It is advised to keep one physical core per worker on a dedicated machine. On a local machine,keep it low, **2** is a good start (using 8 on runbot.odoo.com).
- The *number of running build* is the number of parallel running builds. Runbot will start to kill running builds once this limit is reached. This number can be pumped up on a server (using 60 on runbot.odoo.com).
-- *Runbot domain* will mainly be used for nginx to access running builds.
- Max commit age is the limit after which a branch head will be ignored in processing. This will reduce the processing of old non deleted branches. Keep in mind that pushing an old commit on a branch will also be ignored by runbot.
- **Discover new commits** is disabled by default but is needed to fetch repositories and create new commits/batches/builds. **Check** this option.
diff --git a/runbot/models/build.py b/runbot/models/build.py
index c25bd5a7..2910af47 100644
--- a/runbot/models/build.py
+++ b/runbot/models/build.py
@@ -1166,8 +1166,7 @@ class BuildResult(models.Model):
_logger.info("skipping github status for build %s ", build.id)
continue
- runbot_domain = self.env['runbot.runbot']._domain()
- target_url = trigger.ci_url or "http://%s/runbot/build/%s" % (runbot_domain, build.id)
+ target_url = trigger.ci_url or "%s/runbot/build/%s" % (self.get_base_url(), build.id)
for build_commit in self.params_id.commit_link_ids:
commit = build_commit.commit_id
if 'base_' not in build_commit.match_type and commit.repo_id in trigger.repo_ids:
diff --git a/runbot/models/res_config_settings.py b/runbot/models/res_config_settings.py
index dbb66059..9dedc602 100644
--- a/runbot/models/res_config_settings.py
+++ b/runbot/models/res_config_settings.py
@@ -15,7 +15,6 @@ class ResConfigSettings(models.TransientModel):
runbot_running_max = fields.Integer('Maximum number of running builds')
runbot_timeout = fields.Integer('Max allowed step timeout (in seconds)')
runbot_starting_port = fields.Integer('Starting port for running builds')
- runbot_domain = fields.Char('Runbot domain')
runbot_max_age = fields.Integer('Max commit age (in days)')
runbot_logdb_uri = fields.Char('Runbot URI for build logs')
runbot_update_frequency = fields.Integer('Update frequency (in seconds)')
@@ -47,7 +46,6 @@ class ResConfigSettings(models.TransientModel):
runbot_running_max=int(get_param('runbot.runbot_running_max', default=5)),
runbot_timeout=int(get_param('runbot.runbot_timeout', default=10000)),
runbot_starting_port=int(get_param('runbot.runbot_starting_port', default=2000)),
- runbot_domain=get_param('runbot.runbot_domain', default=common.fqdn()),
runbot_max_age=int(get_param('runbot.runbot_max_age', default=30)),
runbot_logdb_uri=get_param('runbot.runbot_logdb_uri', default=False),
runbot_update_frequency=int(get_param('runbot.runbot_update_frequency', default=10)),
@@ -67,7 +65,6 @@ class ResConfigSettings(models.TransientModel):
set_param("runbot.runbot_running_max", self.runbot_running_max)
set_param("runbot.runbot_timeout", self.runbot_timeout)
set_param("runbot.runbot_starting_port", self.runbot_starting_port)
- set_param("runbot.runbot_domain", self.runbot_domain)
set_param("runbot.runbot_max_age", self.runbot_max_age)
set_param("runbot.runbot_logdb_uri", self.runbot_logdb_uri)
set_param('runbot.runbot_update_frequency', self.runbot_update_frequency)
diff --git a/runbot/models/runbot.py b/runbot/models/runbot.py
index bb71a08e..5a1e1649 100644
--- a/runbot/models/runbot.py
+++ b/runbot/models/runbot.py
@@ -140,50 +140,41 @@ class Runbot(models.AbstractModel):
self.env.cr.execute(query, [host.name] + select_params + [nb_slots])
return self.env.cr.fetchall()
- def _domain(self):
- return self.env.get('ir.config_parameter').sudo().get_param('runbot.runbot_domain', fqdn())
-
def _reload_nginx(self):
env = self.env
settings = {}
settings['port'] = config.get('http_port')
- settings['runbot_domain'] = self._domain()
- settings['runbot_static'] = os.path.join(get_module_resource('runbot', 'static'), '')
nginx_dir = os.path.join(self._root(), 'nginx')
settings['nginx_dir'] = nginx_dir
settings['re_escape'] = re.escape
settings['fqdn'] = fqdn()
- icp = env['ir.config_parameter'].sudo()
- nginx = icp.get_param('runbot.runbot_nginx', True) # or just force nginx?
+ settings['builds'] = env['runbot.build'].search([('local_state', '=', 'running'), ('host', '=', fqdn())])
- if nginx:
- settings['builds'] = env['runbot.build'].search([('local_state', '=', 'running'), ('host', '=', fqdn())])
-
- nginx_config = env['ir.ui.view']._render_template("runbot.nginx_config", settings)
- os.makedirs(nginx_dir, exist_ok=True)
- content = None
- nginx_conf_path = os.path.join(nginx_dir, 'nginx.conf')
- content = ''
- if os.path.isfile(nginx_conf_path):
- with open(nginx_conf_path, 'rb') as f:
- content = f.read()
- if content != nginx_config:
- _logger.info('reload nginx')
- with open(nginx_conf_path, 'wb') as f:
- f.write(nginx_config)
- try:
- pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
- os.kill(pid, signal.SIGHUP)
- except Exception:
- _logger.info('start nginx')
- if subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf']):
- # obscure nginx bug leaving orphan worker listening on nginx port
- if not subprocess.call(['pkill', '-f', '-P1', 'nginx: worker']):
- _logger.warning('failed to start nginx - orphan worker killed, retrying')
- subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf'])
- else:
- _logger.warning('failed to start nginx - failed to kill orphan worker - oh well')
+ nginx_config = env['ir.ui.view']._render_template("runbot.nginx_config", settings)
+ os.makedirs(nginx_dir, exist_ok=True)
+ content = None
+ nginx_conf_path = os.path.join(nginx_dir, 'nginx.conf')
+ content = ''
+ if os.path.isfile(nginx_conf_path):
+ with open(nginx_conf_path, 'rb') as f:
+ content = f.read()
+ if content != nginx_config:
+ _logger.info('reload nginx')
+ with open(nginx_conf_path, 'wb') as f:
+ f.write(nginx_config)
+ try:
+ pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
+ os.kill(pid, signal.SIGHUP)
+ except Exception:
+ _logger.info('start nginx')
+ if subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf']):
+ # obscure nginx bug leaving orphan worker listening on nginx port
+ if not subprocess.call(['pkill', '-f', '-P1', 'nginx: worker']):
+ _logger.warning('failed to start nginx - orphan worker killed, retrying')
+ subprocess.call(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf'])
+ else:
+ _logger.warning('failed to start nginx - failed to kill orphan worker - oh well')
def _get_cron_period(self):
""" Compute a randomized cron period with a 2 min margin below
diff --git a/runbot/templates/nginx.xml b/runbot/templates/nginx.xml
index 64d0661b..0ddbdb01 100644
--- a/runbot/templates/nginx.xml
+++ b/runbot/templates/nginx.xml
@@ -37,20 +37,6 @@ proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $real_scheme;
proxy_set_header Host $host;
-server {
- listen 8080 default;
- location / { proxy_pass http://127.0.0.1:; }
- location /longpolling/im/poll { return 404; }
- location /longpolling/poll { return 404; }
- location /runbot/static/ {
- alias ;
- autoindex off;
- location ~ /runbot/static/build/[^/]+/(logs|tests)/ {
- autoindex on;
- add_header 'Access-Control-Allow-Origin' 'https://';
- }
- }
-}
server {
listen 8080;
diff --git a/runbot/tests/test_build.py b/runbot/tests/test_build.py
index 9a3c1c6c..3781cffd 100644
--- a/runbot/tests/test_build.py
+++ b/runbot/tests/test_build.py
@@ -161,11 +161,8 @@ class TestBuildResult(RunbotCase):
self.assertEqual(build.dest, '%05d-13-0' % build.id)
# Test domain compute with fqdn and ir.config_parameter
- self.env['ir.config_parameter'].sudo().set_param('runbot.runbot_nginx', False)
self.patchers['fqdn_patcher'].return_value = 'runbot98.nowhere.org'
- self.env['ir.config_parameter'].sudo().set_param('runbot.runbot_domain', False)
self.assertEqual(build.domain, 'runbot98.nowhere.org:1234')
- self.env['ir.config_parameter'].set_param('runbot.runbot_domain', 'runbot99.example.org')
build._compute_domain()
self.assertEqual(build.domain, 'runbot99.example.org:1234')
diff --git a/runbot/views/res_config_settings_views.xml b/runbot/views/res_config_settings_views.xml
index d2d88422..7196edd5 100644
--- a/runbot/views/res_config_settings_views.xml
+++ b/runbot/views/res_config_settings_views.xml
@@ -46,8 +46,6 @@