Commit 13169cab authored by Kirill Smelkov's avatar Kirill Smelkov

gitlab: Hook gitlab- and gitlab-shell- configuration files into the system

- Download them on SR build and pass info to instance
- Instance prepares to process them as jinja2 templates
- Instance hooks the files into configuration location as appropriate

Every file so far is renamed *.erb -> *.in and a header added showing
that this file is autogenerated with links about what was the base
gitlab and/or omnibus version and omnibus reference revision this
template was last updated for.

So far all result configuration files are invalid - because ERB syntax
is there. We will convert the configuration files to proper jinja2
syntax and to using slapos parameters incrementally in the upcoming
patches.

NOTE (again): md5 sums are not yet fixed - we will fix them in the end
    of gitlab patches series after applying all tweaking changes.

/cc @kazuhiko, @jerome
parent 6fd7b987
...@@ -118,7 +118,58 @@ mode = 0700 ...@@ -118,7 +118,58 @@ mode = 0700
# 2. bin/ # 2. configuration files
[etc-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
mode = 0640
context =
raw autogenerated # This file was autogenerated. (DO NOT EDIT - changes will be lost)
section instance_parameter instance-parameter
${:context-extra}
context-extra =
[gitlab-etc-template]
<= etc-template
rendered= ${gitlab:etc}/${:_buildout_section_name_}
[config.ru]
<= gitlab-etc-template
template = {{ config_ru_in }}
[database.yml]
<= gitlab-etc-template
template= {{ database_yml_in }}
[gitlab-shell-config.yml]
<= etc-template
template= {{ gitlab_shell_config_yml_in }}
rendered= ${gitlab-shell:etc}/config.yml
[gitlab.yml]
<= gitlab-etc-template
template= {{ gitlab_yml_in }}
[rack_attack.rb]
<= gitlab-etc-template
template = {{ rack_attack_rb_in }}
[resque.yml]
<= gitlab-etc-template
template= {{ resque_yml_in }}
[smtp_settings.rb]
<= gitlab-etc-template
template= {{ smtp_settings_rb_in }}
[unicorn.rb]
<= gitlab-etc-template
template = {{ unicorn_rb_in }}
# 3. bin/
# gitlab-<prog> # gitlab-<prog>
[gitlab-bin] [gitlab-bin]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
...@@ -140,7 +191,7 @@ prog = {{ prog }} ...@@ -140,7 +191,7 @@ prog = {{ prog }}
{% endfor %} {% endfor %}
# 3. gitlab- & gitlab-shell- work directories # 4. gitlab- & gitlab-shell- work directories
# #
# Gitlab/Rails operation is tightened that config/ lives inside code, which goes # Gitlab/Rails operation is tightened that config/ lives inside code, which goes
# against having ability to create several instances configured differently # against having ability to create several instances configured differently
...@@ -188,17 +239,27 @@ update-command = ...@@ -188,17 +239,27 @@ update-command =
<= work-base <= work-base
software = {{ gitlab_repository_location }} software = {{ gitlab_repository_location }}
tune-command = tune-command =
# secret* tmp/ log/ # secret* config.ru tmp/ log/
rm -f .secret && rm -f .secret &&
rm -f config.ru &&
rm -rf log tmp && rm -rf log tmp &&
ln -sf ${secrets:secrets}/gitlab_rails_secret .secret && ln -sf ${secrets:secrets}/gitlab_rails_secret .secret &&
ln -sf ${config.ru:rendered} config.ru &&
ln -sf ${gitlab:log} log && ln -sf ${gitlab:log} log &&
ln -sf ${gitlab:tmp} tmp && ln -sf ${gitlab:tmp} tmp &&
# config/ # config/
cd config && cd config &&
ln -sf ${unicorn.rb:rendered} unicorn.rb &&
ln -sf ${gitlab.yml:rendered} gitlab.yml &&
ln -sf ${database.yml:rendered} database.yml &&
ln -sf ${resque.yml:rendered} resque.yml &&
ln -sf ${secrets:secrets}/gitlab_secrets.yml secrets.yml && ln -sf ${secrets:secrets}/gitlab_secrets.yml secrets.yml &&
# config/initializers/
cd initializers &&
ln -sf ${rack_attack.rb:rendered} rack_attack.rb &&
ln -sf ${smtp_settings.rb:rendered} smtp_settings.rb &&
# public/ # public/
cd ../public && cd ../../public &&
rm -rf uploads assets && rm -rf uploads assets &&
ln -sf ${gitlab:uploads} uploads && ln -sf ${gitlab:uploads} uploads &&
ln -sf ${gitlab:assets} assets && ln -sf ${gitlab:assets} assets &&
...@@ -211,12 +272,12 @@ tune-command = ...@@ -211,12 +272,12 @@ tune-command =
software = {{ gitlab_shell_repository_location }} software = {{ gitlab_shell_repository_location }}
tune-command = tune-command =
ln -sf ${gitlab-shell-config.yml:rendered} config.yml &&
true true
# 5. services
# 4. services
# [promise-<something>] to generate promise wrapper <something> # [promise-<something>] to generate promise wrapper <something>
[promise-wrapper] [promise-wrapper]
......
...@@ -34,3 +34,13 @@ context = ...@@ -34,3 +34,13 @@ context =
raw logrotate_bin ${logrotate:location}/usr/sbin/logrotate raw logrotate_bin ${logrotate:location}/usr/sbin/logrotate
raw postgresql_location ${postgresql92:location} raw postgresql_location ${postgresql92:location}
raw redis_binprefix ${redis28:location}/bin raw redis_binprefix ${redis28:location}/bin
# config files
raw config_ru_in ${config.ru.in:target}
raw database_yml_in ${database.yml.in:target}
raw gitlab_shell_config_yml_in ${gitlab-shell-config.yml.in:target}
raw gitlab_yml_in ${gitlab.yml.in:target}
raw rack_attack_rb_in ${rack_attack.rb.in:target}
raw resque_yml_in ${resque.yml.in:target}
raw smtp_settings_rb_in ${smtp_settings.rb.in:target}
raw unicorn_rb_in ${unicorn.rb.in:target}
...@@ -178,11 +178,48 @@ recipe = slapos.recipe.build:download ...@@ -178,11 +178,48 @@ recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_} url = ${:_profile_base_location_}/${:_buildout_section_name_}
destination = ${buildout:directory}/${:_buildout_section_name_} destination = ${buildout:directory}/${:_buildout_section_name_}
# like download-file, but download from template/<filename>
[download-template]
<= download-file
url = ${:_profile_base_location_}/template/${:_buildout_section_name_}
[config.ru.in]
<= download-template
# md5sum = TODO
[database.yml.in]
<= download-template
# md5sum = TODO
[gitlab-shell-config.yml.in]
<= download-template
# md5sum = TODO
[gitlab.yml.in]
<= download-template
# md5sum = TODO
[instance-gitlab.cfg.in] [instance-gitlab.cfg.in]
<= download-file <= download-file
# md5sum = TODO # md5sum = TODO
[rack_attack.rb.in]
<= download-template
# md5sum = TODO
[resque.yml.in]
<= download-template
# md5sum = TODO
[smtp_settings.rb.in]
<= download-template
# md5sum = TODO
[unicorn.rb.in]
<= download-template
# md5sum = TODO
[versions] [versions]
plone.recipe.command = 1.1 plone.recipe.command = 1.1
......
{{ autogenerated }}
# see:
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config.ru
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/gitlab-rails-config.ru.erb
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.
if defined?(Unicorn) if defined?(Unicorn)
......
# This file is managed by gitlab-ctl. Manual changes will be {{ autogenerated }}
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb # see:
# and run `sudo gitlab-ctl reconfigure`. # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/database.yml.postgresql
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/database.yml.erb
# (last updated for 8.2.3+ce.0-0-g8eda093)
production: production:
adapter: <%= @db_adapter %> adapter: <%= @db_adapter %>
......
# This file is managed by gitlab-ctl. Manual changes will be {{ autogenerated }}
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb # see:
# and run `sudo gitlab-ctl reconfigure`. # https://gitlab.com/gitlab-org/gitlab-shell/blob/master/config.yml.example
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/gitlab-shell-config.yml.erb
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
# GitLab user. git by default # GitLab user. git by default
user: <%= @user %> user: <%= @user %>
......
# This file is managed by gitlab-ctl. Manual changes will be {{ autogenerated }}
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb # see:
# and run `sudo gitlab-ctl reconfigure`. # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example
# 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)
production: &base production: &base
# #
......
# This file is managed by gitlab-ctl. Manual changes will be {{ autogenerated }}
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb # see:
# and run `sudo gitlab-ctl reconfigure`. # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/initializers/rack_attack.rb.example
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/rack_attack.rb.erb
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
# 1. Rename this file to rack_attack.rb # 1. Rename this file to rack_attack.rb
# 2. Review the paths_to_be_protected and add any other path you need protecting # 2. Review the paths_to_be_protected and add any other path you need protecting
......
{{ autogenerated }}
# see:
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/resque.yml.example
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/resque.yml.erb
# (last udpdated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
production: <%= @redis_url %>
# This file is managed by gitlab-ctl. Manual changes will be {{ autogenerated }}
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb # see:
# and run `sudo gitlab-ctl reconfigure`. # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/initializers/smtp_settings.rb.sample
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/smtp_settings.rb.erb
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
<% rails_app = @app == 'gitlab' ? 'Gitlab' : 'GitlabCi' %> <% rails_app = @app == 'gitlab' ? 'Gitlab' : 'GitlabCi' %>
<% container = @app == 'gitlab' ? 'gitlab-rails' : 'gitlab-ci' %> <% container = @app == 'gitlab' ? 'gitlab-rails' : 'gitlab-ci' %>
......
# This file is managed by gitlab-ctl. Manual changes will be {{ autogenerated }}
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb # see:
# and run `sudo gitlab-ctl reconfigure`. # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example.development
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/unicorn.rb.erb
# (last updated for omnibus-gitlab 8.2.3+ce.0-0-g8eda093)
# What ports/sockets to listen on, and what options for them. # What ports/sockets to listen on, and what options for them.
......
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