Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0acc16b
In docker-entrypoint ensure tables exist
Apr 12, 2017
464e634
upgrade node and npm in dockerfile
alison985 Aug 11, 2017
795f6c2
Update Circle CI for our workflow
robotblake Apr 19, 2017
839b0db
add pyup config document
alison985 Jul 8, 2017
c8c89b6
Pin PyAthena dependency to 1.2.0.
jezdez Oct 25, 2017
63535aa
Switch to PyMySQL for MySQL 5.7 support
Sep 14, 2017
d8689e9
upgrade to Celery 4.1.1
Jan 8, 2018
d9c59f4
Documentation links for data sources (re #6)
Nov 8, 2016
9dd0160
Don't execute query when changing data sources (fixes #29)
Feb 10, 2017
a212d1e
Retry fetching query result on failure (fixes #36)
Feb 16, 2017
64913b2
Use saved values for parameters in scheduled queries (re #43)
Feb 24, 2017
4e41acb
Add `schedule_until` field to queries, to allow expiry (re #15)
Mar 2, 2017
1e4129f
add compare query version support (re #7)
spasovski Feb 6, 2017
58a5e36
Filter tables from schema browser (re #31)
Jul 9, 2018
5fa01cc
give warning/error msg on inaccurate graph config (re #57)
alison985 Jun 22, 2017
883c36b
add column type info to query runners (re #152, #23)
alison985 Jul 28, 2017
829b773
add hideParameters param (re #163)
alison985 Jul 28, 2017
be0cd84
add ability to add query to dashboard from query page (re #154)
alison985 Aug 8, 2017
173ceb5
Add last_active_at column to users page (re #155)
alison985 Aug 12, 2017
07346c7
add partition key marker to Athena and Presto columns (re #185)
Dec 9, 2017
48ddd18
make autocomplete for large schemas faster (re #232)
Dec 9, 2017
77a92a7
Toggle for query editor autocomplete (re #282)
Dec 19, 2017
231f7df
hide query more menu if empty (re #208)
spasovski Aug 17, 2017
569cda6
Move events server side (re #245)
alison985 Sep 1, 2017
6362537
Run queries with no cached result in public dashboards (re #220)
Sep 6, 2017
f2d5cd2
allow x-axis label truncation (re #249)
Jul 9, 2018
d97f761
secure cookies, add X-Content-Type-Options header (bug 1371613)
Sep 27, 2017
9bcda87
Merge mozilla schema updates with schema from master
Dec 12, 2017
4ccca67
merge upstream db changes
Feb 14, 2018
326e0f8
Support authentication for URL data source (re #330) (#336)
Mar 20, 2018
bd401fc
properly rollback failed db commits
Mar 21, 2018
0e4df2a
Install redash-stmo.
jezdez Feb 28, 2018
2af92dc
Extend the Remote User Auth backend with REMOTE_GROUPS ability (#311)
jezdez Mar 23, 2018
3f20065
Unique names for query parameters (re #164)
Jan 16, 2018
7947862
Aggregate query results (re #35) (#339)
Mar 27, 2018
ee85ed3
Updates to docker-entrypoint for worker and scheduler (#364)
jasonthomas Apr 11, 2018
b9d48b6
Closes #396: Integration with Flower.
May 11, 2018
6c55cb4
merge upstream db changes
Jun 28, 2018
74d19ea
Add data source health monitoring via an extension.
Apr 27, 2018
3d7ba67
Frontend Extensions API.
Jul 16, 2018
44bb2b5
Frontend extension API should be under the redash.extensions entry.
Sep 6, 2018
b4209b1
Closes #537: Port datasource URL code to an extension.
Sep 6, 2018
41c41be
Closes #553: Port data source version code to an extension.
Sep 7, 2018
aa3e70f
Update flask from 0.11.1 to 1.0.2
pyup-bot Nov 8, 2018
b36d36b
Update pyopenssl from 16.2.0 to 18.0.0
pyup-bot Nov 8, 2018
a6b93e1
Update flask-admin from 1.4.2 to 1.5.2
pyup-bot Nov 8, 2018
5bb5494
Update requests from 2.11.1 to 2.20.0
pyup-bot Nov 8, 2018
dc1ce15
Update cryptography from 2.0.2 to 2.3.1
pyup-bot Nov 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 110 additions & 103 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,124 +1,131 @@
version: 2.0
# These environment variables must be set in CircleCI UI
#
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo>
# DOCKER_USER
# DOCKER_PASS
#

version: 2
jobs:
unit-tests:
environment:
COMPOSE_FILE: .circleci/docker-compose.circle.yml
COMPOSE_PROJECT_NAME: redash
build:
docker:
- image: circleci/buildpack-deps:xenial
- image: docker:18.02.0-ce
working_directory: ~/mozilla/redash
steps:
- setup_remote_docker
- checkout
- setup_remote_docker
- run:
name: Build Docker Images
command: |
set -x
docker-compose up -d
sleep 10
- run:
name: Create Test Database
command: docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests;"
- run:
name: Run Tests
command: docker-compose run --name tests redash tests --junitxml=junit.xml tests/
- run:
name: Copy Test Results
command: |
mkdir -p /tmp/test-results/unit-tests
docker cp tests:/app/coverage.xml ./coverage.xml
docker cp tests:/app/junit.xml /tmp/test-results/unit-tests/results.xml
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: coverage.xml
build-tarball:
command: docker build -t app:build .
no_output_timeout: 20m

test:
docker:
- image: circleci/node:8
- image: circleci/node:6.14.3-stretch
- image: redis
- image: circleci/postgres:10-alpine-postgis
working_directory: ~/mozilla/redash
steps:
- checkout
- run: npm install
- run: npm run build
- run: .circleci/update_version
- run: .circleci/pack
- run: mkdir -p /tmp/test-reports/pytest
- run: sudo apt-get update
- run: sudo apt-get install -y python-pip python-dev
- run: sudo apt-get install -y redis-tools redis-server
- run: sudo pip install --upgrade setuptools
- run: sudo pip install -r requirements_dev.txt
- run: sudo pip install -r requirements.txt
- run: sudo npm install
- run: sudo npm run bundle
- run: sudo npm run build
- run:
command: pytest --junitxml=/tmp/test-reports/pytest/junit.xml tests/
environment:
REDASH_REDIS_URL: redis://localhost:6379/0
REDASH_DATABASE_URL: "postgresql://postgres@localhost/postgres"
- store_artifacts:
path: /tmp/artifacts/
build-docker-image:
docker:
- image: circleci/buildpack-deps:xenial
steps:
- setup_remote_docker
- checkout
- run: .circleci/update_version
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: docker build -t redash/redash:$(.circleci/docker_tag) .
- run: docker push redash/redash:$(.circleci/docker_tag)
integration-tests:
working_directory: ~/redash
machine: true
environment:
REDASH_SERVER_URL : "http://127.0.0.1:5000/"
DOCKER_IMAGE: mozilla/redash-ui-tests
path: /tmp/test-reports/
destination: tr1
- store_test_results:
path: /tmp/test-reports/

deploy-master:
machine:
enable: true
working_directory: ~/mozilla/redash
steps:
- checkout
- run:
name: Install Docker Compose
command: |
set -x
pip install --upgrade pip
pip install docker-compose>=1.18
docker-compose --version
- run:
name: Pull redash images
name: Deploy to Dockerhub
no_output_timeout: 20m
command: |
set -x
docker-compose -f docker-compose.yml up --no-start
sleep 10
- run:
name: Pull redash-ui-tests
command: docker pull "${DOCKER_IMAGE}":latest
./bin/deploy "master"

deploy-rc:
machine:
enable: true
working_directory: ~/mozilla/redash
steps:
- checkout
- run:
name: Setup redash instance
name: Deploy to Dockerhub
no_output_timeout: 20m
command: |
set -x
docker-compose run --rm --user root server create_db
docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"
docker-compose run --rm --user root server /app/manage.py users create_root root@example.com "rootuser" --password "IAMROOT" --org default
docker-compose run --rm --user root server /app/manage.py ds new "ui-tests" --type "url" --options '{"title": "uitests"}'
docker-compose run -d -p 5000:5000 --user root server
docker-compose start postgres
./bin/deploy "rc"

deploy-milestone:
machine:
enable: true
working_directory: ~/mozilla/redash
steps:
- checkout
- run:
name: Run tests
name: Deploy milestone to Dockerhub
no_output_timeout: 20m
command: |
set -x
docker run --net="host" --env REDASH_SERVER_URL="${REDASH_SERVER_URL}" "${DOCKER_IMAGE}"
- store_artifacts:
path: report.html
./bin/deploy "$CIRCLE_TAG"
./bin/alias "$CIRCLE_TAG" "latest"


workflows:
version: 2
integration_tests:
build-test-deploy:
jobs:
- integration-tests:
- build:
filters:
branches:
only: master
build:
jobs:
- unit-tests
- build-tarball:
requires:
- unit-tests
filters:
tags:
only: /v[0-9]+(\.[0-9\-a-z]+)*/
branches:
only:
- master
- release
- build-docker-image:
requires:
- unit-tests
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9\-a-z]+)*/
tags:
only: /.*/
branches:
ignore:
- gh-pages

- test:
filters:
tags:
only: /.*/
branches:
ignore:
- gh-pages

- deploy-master:
requires:
- test
filters:
branches:
only:
- master

- deploy-rc:
requires:
- test
filters:
branches:
only:
- release

- deploy-milestone:
requires:
- test
filters:
tags:
only: /^m[0-9]+(\.[0-9]+)?$/
branches:
ignore: /.*/
6 changes: 6 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
schedule: "every day"
search: False
update: insecure
requirements:
- requirements.txt:
update: insecure
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ COPY requirements.txt requirements_dev.txt requirements_all_ds.txt ./
RUN pip install -r requirements.txt -r requirements_dev.txt -r requirements_all_ds.txt

COPY . ./
RUN npm install && npm run build && rm -rf node_modules

# Upgrade node to LTS 6.11.2
RUN cd ~
RUN wget https://nodejs.org/download/release/v6.11.2/node-v6.11.2-linux-x64.tar.gz
RUN sudo tar --strip-components 1 -xzvf node-v* -C /usr/local

# Upgrade npm
RUN npm upgrade npm

RUN npm install && npm run bundle && npm run build && rm -rf node_modules
RUN chown -R redash /app
USER redash

Expand Down
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: build bundle compose_build create_database tests test_db clean

compose_build:
docker-compose build

test_db:
docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"

create_database:
docker-compose run server create_db

clean:
docker ps -a -q | xargs docker kill;docker ps -a -q | xargs docker rm

bundle:
docker-compose run server bin/bundle-extensions

tests:
docker-compose run server tests

build: bundle
npm run build
12 changes: 12 additions & 0 deletions bin/alias
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -eo pipefail

[ ! -z $DOCKERHUB_REPO ] && [ $# -eq 2 ]

VERSION="$1"
ALIAS="$2"

docker login -u $DOCKER_USER -p $DOCKER_PASS
docker tag $DOCKERHUB_REPO:$VERSION $DOCKERHUB_REPO:$ALIAS
docker push $DOCKERHUB_REPO:$ALIAS
39 changes: 39 additions & 0 deletions bin/bundle-extensions
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python

import os
from subprocess import call
from distutils.dir_util import copy_tree

from pkg_resources import iter_entry_points, resource_filename, resource_isdir



# Make a directory for extensions and set it as an environment variable
# to be picked up by webpack.
EXTENSIONS_RELATIVE_PATH = os.path.join('client', 'app', 'extensions')
EXTENSIONS_DIRECTORY = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
EXTENSIONS_RELATIVE_PATH)

if not os.path.exists(EXTENSIONS_DIRECTORY):
os.makedirs(EXTENSIONS_DIRECTORY)
os.environ["EXTENSIONS_DIRECTORY"] = EXTENSIONS_RELATIVE_PATH

for entry_point in iter_entry_points('redash.extensions'):
# This is where the frontend code for an extension lives
# inside of its package.
content_folder_relative = os.path.join(
entry_point.name, 'bundle')
(root_module, _) = os.path.splitext(entry_point.module_name)

if not resource_isdir(root_module, content_folder_relative):
continue

content_folder = resource_filename(root_module, content_folder_relative)

# This is where we place our extensions folder.
destination = os.path.join(
EXTENSIONS_DIRECTORY,
entry_point.name)

copy_tree(content_folder, destination)
19 changes: 19 additions & 0 deletions bin/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -eo pipefail

[ ! -z $DOCKERHUB_REPO ] && [ $# -eq 1 ]

VERSION="$1"

printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \
"$CIRCLE_SHA1" \
"$VERSION" \
"$CIRCLE_PROJECT_USERNAME" \
"$CIRCLE_PROJECT_REPONAME" \
"$CIRCLE_BUILD_URL" \
> version.json

docker login -u $DOCKER_USER -p $DOCKER_PASS
docker build -t $DOCKERHUB_REPO:$VERSION .
docker push $DOCKERHUB_REPO:$VERSION
13 changes: 11 additions & 2 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,32 @@
set -e

worker() {
/app/manage.py db upgrade
WORKERS_COUNT=${WORKERS_COUNT:-2}
QUEUES=${QUEUES:-queries,scheduled_queries,celery}
MAX_MEMORY=$(($(/usr/bin/awk '/MemTotal/ {print $2}' /proc/meminfo)/4))

echo "Starting $WORKERS_COUNT workers for queues: $QUEUES..."
exec /usr/local/bin/celery worker --app=redash.worker -c$WORKERS_COUNT -Q$QUEUES -linfo --maxtasksperchild=10 -Ofair
exec /usr/local/bin/celery worker --app=redash.worker -c$WORKERS_COUNT -Q$QUEUES -linfo \
--max-tasks-per-child=10 \
--max-memory-per-child=$MAX_MEMORY \
-Ofair
}

scheduler() {
/app/manage.py db upgrade
WORKERS_COUNT=${WORKERS_COUNT:-1}
QUEUES=${QUEUES:-celery}

echo "Starting scheduler and $WORKERS_COUNT workers for queues: $QUEUES..."

exec /usr/local/bin/celery worker --app=redash.worker --beat -c$WORKERS_COUNT -Q$QUEUES -linfo --maxtasksperchild=10 -Ofair
exec /usr/local/bin/celery worker --app=redash.worker --beat -c$WORKERS_COUNT -Q$QUEUES -linfo \
--max-tasks-per-child=10 \
-Ofair
}

server() {
/app/manage.py db upgrade
exec /usr/local/bin/gunicorn -b 0.0.0.0:5000 --name redash -w${REDASH_WEB_WORKERS:-4} redash.wsgi:app
}

Expand Down
Loading