Upgrade from 3.0.20 to 4.0.7

194 views
Skip to first unread message

Martin Marusinec

unread,
Jun 27, 2022, 9:38:50 AM6/27/22
to Review Board Community
Hello,

what is the correct method to upgrade from 3.0.20 to 4.0.7 ? I inherited the server and was asked to upgrade, however the method described in the documentation (pip upgrade ...) does not work, it fails with python errors. I understood the 3.x runs with python 2.7 and 4.x runs with python 3, but here my python experience ends. 

I managed to run "python3 -m pip install --upgrade pip" without erros, and "pip3 install ReviewBoard" afterwards. It complained I ran it as root. Running "rb-site upgrade /var/www/rbsite" wrote ModuleNotFoundError: No module named 'psycopg2' and some other errors. Running "pip3 install psycopg2" wrote:
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
ERROR: Command errored out with exit status 1:
...
./psycopg/psycopg.h:35:20: fatal error: Python.h: No such file or directory

So I run "pip install psycopg2-binary==2.8.6" (I cound not compile it and newer version had issue with timezone). 

"rb-site upgrade /var/www/rbsite" was successfull this time, I restarted httpd and memcached, however I get HTTP500 error now.  I see no log files generated.

Running the file manually writes this:
[root@localhost htdocs]# python3 reviewboard.wsgi
/usr/local/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
  from cryptography.hazmat.backends import default_backend
[root@localhost htdocs]#

Could you please give try to navigate me, what to fix ?

Thansk,

BR

MM

Martin Marusinec

unread,
Jun 27, 2022, 10:59:12 AM6/27/22
to Review Board Community
I switched the python symbolic link to python3, and found the logs in /var/log/httpd, and it seems it tries to use python2.7:
[Mon Jun 27 16:57:10.508059 2022] [:error] [pid 1856] [client 10.103.108.170:60804] mod_wsgi (pid=1856): Target WSGI script '/var/www/XXXXXX/htdocs/reviewboard.wsgi' cannot be loaded as Python module., referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508117 2022] [:error] [pid 1856] [client 10.103.108.170:60804] mod_wsgi (pid=1856): Exception occurred processing WSGI script '/var/www/ XXXXXX/htdocs/reviewboard.wsgi'., referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508188 2022] [:error] [pid 1856] [client 10.103.108.170:60804] Traceback (most recent call last):, referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508224 2022] [:error] [pid 1856] [client 10.103.108.170:60804]   File "/var/www/ XXXXXX/htdocs/reviewboard.wsgi", line 3, in <module>, referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508304 2022] [:error] [pid 1856] [client 10.103.108.170:60804]     import pkg_resources, referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508318 2022] [:error] [pid 1856] [client 10.103.108.170:60804]   File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>, referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508351 2022] [:error] [pid 1856] [client 10.103.108.170:60804]     from . import py31compat, referer: https://10.103.100.250/
[Mon Jun 27 16:57:10.508382 2022] [:error] [pid 1856] [client 10.103.108.170:60804] ImportError: cannot import name py31compat, referer: https://10.103.100.250/


Dátum: pondelok 27. júna 2022, čas: 15:38:50 UTC+2, odosielateľ: Martin Marusinec

Christian Hammond

unread,
Jul 3, 2022, 10:55:02 PM7/3/22
to revie...@googlegroups.com
Hi Martin,

I'm so sorry we haven't gotten back to you until now. Between our private support channel and the upcoming Review Board release, we've been stretched a bit thin this past week. I don't know if you've gotten any further at this point, but I can try to help you get unstuck.

Review Board 4 does work with Python 2.7. You don't need Python 3. Review Board 5.0 and higher will require Python 3, so it's still worth doing.

However, your system is only configured to run Apache with Python 2.7. So your attempt to install the Python 3 versions (using pip3) isn't going to work at this stage. Depending on how old your distribution is, you may or may not be able to switch this to Python 3. It could require a new install (I'll talk about that in a minute).

For now, you may want to just stay on Python 2.7.


Now, the py31compat issue. I've seen this before. It's a third-party issue that's common on some versions of Ubuntu, due to a packaging problem of theirs. It's affected a lot of Python-based software.

You can try to install the official setuptools package (which provides pkg_resources) via pip, and see if that addresses it. You may also need to remove or move aside the old version shown in that error output.

To try to install the official version:

    sudo pip install -U setuptools

Then restart Apache, see if the error changes. It very well may not, in which case you'd have to see if moving /usr/lib/python2.7/site-packages/pkg_resources/ elsewhere does any good (I wouldn't outright delete it though, in case you need to undo this).


At some point, maybe sooner, you probably should consider a new Linux install built for Python 3. You'd have to go through our guide and set up all the packages from scratch. What you'd then do is, instead of running 'rb-site install', you'd copy over the old server's site directory (what you pass to 'rb-site') and Apache configuration. Get those in the right place, then 'rb-site upgrade' that. Since you've already gone through that 'rb-site upgrade' process with your current database, this should be quick, just setting up some state for your new server.

We do provide support contracts, if you'd like details on that at any point. We can help with upgrade planning and be on call when it's time to move things over.

Christian



--
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 reviewboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reviewboard/26eec0e5-f5c0-4a9a-b71d-ae68771170f0n%40googlegroups.com.


--
Christian Hammond
President/CEO of Beanbag
Makers of Review Board

Ant

unread,
Jul 16, 2022, 4:28:13 PM7/16/22
to Review Board Community
Hi Christian,

I am trying to do this upgrade right now. Along with what suggested, do you also have to copy over the "Secret Key" from the 3.0.20 config? Also, what about the database, in my case, postgresql? And lastly, what about the path the django? Does that changes with the 'upgrade' command?

Christian Hammond

unread,
Jul 20, 2022, 4:06:46 PM7/20/22
to revie...@googlegroups.com
Hi Ant,

You'll need to copy the SECRET_KEY. That's used for AES encryption of things like stored repository passwords.

You'll also need to make sure the new site directory uses the same path as the old one (or you'll have to fix up some settings to point to the moved paths via some command line tools).
 
If you're moving the database, you can do a database dump on the old server and an import on the new one, using standard Postgres tools. This would have the benefit of giving you a backup in the process. Make sure settings_local.py points to the new database location. The database should be absolutely empty before import, and you should not use 'rb-site install'.

I'm not sure what you mean about Django or the upgrade command. If you install Review Board through normal means, the correct Django will be installed. 'rb-site upgrade' should do the right thing if you have everything configured correctly.

Christian


Reply all
Reply to author
Forward
0 new messages