Hi. The problem is that you need a frontend web server, which talks the
uwsgi protocol to the uwscgi. I don't use the omnibus-installer, but the
relevant settings on my system looks like this:
#nginx.conf
server {
include default.conf;
client_max_body_size 4G;
server_name git.domain.tld;
# ~2 seconds is often enough for most folks to parse HTML/CSS and
# retrieve needed images/icons/frames, connections are cheap in
# nginx so increasing this is generally safe...
keepalive_timeout 5;
# path for static files
root /usr/share/webapps/gitlab/public;
# Prefer to serve static files directly from nginx to avoid unnecessary
# data copies from the application server.
#
# try_files directive appeared in in nginx 0.7.27 and has stabilized
# over time. Older versions of nginx (e.g. 0.6.x) requires
# "if (!-f $request_filename)" which was less efficient:
# http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
try_files $uri/index.html $uri.html $uri @app;
location @app {
# an HTTP header important enough to have its own Wikipedia entry:
# http://en.wikipedia.org/wiki/X-Forwarded-For
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
# enable this if you forward HTTPS traffic to unicorn,
# this helps Rack set the proper URL scheme for doing redirects:
# proxy_set_header X-Forwarded-Proto $scheme;
# pass the Host: header from the client right along so redirects
# can be set properly within the Rack application
#proxy_set_header Host $http_host;
uwsgi_param HOST $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
#proxy_redirect off;
# set "proxy_buffering off" *only* for Rainbows! when doing
# Comet/long-poll/streaming. It's also safe to set if you're using
# only serving fast clients with Unicorn + nginx, but not slow
# clients. You normally want nginx to buffer responses to slow
# clients, even with Rails 3.1 streaming because otherwise a slow
# client can become a bottleneck of Unicorn.
#
# The Rack application may also set "X-Accel-Buffering (yes|no)"
# in the response headers do disable/enable buffering on a
# per-response basis.
# proxy_buffering off;
#proxy_pass http://ipv4.git:9000;
uwsgi_pass 127.0.0.1:9000;
include uwsgi_params;
}
# Rails error pages
error_page 500 502 503 504 /500.html;
location = /500.html {
root /usr/share/webapps/gitlab/public;
}
}
#/etc/uwsgi/gitlab.ini
[uwsgi]
plugins = rack
socket = 127.0.0.1:9000
uid = gitlab
gid = gitlab
rack = config.ru
master = true
processes = 1
lazy-apps = true
reuse-port = true
chdir = /usr/share/webapps/gitlab/ # where the Gemfile is located
buffer-size = 32768
post-buffering = 4096
rbrequire = rubygems
rbrequire = bundler/setup
env = BUNDLE_GEMFILE=/usr/share/webapps/gitlab/Gemfile
env = RAILS_ENV=production
env = HOME=/var/lib/gitlab # HOME needs to readable, I use origin HOME of
the gitlab user
To start it i use the following command:
$ /usr/bin/uwsgi --ini /etc/uwsgi/uwsgi.ini
I also managed to use systemds socket activation:
#/etc/systemd/system/[email protected]
[Unit]
Description=uWSGI service unit
After=syslog.target
[Service]
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -INT $MAINPID
Restart=always
Type=notify
StandardError=syslog
NotifyAccess=all
KillSignal=SIGQUIT
[Install]
WantedBy=multi-user.target
#/etc/systemd/system/[email protected]
[Unit]
Description=Socket for uWSGI %I
[Socket]
# Change this to your uwsgi application port or unix socket location
ListenStream=127.0.0.1:9000
[Install]
WantedBy=sockets.target
$ systemctl start [email protected]
On Monday, September 29, 2014 3:33:20 PM UTC+2, Diep Pham wrote:
>
> I try to setup omnibus-gitlab but with uwsgi (I already use uwsgi for
> everything, so it's nice to use with gitlab because I will get auto
> inventory for monitoring).
>
> I install gitlab, and modify `/etc/gitlab/gitlab.rb` and run `gitlab-ctl
> reconfigure`.
>
> ```
> # Change the external_url to the address your users will type in their
> browser
> external_url 'http://gitlab.example.com'
> nginx['enable'] = false
> unicorn['enable'] = false
> ```
>
> I download latest uwsgi 2.0.7 and compile with gitlab's embbeded ruby.
>
> ```
> # UWSGI_INCLUDES=/opt/gitlab/embedded/include
> UWSGICONFIG_RUBYPATH=/opt/gitlab/embedded/bin/ruby python uwsgiconfig.py
> --build
> ```
>
> The build run successful, return no erros.
>
> After that I run uwsgi with config:
>
> ```
> uwsgi:
> socket: 127.0.0.1:3132
> uid: git
> gid: git
> rack: config.ru
> master: true
> processes: 2
> lazy-apps: true
> chdir: /opt/gitlab/embedded/service/gitlab-rails
> buffer-size: 32768
> post-buffering: 4096
> rbrequire: rubygems
> rbrequire: bundler/setup
> env: BUNDLE_GEMFILE=/opt/gitlab/embedded/service/gitlab-rails/Gemfile
> env: RAILS_ENV=production
> ```
>
> uwsgi seems to start fine
>
> ```
> Sep 29 08:58:05 dev-1 uwsgi: *** Starting uWSGI 2.0.7 (64bit) on [Mon Sep
> 29 08:58:05 2014] ***
> Sep 29 08:58:05 dev-1 uwsgi: compiled with version: 4.6.3 on 29 September
> 2014 07:16:13
> Sep 29 08:58:05 dev-1 uwsgi: os: Linux-3.13.0-32-generic
> #57~precise1-Ubuntu SMP Tue Jul 15 03:51:20 UTC 2014
> Sep 29 08:58:05 dev-1 uwsgi: nodename: dev-1
> Sep 29 08:58:05 dev-1 uwsgi: machine: x86_64
> Sep 29 08:58:05 dev-1 uwsgi: clock source: unix
> Sep 29 08:58:05 dev-1 uwsgi: detected number of CPU cores: 2
> Sep 29 08:58:05 dev-1 uwsgi: current working directory: /etc/uwsgi
> Sep 29 08:58:05 dev-1 uwsgi: detected binary path:
> /usr/local/uwsgi-2.0.7/uwsgi
> Sep 29 08:58:05 dev-1 uwsgi: !!! no internal routing support, rebuild with
> pcre support !!!
> Sep 29 08:58:05 dev-1 uwsgi: your processes number limit is 15848
> Sep 29 08:58:05 dev-1 uwsgi: your memory page size is 4096 bytes
> Sep 29 08:58:05 dev-1 uwsgi: detected max file descriptor number: 1024
> Sep 29 08:58:05 dev-1 uwsgi: lock engine: pthread robust mutexes
> Sep 29 08:58:05 dev-1 uwsgi: thunder lock: disabled (you can enable it
> with --thunder-lock)
> Sep 29 08:58:05 dev-1 uwsgi: uwsgi socket 0 bound to TCP address
> 127.0.0.1:3132 fd 3
> Sep 29 08:58:05 dev-1 uwsgi: setgid() to 1000
> Sep 29 08:58:05 dev-1 uwsgi: setuid() to 1000
> Sep 29 08:58:06 dev-1 uwsgi: ruby 2.1.2p95 (2014-05-08 revision 45877)
> [x86_64-linux]
> Sep 29 08:58:06 dev-1 uwsgi: your server socket listen backlog is limited
> to 100 connections
> Sep 29 08:58:06 dev-1 uwsgi: your mercy for graceful operations on workers
> is 60 seconds
> Sep 29 08:58:06 dev-1 uwsgi: mapped 328872 bytes (321 KB) for 2 cores
> Sep 29 08:58:06 dev-1 uwsgi: *** Operational MODE: preforking ***
> Sep 29 08:58:06 dev-1 uwsgi: *** uWSGI is running in multiple interpreter
> mode ***
> Sep 29 08:58:06 dev-1 uwsgi: spawned uWSGI master process (pid: 4220)
> Sep 29 08:58:06 dev-1 uwsgi: Mon Sep 29 08:58:06 2014 - [emperor] vassal
> gitlab.yml has been spawned
> Sep 29 08:58:06 dev-1 uwsgi: spawned uWSGI worker 1 (pid: 4222, cores: 1)
> Sep 29 08:58:06 dev-1 uwsgi: spawned uWSGI worker 2 (pid: 4223, cores: 1)
> Sep 29 08:58:10 dev-1 uwsgi: [deprecated] I18n.enforce_available_locales
> will default to true in the future. If you really want to skip validation
> of your locale you can set I18n.enforce_available_locales = false to avoid
> this message.
> Sep 29 08:58:10 dev-1 uwsgi:
> Sep 29 08:58:10 dev-1 uwsgi: [deprecated] I18n.enforce_available_locales
> will default to true in the future. If you really want to skip validation
> of your locale you can set I18n.enforce_available_locales = false to avoid
> this message.
> Sep 29 08:58:10 dev-1 uwsgi:
> Sep 29 08:58:14 dev-1 uwsgi: RACK app 0 loaded in 8 seconds at 0x1020 (GC
> frequency: AGGRESSIVE)
> Sep 29 08:58:14 dev-1 uwsgi: Mon Sep 29 08:58:14 2014 - [emperor] vassal
> gitlab.yml is ready to accept requests
> Sep 29 08:58:14 dev-1 uwsgi: RACK app 0 loaded in 8 seconds at 0x1020 (GC
> frequency: AGGRESSIVE)
> ```
>
> But when I test, the server returns empty response.
>
> ```
> # curl 127.0.0.1:3132
> curl: (52) Empty reply from server
> ```
>
> So anyone can tell me what I did wrong? Or how to debug this problem?
> For anyone wants to read this mail with proper formatting:
> https://gitlab.com/gitlab-org/omnibus-gitlab/issues/266 :P
>
--
You received this message because you are subscribed to the Google Groups
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/gitlabhq/806416a7-d059-4272-b7f1-6e6a2019b5ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.