Commit 43feccadb2856a4402b5862d4e82e25cf9f7e0bd

Authored by Jacob Vosmaer
2 parents 25d3f635 4a49b564

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

README.md
... ... @@ -3,6 +3,17 @@
3 3 This project creates full-stack platform-specific packages for
4 4 GitLab!
5 5  
  6 +## Installation
  7 +
  8 +### Ubuntu
  9 +
  10 +```
  11 +sudo apt-get install openssh-server
  12 +sudo apt-get install postfix # sendmail or exim is also OK
  13 +sudo dpkg -i gitlab-x.y.z.deb # this is the .deb you downloaded
  14 +sudo gitlab-ctl reconfigure
  15 +```
  16 +
6 17 ## How to manage an Omnibus-installed GitLab
7 18  
8 19 ### Administrative commands
... ... @@ -40,11 +51,13 @@ Omnibus-gitlab uses four different directories.
40 51 - `/var/log/gitlab` contains all log data generated by components of
41 52 omnibus-gitlab.
42 53  
43   -## Preparing a build environment on Ubuntu 12.04
  54 +## Preparing a build environment
44 55  
45   -To create builds you will need a build user (`ubuntu:ubuntu` in our example).
  56 +To create builds you will need a build user (`omnibus-build:omnibus-build` in our example).
46 57 Preparing the build machine requires sudo access.
47 58  
  59 +### Ubuntu 12.04
  60 +
48 61 ```shell
49 62 # Install dependencies
50 63 sudo apt-get install ruby1.9.1 ruby1.9.1-dev git build-essential
... ... @@ -52,11 +65,11 @@ sudo gem install --no-ri --no-rdoc bundler
52 65  
53 66 # Create build directories for use by the build user
54 67 sudo mkdir -p /opt/gitlab /var/cache/omnibus
55   -# We assume the build user and group is 'ubuntu'
56   -sudo chown ubuntu:ubuntu /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
57 70 ```
58 71  
59   -Then, as the build user:
  72 +Then, as the build user (omnibus-build):
60 73  
61 74 ```shell
62 75 # Clone the omnibus repo
... ... @@ -65,6 +78,43 @@ git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git
65 78 # Install gem dependencies for omnibus-ruby
66 79 cd omnibus-gitlab
67 80 bundle install --path .bundle --binstubs
  81 +
  82 +# Do a build (and take a break from the computer)
  83 +bin/omnibus build project gitlab
  84 +```
  85 +
  86 +### Centos 6.5
  87 +
  88 +```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
  98 +```
  99 +
  100 +As the build user (omnibus-build):
  101 +
  102 +```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
68 118 ```
69 119  
70 120 ## Usage
... ...
config/software/gitlab-rails.rb
... ... @@ -30,6 +30,12 @@ dependency "postgresql"
30 30  
31 31 source :git => "https://gitlab.com/gitlab-org/gitlab-ce.git"
32 32  
  33 +env = {
  34 + "LDFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
  35 + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
  36 + "LD_RUN_PATH" => "#{install_dir}/embedded/lib",
  37 +}
  38 +
33 39 build do
34 40 # GitLab assumes it can extract the Git revision of the currently version
35 41 # from the Git repo the code lives in at boot. Because of our rsync later on,
... ... @@ -38,7 +44,7 @@ build do
38 44 # build.
39 45 command "sed -i \"s/.*REVISION.*/REVISION = '$(git log --pretty=format:'%h' -n 1)'/\" config/initializers/2_app.rb"
40 46  
41   - bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem"
  47 + bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env
42 48  
43 49 # In order to precompile the assets, we need to get to a state where rake can
44 50 # load the Rails environment.
... ...
config/software/gitlab-shell.rb
... ... @@ -25,17 +25,16 @@ dependency "rsync"
25 25 source :git => "https://gitlab.com/gitlab-org/gitlab-shell.git"
26 26  
27 27 build do
  28 + command "mkdir -p #{install_dir}/embedded/service/gitlab-shell"
  29 + command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-shell/"
28 30 block do
29 31 env_shebang = "#!/usr/bin/env ruby"
30 32 `grep -r -l '^#{env_shebang}' #{project_dir}`.split("\n").each do |ruby_script|
31 33 script = File.read(ruby_script)
32   - next if script.start_with?("#!#{install_dir}") # Shebang looks good, skip this script
33   - erb :dest => ruby_script,
  34 + erb :dest => ruby_script.sub(project_dir, "#{install_dir}/embedded/service/gitlab-shell"),
34 35 :source => "ruby_script_wrapper.erb",
35 36 :mode => 0755,
36 37 :vars => {:script => script, :install_dir => install_dir}
37 38 end
38 39 end
39   - command "mkdir -p #{install_dir}/embedded/service/gitlab-shell"
40   - command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-shell/"
41 40 end
... ...
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
... ... @@ -38,6 +38,12 @@ directory ssh_dir do
38 38 recursive true
39 39 end
40 40  
  41 +# If SELinux is enabled, make sure that OpenSSH thinks the .ssh directory of the
  42 +# git_user is valid.
  43 +execute "chcon -t ssh_home_t #{ssh_dir}" do
  44 + only_if "id -Z"
  45 +end
  46 +
41 47 directory log_directory do
42 48 owner git_user
43 49 recursive true
... ...