This is a support feature request :slight_smile: The redash installation docs are very solid, and the fact that there are AMIs and a docker image makes it even easier.

One common task that I think many people will want to do is set up the Redash metadata database as an RDS db instead of on localhost. I’m positive that if I sink some hours into this that I can figure out how to do it, but it would be great if a walkthrough for how to do this were just a part of the setup docs, because I’m sure many people will want to do it.

If someone already knows how to easily do this and can provide a walkthrough that would be amazing. If no one has time, I will eventually do it and will contribute an update to the setup guide.

2 Likes

Actually it’s quite simple and something I encourage people to do when they go to “production” with their Redash instance.

It’s trickier for existing setup, but for a new instance it’s quite simple:

The steps are:

  1. Create the RDS instance.
  2. Create database and user for Redash.
  3. Update REDASH_DATABASE_URL in /opt/redash/.env to point at the URL of the new RDS instance.
  4. From /opt/redash/current run sudo -u redash bin/run ./manage.py database create_tables (create the tables).
  5. Again from /opt/redash/current run sudo -u redahs bin/run ./manage.py users create --admin --password admin "Admin" "admin" (create admin user, better change the password to something which isn’t admin).
  6. Restart everything (supervisorctl restart all).
  7. Done.

If you want to migrate an existing instance, then instead of steps 4-5 you need to:

  1. Create a backup of the existing database using pg_dump.
  2. Restore this backup into the RDS database.

There is a page in the docs on how to backup/restore the DB, it might help here.

2 Likes

(moved the post to the #Support category)

@arikfr -
Recommended configuration for instance type?

It really depends on your usage, but you can probably start with the smallest they offer.

I have done this with our production instance, it was pretty easy.

We have also started investigating putting a load balance in front of redash.

Looking at possibly the following setup for now:

  • Load balancer
  • Two re:dash application instances
  • RDS database with HA enabled

I’m interested to hear what other people have done to make their production environment resilient.

Redash’s web server is stateless, so you can definitely put it behind a load balancer. This is actually what I’m doing for the hosted solution.

The only part that has state and can’t be duplicated is Celery’s scheduler process (the worker you run with the --beat option).

Can I get an example for the URL of the RDS instance.

export REDASH_DATABASE_URL=“postgresql://redash@db-nwredash.east1.stage.company.com:5432/redash”

says password not supplied. redash is a password less user that I have created per the script.

This /opt/redash/.envdoesn’t exist in the “server” container. Where are we supposed to find it?

Hey @tekne did you resolve this issue by any means?
I have the same issue and unable to see the .env file either on the docker container or the host machine.
Any help would be much appreciated. I installed the latest redash version using their installation script

I wanted to connect rds instance for my redash metadata store and run some query as mentioned to create the default schemas.

If you’re using a Docker based AMI, your configuration is in /opt/redash/env file.

Yeah I have that directory /opt/redash/env on my host machine, but my problem is in order to create default tables , create users what are the commands I need to run from this directory path.

So, this is my directory paths and files in them on my host machine(ubuntu 18.04).
/opt/redash has docker-compose.yml, env, postgres-data(dir)

The commands that you mentioned in steps 4 and 5 in your above explanation doesn’t work for me.
4. From /opt/redash/current run sudo -u redash bin/run ./manage.py database create_tables (create the tables).
5. Again from /opt/redash/current run sudo -u redahs bin/run ./manage.py users create --admin --password admin "Admin" "admin" (create admin user, better change the password to something which isn’t admin ).
can you let me know if I need to run a different command to create the tables and users ?

Thanks.

If anyone comes across this article, as I did, here are the steps I followed for Redash 5.0.2+b5486 running in an EC2 in AWS.

Create database and user for Redash in RDS
Update REDASH_DATABASE_URL in /opt/redash/env to point at the URL of the new RDS instance and DB.
Update POSTGRES_PASSWORD to the password you set for your RDS DB user account
After updating /opt/redash/env, from /opt/redash/ run: sudo docker-compose up -d
This recreates the Redash docker environment, which in turn rereads the /opt/redash/env file.
To create the default Redash tables in the RDS database run: sudo docker exec -it redash_server_1 ./manage.py database create_tables
Optionally, you can add an admin user run: sudo docker exec -it redash_server_1 ./manage.py users create --admin --password admin “Admin” “admin” (create admin user, better change the password to something which isn’t admin). Or, you can go to the web interface to create the user.
Done.

As a bonus, to see other manage.py usage do: sudo docker exec -it redash_server_1 ./manage.py --help

2 Likes

For those that are looking for a solution please refer to this!

link for the solution?

Look at @bfransman’s response earlier in this thread :smiley: