Internal server error (500) after restored postgres database

Keywords: Re:dash - AWS - Technical issue - Upgrade
bnsupport ID: b26546a6-62ee-434b-54e8-3a218f49222d
Description:
We’re using AWS Bitnami Redash (V5) and we need to upgrade it. I installed a new Bitnami server and restored dump file on it. But not able to make the new server work with the 500 error.

Hi @ahmokhtari,

Did you restart postgres?

sudo /opt/bitnami/ctlscript.sh restart postgres

Could you tell me the output of that command?

Did you restore the database as described in this guide?

https://docs.bitnami.com/general/apps/redash/administration/backup-restore-postgresql/

Regards,
Michiel

1 Like

Thanks @michiel for your reply.
Yes, I used the same guide and restarted all of the services after the dump restore. Below, is the output for that command:

sudo /opt/bitnami/ctlscript.sh restart postgresql
waiting for server to shut down… done
server stopped
/opt/bitnami/postgresql/scripts/ctl.sh : postgresql stopped
waiting for server to start… done
server started
/opt/bitnami/postgresql/scripts/ctl.sh : postgresql started at port 5432

I forgot to tell you! I already tried so many ways to upgrade our bitnami instance from v5 to v8 as wee need some options which are only available in v8. Finally, I managed to backup and restore the database in a new instance and I faced the above issue. Please let me know if there is any clean way to do the upgrade. I tried all the solutions for upgrade using guides in bitnami website. Thanks!

Using the Bitnami upgrade guide, I’m facing this error during applying the migration:

sudo ./bin/run python migrations/new_migrations.py
/opt/bitnami/python/bin/python: can’t open file ‘migrations/new_migrations.py’: [Errno 2] No such file or directory

It seems not doable after try few times!

Hi @ahmokhtari,

Sorry I didn’t mention it in my previous reply, but did you follow the exact steps in this guide to upgrade it? https://docs.bitnami.com/aws/apps/redash/administration/upgrade/.


Please, click on :heart: if you think my answer was helpful

@michiel Both of your provided methods for backing up or upgrading Redash is totally not doable! We trusted Bitnami and used it for our Redash stack for few years, now it comes to need support for upgrade, but we already stuck!

Restoring database using your provided method https://docs.bitnami.com/general/apps/redash/administration/backup-restore-postgresql/

ERROR: syntax error at or near “bitnami_redash”
LINE 1: bitnami_redash

Upgrading the whole Bitnami stack using your provided method https://docs.bitnami.com/aws/apps/redash/administration/upgrade/

sudo ./bin/run python migrations/new_migrations.py
/opt/bitnami/python/bin/python: can’t open file ‘migrations/new_migrations.py’: [Errno 2] No such file or directory

After this message, Redash throws 500 internal server error!

Hi @ahmokhtari,

I am sorry you run into those many issues. Can you let me know the exact version of Re:dash that you are trying to upgrade. And your target version is 7.0.0 right? I would like to try an upgrade on my own to see if I can reproduce those issues and see how we can help.

1 Like

Hi @tomasp,

Thanks for the reply. I’m using the version 5 and trying to upgrade it to 7. But I think it need to be upgraded to v6 first and then v7. (Please correct me if I’m wrong).

During the upgrade I’m facing some errors in the requirements part:
cd /opt/bitnami/apps/redash/htdocs
. venv/bin/activate
pip install -r requirements.txt

OSError: [Errno 2] No such file or directory: '/opt/bitnami/python/lib/python2.7/site-packages/simplejson-

And after restarting the services using /opt/bitnami/ctlscript.sh restart, I’m getting the 503 error

You know that it’s totally frustrating. I’m exactly following the provided instructions by Bitnami. Any help, is highly appreciated.

@tomasp Have you managed to simulate my environment? Can you please help me to settle this issue? Thanks!

@tomasp @michiel Is there any update on my issue? Actually, this is a very big stopper for our business and it seems that we’re not receiving any proper support form Bitnami for their product. Thanks!

Hi @ahmokhtari,

