5015: [Errno 111] Connection refused when use rbtools to connect to reviewboard built by docker-compose

wayne

What version are you running?

docker-compose image beanbag/reviewboard:6.0

What's the URL of the page containing the problem?

http://localhost:8008

What steps will reproduce the problem?

  1. modify default port 80 in docker-compose.mysql.yaml to port 8008
  2. run docker-compose and enter http://localhost:8008
  3. use rbt setup-repo to connect to localhost:8008

What is the expected output? What do you see instead?

expected output:

This command is intended to help users create a .reviewboardrc file in the current
directory to connect a repository and Review Board server.
Enter the Review Board server URL: localhost:8008

Making HTTP GET request to http://localhost:8008/api/
[scan] Checking for available SCMs for /home/dev/selenium_ide...
[scan] Considering all repository types
[scan] Checking for a Subversion repository...
[scan] SCM scan complete. Found svn (/home/dev/selenium_ide)
[scan] Verifying repository information...
Running: svn --non-interactive --version -q
[scan] Successfully found repository information: <SVNRepositoryInfo(path='', base_path='/', local_path='/home/dev/selenium_ide')>
Making HTTP GET request to http://localhost:8008/api/repositories/...
Added cache entry for HTTP GET request to http://localhost:8008/api/repositories/?only-fields=id%2Cname%2Cmirror_path%2Cpath&only-links=info&path=http%3A%2F%2F%2Fsvn%2F&tool=Subversion
Making HTTP GET request to http://localhost:8008/api/repositories/1/info/
Added cache entry for HTTP GET request to http://localhost:8008/api/repositories/1/info/
Current server: localhost:8008
Making HTTP GET request to http://localhost:8008/api/repositories/?tool=Subversion
Added cache entry for HTTP GET request to http://localhost:8008/api/repositories/?tool=Subversion
1 matching Subversion repositories found:
1) "Auototest" (http://url)
Select a Subversion repository to use [1-1]: 1
Selecting "Auototest" (http://url)...
Create "/home/dev/selenium_ide/.reviewboardrc" with the following?
REVIEWBOARD_URL = "localhost:8008"
REPOSITORY = "Auototest"
REPOSITORY_TYPE = "svn"

.reviewboardrc creation successful! Config written to /home/dev/selenium_ide/.reviewboardrc

Actual output:

This command is intended to help users create a .reviewboardrc file in the current
directory to connect a repository and Review Board server.

Enter the Review Board server URL: localhost:8008

Making HTTP GET request to http://localhost:8008/api/
[scan] Checking for a Subversion repository...
[scan] Verifying repository information...
Running: svn --non-interactive --version -q
[scan] Successfully found repository information: <SVNRepositoryInfo(path='http://', base_path='/', local_path='/home/dev/selenium_ide')>
Making HTTP GET request to http://localhost/api/repositories/?only-fields=id%2Cname%2Cmirror_path%2Cpath&only-links=info&path=http%3A%2F%2F%2Fsvn%2&tool=Subversion
Traceback (most recent call last):
File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1011, in _send_output
self.send(msg)
File "/usr/lib/python3.8/http/client.py", line 951, in send
self.connect()
File "/usr/lib/python3.8/http/client.py", line 922, in connect
self.sock = self._create_connection(
File "/usr/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/usr/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/request.py", line 1264, in make_request
rsp = self._urlopen(Request(
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/cache.py", line 462, in make_request
response = LiveHTTPResponse(urlopen(request))
File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.8/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib/python3.8/urllib/request.py", line 1383, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.8/urllib/request.py", line 1357, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/dev/.local/bin/rbt", line 8, in <module>
sys.exit(main())
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/commands/main.py", line 207, in main
command.run_from_argv([RB_MAIN, command_name] + args)
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/commands/init.py", line 1118, in run_from_argv
exit_code = self.main(*args) or 0
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/commands/setup_repo.py", line 182, in main
repository, info = get_repository_resource(
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/utils/repository.py", line 61, in get_repository_resource
repositories = api_root.get_repositories(query)
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/resource.py", line 328, in <lambda>
self._get_url(url,
kwargs)))
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/decorators.py", line 23, in request_method
return self._transport.execute_request_method(method_wrapper,
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/transport/sync.py", line 289, in execute_request_method
return self._execute_request(request)
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/transport/sync.py", line 310, in _execute_request
rsp = self.server.make_request(request)
File "/home/dev/.local/lib/python3.8/site-packages/rbtools/api/request.py", line 1269, in make_request
raise ServerInterfaceError('%s' % e.reason)
rbtools.api.errors.ServerInterfaceError: [Errno 111] Connection refused

What operating system are you using? What browser?

Ubuntu20.04;firefox

Please provide any additional information below.

Below is my docker-compose.mysql.yaml and default.conf.template

# Example docker-compose configuration for Review Board on MySQL.
#
# Please note, this file is meant to be used as an example! You will need
# to change some settings first. See the instructions.
#
#
# Instructions
# ============
#
# 1. Copy the following to a new directory:
#
#    * docker-compose.yaml (based on this file)
#    * nginx_templates
#
# 2. Change the hostname below to a fully-qualified domain name you'll be
#    able to use for the server. Search for "localhost" for the default.
#
#    See DOMAIN and NGINX_HOST below.
#
#    To temporarily test a hostname, you can modify /etc/hosts on Linux
#    or macOS and alias it to your IP address.
#
#    NOTE: If you change this later, you will need to edit the sitedir
#          volume's conf/settings_local.py to include the new hostname in
#          ALLOWED_HOSTS, and change the hostname in Review Board's
#          Admin UI -> General Settings page.
#
# 3. Change the database passwords below to someth
upstream reviewboard {
    server reviewboard:8080;
}
server {
    server_name ${NGINX_HOST};
    # If enabling SSL on Nginx, remove the "listen ${NGINX_PORT}" lines below
    # and use these settings instead. You will also need to change
    # X-Forwarded-Ssl below.
    #
    # listen [::]:443 ssl http2;
    # listen 443 ssl http2;
    # ssl_certificate /var/www/reviewboard/conf/ssl/fullchain.pem;
    # ssl_certificate_key /var/www/reviewboard/conf/ssl/privkey.pem;
    listen [::]:${NGINX_PORT};
    listen ${NGINX_PORT};
    root /var/www/reviewboard/htdocs;
    location / {
        proxy_pass http://reviewboard;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Proto $scheme;
        # NOTE: Set this to "on" if using SSL.
   
hongyver
#1 hongyver

You need to change proxy_set_header Host $host; in default.conf.template to actual ip:port.