Thanks Ryan. I appreciate the detailed information. It sounds like Mercurial
isn't seeing the proper directory when it invokes its own ssh functionality,
so we'll need to look further into it. It would help if someone
knowledgeable with Mercurial could do some digging to figure out why it's
not seeing the right $HOME.

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com


On Wed, Aug 18, 2010 at 1:49 PM, Ryan Roemer <r...@ipstreet.com> wrote:

> Hi Christian,
>
> I run post-review from my laptop ("dev box") to submit review requests
> to our remote RB server, which is running in a cloud VM.
>
> For our RB server, we take a new VM with Ubuntu, install vanilla
> apache, and issue an 'rb-site' command to install RB and host through
> Apache.  So, this is an Apache install, and we use mod_python. Our
> apache config for RB is at /etc/apache2/sites-available/reviewboard
> and includes in relevant part:
>
> # Serve django pages
> <Location "/">
>    PythonPath "['/var/www/reviewboard/conf'] + sys.path"
>    SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
>    SetEnv PYTHON_EGG_CACHE "/var/www/reviewboard/tmp/egg_cache"
>    SetEnv HOME "/var/www/reviewboard/data"
>    SetHandler mod_python
>    PythonHandler django.core.handlers.modpython
>    PythonAutoReload Off
>    PythonDebug Off
>    # Used to run multiple mod_python sites in the same apache
>    PythonInterpreter reviewboard_reviewboard
> </Location>
>
> Note: we haven't tweaked any of the settings -- we just let the basic
> install / rb-site do the work.
>
> Digging in a little bit more, is that (if I remember correctly -- I
> had debug statements in an older install that I've since wiped, so I
> may be off), here are the two checks:
>
> (1) Add a new repository in RB Admin site with Path: "ssh:// ...
> anything ...":  This causes a validation check through:
> reviewboard.scmtools.core.SCMTool.check_repository() that uses "/var/
> www/reviewboard/data/.ssh" as the operative SSH directory.  This is
> the operative directory for all John's previous email, and was what
> was causing us problems for adding respositories on RB server only.
>
> (2) On a dev. machine (laptop, etc. separate from the RB Server), a
> dev wants to submit a review requests and issues a 'post-review'
> command on their machine.  Post-review contacts the RB server, and (as
> far as I can tell) this starts a different code path on the RB server,
> which ends up going to reviewboard.scmtools.HgClient.__init__().  When
> we hit the line (175 in 1.5 RC1): "self.repo = hg.repository(hg_ui,
> path=repoPath)", then we get an SSH exception bubbled up as follows:
>
> 2010-08-17 13:29:26,645 - ERROR - Exception thrown for user USER at
> http://REPO_IP_ADDRESS/r/1/
>
> no suitable response from remote hg
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.6/dist-packages/Django-1.2.1-py2.6.egg/
> django/core/handlers/base.py", line 100, in get_response
>    response = callback(request, *callback_args, **callback_kwargs)
>   File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/accounts/decorators.py", line 25, in _check
>    return login_required(view_func)(*args, **kwargs)
>  File "/usr/local/lib/python2.6/dist-packages/Djblets-0.6.3-py2.6.egg/
> djblets/auth/util.py", line 46, in _checklogin
>    return view_func(request, *args, **kwargs)
>  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/reviews/views.py", line 226, in review_detail
>    'upload_diff_form': UploadDiffForm(review_request),
>  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/reviews/forms.py", line 214, in __init__
>    data, *args, **kwargs)
>  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/diffviewer/forms.py", line 44, in __init__
>     if self.repository.get_scmtool().get_diffs_use_absolute_paths():
>   File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/scmtools/models.py", line 52, in get_scmtool
>    return cls(self)
>  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/scmtools/hg.py", line 29, in __init__
>     self.client = HgClient(repository.path)
>   File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.5rc1-
> py2.6.egg/reviewboard/scmtools/hg.py", line 175, in __init__
>     self.repo = hg.repository(hg_ui, path=repoPath)
>  File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 63, in
> repository
>    repo = _lookup(path).instance(ui, path, create)
>  File "/usr/lib/pymodules/python2.6/mercurial/sshrepo.py", line 51,
> in __init__
>    self.validate_repo(ui, sshcmd, args, remotecmd)
>  File "/usr/lib/pymodules/python2.6/mercurial/sshrepo.py", line 82,
> in validate_repo
>    self.abort(error.RepoError(_("no suitable response from remote
> hg")))
>  File "/usr/lib/pymodules/python2.6/mercurial/sshrepo.py", line 100,
> in abort
>    raise exception
> RepoError: no suitable response from remote hg
>
> This second error was fixed by adding the same identity file to a
> directory "/var/www/.ssh" as we had in "/var/www/reviewboard/
> data/.ssh".
>
> So, it looks like for check #1 (add a repo), the $HOME = "/var/www/
> reviewboard/data" (the RB-specific home), but for check #2 (RB server
> receives a request from remote post-review), the $HOME = "/var/
> www/" (the real Unix user home for 'www-data').
>
> Thanks,
> Ryan
>
>
>
> On Aug 18, 12:34 pm, Christian Hammond <chip...@chipx86.com> wrote:
> > Glad it works for you, though I want to understand this a bit more.
> >
> > When you say you run post-review with a dev box, I assume you mean that
> it's
> > still Apache looking for the /var/www/.ssh/id_dsa, right? is that a
> > different install from the main install, or is it just that you're
> running
> > post-review *on* the dev box?
> >
> > Is this happening with an Apache install, or using devserver? Also, are
> you
> > running mod_python or fastcgi/wsgi?
> >
> > Does your Apache config have the SetEnv HOME line? If so, I'm surprised
> > we're seeing that behavior, but it would indicate that Mercurial is never
> > seeing what we've set it to, unlike Subversion and Git.
> >
> > Christian
> >
> > --
> > Christian Hammond - chip...@chipx86.com
> > Review Board -http://www.reviewboard.org
> > VMware, Inc. -http://www.vmware.com
> >
> > On Tue, Aug 17, 2010 at 2:03 PM, Ryan Roemer <r...@ipstreet.com> wrote:
> > > I've been working with John on this, and we finally pounded out
> > > something that works.  We are running Review Board 1.5 RC1.  Say we
> > > have a code base repo with ssh string of: ssh://
> > > some_u...@foo.codebasehq.com/path/to/repo.hg
> > > . To generalize, it took us something like this to get hosted SSH from
> > > Codebase working:
> >
> > > SSH Directories
> >
> > > For server setup on Ubuntu, Review Board is going to run as the Apache
> > > user 'www-data'.  The Apache user's home (e.g., "$HOME") is '/var/www'
> > > and we're installing Review Board to '/var/www/reviewboard'.  We have
> > > a private key named "id_dsa", that is uploaded (and passphrase-less)
> > > to Codebase.  We installed id_dsa on the server as follows:
> >
> > > * /var/www/.ssh/id_dsa
> > > * /var/www/reviewboard/data/.ssh/id_dsa
> >
> > > (Actually with symlinks).  I'm not sure if this was strictly
> > > necessary, but seemed the only combination to work.  Skimming (really
> > > quickly) the code it seems that adding a repository with "ssh://" URL
> > > does a validation against '/var/www/reviewboard/data/.ssh/id_dsa', but
> > > using post-review on a dev. box causes actions on the server to use '/
> > > var/www/.ssh/id_dsa' (with the Mercurial API calls).
> >
> > > Adding a Repository
> >
> > > Then, when we add a repository, the relevant fields we set were:
> >
> > > * Path: "ssh://some_u...@foo.codebasehq.com/path/to/repo.hg"
> > > * Username: "some_user"
> > > * Password: (Empty)
> >
> > > And everything seems to work (from post-review through actual reviews
> > > on Review Board).
> >
> > > Not sure if the above behavior is / will be different with newer
> > > versions of RB, but this is what got us through and actually hooked up
> > > with Codebase, so hope it helps!
> >
> > > Best,
> > > Ryan
> >
> > > On Aug 13, 12:10 pm, John DeRosa <jo...@ipstreet.com> wrote:
> > > > On Aug 13, 2010, at 3:20 AM, Christian Hammond wrote:
> >
> > > > > Try renaming id_rsa_ipstreet to just id_rsa. This is what paramiko
> is
> > > expecting to find in that directory.
> >
> > > > > Christian
> >
> > > > Done. Same thing happens.
> >
> > > > John
> >
> > > --
> > > Want to help the Review Board project? Donate today at
> > >http://www.reviewboard.org/donate/
> > > Happy user? Let us know athttp://www.reviewboard.org/users/
> > > -~----------~----~----~----~------~----~------~--~---
> > > To unsubscribe from this group, send email to
> > > reviewboard+unsubscr...@googlegroups.com<reviewboard%2bunsubscr...@googlegroups.com>
> <reviewboard%2bunsubscr...@googlegroups.com<reviewboard%252bunsubscr...@googlegroups.com>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/reviewboard?hl=en
>
> --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com<reviewboard%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en
>

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to