Commit 112cfd2862248e9d85b043f3f626ffe4485534c4
1 parent
06a8d950
Exists in
master
and in
17 other branches
Import unicorn_config defintion from chef-server
Path files/chef-server-cookbooks/chef-server/definitions/unicorn_config.rb Repo https://github.com/opscode/omnibus-chef-server.git Revision 6a11fd840045a7ae7961e5a37439371b7407f3e9
Showing
1 changed file
with
45 additions
and
0 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/definitions/unicorn_config.rb
0 → 100644
| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | +# | |
| 2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | |
| 3 | +# License:: Apache License, Version 2.0 | |
| 4 | +# | |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | +# you may not use this file except in compliance with the License. | |
| 7 | +# You may obtain a copy of the License at | |
| 8 | +# | |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | +# | |
| 11 | +# Unless required by applicable law or agreed to in writing, software | |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | +# See the License for the specific language governing permissions and | |
| 15 | +# limitations under the License. | |
| 16 | +# | |
| 17 | + | |
| 18 | +define :unicorn_config, :listen => nil, :working_directory => nil, :worker_timeout => 60, :preload_app => false, :worker_processes => 4, :before_fork => nil, :after_fork => nil, :pid => nil, :stderr_path => nil, :stdout_path => nil, :notifies => nil, :owner => nil, :group => nil, :mode => nil do | |
| 19 | + config_dir = File.dirname(params[:name]) | |
| 20 | + | |
| 21 | + directory config_dir do | |
| 22 | + recursive true | |
| 23 | + action :create | |
| 24 | + end | |
| 25 | + | |
| 26 | + tvars = params.clone | |
| 27 | + params[:listen].each do |port, options| | |
| 28 | + oarray = Array.new | |
| 29 | + options.each do |k, v| | |
| 30 | + oarray << ":#{k} => #{v}" | |
| 31 | + end | |
| 32 | + tvars[:listen][port] = oarray.join(", ") | |
| 33 | + end | |
| 34 | + | |
| 35 | + template params[:name] do | |
| 36 | + source "unicorn.rb.erb" | |
| 37 | + mode "0644" | |
| 38 | + owner params[:owner] if params[:owner] | |
| 39 | + group params[:group] if params[:group] | |
| 40 | + mode params[:mode] if params[:mode] | |
| 41 | + variables params | |
| 42 | + notifies *params[:notifies] if params[:notifies] | |
| 43 | + end | |
| 44 | + | |
| 45 | +end | ... | ... |