Issue Summary

Installed the redash version 5.0.2.b5486 on Ubuntu back in Nov-2018. Created few dashboards. Things are working fine. I am trying to copy the setup (dashboards/data sources etc) to a new box. Not able to figure out how to take the backup though.

Tried to backup:

# Uncompressed backup
$ sudo -u redash pg_dump > backup_filename.sql
# redash user not found

I tried to see if postgres is running

$ psql 
# not able to connect to db
# no postgres file in /var/run

Then I realized redash is dockerized.

$ sudo docker ps
# shows 7 containers running

$ sudo docker exec -it redash_postgres_1 bash
bash-4.3# psql -U postgres
postgres=# \l
# this does not show redash database

Tried few other options:

$ sudo docker exec -t redash_server_1 pg_dump > ~/backup_filename.sql
$ sudo docker exec -t redash_postgres_1 pg_dump > ~/backup_filename.sql

Not sure what am I doing wrong.

Technical details:

  • Redash Version: 5.0.2.b5486
  • Browser/OS: Ubuntu 18.04.1 LTS
  • How did you install Redash: as per the documentation ($ git clone https://github.com/getredash/redash.git; cd redash; bash setup/setup.sh;)

As a thought, the dockerised version of Redash creates a local directory /opt/redash/postgres-data on your Ubuntu box, and mounts that into the PostgreSQL docker container for storing the PostgreSQL database.

You could probably just rsync that directory to the new box (after shutting down the docker containers, to be safe), and that should work. If the new box has a newer Redash, it’d probably need the upgrade process run on it after the rsync.

Does that help? :slight_smile:

Thank you for the pointer!

What I ended up doing is: upgrading the current redash installation.

# taking the backup in case something goes wrong
$ cp /opt/redash/postgres-data ~/backup/

# clone latest redash repo
$ git clone https://github.com/getredash/redash.git

# backup existing yml
$ cp /opt/redash/docker-compose.yml ~/redash/backup-docker-compose.yml

# copy the latest yml to /opt/redash
$ cp ~/redash/setup/docker-compose.yml /opt/redash/docker-compose.yml

# stop all the docker containers
$ docker-compose stop server scheduler scheduled_worker adhoc_worker nginx postgres redis

# upgrade
$ docker-compose run --rm server manage db upgrade

# run
$ docker-compose up -d

At this point, current redash installation was upgraded to 7.0.0.b18042. Everything was working fine now.

# now the db backup
$ docker exec -t redash_postgres_1 pg_dump -U postgres > ~/backup_redash_postgres.sql

Now I have a backup that I am able to restore to new installation.

# create a new box and install redash
$ git clone https://github.com/getredash/redash.git; cd redash; bash setup/setup.sh

# restore from the backup file
$ cat ~/backup_redash_postgres.sql | docker exec -i redash_postgres_1 psql -U postgres
2 Likes

Excellent. That’s a win. :slight_smile: