Grid環境構築用のChefリポジトリです。
Revisión | 860541cf9ec239a8a0d25fec17361f0f6c6432c9 (tree) |
---|---|
Tiempo | 2017-08-05 15:49:43 |
Autor | whitestar <whitestar@user...> |
Commiter | whitestar |
adds the gitlab-grid::docker-compose recipe.
@@ -25,8 +25,10 @@ Style/RescueModifier: | ||
25 | 25 | Enabled: false |
26 | 26 | Style/SpaceBeforeFirstArg: |
27 | 27 | Enabled: false |
28 | +Style/SpaceInsideBlockBraces: | |
29 | + Enabled: false | |
28 | 30 | Style/TrailingCommaInLiteral: |
29 | - EnforcedStyleForMultiline: comma | |
31 | + EnforcedStyleForMultiline: consistent_comma | |
30 | 32 | Style/WordArray: |
31 | 33 | Enabled: false |
32 | 34 |
@@ -14,8 +14,6 @@ | ||
14 | 14 | # limitations under the License. |
15 | 15 | # |
16 | 16 | |
17 | -# for ver. 3.x | |
18 | -#source 'https://gpm00.grid.example.com:6280' | |
19 | 17 | source 'https://supermarket.chef.io' |
20 | 18 | |
21 | 19 | metadata |
@@ -1,5 +1,9 @@ | ||
1 | 1 | # gitlab-grid CHANGELOG |
2 | 2 | |
3 | +0.1.3 | |
4 | +----- | |
5 | +- adds the `gitlab-grid::docker-compose` recipe. | |
6 | + | |
3 | 7 | 0.1.2 |
4 | 8 | ----- |
5 | 9 | - improves service management. |
@@ -1,3 +1,4 @@ | ||
1 | 1 | source 'https://rubygems.org' |
2 | 2 | |
3 | -#gem 'foodcritic' | |
3 | +# with Chef DK | |
4 | +gem 'stove' |
@@ -13,7 +13,7 @@ This cookbook sets up a GitLab server. | ||
13 | 13 | - [Recipes](#recipes) |
14 | 14 | - [gitlab-grid::default](#gitlab-griddefault) |
15 | 15 | - [gitlab-grid::server](#gitlab-gridserver) |
16 | - - [gitlab-grid::docker-compose (NOT supported yet)](#gitlab-griddocker-compose-not-supported-yet) | |
16 | + - [gitlab-grid::docker-compose](#gitlab-griddocker-compose) | |
17 | 17 | - [gitlab-grid::runner-docker-compose](#gitlab-gridrunner-docker-compose) |
18 | 18 | - [Role Examples](#role-examples) |
19 | 19 | - [Internal CA certificates management by ssl_cert cookbook](#internal-ca-certificates-management-by-ssl_cert-cookbook) |
@@ -56,7 +56,7 @@ This recipe does nothing. | ||
56 | 56 | |
57 | 57 | This recipe sets up a GitLab server. |
58 | 58 | |
59 | -#### gitlab-grid::docker-compose (NOT supported yet) | |
59 | +#### gitlab-grid::docker-compose | |
60 | 60 | |
61 | 61 | This recipe generates a `docker-compose.yml` for the GitLab server. |
62 | 62 |
@@ -136,6 +136,140 @@ override_attributes( | ||
136 | 136 | ) |
137 | 137 | ``` |
138 | 138 | |
139 | +- `roles/gitlab-on-docker.rb` | |
140 | + | |
141 | +```ruby | |
142 | +name 'gitlab-on-docker' | |
143 | +description 'GitLab on Docker' | |
144 | + | |
145 | +gitlab_cn = 'gitlab.io.example.com' | |
146 | +gitlab_http_port = '8080' | |
147 | +gitlab_ssh_port = '2022' | |
148 | + | |
149 | +run_list( | |
150 | + 'role[docker]', | |
151 | + 'recipe[gitlab-grid::docker-compose]', | |
152 | +) | |
153 | + | |
154 | +#env_run_lists() | |
155 | + | |
156 | +#default_attributes() | |
157 | + | |
158 | +override_attributes( | |
159 | + 'gitlab-grid' => { | |
160 | + 'gitlab.rb' => { | |
161 | + 'external_url' => "http://#{gitlab_cn}:#{gitlab_http_port}", | |
162 | + 'gitlab_rails' => { | |
163 | + 'time_zone' => 'Asia/Tokyo', | |
164 | + 'gitlab_shell_ssh_port' => gitlab_ssh_port.to_i, | |
165 | + }, | |
166 | + 'nginx' => { | |
167 | + 'redirect_http_to_https' => false, | |
168 | + }, | |
169 | + }, | |
170 | + 'docker-compose' => { | |
171 | + 'config' => { | |
172 | + # Version 2 docker-compose format | |
173 | + 'version' => '2', | |
174 | + 'services' => { | |
175 | + 'gitlab' => { | |
176 | + 'restart' => 'always', | |
177 | + 'image' => 'gitlab/gitlab-ce:latest', | |
178 | + 'hostname' => gitlab_cn, | |
179 | + 'ports' => [ | |
180 | + "#{gitlab_http_port}:#{gitlab_http_port}", | |
181 | + "#{gitlab_ssh_port}:22", | |
182 | + ], | |
183 | + 'environment' => { | |
184 | + }, | |
185 | + #'volumes' => [ | |
186 | + #], | |
187 | + }, | |
188 | + }, | |
189 | + }, | |
190 | + }, | |
191 | + }, | |
192 | +) | |
193 | +``` | |
194 | + | |
195 | +- `roles/gitlab-with-ssl-on-docker.rb`: and activates Container registry feature. | |
196 | + | |
197 | +```ruby | |
198 | +name 'gitlab-with-ssl-on-docker' | |
199 | +description 'GitLab with SSL on Docker' | |
200 | + | |
201 | +gitlab_cn = 'gitlab.io.example.com' | |
202 | +gitlab_https_port = '8443' | |
203 | +gitlab_ssh_port = '2022' | |
204 | +gitlab_registry_port = '5050' | |
205 | + | |
206 | +run_list( | |
207 | + 'recipe[ssl_cert::server_key_pairs]', | |
208 | + 'role[docker]', | |
209 | + 'recipe[gitlab-grid::docker-compose]', | |
210 | +) | |
211 | + | |
212 | +#env_run_lists() | |
213 | + | |
214 | +#default_attributes() | |
215 | + | |
216 | +override_attributes( | |
217 | + 'ssl_cert' => { | |
218 | + 'common_names' => [ | |
219 | + gitlab_cn, | |
220 | + ], | |
221 | + }, | |
222 | + 'gitlab-grid' => { | |
223 | + 'with_ssl_cert_cookbook' => true, | |
224 | + 'ssl_cert' => { | |
225 | + 'common_name' => gitlab_cn, | |
226 | + 'registry' => { | |
227 | + 'reuse_gitlab_common_name' => true, | |
228 | + # or | |
229 | + #'reuse_gitlab_common_name' => false, | |
230 | + #'common_name' => registry_gitlab_cn, | |
231 | + }, | |
232 | + }, | |
233 | + 'gitlab.rb' => { | |
234 | + 'external_url' => "https://#{gitlab_cn}:#{gitlab_https_port}", | |
235 | + 'registry_external_url' => "https://#{gitlab_cn}:#{gitlab_registry_port}", # Do not use 5000 if same domain (common name) | |
236 | + 'gitlab_rails' => { | |
237 | + 'time_zone' => 'Asia/Tokyo', | |
238 | + 'gitlab_shell_ssh_port' => gitlab_ssh_port.to_i, | |
239 | + }, | |
240 | + 'nginx' => { | |
241 | + 'redirect_http_to_https' => true, | |
242 | + }, | |
243 | + 'registry_nginx' => { | |
244 | + 'redirect_http_to_https' => true, | |
245 | + }, | |
246 | + }, | |
247 | + 'docker-compose' => { | |
248 | + 'config' => { | |
249 | + # Version 2 docker-compose format | |
250 | + 'version' => '2', | |
251 | + 'services' => { | |
252 | + 'gitlab' => { | |
253 | + 'restart' => 'always', | |
254 | + 'image' => 'gitlab/gitlab-ce:latest', | |
255 | + 'hostname' => gitlab_cn, | |
256 | + 'ports' => [ | |
257 | + "#{gitlab_https_port}:#{gitlab_https_port}", | |
258 | + "#{gitlab_registry_port}:#{gitlab_registry_port}", | |
259 | + "#{gitlab_ssh_port}:22", | |
260 | + ], | |
261 | + 'environment' => { | |
262 | + }, | |
263 | + #'volumes' => [ | |
264 | + #], | |
265 | + }, | |
266 | + }, | |
267 | + }, | |
268 | + }, | |
269 | + }, | |
270 | +) | |
271 | +``` | |
272 | + | |
139 | 273 | - `roles/gitlab-runner.rb` |
140 | 274 | |
141 | 275 | ```ruby |
@@ -191,17 +325,19 @@ See https://supermarket.chef.io/cookbooks/ssl_cert | ||
191 | 325 | - create vault items. |
192 | 326 | |
193 | 327 | ```text |
194 | -$ ruby -rjson -e 'puts JSON.generate({"private" => File.read("gitlab_io_example_com.prod.key")})' \ | |
195 | -> > ~/tmp/gitlab_io_example_com.prod.key.json | |
328 | +$ ruby -rjson -e 'puts JSON.generate({"private" => File.read("gitlab.io.example.com.prod.key")})' \ | |
329 | +> > ~/tmp/gitlab.io.example.com.prod.key.json | |
196 | 330 | |
197 | -$ knife vault create ssl_server_keys gitlab.io.example.com.prod \ | |
198 | -> --json ~/tmp/gitlab_io_example_com.prod.key.json | |
331 | +$ ruby -rjson -e 'puts JSON.generate({"public" => File.read("gitlab.io.example.com.prod.crt")})' \ | |
332 | +> > ~/tmp/gitlab.io.example.com.prod.crt.json | |
199 | 333 | |
200 | -$ ruby -rjson -e 'puts JSON.generate({"public" => File.read("gitlab_io_example_com.prod.crt")})' \ | |
201 | -> > ~/tmp/gitlab_io_example_com.prod.crt.json | |
334 | +$ cd $CHEF_REPO_PATH | |
335 | + | |
336 | +$ knife vault create ssl_server_keys gitlab.io.example.com.prod \ | |
337 | +> --json ~/tmp/gitlab.io.example.com.prod.key.json | |
202 | 338 | |
203 | 339 | $ knife vault create ssl_server_certs gitlab.io.example.com.prod \ |
204 | -> --json ~/tmp/gitlab_io_example_com.prod.crt.json | |
340 | +> --json ~/tmp/gitlab.io.example.com.prod.crt.json | |
205 | 341 | ``` |
206 | 342 | |
207 | 343 | - grant reference permission to the gitlab host |
@@ -1,10 +1,15 @@ | ||
1 | 1 | require 'rspec/core/rake_task' |
2 | 2 | require 'rubocop/rake_task' |
3 | 3 | require 'foodcritic' |
4 | +require 'stove/rake_task' | |
4 | 5 | |
5 | 6 | namespace :style do |
6 | 7 | desc 'Run Ruby style checks' |
7 | - RuboCop::RakeTask.new(:ruby) | |
8 | + RuboCop::RakeTask.new(:ruby) do |t| | |
9 | + t.options = [ | |
10 | + '--auto-gen-config', # creates .rubocop_todo.yml | |
11 | + ] | |
12 | + end | |
8 | 13 | |
9 | 14 | desc 'Run Chef style checks' |
10 | 15 | FoodCritic::Rake::LintTask.new(:chef) do |t| |
@@ -20,4 +25,17 @@ task style: ['style:chef', 'style:ruby'] | ||
20 | 25 | desc 'Run ChefSpec examples' |
21 | 26 | RSpec::Core::RakeTask.new(:spec) |
22 | 27 | |
28 | +desc 'Publish cookbook' | |
29 | +Stove::RakeTask.new(:publish) do |t| | |
30 | + t.stove_opts = [ | |
31 | + # `--username` and `--key` are set in ~/.stove typically. | |
32 | + #'--username', 'somebody', | |
33 | + #'--key', '~/chef/chef.io.example.com/somebody.pem', | |
34 | + #'--endpoint', 'https://supermarket.io.example.com/api/v1', # default: supermarket.chef.io | |
35 | + #'--no-ssl-verify', | |
36 | + '--no-git', | |
37 | + '--log-level', 'info', | |
38 | + ] | |
39 | +end | |
40 | + | |
23 | 41 | task default: ['style', 'spec'] |
@@ -0,0 +1,100 @@ | ||
1 | +--- | |
2 | +# $ fly -t target sp -p gitlab-grid-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml | |
3 | +resources: | |
4 | +- name: src-git | |
5 | + type: git | |
6 | + source: | |
7 | + uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git | |
8 | + branch: master | |
9 | + paths: | |
10 | + - cookbooks/((cookbook-name)) | |
11 | + private_key: ((git-private-key)) | |
12 | + git_user: ((git-user-osdn)) | |
13 | + #check_every: 1h # default: 1m | |
14 | +- name: chefdk-cache | |
15 | + type: docker-image | |
16 | + source: | |
17 | + repository: chef/chefdk | |
18 | + tag: ((chefdk-version)) | |
19 | + # ((param)) style: fly >= 3.2.0 | |
20 | + registry_mirror: https://((registry-mirror-domain)) # e.g. https://registry.docker.example.com:5000 | |
21 | + ca_certs: | |
22 | + - domain: ((registry-mirror-domain)) # e.g. registry.docker.example.com:5000 | |
23 | + cert: ((docker-reg-ca-cert)) | |
24 | + check_every: 12h # default: 1m | |
25 | + | |
26 | +jobs: | |
27 | +- name: test-cookbook | |
28 | + plan: | |
29 | + - aggregate: | |
30 | + - get: src-git | |
31 | + params: | |
32 | + depth: 5 | |
33 | + trigger: true | |
34 | + - get: chefdk-cache | |
35 | + - task: ci-build | |
36 | + image: chefdk-cache | |
37 | + params: | |
38 | + http_proxy: ((http-proxy)) # e.g. http://proxy.example.com:3128 | |
39 | + #HTTP_PROXY: ((http-proxy)) | |
40 | + config: | |
41 | + platform: linux | |
42 | + #image_resource: | |
43 | + # type: docker-image | |
44 | + # source: | |
45 | + # repository: chef/chefdk | |
46 | + # tag: ((chefdk-version)) | |
47 | + # NG, setting disable | |
48 | + #registry_mirror: https://((registry-mirror-domain)) | |
49 | + #ca_certs: | |
50 | + #- domain: ((registry-mirror-domain)) | |
51 | + # cert: ((docker-reg-ca-cert)) | |
52 | + inputs: | |
53 | + - name: src-git | |
54 | + run: | |
55 | + #dir: ./src-git/cookbooks/((cookbook-name)) | |
56 | + #path: rake | |
57 | + path: /bin/bash | |
58 | + args: | |
59 | + - -c | |
60 | + - | | |
61 | + cd ./src-git/cookbooks/((cookbook-name)) | |
62 | + bundle install | |
63 | + rake | |
64 | +- name: publish-cookbook | |
65 | + plan: | |
66 | + - aggregate: | |
67 | + - get: src-git | |
68 | + params: | |
69 | + depth: 5 | |
70 | + trigger: false | |
71 | + passed: [test-cookbook] | |
72 | + - get: chefdk-cache | |
73 | + passed: [test-cookbook] | |
74 | + - task: publish | |
75 | + image: chefdk-cache | |
76 | + params: | |
77 | + http_proxy: ((http-proxy)) | |
78 | + chef_username: ((chef-username)) | |
79 | + chef_client_key: ((chef-client-key)) | |
80 | + config: | |
81 | + platform: linux | |
82 | + inputs: | |
83 | + - name: src-git | |
84 | + run: | |
85 | + path: /bin/bash | |
86 | + args: | |
87 | + - -c | |
88 | + - | | |
89 | + echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove | |
90 | + echo "$chef_client_key" > /root/chef-client-key.pem | |
91 | + cd ./src-git/cookbooks/((cookbook-name)) | |
92 | + bundle install | |
93 | + rake publish | |
94 | + - put: src-git | |
95 | + params: | |
96 | + repository: src-git | |
97 | + tag_prefix: ((cookbook-name))- | |
98 | + tag: src-git/cookbooks/((cookbook-name))/version | |
99 | + only_tag: true | |
100 | + annotate: ../src-git/cookbooks/((cookbook-name))/version |
@@ -0,0 +1,3 @@ | ||
1 | +--- | |
2 | +cookbook-name: gitlab-grid | |
3 | +chefdk-version: 1.4.3 |
@@ -5,12 +5,13 @@ maintainer_email '' | ||
5 | 5 | license 'Apache 2.0' |
6 | 6 | description 'Installs/Configures gitlab-grid' |
7 | 7 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
8 | -version '0.1.2' | |
8 | +version IO.read(File.join(File.dirname(__FILE__), 'version')).chomp | |
9 | 9 | source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git' |
10 | 10 | issues_url 'https://osdn.jp/projects/metasearch/ticket' |
11 | 11 | |
12 | +chef_version '>= 12' | |
12 | 13 | supports 'ubuntu', '>= 16.04' |
13 | -%w( centos redhat ).each do |os| | |
14 | +%w(centos redhat).each do |os| | |
14 | 15 | supports os, '>= 7.3' |
15 | 16 | end |
16 | 17 |
@@ -17,9 +17,9 @@ | ||
17 | 17 | # limitations under the License. |
18 | 18 | # |
19 | 19 | |
20 | -config = node['gitlab-grid']['gitlab.rb'] | |
21 | -#override_config = node.override['gitlab-grid']['gitlab.rb'] | |
22 | -force_override_config = node.force_override['gitlab-grid']['gitlab.rb'] | |
20 | +gitlab_rb = node['gitlab-grid']['gitlab.rb'] | |
21 | +#override_gitlab_rb = node.override['gitlab-grid']['gitlab.rb'] | |
22 | +force_override_gitlab_rb = node.force_override['gitlab-grid']['gitlab.rb'] | |
23 | 23 | |
24 | 24 | if node['gitlab-grid']['with_ssl_cert_cookbook'] |
25 | 25 | ::Chef::Recipe.send(:include, SSLCert::Helper) |
@@ -27,13 +27,13 @@ if node['gitlab-grid']['with_ssl_cert_cookbook'] | ||
27 | 27 | cn = node['gitlab-grid']['ssl_cert']['common_name'] |
28 | 28 | cert_path = server_cert_path(cn) |
29 | 29 | key_path = server_key_path(cn) |
30 | - force_override_config['external_url'] = config['external_url'].gsub('http://', 'https://') | |
31 | - force_override_config['nginx']['ssl_certificate'] = cert_path | |
32 | - force_override_config['nginx']['ssl_certificate_key'] = key_path | |
30 | + force_override_gitlab_rb['external_url'] = gitlab_rb['external_url'].gsub('http://', 'https://') | |
31 | + force_override_gitlab_rb['nginx']['ssl_certificate'] = cert_path | |
32 | + force_override_gitlab_rb['nginx']['ssl_certificate_key'] = key_path | |
33 | 33 | |
34 | 34 | # GitLab Container Registry |
35 | - unless config['registry_external_url'].nil? | |
36 | - force_override_config['registry_external_url'] = config['registry_external_url'].gsub('http://', 'https://') | |
35 | + unless gitlab_rb['registry_external_url'].nil? | |
36 | + force_override_gitlab_rb['registry_external_url'] = gitlab_rb['registry_external_url'].gsub('http://', 'https://') | |
37 | 37 | end |
38 | 38 | |
39 | 39 | reg_cert_path = nil |
@@ -49,6 +49,6 @@ if node['gitlab-grid']['with_ssl_cert_cookbook'] | ||
49 | 49 | end |
50 | 50 | end |
51 | 51 | |
52 | - force_override_config['registry_nginx']['ssl_certificate'] = reg_cert_path unless reg_cert_path.nil? | |
53 | - force_override_config['registry_nginx']['ssl_certificate_key'] = reg_key_path unless reg_key_path.nil? | |
52 | + force_override_gitlab_rb['registry_nginx']['ssl_certificate'] = reg_cert_path unless reg_cert_path.nil? | |
53 | + force_override_gitlab_rb['registry_nginx']['ssl_certificate_key'] = reg_key_path unless reg_key_path.nil? | |
54 | 54 | end |
@@ -22,18 +22,48 @@ doc_url = 'https://docs.gitlab.com/omnibus/docker/README.html' | ||
22 | 22 | include_recipe 'docker-grid::compose' |
23 | 23 | include_recipe 'gitlab-grid::commons' |
24 | 24 | |
25 | +#gitlab_rb = node['gitlab-grid']['gitlab.rb'] | |
26 | +#override_gitlab_rb = node.override['gitlab-grid']['gitlab.rb'] | |
27 | +force_override_gitlab_rb = node.force_override['gitlab-grid']['gitlab.rb'] | |
28 | + | |
25 | 29 | config = node['gitlab-grid']['docker-compose']['config'] |
26 | 30 | override_config = node.override['gitlab-grid']['docker-compose']['config'] |
27 | 31 | force_override_config = node.force_override['gitlab-grid']['docker-compose']['config'] |
32 | + | |
28 | 33 | app_dir = node['gitlab-grid']['docker-compose']['app_dir'] |
29 | 34 | etc_dir = node['gitlab-grid']['docker-compose']['etc_dir'] |
30 | 35 | logs_dir = node['gitlab-grid']['docker-compose']['logs_dir'] |
31 | 36 | data_dir = node['gitlab-grid']['docker-compose']['data_dir'] |
32 | -#certs_dir = "#{app_dir}/certs" | |
33 | 37 | |
34 | 38 | envs = {} |
35 | 39 | vols = config['services']['gitlab']['volumes'].to_a |
36 | 40 | |
41 | +if node['gitlab-grid']['with_ssl_cert_cookbook'] | |
42 | + # GitLab | |
43 | + # These paths are already set in the `gitlab-grid::commons` recipe. | |
44 | + cert_path = force_override_gitlab_rb['nginx']['ssl_certificate'] | |
45 | + key_path = force_override_gitlab_rb['nginx']['ssl_certificate_key'] | |
46 | + | |
47 | + vols.push("#{cert_path}:/etc/gitlab/server.crt:ro") | |
48 | + vols.push("#{key_path}:/etc/gitlab/server.key:ro") | |
49 | + force_override_gitlab_rb['nginx']['ssl_certificate'] = '/etc/gitlab/server.crt' | |
50 | + force_override_gitlab_rb['nginx']['ssl_certificate_key'] = '/etc/gitlab/server.key' | |
51 | + | |
52 | + # GitLab Container Registry | |
53 | + # These paths are already set in the `gitlab-grid::commons` recipe. | |
54 | + reg_cert_path = force_override_gitlab_rb['registry_nginx']['ssl_certificate'] | |
55 | + reg_key_path = force_override_gitlab_rb['registry_nginx']['ssl_certificate_key'] | |
56 | + | |
57 | + unless reg_cert_path.nil? | |
58 | + vols.push("#{reg_cert_path}:/etc/gitlab/reg_server.crt:ro") | |
59 | + force_override_gitlab_rb['registry_nginx']['ssl_certificate'] = '/etc/gitlab/reg_server.crt' | |
60 | + end | |
61 | + unless reg_key_path.nil? | |
62 | + vols.push("#{reg_key_path}:/etc/gitlab/reg_server.key:ro") | |
63 | + force_override_gitlab_rb['registry_nginx']['ssl_certificate_key'] = '/etc/gitlab/reg_server.key' | |
64 | + end | |
65 | +end | |
66 | + | |
37 | 67 | [ |
38 | 68 | app_dir, |
39 | 69 | data_dir, |
@@ -58,23 +88,24 @@ vols = config['services']['gitlab']['volumes'].to_a | ||
58 | 88 | end |
59 | 89 | } |
60 | 90 | |
61 | -override_config['services']['gitlab']['ports'] = [ | |
62 | - '80:80', | |
63 | - '443:443', | |
64 | - '22:22', | |
65 | -] if config['services']['gitlab']['ports'].empty? | |
66 | - | |
67 | -=begin | |
68 | -if node['gitlab-grid']['with_ssl_cert_cookbook'] | |
69 | - ::Chef::Recipe.send(:include, SSLCert::Helper) | |
70 | - cn = node['gitlab-grid']['ssl_cert']['common_name'] | |
71 | - # TODO: support | |
91 | +if config['services']['gitlab']['ports'].empty? | |
92 | + override_config['services']['gitlab']['ports'] = [ | |
93 | + '80:80', | |
94 | + '443:443', | |
95 | + '22:22', | |
96 | + ] | |
72 | 97 | end |
73 | -=end | |
74 | 98 | |
75 | 99 | force_override_config['services']['gitlab']['environment'] = envs unless envs.empty? |
76 | 100 | override_config['services']['gitlab']['volumes'] = vols unless vols.empty? |
77 | 101 | |
102 | +template "#{etc_dir}/gitlab.rb" do | |
103 | + source 'etc/gitlab/gitlab.rb' | |
104 | + owner 'root' | |
105 | + group 'root' | |
106 | + mode '0644' | |
107 | +end | |
108 | + | |
78 | 109 | [ |
79 | 110 | 'docker-compose.yml', |
80 | 111 | ].each {|conf_file| |
@@ -1,7 +1,7 @@ | ||
1 | 1 | <% |
2 | 2 | config = node['gitlab-grid']['docker-compose']['config'].to_hash |
3 | -gitlab_rb = render('etc/gitlab/gitlab.rb').force_encoding("UTF-8") | |
4 | -config['services']['gitlab']['environment']['GITLAB_OMNIBUS_CONFIG'] = gitlab_rb | |
3 | +#gitlab_rb = render('etc/gitlab/gitlab.rb').force_encoding("UTF-8") | |
4 | +#config['services']['gitlab']['environment']['GITLAB_OMNIBUS_CONFIG'] = gitlab_rb | |
5 | 5 | |
6 | 6 | require 'yaml' |
7 | 7 | yaml_str = config.to_yaml |
@@ -0,0 +1 @@ | ||
1 | +0.1.3 |
@@ -0,0 +1,5 @@ | ||
1 | +{ | |
2 | + "run_list": [ | |
3 | + "role[gitlab-on-docker]" | |
4 | + ] | |
5 | +} |
@@ -0,0 +1,48 @@ | ||
1 | +name 'gitlab-on-docker' | |
2 | +description 'GitLab on Docker' | |
3 | + | |
4 | +gitlab_cn = 'gitlab.io.example.com' | |
5 | +gitlab_http_port = '8080' | |
6 | +gitlab_ssh_port = '2022' | |
7 | + | |
8 | +run_list( | |
9 | + 'role[docker]', | |
10 | + 'recipe[gitlab-grid::docker-compose]', | |
11 | +) | |
12 | + | |
13 | +#env_run_lists() | |
14 | + | |
15 | +#default_attributes() | |
16 | + | |
17 | +override_attributes( | |
18 | + 'gitlab-grid' => { | |
19 | + 'gitlab.rb' => { | |
20 | + 'external_url' => "http://#{gitlab_cn}:#{gitlab_http_port}", | |
21 | + 'gitlab_rails' => { | |
22 | + 'time_zone' => 'UTC', | |
23 | + #'time_zone' => 'Asia/Tokyo', | |
24 | + 'gitlab_shell_ssh_port' => gitlab_ssh_port.to_i, | |
25 | + }, | |
26 | + 'nginx' => { | |
27 | + 'redirect_http_to_https' => false, | |
28 | + }, | |
29 | + }, | |
30 | + 'docker-compose' => { | |
31 | + 'config' => { | |
32 | + # Version 2 docker-compose format | |
33 | + 'version' => '2', | |
34 | + 'services' => { | |
35 | + 'gitlab' => { | |
36 | + 'restart' => 'always', | |
37 | + 'image' => 'gitlab/gitlab-ce:latest', | |
38 | + 'hostname' => gitlab_cn, | |
39 | + 'ports' => [ | |
40 | + "#{gitlab_http_port}:#{gitlab_http_port}", | |
41 | + "#{gitlab_ssh_port}:22", | |
42 | + ], | |
43 | + }, | |
44 | + }, | |
45 | + }, | |
46 | + }, | |
47 | + }, | |
48 | +) |