Commit 23e826c4 authored by Kirill Smelkov's avatar Kirill Smelkov

X Switch to jinja2

parent c0025cbc
......@@ -165,7 +165,7 @@ return = redis_ip redis_port
# GitLab instance setup #
#############################
# create gitlab dirs structure
# 1. directories
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
......@@ -202,41 +202,50 @@ etc = ${directory:etc}/gitlab-shell
[gitlab-database.yml]
recipe = slapos.recipe.template
url = {{ database_yml_in }}
output = ${gitlab:etc}/database.yml
# FIXME aaa should not be here
aaa = ${request-postgresql:connection-url}
# 2. configuration files
[gitlab-etc-template]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
rendered= ${gitlab:etc}/${:_buildout_section_name_}
mode = 0640
[database.yml]
<= gitlab-etc-template
template= {{ database_yml_in }}
context =
section pgsql postgresql-urlparse
[gitlab.yml]
recipe = slapos.recipe.template
url = {{ gitlab_yml_in }}
output = ${gitlab:etc}/gitlab.yml
<= gitlab-etc-template
template= {{ gitlab_yml_in }}
context =
section gitlab gitlab
section gitlab_backend gitlab-backend
section instance_parameter instance-parameter
[resque.yml]
recipe = slapos.recipe.template
url = {{ resque_yml_in }}
output = ${gitlab:etc}/resque.yml
# FIXME aaa should not be here
aaa = ${request-redis:connection-redis_ip}
<= gitlab-etc-template
template= {{ resque_yml_in }}
context =
section redis request-redis
[smtp_settings.rb]
recipe = slapos.recipe.template
url = {{ smtp_settings_rb_in }}
output = ${gitlab:etc}/smtp_settings.rb
<= gitlab-etc-template
template= {{ smtp_settings_rb_in }}
context =
section instance_parameter instance-parameter
# TODO log: logrotate
# bin/
# 3. bin/
# gitlab-rails
# gitlab-rake
# ? gitlab-unicorn
# ? gitlab-sidekiq
# gitlab-unicorn
# gitlab-sidekiq
[gitlab-bin]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/${:_buildout_section_name_}
......@@ -318,13 +327,13 @@ command =
# config/
cd config &&
ln -s ${gitlab:etc}/unicorn.rb . &&
ln -s ${gitlab.yml:output} gitlab.yml &&
ln -s ${gitlab-database.yml:output} database.yml &&
ln -s ${resque.yml:output} resque.yml &&
ln -s ${gitlab.yml:rendered} gitlab.yml &&
ln -s ${database.yml:rendered} database.yml &&
ln -s ${resque.yml:rendered} resque.yml &&
# config/initializers/
cd initializers &&
ln -s ${gitlab:etc}/rack_attack.rb . &&
ln -s ${smtp_settings.rb:output} smtp_settings.rb &&
ln -s ${smtp_settings.rb:rendered} smtp_settings.rb &&
# public/
cd ../../public &&
rm -rf uploads &&
......
......@@ -17,7 +17,7 @@ default = $${instance-gitlab.cfg:rendered}
[instance-gitlab.cfg]
#<= jinja2-template-base
recipe = slapos.recipe.template:jinja2
mode = 0640
mode = 0644
template= ${instance-gitlab.cfg.in:target}
rendered= $${buildout:directory}/instance-gitlab.cfg
context =
......
......@@ -7,10 +7,10 @@ production:
adapter: postgresql
encoding: unicode
#database: gitlabhq_production
database: ${postgresql-urlparse:path}
database: {{ pgsql.path }}
pool: 10
username: '${postgresql-urlparse:username}'
password: '${postgresql-urlparse:password}'
host: ${postgresql-urlparse:host}
port: ${postgresql-urlparse:port}
username: '{{ pgsql.username }}'
password: '{{ pgsql.password }}'
host: {{ pgsql.host }}
port: {{ pgsql.port }}
# socket:
......@@ -4,6 +4,9 @@
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb
# (last updated for v7.13.0.rc2)
{# cfg(name) -> instance_parameter:configuration.<name> #}
{% macro cfg(name) %}{{ instance_parameter[str("configuration." + name)] }}{% endmacro %}
production: &base
#
# 1. GitLab app settings
......@@ -12,30 +15,30 @@ production: &base
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: ${gitlab-backend:host}
port: ${gitlab-backend:port}
host: {{ gitlab_backend.host }}
port: {{ gitlab_backend.port }}
# TODO
#https: <%= @gitlab_https %>
https: false
# XXX temp workaround for gitlab not building correct url for host being ipv6 addr
url: ${gitlab-backend:url}
url: {{ gitlab_backend.url }}
user: ${gitlab-backend:user}
user: {{ gitlab_backend.user }}
## Email settings
email_enabled: ${instance-parameter:configuration.email_enabled}
email_from: ${instance-parameter:configuration.email_from}
email_display_name: ${instance-parameter:configuration.email_display_name}
email_reply_to: ${instance-parameter:configuration.email_reply_to}
email_enabled: {{ cfg('email_enabled') }}
email_from: {{ cfg('email_from') }}
email_display_name: {{ cfg('email_display_name') }}
email_reply_to: {{ cfg('email_reply_to') }}
# Email server smtp settings are in template/smtp_settings.rb.in
## User settings
default_can_create_group: ${instance-parameter:configuration.default_can_create_group}
username_changing_enabled: ${instance-parameter:configuration.username_changing_enabled}
default_theme: ${instance-parameter:configuration.default_theme}
default_can_create_group: {{ cfg('default_can_create_group') }}
username_changing_enabled: {{ cfg('username_changing_enabled') }}
default_theme: {{ cfg('default_theme') }}
# TODO
# restricted_visibility_levels: ...
......@@ -43,14 +46,14 @@ production: &base
## Default project features settings
default_projects_features:
issues: ${instance-parameter:configuration.default_projects_features.issues}
merge_requests: ${instance-parameter:configuration.default_projects_features.merge_requests}
wiki: ${instance-parameter:configuration.default_projects_features.wiki}
snippets: ${instance-parameter:configuration.default_projects_features.snippets}
visibility_level: '${instance-parameter:configuration.default_projects_features.visibility_level}'
issues: {{ cfg('default_projects_features.issues') }}
merge_requests: {{ cfg('default_projects_features.merge_requests') }}
wiki: {{ cfg('default_projects_features.wiki') }}
snippets: {{ cfg('default_projects_features.snippets') }}
visibility_level: '{{ cfg("default_projects_features.visibility_level") }}'
## Webhook settings
webhook_timeout: ${instance-parameter:configuration.webhook_timeout}
webhook_timeout: {{ cfg('webhook_timeout') }}
# TODO
# repository_downloads_path: ...
......@@ -89,8 +92,8 @@ production: &base
## Backup settings
backup:
path: ${gitlab:backup}
keep_time: ${instance-parameter:configuration.backup_keep_time}
path: {{ gitlab.backup }}
keep_time: {{ cfg('backup_keep_time') }}
upload:
# TODO ?
# connection: ...
......@@ -100,10 +103,10 @@ production: &base
## GitLab Shell settings
gitlab_shell:
path: ${gitlab-backend:gitlab-shell}
path: {{ gitlab_backend['gitlab-shell'] }}
repos_path: ${gitlab:repositories}
hooks_path: ${gitlab-backend:gitlab-shell}/hooks/
repos_path: {{ gitlab.repositories }}
hooks_path: {{ gitlab_backend['gitlab-shell'] }}/hooks/
# Git over HTTP is enabled
upload_pack: true
......@@ -115,9 +118,9 @@ production: &base
## Git settings
git:
bin_path: ${gitlab-backend:git}
max_size: ${instance-parameter:configuration.git_max_size}
timeout: ${instance-parameter:configuration.git_timeout}
bin_path: {{ gitlab_backend.git }}
max_size: {{ cfg('git_max_size') }}
timeout: {{ cfg('git_timeout') }}
#
......
......@@ -3,4 +3,4 @@
# 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
production: redis://[${request-redis:connection-redis_ip}]:${request-redis:connection-redis_port}
production: redis://[{{ redis['connection-redis_ip'] }}]:{{ redis['connection-redis_port'] }}
......@@ -3,17 +3,22 @@
# 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
{# cfg(name) -> instance_parameter:configuration.<name> #}
{# XXX dup -> import from gitlab.yml.in ? #}
{% macro cfg(name) %}{{ instance_parameter[str("configuration." + name)] }}{% endmacro %}
if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "${instance-parameter:configuration.smtp_address}",
port: ${instance-parameter:configuration.smtp_port},
user_name: "${instance-parameter:configuration.smtp_user_name}",
password: "${instance-parameter:configuration.smtp_password}",
domain: "${instance-parameter:configuration.smtp_domain}",
authentication: :${instance-parameter:configuration.smtp_authentication},
enable_starttls_auto: ${instance-parameter:configuration.smtp_enable_starttls_auto},
openssl_verify_mode: '${instance-parameter:configuration.smtp_openssl_verify_mode}'
address: "{{ cfg('smtp_address') }}",
port: {{ cfg('smtp_port') }},
user_name: "{{ cfg('smtp_user_name') }}",
password: "{{ cfg('smtp_password') }}",
domain: "{{ cfg('smtp_domain') }}",
authentication: :{{ cfg('smtp_authentication') }},
enable_starttls_auto: {{ cfg('smtp_enable_starttls_auto') }},
openssl_verify_mode: '{{ cfg("smtp_openssl_verify_mode") }}'
}
end
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