Commit 9d9cb8bf1e095528efab376461b941dc8d0f409e
Exists in
master
and in
13 other branches
Merge branch 'update/runit_and_omnibus_ctl' into 'master'
Update Runit and omnibus-ctl
Showing
2 changed files
with
1 additions
and
117 deletions
Show diff stats
Gemfile.lock
config/software/runit.rb
| ... | ... | @@ -1,116 +0,0 @@ |
| 1 | -# | |
| 2 | -# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc. | |
| 3 | -# Copyright:: Copyright (c) 2014 GitLab.com | |
| 4 | -# License:: Apache License, Version 2.0 | |
| 5 | -# | |
| 6 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
| 7 | -# you may not use this file except in compliance with the License. | |
| 8 | -# You may obtain a copy of the License at | |
| 9 | -# | |
| 10 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | -# | |
| 12 | -# Unless required by applicable law or agreed to in writing, software | |
| 13 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
| 14 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 15 | -# See the License for the specific language governing permissions and | |
| 16 | -# limitations under the License. | |
| 17 | -# | |
| 18 | - | |
| 19 | -name "runit" | |
| 20 | -default_version "2.1.1" | |
| 21 | - | |
| 22 | -source :url => "http://smarden.org/runit/runit-2.1.1.tar.gz", | |
| 23 | - :md5 => "8fa53ea8f71d88da9503f62793336bc3" | |
| 24 | - | |
| 25 | -relative_path "admin" | |
| 26 | - | |
| 27 | -working_dir = "#{project_dir}/runit-2.1.1" | |
| 28 | - | |
| 29 | -build do | |
| 30 | - # put runit where we want it, not where they tell us to | |
| 31 | - command 'sed -i -e "s/^char\ \*varservice\ \=\"\/service\/\";$/char\ \*varservice\ \=\"' + project.install_path.gsub("/", "\\/") + '\/service\/\";/" src/sv.c', :cwd => working_dir | |
| 32 | - # TODO: the following is not idempotent | |
| 33 | - command "sed -i -e s:-static:: src/Makefile", :cwd => working_dir | |
| 34 | - | |
| 35 | - # build it | |
| 36 | - command "make", :cwd => "#{working_dir}/src" | |
| 37 | - command "make check", :cwd => "#{working_dir}/src" | |
| 38 | - | |
| 39 | - # move it | |
| 40 | - command "mkdir -p #{install_dir}/embedded/bin" | |
| 41 | - ["src/chpst", | |
| 42 | - "src/runit", | |
| 43 | - "src/runit-init", | |
| 44 | - "src/runsv", | |
| 45 | - "src/runsvchdir", | |
| 46 | - "src/runsvdir", | |
| 47 | - "src/sv", | |
| 48 | - "src/svlogd", | |
| 49 | - "src/utmpset"].each do |bin| | |
| 50 | - command "cp #{bin} #{install_dir}/embedded/bin", :cwd => working_dir | |
| 51 | - end | |
| 52 | - | |
| 53 | - block do | |
| 54 | - install_path = self.project.install_path | |
| 55 | - open("#{install_dir}/embedded/bin/runsvdir-start", "w") do |file| | |
| 56 | - file.print <<-EOH | |
| 57 | -#!/bin/bash | |
| 58 | -# | |
| 59 | -# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc. | |
| 60 | -# License:: Apache License, Version 2.0 | |
| 61 | -# | |
| 62 | -# Licensed under the Apache License, Version 2.0 (the "License"); | |
| 63 | -# you may not use this file except in compliance with the License. | |
| 64 | -# You may obtain a copy of the License at | |
| 65 | -# | |
| 66 | -# http://www.apache.org/licenses/LICENSE-2.0 | |
| 67 | -# | |
| 68 | -# Unless required by applicable law or agreed to in writing, software | |
| 69 | -# distributed under the License is distributed on an "AS IS" BASIS, | |
| 70 | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 71 | -# See the License for the specific language governing permissions and | |
| 72 | -# limitations under the License. | |
| 73 | -# | |
| 74 | - | |
| 75 | -PATH=#{install_path}/bin:#{install_path}/embedded/bin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin | |
| 76 | - | |
| 77 | -# enforce our own ulimits | |
| 78 | - | |
| 79 | -ulimit -c 0 | |
| 80 | -ulimit -d unlimited | |
| 81 | -ulimit -e 0 | |
| 82 | -ulimit -f unlimited | |
| 83 | -ulimit -i 62793 | |
| 84 | -ulimit -l 64 | |
| 85 | -ulimit -m unlimited | |
| 86 | -# WARNING: increasing the global file descriptor limit increases RAM consumption on startup dramatically | |
| 87 | -ulimit -n 50000 | |
| 88 | -ulimit -q 819200 | |
| 89 | -ulimit -r 0 | |
| 90 | -ulimit -s 10240 | |
| 91 | -ulimit -t unlimited | |
| 92 | -ulimit -u unlimited | |
| 93 | -ulimit -v unlimited | |
| 94 | -ulimit -x unlimited | |
| 95 | -echo "1000000" > /proc/sys/fs/file-max | |
| 96 | - | |
| 97 | -# and our ulimit | |
| 98 | - | |
| 99 | -umask 022 | |
| 100 | - | |
| 101 | -exec env - PATH=$PATH \ | |
| 102 | -runsvdir -P #{install_path}/service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' | |
| 103 | - EOH | |
| 104 | - end | |
| 105 | - end | |
| 106 | - | |
| 107 | - command "chmod 755 #{install_dir}/embedded/bin/runsvdir-start" | |
| 108 | - | |
| 109 | - # set up service directories | |
| 110 | - ["#{install_dir}/service", | |
| 111 | - "#{install_dir}/sv", | |
| 112 | - "#{install_dir}/init"].each do |dir| | |
| 113 | - command "mkdir -p #{dir}" | |
| 114 | - command "touch #{dir}/.gitkeep" | |
| 115 | - end | |
| 116 | -end |