I dug into *reviewboard/scmtools/perforce.py* so I could add some diagnostic code to see what exactly was going wrong in *check_repository*. This is the P4Exception that's raised on p4.connect():
[P4.connect()] Connect to server failed; check $P4PORT. Fail create ctx on the connecting client. I examined the client.p4 object at this point, and it seems to be configured the way I'd expect. I also verified where P4 was being imported from: <module 'P4' from '/usr/local/lib/python2.7/dist-packages/P4.pyc'> This is exactly the same p4python module that's imported when I run a python interpreter, create a P4 instance, and configure it the same way that Review Board's is configured. Yet in that case p4.connect() works fine. Any idea what could be different in Review Board's case? On Monday, October 29, 2018 at 6:53:35 PM UTC-5, Alex Forsythe wrote: > > I've installed Review Board 3.0.9 and have the webapp up and running on my > server. I'm able to access it from another machine on the network, log in, > create users, add integrations, and so on. > > However, I'm unable to add a repository. I'm trying to add a > locally-hosted Perforce server (which happens to be running on the same > machine), but Review Board is unable to connect to it. > > The correct P4PORT for the P4 server is *ssl:10.1.9.60:1666 > <http://10.1.9.60:1666>*, and the hostname of the server is > *ubuntu_server*. If I enter any 'ssl:'-prefixed path (*ssl:10.1.9.60:1666 > <http://10.1.9.60:1666>*, *ssl:127.0.0.1:1666 <http://127.0.0.1:1666>*, > *ssl:ubuntu_server:1666*, *ssl:localhost:1666*, or *ssl:1666*), I get the > same error: *"A repository was not found at the specified path."* > Checking the log just shows me the traceback for that exception: > > 2018-10-29 23:01:53,862 - ERROR - - root - Unexpected exception while > verifying repository path for hosting service None using plan None and tool > <Tool: Perforce>: A repository was not found at the specified path. > Traceback (most recent call last): > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/forms.py", > line 1357, in _verify_repository_path > self.local_site_name) > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/perforce.py", > line 725, in check_repository > client.get_info() > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/perforce.py", > line 532, in get_info > with self.run_worker(): > File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__ > return self.gen.next() > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/perforce.py", > line 492, in run_worker > raise RepositoryNotFoundError > RepositoryNotFoundError: A repository was not found at the specified path. > > > However, if I remove the 'ssl:' prefix from any of those variants, I get a > different error: *"[P4.connect()] Failed client connect, server using > SSL. Client must add SSL protocol prefix to P4PORT."* > > 2018-10-29 23:01:47,104 - ERROR - - root - Unexpected exception while > verifying repository path for hosting service None using plan None and tool > <Tool: Perforce>: [P4.connect()] Failed client connect, server using SSL. > Client must add SSL protocol prefix to P4PORT. > Traceback (most recent call last): > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/forms.py", > line 1357, in _verify_repository_path > self.local_site_name) > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/perforce.py", > line 725, in check_repository > client.get_info() > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/perforce.py", > line 532, in get_info > with self.run_worker(): > File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__ > return self.gen.next() > File > "/usr/local/lib/python2.7/dist-packages/reviewboard/scmtools/perforce.py", > line 499, in run_worker > raise SCMError(error) > SCMError: [P4.connect()] Failed client connect, server using SSL. > Client must add SSL protocol prefix to P4PORT. > > > This seems to indicate that Review Board is able to reach the P4 server, > insofar as it can attempt to connect and be rejected because it's not using > the SSL prefix. > > Any idea what could be going wrong here? Do I maybe have to do some kind > of *p4 trust* acrobatics to get the connection working? Any suggestions > for what I could do to better diagnose the issue? > > Any help is appreciated. More details below. > > --- > > Here's how I'm starting Review Board: > > /usr/local/bin/uwsgi --socket 0.0.0.0:8005 --processes 2 --harakiri 60 > --master --post-buffering 4096 --wsgi-file /var/www/ > rb.example.com/htdocs/reviewboard.wsgi > > > I have a couple different lightweight webapps running on this machine, so > I'm using nginx to serve Review Board on a subdomain. Here's what my nginx > config file looks like: > > upstream reviewboard_uwsgi { > server 127.0.0.1:8005; > } > > server { > listen 443 ssl; > > listen 80; > listen [::]:80; > server_name rb.example.com; > > location /media { > alias /var/www/rb.example.com/htdocs/media; > } > > location /static { > alias /var/www/rb.example.com/htdocs/static; > } > > location /errordocs { > alias /var/www/rb.example.com/htdocs/errordocs; > } > > location /favicon.ico { > alias /var/www/rb.example.com/htdocs/static/rb/images/favicon.png; > } > > location / { > include uwsgi_params; > uwsgi_pass reviewboard_uwsgi; > uwsgi_param X-Real-IP $remote_addr; > uwsgi_param Host $http_host; > } > } > > > Note that if I start uwsgi with *--http-socket* instead of *--socket*, > and then browse directly to *http://10.1.9.60:8005 > <http://10.1.9.60:8005>*, I get the same set of errors when attempting to > add the repository. > > Here's the output I get from *p4 info*, first on the server itself, and > then on an example remote machine: > > owner@ubuntu_server:~$ p4 info > User name: super > Client name: ubuntu_server > Client host: ubuntu_server > Client root: /home/owner/p4temp > Client stream: //bxrc/main > Current directory: /home/owner > Peer address: 127.0.0.1:55138 > Client address: 127.0.0.1 > Server address: localhost.localdomain:1666 > Server root: /opt/perforce/servers/master > Server date: 2018/10/29 15:58:06 -0700 PDT > Server uptime: 00:56:41 > Server version: P4D/LINUX26X86_64/2018.1/1687724 (2018/08/06) > Server encryption: encrypted > Server cert expires: Jul 18 18:46:37 2020 GMT > ServerID: master > Server services: standard > Server license: none > Case Handling: insensitive > > C:\Users\awfor>p4 info > User name: aforsythe > Client name: aforsythe_ERSKINE_bxrc > Client host: ERSKINE > Client root: E:\bxrc > Client stream: //bxrc/main > Current directory: c:\Users\awfor > Peer address: 10.1.11.62:64523 > Client address: 10.1.11.62 > Server address: ubuntu_server:1666 > Server root: /opt/perforce/servers/master > Server date: 2018/10/29 15:58:34 -0700 PDT > Server uptime: 00:57:09 > Server version: P4D/LINUX26X86_64/2018.1/1687724 (2018/08/06) > Server encryption: encrypted > Server cert expires: Jul 18 18:46:37 2020 GMT > ServerID: master > Server services: standard > Server license: none > Case Handling: insensitive > > > If I open a python REPL on the same server that's running reviewboard, as > the same user, I'm able to connect via p4python without errors: > > >>> from P4 import P4, P4Exception > >>> p4 = P4() > >>> p4.port = 'ssl:10.1.9.60:1666' > >>> p4.user = 'NOT_A_REAL_USER' > >>> p4.connect() > P4 [NOT_A_REAL_USER@ubuntu_server ssl:10.1.9.60:1666] connected > > > Here's the Django config from */var/www/rb.example.com/conf/settings_local.py > <http://rb.example.com/conf/settings_local.py>*: > > # Site-specific configuration settings for Review Board > # Definitions of these settings can be found at > # http://docs.djangoproject.com/en/dev/ref/settings/ > > # Database configuration > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.postgresql_psycopg2', > 'NAME': 'reviewboard', > 'USER': '[REDACTED]', > 'PASSWORD': '[REDACTED]', > 'HOST': 'localhost', > 'PORT': '', > }, > } > > # Unique secret key. Don't share this with anybody. > SECRET_KEY = '[REDACTED]' > > # Cache backend settings. > CACHES = { > 'default': { > 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', > 'LOCATION': 'localhost:11211', > }, > } > > # Extra site information. > SITE_ID = 1 > SITE_ROOT = '/' > FORCE_SCRIPT_NAME = '' > DEBUG = False > ALLOWED_HOSTS = ['*'] > > > And here's *reviewboard.wsgi*: > > import __main__ > __main__.__requires__ = ['ReviewBoard'] > import pkg_resources > > import os > import sys > > os.environ['DJANGO_SETTINGS_MODULE'] = "reviewboard.settings" > os.environ['PYTHON_EGG_CACHE'] = "/var/www/rb.example.com/tmp/egg_cache" > os.environ['HOME'] = "/var/www/rb.example.com/data" > os.environ['PYTHONPATH'] = '/var/www/rb.example.com/conf:' + > os.environ.get('PYTHONPATH', '') > > sys.path = ['/var/www/rb.example.com/conf'] + sys.path > > import django.core.handlers.wsgi > application = django.core.handlers.wsgi.WSGIHandler() > > > Thanks! > -- Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/ Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/ Happy user? Let us know! https://www.reviewboard.org/users/ --- You received this message because you are subscribed to the Google Groups "Review Board Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
