On Tue, Nov 27, 2012 at 06:05:55AM -0800, Daniel E wrote:
> I know this is late, but I wanted to give some extra advice to people who
> may be googling and looking for a solution.
>
> For us, the gitorious poller service had crashed, causing SSH keys to not
> be added properly.  To run the poller manually, go to your gitorious
> directory (in our case '/var/www/gitorious') and enter 'script/poller run'.
>  This should either run the service, or give you an error as to why it
> wasn't working.  In our case, we were getting an error with the
> gitorious.yml file.  Some people suggested there was an indentation
> problem, so you might check that.  In our case, it turned out that the
> RAILS_ENV environment variable was unset.  I set it back to production
> (export RAILS_ENV=production) and then ran the poller and everything worked
> great.  You can run the poller in the long term by entering 'script/poller
> start' once you're sure it is working.

Daniel,
Thanks for sharing this information. Getting permission and
environment variables right in Gitorious can be troublesome.

In the latest release of Gitorious (the 2.4 series) we've added quite
a few scripts to the bin/ directory inside Gitorious; all the scripts
in there are written so you shouldn't have to worry about getting
these things right. All the scripts will:

- set up the correct RAILS_ENV
- look up which user it should run as (from config/gitorious.yml) and
  (try to) switch to that user unless he's already running the script
- set up the HOME environment variable correctly (so the correct
  ~/.ssh/authorized_keys file is used)
- change to the correct directory, so you can call it from anywhere on
  the file system (eg cd /tmp && /var/www/gitorious/bin/console will
  work)
- set up the bundler environment

There is no poller script in the bin/ directory, mainly because
Gitorious 3 will only support Resque for messaging, and Resque uses
rake to run a consumer (there is a bin/rake in Gitorious now which can
be used for this. If you're running Gitorious 2.4, you should consider
switching to Resque - it's a lot easier to set up than Stomp/activemq.

To switch to Resque, follow these steps:
- Install redis on your server (`apt-get install redis-server` on
Ubuntu, `yum install redis` on Centos)
- Make Redis start at boot (`update-rc.d redis-server defaults` on
Ubuntu, `chkconfig redis on` on Centos)
- Start Redis (`/etc/init.d/redis[-server] start)
- Add/change to `messaging_adapter: resque` in gitorious.yml
- Restart the app server
- Run `QUEUE=* /var/www/gitorious/bin/rake resque:work` to start the
Resque equivalent of script/poller

Once you've ensured this works, set up an Upstart recipe for this
poller like this (Centos and Ubuntu):

#/etc/init/resque-worker.conf

description "Run a Resque worker on all queues"
author "Marius Mårnes Mathiesen <mar...@gitorious.com>"

start on started rc RUNLEVEL=[35]
stop on runlevel [06]

env QUEUE=*
env PIDFILE=/var/www/gitorious/tmp/pids/resque-worker1.pid

exec /var/www/gitorious/bin/rake resque:work

# EOF

I'll add a description for this to
http://getgitorious.com/documentation within a day or two.

Cheers,
- Marius

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com

Reply via email to