Commit 4218116e21aefc7b334b7cbc6a206cdb5b35701d

Authored by Jacob Vosmaer
2 parents 43feccad e5409c91

Merge branch 'master' of gitlab.com:gitlab-org/omnibus-gitlab into 6-6-pre

- Fix issue where Unicorn was not getting restarted by `gitlab-ctl reconfigure`
- Support for external_url configuration setting
- Faster Ruby source downloads
@@ -5,7 +5,10 @@ GitLab! @@ -5,7 +5,10 @@ GitLab!
5 5
6 ## Installation 6 ## Installation
7 7
8 -### Ubuntu 8 +After the steps below your GitLab instance should reachable over HTTP,
  9 +and have an admin user with username `root` and password `5iveL!fe`.
  10 +
  11 +### Ubuntu 12.04
9 12
10 ``` 13 ```
11 sudo apt-get install openssh-server 14 sudo apt-get install openssh-server
@@ -14,194 +17,85 @@ sudo dpkg -i gitlab-x.y.z.deb # this is the .deb you downloaded @@ -14,194 +17,85 @@ sudo dpkg -i gitlab-x.y.z.deb # this is the .deb you downloaded
14 sudo gitlab-ctl reconfigure 17 sudo gitlab-ctl reconfigure
15 ``` 18 ```
16 19
17 -## How to manage an Omnibus-installed GitLab  
18 -  
19 -### Administrative commands  
20 -  
21 -You can make configuration changes by editing `/etc/gitlab/gitlab.rb` and  
22 -`/etc/gitlab/gitlab-secrets.json`, followed by running 20 +### CentOS 6.5
23 21
24 ``` 22 ```
  23 +sudo yum install openssh-server
  24 +sudo yum install postfix # sendmail or exim is also OK
  25 +sudo rpm -i gitlab-x.y.z.rpm
25 sudo gitlab-ctl reconfigure 26 sudo gitlab-ctl reconfigure
  27 +# Open up the firewall for HTTP and SSH
  28 +sudo lokkit -s http -s ssh
26 ``` 29 ```
27 30
28 -To start/stop a component of GitLab run e.g.  
29 -`sudo gitlab-ctl stop sidekiq`. To permanently disable e.g. Sidekiq, add  
30 -`sidekiq['enable'] = false` to `/etc/gitlab/gitlab.rb`, and run  
31 -`sudo gitlab-ctl reconfigure` for the change to take effect.  
32 -  
33 -To invoke a GitLab rake task, use `gitlab-rake`. For example:  
34 -  
35 -```  
36 -sudo gitlab-rake gitlab:backup:create  
37 -```  
38 -  
39 -There is no need to change the user or the `RAILS_ENV` environment variable;  
40 -this is taken care of by the `gitlab-rake` wrapper script.  
41 -  
42 -### Directory structure  
43 -  
44 -Omnibus-gitlab uses four different directories.  
45 -  
46 -- `/opt/gitlab` holds application code for GitLab and its dependencies.  
47 -- `/var/opt/gitlab` holds application data and configuration files that  
48 - `gitlab-ctl reconfigure` writes too.  
49 -- `/etc/gitlab` holds configuration files for omnibus-gitlab. These are  
50 - the only files that you should ever have to edit manually.  
51 -- `/var/log/gitlab` contains all log data generated by components of  
52 - omnibus-gitlab.  
53 -  
54 -## Preparing a build environment  
55 -  
56 -To create builds you will need a build user (`omnibus-build:omnibus-build` in our example).  
57 -Preparing the build machine requires sudo access.  
58 -  
59 -### Ubuntu 12.04 31 +## How to manage an Omnibus-installed GitLab
60 32
61 -```shell  
62 -# Install dependencies  
63 -sudo apt-get install ruby1.9.1 ruby1.9.1-dev git build-essential  
64 -sudo gem install --no-ri --no-rdoc bundler  
65 -  
66 -# Create build directories for use by the build user  
67 -sudo mkdir -p /opt/gitlab /var/cache/omnibus  
68 -# We assume the build user and group is 'omnibus-build'  
69 -sudo chown omnibus-build:omnibus-build /opt/gitlab /var/cache/omnibus  
70 -``` 33 +### Start/stop GitLab
71 34
72 -Then, as the build user (omnibus-build): 35 +You can start, stop or restart GitLab and all of its components with the
  36 +following commands.
