djangobitnamireview-board

Can’t connect to MySQL while upgrading Bitnami Review Board by rb-site


I am trying to upgrade Bitnami ReviewBoard from 3.0.1 to 3.0.2 . I have done the venv/bin/easy_install -U ReviewBoard. But when I try venv/bin/rb-site upgrade installdir/rb-sites/reviewboard/, I obtained an error of django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/opt/reviewboard-3.0.1-0/mysql/tmp/mysql.sock' (2)").

Following is the detailed log:

bash-4.2# venv/bin/rb-site upgrade ./rb-sites/reviewboard/
Traceback (most recent call last):
  File "venv/bin/rb-site", line 11, in <module>
    load_entry_point('ReviewBoard==3.0.2', 'console_scripts', 'rb-site')()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1965,                                                                                                              in main
    command.run()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1742,                                                                                                              in run
    static_media_upgrade_needed = site.get_static_media_upgrade_needed()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard/cmdline/rbsite.py", line 503,                                                                                                              in get_static_media_upgrade_needed
    siteconfig = SiteConfiguration.objects.get_current()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/Djblets-1.0.2-py2.7.egg/djblets/siteconfig/managers.py", line 50, in g                                                                                                             et_current
    site = Site.objects.get_current()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/contrib/sites/models.py", line 47, in get_current
    current_site = self.get(pk=sid)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/manager.py", line 151, in get
    return self.get_queryset().get(*args, **kwargs)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/query.py", line 304, in get
    num = len(clone)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/query.py", line 77, in __len__
    self._fetch_all()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/query.py", line 857, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/query.py", line 220, in iterator
    for row in compiler.results_iter():
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/sql/compiler.py", line 713, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/models/sql/compiler.py", line 785, in execute_sql
    cursor = self.connection.cursor()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/backends/__init__.py", line 162, in cursor
    cursor = util.CursorWrapper(self._cursor(), self)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/backends/__init__.py", line 132, in _cursor
    self.ensure_connection()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/backends/__init__.py", line 115, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/django/db/backends/mysql/base.py", line 435, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site                                                                                                             -packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server th                                                                                                             rough socket '/opt/reviewboard-3.0.1-0/mysql/tmp/mysql.sock' (2)")
bash-4.2# pwd
/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs
bash-4.2# /opt/reviewboard-3.0.1-0/ctlscript.sh status
apache not running
mysql not running
memcached not running
bash-4.2# sudo venv/bin/rb-site upgrade ./rb-sites/reviewboard/
Cannot locate wrapped file
bash-4.2# venv/bin/rb-site upgrade ./rb-sites/reviewboard/
Traceback (most recent call last):
  File "venv/bin/rb-site", line 11, in <module>
    load_entry_point('ReviewBoard==3.0.2', 'console_scripts', 'rb-site')()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1965, in main
    command.run()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1742, in run
    static_media_upgrade_needed = site.get_static_media_upgrade_needed()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard/cmdline/rbsite.py", line 503, in get_static_media_upgrade_needed
    siteconfig = SiteConfiguration.objects.get_current()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/Djblets-1.0.2-py2.7.egg/djblets/siteconfig/managers.py", line 50, in get_current
    site = Site.objects.get_current()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/contrib/sites/models.py", line 47, in get_current
    current_site = self.get(pk=sid)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
    return self.get_queryset().get(*args, **kwargs)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/query.py", line 304, in get
    num = len(clone)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __len__
    self._fetch_all()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/query.py", line 857, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
    for row in compiler.results_iter():
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 713, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 785, in execute_sql
    cursor = self.connection.cursor()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/backends/__init__.py", line 162, in cursor
    cursor = util.CursorWrapper(self._cursor(), self)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/backends/__init__.py", line 132, in _cursor
    self.ensure_connection()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/backends/__init__.py", line 115, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 435, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/opt/reviewboard-3.0.1-0/mysql/tmp/mysql.sock' (2)")

All operations are executed in the Bitnami Console.

Environemnts:

bash-4.2# /opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/bin/rb-site --version
rb-site 3.0.2
Python 2.7.14 (default, Dec 12 2017, 10:27:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
Installed to /opt/reviewboard-3.0.1-0/apps/reviewboard/htdocs/venv/lib/python2.7/site-packages/ReviewBoard-3.0.2-py2.7.egg/reviewboard

Currently, if I start all the required services and visite the review board, the following page is showed: enter image description here

Thank you in advance!!


Solution

  • It was my stupid mistake! I thought upgrading should stop the MySQL service. It works perfectly after I started the MySQL service.