Are you using any dashboard or tool to analyze your company data? If not, or if you're not satisfied the one you're using currently, redash could be a helpful tool for you and for your company.
It's really easy to use and quite nice! On this article, I'm going to introduce you guys how to build redash on AWS EC2.
Make Your Company Data Driven
Connect to any data source, easily visualize and share your data
You can use redash without doing anything if you pay, but since you're (probably) engineer, you can do everything for free.
This is the documentation.
If you think you don't need any help, no need to read this article. Let's try :)
1. Launch EC2 with redash AMI
2. Connect to data source
3. Set up Email by SES for production use
First Step: Launch EC2 with redash AMI
redash prepares two easy ways. One is by Docker. The another one is AWS AMI(Also you can launch it on GCC, too).
Here, I want to introduce AWS AMI.
On EC2 dashboard, click "Launch Instance", please. Then on the left pane, choose "Community AMIs". Next, on the search box, put AMI name which is on the list on above document link. (If you cannot find the AMI, please check region of your EC2.) The instance size is enough with small. Once you launch it, you can access redash dashboard by public DNS. Of course, if you have your domain, you can set it for redash dashboard.
Second Step: Connect to data source
First step was quite easy. I think this second step is a bit difficult. Here, I'll show you how to setup data source with PostgreSQL.
The difficult part is "Port". The easier way I think is to use
autossh. If you have a database on AWS, you can connect somehow, but if the database is outside of AWS(even inside),
autossh could be helpful.
Let's install autossh on your ubuntu OS.
$ sudo apt-get install autossh
Example of connection.
$ autossh -M 0 -f -N -L 127.0.0.1:15432:127.0.0.1:5432 email@example.com -p 5082
In this case,
1. connect via ssh by ubuntu user to example.com through port 5082
2. connect the port 127.0.0.1:5432 on example.com to the port 127.0.0.1:15432 of the host which is using autossh.
Also, you can check autossh process, like below.
ubuntu@redash-production:~$ ps ax | grep autossh 5746 pts/0 S+ 0:00 grep --color=auto autossh 14346 ? Ss 0:00 /usr/lib/autossh/autossh -M 0 -N -L 127.0.0.1:15432:127.0.0.1:5432 firstname.lastname@example.org -p 5082
By the way, I recommend you to create a user such as "redash" and make a read-only permittion.
Third Step: Set up Email by SES for production use
If you want to add more users who can login redash dashboard, you need to enable to send emails from redash server since the user needs to confirm the invitation from the url on the email.
Since we're already using AWS, to use SES is an easier way.
/opt/redash, there is everything about redash itself. There, you can find
.env hidden file. Let's edit it for SES. (*Please setup SES by yourself. I don't write the details down here.)
This is an example.
# .env export REDASH_LOG_LEVEL="INFO" export REDASH_REDIS_URL=redis://localhost:6379/0 export REDASH_DATABASE_URL="postgresql:///redash" export REDASH_COOKIE_SECRET=SECRET_KEY // set by default export REDASH_MAIL_SERVER="email-smtp.eu-west-1.amazonaws.com" # default: localhost export REDASH_MAIL_PORT="587" # default: 25 export REDASH_MAIL_USE_TLS="true" # default: false export REDASH_MAIL_USE_SSL="false" # default: false export REDASH_MAIL_USERNAME="USERNAME_OF_SES" # default: None export REDASH_MAIL_PASSWORD="PASSWORD_OF_SES" # default: None export REDASH_MAIL_DEFAULT_SENDER="email@example.com" # Email address to send from export REDASH_HOST="https://redashhost.com" # base address of your Redash instance, for example: "https://demo.redash.io"
If you don't understand what is your usename and password of SES, check this document please.
Now, you can create queries, dashboard whatever you want!
It's not difficult, isn't it? Happy life with redash! :D