73 37
74 ```shell 38 ```shell
75 -# Clone the omnibus repo  
76 -git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git 39 +# Start all GitLab components
  40 +sudo gitlab-ctl start
77 41
78 -# Install gem dependencies for omnibus-ruby  
79 -cd omnibus-gitlab  
80 -bundle install --path .bundle --binstubs 42 +# Stop all GitLab components
  43 +sudo gitlab-ctl stop
81 44
82 -# Do a build (and take a break from the computer)  
83 -bin/omnibus build project gitlab 45 +# Restart all GitLab components
  46 +sudo gitlab-ctl restart
84 ``` 47 ```
85 48
86 -### Centos 6.5 49 +It is also possible to start, stop or restart individual components.
87 50
88 ```shell 51 ```shell
89 -sudo yum groupinstall 'Development Tools'  
90 -# Install RedHat Software Collections to get Ruby 1.9.3  
91 -sudo yum install centos-release-SCL  
92 -sudo yum install ruby193 ruby193-ruby-devel  
93 -  
94 -# Create build directories for use by the build user  
95 -sudo mkdir -p /opt/gitlab /var/cache/omnibus  
96 -# We assume the build user and group is 'omnibus-build'  
97 -sudo chown omnibus-build:omnibus-build /opt/gitlab /var/cache/omnibus 52 +sudo gitlab-ctl restart unicorn
98 ``` 53 ```
99 54
100 -As the build user (omnibus-build): 55 +### Creating the gitlab.rb configuration file
101 56
102 ```shell 57 ```shell
103 -# Enable Ruby 1.9.3 from Software Collections  
104 -echo 'exec scl enable ruby193 bash' >> .bash_profile  
105 -# Start a new login shell so we do not have to log out and in  
106 -# this one time  
107 -bash --login  
108 -  
109 -# Clone the omnibus repo  
110 -git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git  
111 -  
112 -# Install gem dependencies for omnibus-ruby  
113 -cd omnibus-gitlab  
114 -bundle install --path .bundle --binstubs  
115 -  
116 -# Do a build (and take a break from the computer)  
117 -bin/omnibus build project gitlab 58 +sudo mkdir -p /etc/gitlab
  59 +sudo touch /etc/gitlab/gitlab.rb
  60 +sudo chmod 600 /etc/gitlab/gitlab.rb
118 ``` 61 ```
119 62
120 -## Usage  
121 -  
122 -### Build 63 +### Configuring the external URL for GitLab
123 64
124 -You create a platform-specific package using the `build project` command: 65 +In order for GitLab to display correct repository clone links to your users
  66 +it needs to know the URL under which it is reached by your users, e.g.
  67 +`http://gitlab.example.com`. Add the following line to `/etc/gitlab/gitlab.rb`:
125 68
126 -```shell  
127 -$ bin/omnibus build project gitlab  
128 -```  
129 -  
130 -The platform/architecture type of the package created will match the platform  
131 -where the `build project` command is invoked. So running this command on say a  
132 -MacBook Pro will generate a Mac OS X specific package. After the build  
133 -completes packages will be available in `pkg/`.  
134 -  
135 -### Clean  
136 -  
137 -You can clean up all temporary files generated during the build process with  
138 -the `clean` command:  
139 -  
140 -```shell  
141 -$ bin/omnibus clean 69 +```ruby
  70 +external_url "http://gitlab.example.com"
