This is a support feature request 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.
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:
Create the RDS instance.
Create database and user for Redash.
Update REDASH_DATABASE_URL in /opt/redash/.env to point at the URL of the new RDS instance.
From /opt/redash/current run sudo -u redash bin/run ./manage.py database create_tables (create the tables).
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).
Restart everything (supervisorctl restart all).
Done.
If you want to migrate an existing instance, then instead of steps 4-5 you need to:
Create a backup of the existing database using pg_dump.
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.
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.
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 ?
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