ooyala / barkeep

The friendly code review system.
getbarkeep.org
1.42k stars 145 forks source link

nginx 502 bad gateway with vagrant on windows OS #460

Open kry opened 11 years ago

kry commented 11 years ago

Setting up barkeep code review tool in windows

Using Vagrant to setup an Ubuntu virtual machine to run barkeep gives me a nginx 502 bad gateway error, but I can’t seem to find any problems in the logging why. Attached you can find the vagrantfile, the bootstrap.sh file (slightly adapted because our proxy doesn’t allow git://) and some loggings. When loading the barkeep site it takes a long time and the 502 bad gateway error comes.

Vagrantfile (configuration file to start virtual machine Ubuntu + installation of barkeep)

-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure("2") do |config| config.vm.box = "precise32" config.vm.box_url = "file://C:/temp/precise32.box" config.vm.provision :shell, :path => "bootstrap.sh"

config.vm.network :forwarded_port, host: 4567, guest: 80 config.vm.network :forwarded_port, host: 4568, guest: 8080 config.vm.network :forwarded_port, host: 8082, guest: 8040 config.vm.network :public_network

config.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] v.customize ["modifyvm", :id, "--memory", "512"] end end

bootstrap.sh file (to set proxy settings and install barkeep)

!/usr/bin/env bash

cd /vagrant export http_proxy=:8080 export https_proxy=:8080 export ftp_proxy=:8080

cp 95proxies /etc/apt/apt.conf.d/95proxies

sudo apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get install -y g++ build-essential libxslt1-dev libxml2-dev python-dev libmysqlclient-dev redis-server mysql-server nginx

Install git 1.7.6+

sudo apt-get -y install python-software-properties sudo add-apt-repository ppa:git-core/ppa && sudo apt-get update sudo apt-get install -y git

Install ruby 1.9.3-p194

git clone http://github.com/sstephenson/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile echo 'eval "$(rbenv init -)"' >> ~/.profile source ~/.profile git clone http://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build rbenv install 1.9.3-p194 rbenv global 1.9.3-p194 gem install bundler rbenv rehash

Clone Barkeep

git clone http://github.com/ooyala/barkeep.git ~/barkeep cd ~/barkeep && bundle install && rbenv rehash

Configure a reverse proxy webserver (nginx) to Barkeep

sudo rm /etc/nginx/sites-enabled/default sudo cp ~/barkeep/config/system_setup_files/nginx_site.prod.conf /etc/nginx/sites-enabled/barkeep sudo /etc/init.d/nginx restart

Create database and run migrations

mysqladmin -u root --password='' create barkeep cd ~/barkeep && ./script/run_migrations.rb

Create upstart scripts

cd ~/barkeep foreman export upstart upstart_scripts -a barkeep -l /var/log/barkeep -u $USER -f Procfile sudo mv upstart_scripts/* /etc/init

Configure and start barkeep

cp environment.prod.rb environment.rb cp environment.prod.sh environment.sh echo "_" echo "To configure sending emails from Barkeep, edit GMAIL_ADDRESS and GMAIL_PASSWORD\ in environment.rb and run: sudo restart barkeep" echo "_" sudo start barkeep

Installation is done correctly without any errors, so far so good.

When I now try to go to http://localhost:4567/ I get a 502 Bad Gateway (nginx/1.1.19). When I go to http://localhost:4567/resque i get the overview of the queues, workers and stats. The same for the port 8082, also for 8082/resque I get the overview of the queues, workers and stats. I can so e.g. now that there have been 454 tasks being processed and that the resque client is connected to redis://localhost:6379/1.

It’s like 2 instances of barkeep are running one on port 4567 (internal 80) and port 8082 (internal 8040).

I can’t seem to find any problems in the log files of barkeep, nginx, mysql or redis.

I don't know what is wrong has it something to do with the proxy settings? Any help would be welcome.

barkeep cron log:

Triggering batch_comment_emails Triggering batch_comment_emails Triggering fetch_commits Triggering batch_comment_emails Triggering batch_comment_emails Triggering batch_comment_emails Triggering batch_comment_emails Triggering fetch_commits

barkeep resque log: (seems to have now new entries regarding redis - was not there yesterday - before file was empty)

Tasks: Connection refused - Unable to connect to Redis on localhost:6379 (See full trace by running task with --trace) rake aborted! Connection refused - Unable to connect to Redis on localhost:6379

barkeep web log: empty

redis log:

[1431] 17 Jul 08:39:30 * Background saving terminated with success [1431] 17 Jul 08:44:31 * 10 changes in 300 seconds. Saving... [1431] 17 Jul 08:44:31 * Background saving started by pid 20583 [20583] 17 Jul 08:44:31 * DB saved on disk

nginx log:

2013/07/19 08:45:20 [error] 3335#0: 1 upstream prematurely closed connection while reading response header from upstream, client: 10.0.2.2, server: barkeep_vagrant, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8040/favicon.ico", host: "10.224.34.44:4567" 2013/07/19 08:47:04 [error] 3335#0: 4 upstream prematurely closed connection while reading response header from upstream, client: 10.0.2.2, server: barkeep_vagrant, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8040/favicon.ico", host: "10.224.34.44:4567"

adaiguoguo commented 10 years ago

I have the same problem

ca-masai commented 10 years ago

same problem with Ubuntu12.04

zsim0n commented 10 years ago

+1 here, I cannot see anything in logs or else. It was working for a couple of days. Now I am getting 502 bad gateway. any idea? I have used the install script to setup barkeep. nothing else. Update:

zsim0n commented 10 years ago

Ok I think I've got it...it is just not starting up on boot sudo start barkeep helps on ubuntu vagrant box