142 ``` 71 ```
143 72
144 -Adding the `--purge` purge option removes __ALL__ files generated during the  
145 -build including the project install directory (`/opt/gitlab`) and  
146 -the package cache directory (`/var/cache/omnibus/pkg`):  
147 -  
148 -```shell  
149 -$ bin/omnibus clean --purge  
150 -``` 73 +Run `sudo gitlab-ctl reconfigure` for the change to take effect.
151 74
152 -### Help 75 +### Invoking Rake tasks
153 76
154 -Full help for the Omnibus command line interface can be accessed with the  
155 -`help` command: 77 +To invoke a GitLab Rake task, use `gitlab-rake`. For example:
156 78
157 ```shell 79 ```shell
158 -$ bin/omnibus help 80 +sudo gitlab-rake gitlab:backup:create
159 ``` 81 ```
160 82
161 -## Vagrant-based Virtualized Build Lab  
162 -  
163 -Every Omnibus project ships will a project-specific  
164 -[Berksfile](http://berkshelf.com/) and [Vagrantfile](http://www.vagrantup.com/)  
165 -that will allow you to build your projects on the following platforms:  
166 -  
167 -* CentOS 5 64-bit  
168 -* CentOS 6 64-bit  
169 -* Ubuntu 10.04 64-bit  
170 -* Ubuntu 11.04 64-bit  
171 -* Ubuntu 12.04 64-bit  
172 -  
173 -Please note this build-lab is only meant to get you up and running quickly;  
174 -there's nothing inherent in Omnibus that restricts you to just building CentOS  
175 -or Ubuntu packages. See the Vagrantfile to add new platforms to your build lab.  
176 -  
177 -The only requirements for standing up this virtualized build lab are:  
178 -  
179 -* VirtualBox - native packages exist for most platforms and can be downloaded  
180 -from the [VirtualBox downloads page](https://www.virtualbox.org/wiki/Downloads).  
181 -* Vagrant 1.2.1+ - native packages exist for most platforms and can be downloaded  
182 -from the [Vagrant downloads page](http://downloads.vagrantup.com/). 83 +Contrary to with a traditional GitLab installation, there is no need to change
  84 +the user or the `RAILS_ENV` environment variable; this is taken care of by the
  85 +`gitlab-rake` wrapper script.
183 86
184 -The [vagrant-berkshelf](https://github.com/RiotGames/vagrant-berkshelf) and  
185 -[vagrant-omnibus](https://github.com/schisamo/vagrant-omnibus) Vagrant plugins  
186 -are also required and can be installed easily with the following commands:  
187 -  
188 -```shell  
189 -$ vagrant plugin install vagrant-berkshelf  
190 -$ vagrant plugin install vagrant-omnibus  
191 -```  
192 -  
193 -Once the pre-requisites are installed you can build your package across all  
194 -platforms with the following command: 87 +### Directory structure
195 88
196 -```shell  
197 -$ vagrant up  
198 -``` 89 +Omnibus-gitlab uses four different directories.
199 90
200 -If you would like to build a package for a single platform the command looks like this: 91 +- `/opt/gitlab` holds application code for GitLab and its dependencies.
  92 +- `/var/opt/gitlab` holds application data and configuration files that
  93 + `gitlab-ctl reconfigure` writes to.
  94 +- `/etc/gitlab` holds configuration files for omnibus-gitlab. These are
  95 + the only files that you should ever have to edit manually.
  96 +- `/var/log/gitlab` contains all log data generated by components of
  97 + omnibus-gitlab.
201 98
202 -```shell  
203 -$ vagrant up PLATFORM  
204 -``` 99 +## Building your own package
205 100
206 -The complete list of valid platform names can be viewed with the  
207 -`vagrant status` command. 101 +See [the separate build documentation](doc/build.md).
config/software/ruby.rb 0 → 100644
@@ -0,0 +1,158 @@ @@ -0,0 +1,158 @@
  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 +name "ruby"
  19 +version "1.9.3-p484"
  20 +
  21 +dependency "zlib"
  22 +dependency "ncurses"
  23 +dependency "libedit"
  24 +dependency "openssl"
  25 +dependency "libyaml"
  26 +dependency "libiconv"
  27 +dependency "gdbm" if (platform == "mac_os_x" or platform == "freebsd" or platform == "aix")
  28 +dependency "libgcc" if (platform == "solaris2" and Omnibus.config.solaris_compiler == "gcc")
  29 +
  30 +source :url => "http://cache.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
  31 + :md5 => '8ac0dee72fe12d75c8b2d0ef5d0c2968'
  32 +
  33 +relative_path "ruby-#{version}"
  34 +
  35 +env =
  36 + case platform
  37 + when "mac_os_x"
  38 + {
  39 + "CFLAGS" => "-arch x86_64 -m64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses -O3 -g -pipe",
  40 + "LDFLAGS" => "-arch x86_64 -R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses"
  41 + }
  42 + when "solaris2"
  43 + if Omnibus.config.solaris_compiler == "studio"
  44 + {
  45 + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
  46 + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include"
  47 + }
  48 + elsif Omnibus.config.solaris_compiler == "gcc"
  49 + {
  50 + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -O3 -g -pipe",
  51 + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -static-libgcc",
  52 + "LD_OPTIONS" => "-R#{install_dir}/embedded/lib"
  53 + }
  54 + else
  55 + raise "Sorry, #{Omnibus.config.solaris_compiler} is not a valid compiler selection."
  56 + end
  57 + when "aix"
  58 + {
  59 + # see http://www.ibm.com/developerworks/aix/library/au-gnu.html
  60 + #
  61 + # specifically:
  62 + #
  63 + # "To use AIX run-time linking, you should create the shared object
  64 + # using gcc -shared -Wl,-G and create executables using the library
  65 + # by adding the -Wl,-brtl option to the link line. Technically, you
  66 + # can leave off the -shared option, but it does no harm and reduces
  67 + # confusion."
  68 + #
  69 + # AIX also uses -Wl,-blibpath instead of -R or LD_RUN_PATH, but the
  70 + # option is not additive, so requires /usr/lib and /lib as well (there
  71 + # is a -bsvr4 option to allow ld to take an -R flag in addition
  72 + # to turning on -brtl, but it had other side effects I couldn't fix).
  73 + #
  74 + # If libraries linked with gcc -shared have symbol resolution failures
  75 + # then it may be useful to add -bexpfull to export all symbols.
  76 + #
  77 + # -O2 optimized away some configure test which caused ext libs to fail
  78 + #
  79 + # We also need prezl's M4 instead of picking up /usr/bin/m4 which
  80 + # barfs on ruby.
  81 + #
  82 + "CC" => "xlc -q64",
  83 + "CXX" => "xlC -q64",
  84 + "LD" => "ld -b64",
  85 + "CFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include",
  86 + "CXXFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include",
  87 + "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-brtl -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
  88 + "OBJECT_MODE" => "64",
  89 + "ARFLAGS" => "-X64 cru",
  90 + "M4" => "/opt/freeware/bin/m4",
  91 + "warnflags" => "-qinfo=por"
  92 + }
  93 + else
  94 + {
  95 + "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -g -pipe",
  96 + "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib"
  97 + }
  98 + end
  99 +
  100 +build do
  101 + configure_command = ["./configure",
  102 + "--prefix=#{install_dir}/embedded",
  103 + "--with-out-ext=fiddle",
  104 + "--enable-shared",
  105 + "--enable-libedit",
  106 + "--with-ext=psych",
  107 + "--disable-install-doc"]
  108 +
  109 + case platform
  110 + when "aix"
  111 + patch :source => "ruby-aix-configure.patch", :plevel => 1
  112 + patch :source => "ruby_aix_1_9_3_448_ssl_EAGAIN.patch", :plevel => 1
  113 + # --with-opt-dir causes ruby to send bogus commands to the AIX linker
  114 + when "freebsd"
  115 + configure_command << "--without-execinfo"
  116 + configure_command << "--with-opt-dir=#{install_dir}/embedded"
  117 + when "smartos"
  118 + # Opscode patch - someara@opscode.com
  119 + # GCC 4.7.0 chokes on mismatched function types between OpenSSL 1.0.1c and Ruby 1.9.3-p286
  120 + patch :source => "ruby-openssl-1.0.1c.patch", :plevel => 1
  121 +
  122 + # Patches taken from RVM.
  123 + # http://bugs.ruby-lang.org/issues/5384
  124 + # https://www.illumos.org/issues/1587
  125 + # https://github.com/wayneeseguin/rvm/issues/719
  126 + patch :source => "rvm-cflags.patch", :plevel => 1
  127 +
  128 + # From RVM forum
  129 + # https://github.com/wayneeseguin/rvm/commit/86766534fcc26f4582f23842a4d3789707ce6b96
  130 + configure_command << "ac_cv_func_dl_iterate_phdr=no"
  131 + configure_command << "--with-opt-dir=#{install_dir}/embedded"
  132 + else
  133 + configure_command << "--with-opt-dir=#{install_dir}/embedded"
  134 + end
  135 +
  136 + # @todo expose bundle_bust() in the DSL
  137 + env.merge!({
  138 + "RUBYOPT" => nil,
  139 + "BUNDLE_BIN_PATH" => nil,
  140 + "BUNDLE_GEMFILE" => nil,
  141 + "GEM_PATH" => nil,
  142 + "GEM_HOME" => nil
  143 + })
  144 +
  145 + # @todo: move into omnibus-ruby
  146 + has_gmake = system("gmake --version")
  147 +
  148 + if has_gmake
  149 + env.merge!({'MAKE' => 'gmake'})
  150 + make_binary = 'gmake'
  151 + else
  152 + make_binary = 'make'
  153 + end
  154 +
  155 + command configure_command.join(" "), :env => env
  156 + command "#{make_binary} -j #{max_build_jobs}", :env => env
  157 + command "#{make_binary} -j #{max_build_jobs} install", :env => env
  158 +end
doc/build.md 0 → 100644
@@ -0,0 +1,155 @@ @@ -0,0 +1,155 @@
  1 +# Preparing a build environment
  2 +
  3 +To create builds you will need a build user (`omnibus-build:omnibus-build` in our example).
  4 +Preparing the build machine requires sudo access.
  5 +
  6 +## Ubuntu 12.04
  7 +
  8 +```shell
  9 +# Install dependencies
  10 +sudo apt-get install ruby1.9.1 ruby1.9.1-dev git build-essential
  11 +sudo gem install --no-ri --no-rdoc bundler
  12 +
  13 +# Create build directories for use by the build user
  14 +sudo mkdir -p /opt/gitlab /var/cache/omnibus
  15 +# We assume the build user and group is 'omnibus-build'
  16 +sudo chown omnibus-build:omnibus-build /opt/gitlab /var/cache/omnibus
  17 +```
  18 +
  19 +Then, as the build user (omnibus-build):
  20 +
  21 +```shell
  22 +# Clone the omnibus repo
  23 +git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git
  24 +
  25 +# Install gem dependencies for omnibus-ruby
  26 +cd omnibus-gitlab
  27 +bundle install --path .bundle --binstubs
  28 +
  29 +# Do a build (and take a break from the computer)
  30 +bin/omnibus build project gitlab
  31 +```
  32 +
  33 +## Centos 6.5
  34 +
  35 +```shell
  36 +sudo yum groupinstall 'Development Tools'
  37 +# Install RedHat Software Collections to get Ruby 1.9.3
  38 +sudo yum install centos-release-SCL
  39 +sudo yum install ruby193 ruby193-ruby-devel
  40 +
  41 +# Create build directories for use by the build user
  42 +sudo mkdir -p /opt/gitlab /var/cache/omnibus
  43 +# We assume the build user and group is 'omnibus-build'
  44 +sudo chown omnibus-build:omnibus-build /opt/gitlab /var/cache/omnibus
  45 +```
  46 +
  47 +As the build user (omnibus-build):
  48 +
  49 +```shell
  50 +# Enable Ruby 1.9.3 from Software Collections
  51 +echo 'exec scl enable ruby193 bash' >> .bash_profile
  52 +# Start a new login shell so we do not have to log out and in
  53 +# this one time
  54 +bash --login
  55 +
  56 +# Clone the omnibus repo
  57 +git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git
  58 +
  59 +# Install gem dependencies for omnibus-ruby
  60 +cd omnibus-gitlab
  61 +bundle install --path .bundle --binstubs
  62 +
  63 +# Do a build (and take a break from the computer)
  64 +bin/omnibus build project gitlab
  65 +```
  66 +
  67 +## Usage
  68 +
  69 +### Build
  70 +
  71 +You create a platform-specific package using the `build project` command:
  72 +
  73 +```shell
  74 +$ bin/omnibus build project gitlab
  75 +```
  76 +
  77 +The platform/architecture type of the package created will match the platform
  78 +where the `build project` command is invoked. So running this command on say a
  79 +MacBook Pro will generate a Mac OS X specific package. After the build
  80 +completes packages will be available in `pkg/`.
  81 +
  82 +### Clean
  83 +
  84 +You can clean up all temporary files generated during the build process with
  85 +the `clean` command:
  86 +
  87 +```shell
  88 +$ bin/omnibus clean
  89 +```
  90 +
  91 +Adding the `--purge` purge option removes __ALL__ files generated during the
  92 +build including the project install directory (`/opt/gitlab`) and
  93 +the package cache directory (`/var/cache/omnibus/pkg`):
  94 +
  95 +```shell
  96 +$ bin/omnibus clean --purge
  97 +```
  98 +
  99 +### Help
  100 +
  101 +Full help for the Omnibus command line interface can be accessed with the
  102 +`help` command:
  103 +
  104 +```shell
  105 +$ bin/omnibus help
  106 +```
  107 +
  108 +## Vagrant-based Virtualized Build Lab
  109 +
  110 +Every Omnibus project ships will a project-specific
  111 +[Berksfile](http://berkshelf.com/) and [Vagrantfile](http://www.vagrantup.com/)
  112 +that will allow you to build your projects on the following platforms:
  113 +
  114 +* CentOS 5 64-bit
  115 +* CentOS 6 64-bit
  116 +* Ubuntu 10.04 64-bit
  117 +* Ubuntu 11.04 64-bit
  118 +* Ubuntu 12.04 64-bit
  119 +
  120 +Please note this build-lab is only meant to get you up and running quickly;
  121 +there's nothing inherent in Omnibus that restricts you to just building CentOS
  122 +or Ubuntu packages. See the Vagrantfile to add new platforms to your build lab.
  123 +
  124 +The only requirements for standing up this virtualized build lab are:
  125 +
  126 +* VirtualBox - native packages exist for most platforms and can be downloaded
  127 +from the [VirtualBox downloads page](https://www.virtualbox.org/wiki/Downloads).
  128 +* Vagrant 1.2.1+ - native packages exist for most platforms and can be downloaded
  129 +from the [Vagrant downloads page](http://downloads.vagrantup.com/).
  130 +
  131 +The [vagrant-berkshelf](https://github.com/RiotGames/vagrant-berkshelf) and
  132 +[vagrant-omnibus](https://github.com/schisamo/vagrant-omnibus) Vagrant plugins
  133 +are also required and can be installed easily with the following commands:
  134 +
  135 +```shell
  136 +$ vagrant plugin install vagrant-berkshelf
  137 +$ vagrant plugin install vagrant-omnibus
  138 +```
  139 +
  140 +Once the pre-requisites are installed you can build your package across all
  141 +platforms with the following command:
  142 +
  143 +```shell
  144 +$ vagrant up
  145 +```
  146 +
  147 +If you would like to build a package for a single platform the command looks like this:
  148 +
  149 +```shell
  150 +$ vagrant up PLATFORM
  151 +```
  152 +
  153 +The complete list of valid platform names can be viewed with the
  154 +`vagrant status` command.
  155 +
doc/release.md 0 → 100644
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  1 +# Omnibus-gitlab release process
  2 +
  3 +Our main goal is to make it clear which version of GitLab is in an omnibus package.
  4 +
  5 +## On your development machine
  6 +
  7 +- Pick a tag of GitLab to package (e.g. `v6.6.0`).
  8 +- Create a release branch in omnibus-gitlab (e.g. `6-6-stable`).
  9 +- Change [the gitlab-rails version in omnibus-gitlab].
  10 + In our example that would be `version "v6.6.0"`.
  11 +- Commit the new version to the release branch
  12 +
  13 +```shell
  14 +git commit -m 'Pin GitLab to v6.6.0' config/software/gitlab-rails.rb
  15 +```
  16 +
  17 +- Create an annotated tag on omnibus-gitlab corresponding to the GitLab tag.
  18 + GitLab tag `v6.6.0` becomes omnibus-gitlab tag `6.6.0.omnibus`.
  19 +
  20 +```shell
  21 +git tag -a 6.6.0.omnibus -m 'Pin GitLab to v6.6.0'
  22 +```
  23 +
  24 +- Push the branch and the tag to the main repository.
  25 +
  26 +```shell
  27 +git push origin 6-6-stable 6.6.0.omnibus
  28 +```
  29 +
  30 +## On the build machines
  31 +
  32 +- Check out the release branch of omnibus-gitlab.
  33 +
  34 +```shell
  35 +git fetch
  36 +git checkout 6-6-stable
  37 +```
  38 +
  39 +- Check the version with `git describe`.
  40 +
  41 +```shell
  42 +git describe # Should start with 6.6.0.omnibus
  43 +```
  44 +
  45 +- Build a package with timestamps disabled.
  46 +
  47 +```shell
  48 +OMNIBUS_APPEND_TIMESTAMP=0 bin/omnibus build project gitlab
  49 +```
  50 +
  51 +[the gitlab-rails version in omnibus-gitlab]: ../config/software/gitlab-rails.rb#L20
files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 # limitations under the License. 15 # limitations under the License.
16 # 16 #
17 17
18 -define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil do 18 +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil, :restarts => [] do
19 template params[:name] do 19 template params[:name] do
20 source params[:source] 20 source params[:source]
21 owner params[:owner] 21 owner params[:owner]
@@ -23,6 +23,9 @@ define :template_symlink, :link_from =&gt; nil, :source =&gt; nil, :owner =&gt; nil, :gro @@ -23,6 +23,9 @@ define :template_symlink, :link_from =&gt; nil, :source =&gt; nil, :owner =&gt; nil, :gro
23 mode params[:mode] 23 mode params[:mode]
24 variables params[:variables] 24 variables params[:variables]
25 notifies *params[:notifies] if params[:notifies] 25 notifies *params[:notifies] if params[:notifies]
  26 + params[:restarts].each do |resource|
  27 + notifies :restart, resource
  28 + end
26 end 29 end
27 30
28 link params[:link_from] do 31 link params[:link_from] do
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
@@ -21,11 +21,13 @@ require &#39;chef/mash&#39; @@ -21,11 +21,13 @@ require &#39;chef/mash&#39;
21 require 'chef/json_compat' 21 require 'chef/json_compat'
22 require 'chef/mixin/deep_merge' 22 require 'chef/mixin/deep_merge'
23 require 'securerandom' 23 require 'securerandom'
  24 +require 'uri'
24 25
25 module Gitlab 26 module Gitlab
26 extend(Mixlib::Config) 27 extend(Mixlib::Config)
27 28
28 bootstrap Mash.new 29 bootstrap Mash.new
  30 + user Mash.new
29 postgresql Mash.new 31 postgresql Mash.new
30 redis Mash.new 32 redis Mash.new
31 gitlab_rails Mash.new 33 gitlab_rails Mash.new
@@ -33,6 +35,7 @@ module Gitlab @@ -33,6 +35,7 @@ module Gitlab
33 sidekiq Mash.new 35 sidekiq Mash.new
34 nginx Mash.new 36 nginx Mash.new
35 node nil 37 node nil
  38 + external_url nil
36 39
37 class << self 40 class << self
38 41
@@ -72,10 +75,39 @@ module Gitlab @@ -72,10 +75,39 @@ module Gitlab
72 end 75 end
73 end 76 end
74 77
  78 + def parse_external_url
  79 + return unless external_url
  80 +
  81 + uri = URI(external_url.to_s)
  82 +
  83 + unless uri.host
  84 + raise "External URL must include a FQDN"
  85 + end
  86 + Gitlab['user']['git_user_email'] ||= "gitlab@#{uri.host}"
  87 + Gitlab['gitlab_rails']['external_fqdn'] = uri.host
  88 + Gitlab['gitlab_rails']['notification_email'] ||= "gitlab@#{uri.host}"
  89 +
  90 + case uri.scheme
  91 + when "http"
  92 + Gitlab['gitlab_rails']['external_https'] = false
  93 + when "https"
  94 + Gitlab['gitlab_rails']['external_https'] = true
  95 + else
  96 + raise "Unsupported external URL scheme: #{uri.scheme}"
  97 + end
  98 +
  99 + unless ["", "/"].include?(uri.path)
  100 + raise "Unsupported external URL path: #{uri.path}"
  101 + end
  102 +
  103 + Gitlab['gitlab_rails']['external_port'] = uri.port
  104 + end
  105 +
75 def generate_hash 106 def generate_hash
76 results = { "gitlab" => {} } 107 results = { "gitlab" => {} }
77 [ 108 [
78 "bootstrap", 109 "bootstrap",
  110 + "user",
79 "redis", 111 "redis",
80 "gitlab_rails", 112 "gitlab_rails",
81 "unicorn", 113 "unicorn",
@@ -92,6 +124,7 @@ module Gitlab @@ -92,6 +124,7 @@ module Gitlab
92 124
93 def generate_config(node_name) 125 def generate_config(node_name)
94 generate_secrets(node_name) 126 generate_secrets(node_name)
  127 + parse_external_url
95 generate_hash 128 generate_hash
96 end 129 end
97 end 130 end
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
@@ -39,8 +39,9 @@ gitlab_rails_log_dir = node[&#39;gitlab&#39;][&#39;gitlab-rails&#39;][&#39;log_directory&#39;] @@ -39,8 +39,9 @@ gitlab_rails_log_dir = node[&#39;gitlab&#39;][&#39;gitlab-rails&#39;][&#39;log_directory&#39;]
39 end 39 end
40 end 40 end
41 41
42 -should_notify_unicorn = OmnibusHelper.should_notify?("unicorn")  
43 -should_notify_sidekiq = OmnibusHelper.should_notify?("sidekiq") 42 +dependent_services = []
  43 +dependent_services << "service[unicorn]" if OmnibusHelper.should_notify?("unicorn")
  44 +dependent_services << "service[sidekiq]" if OmnibusHelper.should_notify?("sidekiq")
44 45
45 template_symlink File.join(gitlab_rails_etc_dir, "secret") do 46 template_symlink File.join(gitlab_rails_etc_dir, "secret") do
46 link_from File.join(gitlab_rails_source_dir, ".secret") 47 link_from File.join(gitlab_rails_source_dir, ".secret")
@@ -48,8 +49,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;secret&quot;) do @@ -48,8 +49,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;secret&quot;) do
48 owner "root" 49 owner "root"
49 group "root" 50 group "root"
50 mode "0644" 51 mode "0644"
51 - notifies :restart, 'service[unicorn]' if should_notify_unicorn  
52 - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq 52 + restarts dependent_services
53 end 53 end
54 54
55 template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do 55 template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do
@@ -59,8 +59,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;database.yml&quot;) do @@ -59,8 +59,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;database.yml&quot;) do
59 group "root" 59 group "root"
60 mode "0644" 60 mode "0644"
61 variables(node['gitlab']['postgresql'].to_hash) 61 variables(node['gitlab']['postgresql'].to_hash)
62 - notifies :restart, 'service[unicorn]' if should_notify_unicorn  
63 - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq 62 + restarts dependent_services
64 end 63 end
65 64
66 template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do 65 template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do
@@ -70,8 +69,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;gitlab.yml&quot;) do @@ -70,8 +69,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;gitlab.yml&quot;) do
70 group "root" 69 group "root"
71 mode "0644" 70 mode "0644"
72 variables(node['gitlab']['gitlab-rails'].to_hash) 71 variables(node['gitlab']['gitlab-rails'].to_hash)
73 - notifies :restart, 'service[unicorn]' if should_notify_unicorn  
74 - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq 72 + restarts dependent_services
75 end 73 end
76 74
77 template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do 75 template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do
@@ -81,8 +79,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;rack_attack.rb&quot;) do @@ -81,8 +79,7 @@ template_symlink File.join(gitlab_rails_etc_dir, &quot;rack_attack.rb&quot;) do
81 group "root" 79 group "root"
82 mode "0644" 80 mode "0644"
83 variables(node['gitlab']['gitlab-rails'].to_hash) 81 variables(node['gitlab']['gitlab-rails'].to_hash)
84 - notifies :restart, 'service[unicorn]' if should_notify_unicorn  
85 - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq 82 + restarts dependent_services
86 end 83 end
87 84
88 directory node['gitlab']['gitlab-rails']['satellites_path'] do 85 directory node['gitlab']['gitlab-rails']['satellites_path'] do
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
@@ -46,6 +46,7 @@ end @@ -46,6 +46,7 @@ end
46 46
47 directory log_directory do 47 directory log_directory do
48 owner git_user 48 owner git_user
  49 + mode "0700"
49 recursive true 50 recursive true
50 end 51 end
51 52
files/gitlab-cookbooks/gitlab/recipes/users.rb
@@ -17,21 +17,24 @@ @@ -17,21 +17,24 @@
17 # 17 #
18 18
19 gitlab_username = node['gitlab']['user']['username'] 19 gitlab_username = node['gitlab']['user']['username']
  20 +gitlab_group = node['gitlab']['user']['group']
20 gitlab_home = node['gitlab']['user']['home'] 21 gitlab_home = node['gitlab']['user']['home']
21 22
22 -group gitlab_username 23 +# Create the group for the GitLab user
  24 +group gitlab_group
23 25
24 -# Create a user for Chef services to run as 26 +# Create the GitLab user
25 user gitlab_username do 27 user gitlab_username do
26 shell node['gitlab']['user']['shell'] 28 shell node['gitlab']['user']['shell']
27 home gitlab_home 29 home gitlab_home
28 - gid gitlab_username 30 + gid gitlab_group
29 end 31 end
30 32
  33 +# Configure Git settings for the GitLab user
31 template File.join(gitlab_home, ".gitconfig") do 34 template File.join(gitlab_home, ".gitconfig") do
32 source "gitconfig.erb" 35 source "gitconfig.erb"
33 owner gitlab_username 36 owner gitlab_username
34 - group node['gitlab']['user']['group'] 37 + group gitlab_group
35 mode "0644" 38 mode "0644"
36 variables(node['gitlab']['user'].to_hash) 39 variables(node['gitlab']['user'].to_hash)
37 end 40 end