Yes, I was able to simulate your environment and also found issues following the current Bitnami guide.
I’ve been trying to solve them and it seems finally I was able to update directly from 5.0.2 to 7.0.0.

Let me some time to create detailed steps for you to follow.

1 Like

@ahmokhtari Please follow next steps:

First, create a backup of your current version:

mv /opt/bitnami/apps/redash/htdocs /opt/bitnami/apps/redash/htdocs.bak

Create the htdocs directory for the new version and unpack it there:

cd /opt/bitnami/apps/redash
wget https://github.com/getredash/redash/archive/v7.0.0.tar.gz
mkdir /opt/bitnami/apps/redash/htdocs
tar -C /opt/bitnami/apps/redash/htdocs -xvf v7.0.0.tar.gz --strip-components 1

Copy your .env file and your venv/ directory from the current version to the new version:

cp /opt/bitnami/apps/redash/htdocs.bak/.env /opt/bitnami/apps/redash/htdocs
cp -R /opt/bitnami/apps/redash/htdocs.bak/venv /opt/bitnami/apps/redash/htdocs

Edit your /opt/bitnami/apps/redash/htdocs/.env file and delete the REDASH_STATIC_ASSETS_PATH line.

Change permissions of the htdocs folder:

sudo chown -R bitnami:redash /opt/bitnami/apps/redash/htdocs
sudo find /opt/bitnami/apps/redash/htdocs -type d -exec chmod 775 {} \;

Install new requirements (First you need to load the bitnami environment and change to bitnami user)

sudo /opt/bitnami/use_redash
su bitnami
cd /opt/bitnami/apps/redash/htdocs
. venv/bin/activate
pip install -r requirements.txt

Create a home folder for the redash user

sudo mkdir /home/redash
sudo chown redash:redash /home/redash/

Migrate the database:

bin/run ./manage.py db upgrade

Generate new static files. (Install git and nodejs is required)

sudo apt-get install -y git
sudo curl -o '/opt/node-v10.16.3-linux-x64.tar.xz' 'https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz'
sudo tar xf /opt/node-v10.16.3-linux-x64.tar.xz -C /opt/
export PATH=/opt/node-v10.16.3-linux-x64/bin:$PATH
cd /opt/bitnami/apps/redash/htdocs
npm install && npm run build

Finally, restart the servers:

sudo /opt/bitnami/ctlscript.sh restart

Please let me know if you find some issues with these instructions. We will update our redash upgrade guide based on this procedure.

1 Like

Hi @tomasp,

Many thanks for your detailed instructions! It worked like a charm and I managed to upgrade our Redash Bitnami instance from v5 to v7 first and then v8. The only thing is the npm install is crashing at the first run and the server needs a reboot. After reboot, it’s working.

By the way,I think it’s better to change your upgrade page as it’s totally irrelevant and not doable. Thanks again for your time and the big help.

We’re facing another weird issue after upgrading to v8. Once created a new data source to Presto, it’s throwing this error: init() got an unexpected keyword argument ‘password’

Any idea?

@tomasp I appreciate if you can help me on this issue as well.

Totally agree. We will sync with the docs team so they can update the upgrade guide based on my previous comment. Thanks for confirming it works.

Regarding that unexpected keyword argument error, as Redash V8 is still a beta release, I would ask Redash developers first in case it is a known issue.

Thankd for the reply @tomasp! I already asked them and below is their response:

It’s probably because you have an incorrect (old) version of the pyhive library.

But I have no clue that how I can do for that.

I managed to solve the problem with updating the pyhive library. You can include the below command in your upgrade guide:

pip install pyhive==0.5.1

You can upgrade the pyhive module for the redash app with these commands:

  1. Load Bitnami environment

     sudo /opt/bitnami/use_redash
     su bitnami
     cd /opt/bitnami/apps/redash/htdocs/
    
  2. Activate Re:dash virtualenv

     . venv/bin/activate
    
  3. Check current pyhive version

     pip list | grep -i pyhive
    
  4. Update

     pip install --upgrade pyhive