Commit 93362a08 authored by Kirill Smelkov's avatar Kirill Smelkov

gitlab/gitlab.yml: Handle "external URL"

GitLab has a notion of "external URL" - the canonical "frontend" URL the
server is reachable through: this URL is used as prefix to show
e.g. git-clone URL for repositories, etc, even if a server can be
reachable via several frontends.

Add external_url handling to slapos instance.

NOTE whether to use https or not is also defined by external_url, in
particular by external_url scheme.

/cc @kazuhiko, @jerome
parent c64f7ece
......@@ -9,6 +9,7 @@
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
[gitlab-parameters]
configuration.external_url = http://lab.example.com
# db advanced
configuration.db_pool = 10
......
......@@ -132,6 +132,7 @@ import-list =
context =
raw autogenerated # This file was autogenerated. (DO NOT EDIT - changes will be lost)
section instance_parameter instance-parameter
import urlparse urlparse
${:context-extra}
context-extra =
......
......@@ -6,3 +6,10 @@
{# cfg_bool(name) - like cfg(name), but returns 'true'/''
NOTE macros can return only strings - that's why '' is used for false #}
{% macro cfg_bool(name) %}{{ 'true' if (cfg(name).lower() in ('true', 'yes')) else '' }}{% endmacro %}
{# deduce whether to use https from external url
( here - becasue we cannot use jinja2 logic in instance-gitlab.cfg.in to
process instance parameters ) #}
{% set external_url = urlparse.urlparse(cfg('external_url')) %}
{% set cfg_https = (true if external_url.scheme == 'https' else false) %}
......@@ -4,6 +4,8 @@
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
{% from 'macrolib.cfg.in' import cfg_https, external_url with context %}
production: &base
#
# 1. GitLab app settings
......@@ -12,9 +14,10 @@ production: &base
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: <%= @gitlab_host %>
port: <%= @gitlab_port %>
https: <%= @gitlab_https %>
{% set default_port = {'http': 80, 'https': 443} %}
host: {{ external_url.hostname }}
port: {{ external_url.port or default_port[external_url.scheme] }}
https: {{ cfg_https }}
# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment