Commit 5d45b44df51558a267bbef890c8641b0d13d6df7

Authored by Jacob Vosmaer
2 parents c6b7bf8a 1dc82499

Merge branch 'passenger_readme' of https://gitlab.com/digital.pardoe/omnibus-gitlab

Conflicts:
	README.md
Showing 1 changed file with 73 additions and 0 deletions   Show diff stats
README.md
... ... @@ -645,6 +645,79 @@ from starting before a given filesystem is mounted, add the following to
645 645 # wait for /var/opt/gitlab to be mounted
646 646 high_availability['mountpoint'] = '/var/opt/gitlab'
647 647 ```
  648 +## Using an existing Passenger/Nginx installation
  649 +
  650 +In some cases you may want to host GitLab using an existing Passenger/Nginx
  651 +installation but still have the convenience of updating and installing using
  652 +the omnibus packages.
  653 +
  654 +First, you'll need to setup your `/etc/gitlab/gitlab.rb` to disable the built-in
  655 +Nginx and Unicorn:
  656 +
  657 +```ruby
  658 +# Disable the built-in nginx
  659 +nginx['enable'] = false
  660 +
  661 +# Disable the built-in unicorn
  662 +unicorn['enable'] = false
  663 +
  664 +# Set the internal API URL
  665 +gitlab_rails['internal_api_url'] = 'http://git.yourdomain.com'
  666 +```
  667 +
  668 +Make sure you run `sudo gitlab-ctl reconfigure` for the changes to take effect.
  669 +
  670 +Then, in your custom Passenger/Nginx installation, create the following site
  671 +configuration file:
  672 +
  673 +```
  674 +server {
  675 + listen *:80;
  676 + server_name git.yourdomain.com;
  677 + server_tokens off;
  678 + root /opt/gitlab/embedded/service/gitlab-rails/public;
  679 +
  680 + client_max_body_size 250m;
  681 +
  682 + access_log /var/log/gitlab/nginx/gitlab_access.log;
  683 + error_log /var/log/gitlab/nginx/gitlab_error.log;
  684 +
  685 + # Ensure Passenger uses the bundled Ruby version
  686 + passenger_ruby /opt/gitlab/embedded/bin/ruby;
  687 +
  688 + # Correct the $PATH variable to included packaged executables
  689 + passenger_set_cgi_param PATH "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin";
  690 +
  691 + # Make sure Passenger runs as the correct user and group to
  692 + # prevent permission issues
  693 + passenger_user git;
  694 + passenger_group git;
  695 +
  696 + # Enable Passenger & keep at least one instance running at all times
  697 + passenger_enabled on;
  698 + passenger_min_instances 1;
  699 +
  700 + error_page 502 /502.html;
  701 +}
  702 +```
  703 +
  704 +For a typical Passenger installation this file should probably
  705 +be located at `/etc/nginx/sites-available/gitlab` and symlinked to
  706 +`/etc/nginx/sites-enabled/gitlab`.
  707 +
  708 +To ensure that user uploads are accessible your Nginx user (usually `www-data`)
  709 +should be added to the `git` group. This can be done using the following command:
  710 +
  711 +```shell
  712 +sudo usermod -aG git www-data
  713 +```
  714 +
  715 +Other than the Passenger configuration in place of Unicorn and the lack of HTTPS
  716 +(although this could be enabled) this file is mostly identical to the
  717 +[bundled Nginx configuration](files/gitlab-cookbooks/gitlab/templates/default/nginx-gitlab-http.conf.erb).
  718 +
  719 +Don't forget to restart Nginx to load the new configuration (on Debian-based
  720 +systems `sudo service nginx restart`).
648 721  
649 722 ## Building your own package
650 723  
... ...