- Make sure the domain you picked points at the IP of your Redash server.
- Switch to the
root
user (sudo su
). - Create a folder named
nginx
in/opt/redash
. - Create in the nginx folder two additional folders:
certs
andcerts-data
. - Create the file
/opt/redash/nginx/nginx.conf
and place the following in it: (replaceexample.redashapp.com
with your domain name)upstream redash { server redash:5000; }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
import time | |
from pprint import pprint | |
def poll_job(s, redash_url, job): | |
# TODO: add timeout | |
while job['status'] not in (3,4): | |
response = s.get('{}/api/jobs/{}'.format(redash_url, job['id'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function getQueryResult(slug, queryId, apiKey, options = {}) { | |
const instance = axios.create({ | |
baseURL: `https://app.redash.io/${slug}`, | |
headers: { | |
Authorization: `Key ${apiKey}` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REDASH_HOST = os.environ.get('REDASH_HOST', 'https://app.redash.io/name') | |
def poll_job(s, job): | |
# TODO: timeout | |
while job['status'] not in (3,4): | |
response = s.get('{}/api/jobs/{}'.format(REDASH_HOST, job['id'])) | |
job = response.json()['job'] | |
time.sleep(1) | |
return job['status'] == 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Explanation of what's going on in this query can be found in this blog post: https://blog.redash.io/sql-query-to-calculate-saas-metrics-dd25d72a0521. | |
*/ | |
WITH v_charges AS ( | |
SELECT org_id, | |
date_trunc('month', start_date) AS month, | |
coalesce((extra::json->>'amount')::float, (extra::json->>'charged_amount')::integer/100) as total | |
FROM charges | |
WHERE extra::json->>'months' = '1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: ts=4:sw=4:expandtab:autoindent: | |
import os | |
import sys | |
import requests | |
import filecmp | |
from fabric.context_managers import hide, settings, prefix | |
from fabric.api import sudo, task, run, cd, env | |
from fabric.contrib.console import confirm | |
from fabric.colors import green |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import twitter # python-twitter | |
import csv | |
import cStringIO | |
import codecs | |
from requests_oauthlib import OAuth1Session | |
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' | |
ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' | |
AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' | |
SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Octokit = require("@octokit/rest"); | |
const createCsvWriter = require("csv-writer").createObjectCsvWriter; | |
const octokit = new Octokit({ | |
auth: "token " + process.env.GITHUB_TOKEN | |
}); | |
async function getCommits(since) { | |
const options = octokit.repos.listCommits.endpoint.merge({ | |
owner: "getredash", | |
repo: "redash", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import urljoin | |
import requests | |
import click | |
import json | |
class Redash: | |
def __init__(self, host, api_key): | |
self.host = host | |
self.api_key = api_key |
NewerOlder