Skip to content

Commit

Permalink
Merge pull request #1 from getredash/master
Browse files Browse the repository at this point in the history
merge base master with this fork
  • Loading branch information
atharvai authored Oct 12, 2017
2 parents b11685d + 0c404fa commit c6d1fc1
Show file tree
Hide file tree
Showing 309 changed files with 19,575 additions and 7,117 deletions.
22 changes: 22 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
engines:
pep8:
enabled: true
eslint:
enabled: true
channel: "eslint-3"
config:
config: client/.eslintrc.js
checks:
import/no-unresolved:
enabled: false
ratings:
paths:
- "redash/**/*.py"
- "client/**/*.js"
exclude_paths:
- tests/**/*.py
- migrations/**/*.py
- old_migrations/**/*.py
- setup/**/*
- bin/**/*

4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
client/.tmp/
client/node_modules/
node_modules/
.tmp/
.git/
.vagrant/
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_style = space
indent_size = 4

[*.{js,css,html}]
indent_style = space
indent_size = 2
11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ celerybeat-schedule*
\#*#
*~
_build

# Vagrant related
.vagrant
Berksfile.lock
redash/dump.rdb
.vscode
.env
.ruby-version
venv

dump.rdb

# Docker related
docker-compose.yml

node_modules
.tmp
.sass-cache
Expand Down
2 changes: 0 additions & 2 deletions .landscape.yaml

This file was deleted.

601 changes: 446 additions & 155 deletions CHANGELOG.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following is a set of guidelines for contributing to Redash. These are guide

## Quick Links:

- [Feature Roadmap](https://trello.com/b/b2LUHU7A/re-dash-roadmap)
- [Feature Roadmap](https://trello.com/b/b2LUHU7A/redash-roadmap)
- [Feature Requests](https://discuss.redash.io/c/feature-requests)
- [Gitter Chat](https://gitter.im/getredash/redash) or [Slack](https://slack.redash.io)
- [Documentation](https://redash.io/help/)
Expand All @@ -29,7 +29,7 @@ The following is a set of guidelines for contributing to Redash. These are guide
- [Documentation](#documentation)
- Design?

[Addtional Notes](#additional-notes)
[Additional Notes](#additional-notes)

- [Release Method](#release-method)
- [Code of Conduct](#code-of-conduct)
Expand All @@ -46,17 +46,17 @@ When creating a new bug report, please make sure to:

### Suggesting Enhancements / Feature Requests

If you would like to suggest an enchancement or ask for a new feature:
If you would like to suggest an enhancement or ask for a new feature:

- Please check [the roadmap](https://trello.com/b/b2LUHU7A/re-dash-roadmap) for existing Trello card for what you want to suggest/ask. If there is, feel free to upvote it to signal interest or add your comments.
- Please check [the roadmap](https://trello.com/b/b2LUHU7A/redash-roadmap) for existing Trello card for what you want to suggest/ask. If there is, feel free to upvote it to signal interest or add your comments.
- If there is no existing card, open a thread in [the forum](https://discuss.redash.io/c/feature-requests) to start a discussion about what you want to suggest. Try to provide as much details and context as possible and include information about *the problem you want to solve* rather only *your proposed solution*.

### Pull Requests

- **Code contributions are welcomed**. For big changes or significant features, it's usually better to reach out first and discuss what you want to implement and how (we recommend reading: [Pull Request First](https://medium.com/practical-blend/pull-request-first-f6bb667a9b6#.ozlqxvj36)). This to make sure that what you want to implement is aligned with our goals for the project and that no one else is already working on it.
- Include screenshots and animated GIFs in your pull request whenever possible.
- Please add [documentation](#documentation) for new features or changes in functionality along with the code.
- Please follow existing code style. We use PEP8 for Python and sensible style for Javascript.
- Please follow existing code style. We use PEP8 for Python and sensible style for JavaScript.

### Documentation

Expand Down
58 changes: 10 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
FROM ubuntu:trusty
FROM redash/base:latest

# Ubuntu packages
RUN apt-get update && \
apt-get install -y python-pip python-dev curl build-essential pwgen libffi-dev sudo git-core wget \
# Postgres client
libpq-dev \
# Additional packages required for data sources:
libssl-dev libmysqlclient-dev freetds-dev libsasl2-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# We first copy only the requirements file, to avoid rebuilding on every file
# change.
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

# Users creation
RUN useradd --system --comment " " --create-home redash
COPY . ./
RUN npm install && npm run build && rm -rf node_modules
RUN chown -R redash /app
USER redash

# Pip requirements for all data source types
RUN pip install -U setuptools==23.1.0 && \
pip install supervisor==3.1.2

COPY . /opt/redash/current
RUN chown -R redash /opt/redash/current

# Setting working directory
WORKDIR /opt/redash/current

# Install project specific dependencies
RUN pip install -r requirements_all_ds.txt && \
pip install -r requirements.txt

RUN curl https://deb.nodesource.com/setup_4.x | bash - && \
apt-get install -y nodejs && \
sudo -u redash -H make deps && \
rm -rf node_modules client/node_modules /home/redash/.npm /home/redash/.cache && \
apt-get purge -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Setup supervisord
RUN mkdir -p /opt/redash/supervisord && \
mkdir -p /opt/redash/logs && \
cp /opt/redash/current/setup/docker/supervisord/supervisord.conf /opt/redash/supervisord/supervisord.conf

# Fix permissions
RUN chown -R redash /opt/redash

# Expose ports
EXPOSE 5000
EXPOSE 9001

# Startup script
CMD ["supervisord", "-c", "/opt/redash/supervisord/supervisord.conf"]
ENTRYPOINT ["/app/bin/docker-entrypoint"]
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ FULL_VERSION=$(VERSION)+b$(CIRCLE_BUILD_NUM)
BASE_VERSION=$(shell python ./manage.py version | cut -d + -f 1)
# VERSION gets evaluated every time it's referenced, therefore we need to use VERSION here instead of FULL_VERSION.
FILENAME=$(CIRCLE_ARTIFACTS)/$(NAME).$(VERSION).tar.gz
TEST_ARGS?=--with-coverage --cover-package=redash tests/

deps:
if [ -d "./client/app" ]; then cd client && npm install; fi
if [ -d "./client/app" ]; then cd client && npm run build; fi
if [ -d "./client/app" ]; then npm install; fi
if [ -d "./client/app" ]; then npm run build; fi

pack:
sed -ri "s/^__version__ = '([0-9.]*)'/__version__ = '$(FULL_VERSION)'/" redash/__init__.py
tar -zcv -f $(FILENAME) --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="client/node_modules" --exclude="client/app" *
tar -zcv -f $(FILENAME) --exclude="optipng*" --exclude=".git*" --exclude="*.pyc" --exclude="*.pyo" --exclude="venv" --exclude="node_modules" *

upload:
python bin/release_manager.py $(CIRCLE_SHA1) $(BASE_VERSION) $(FILENAME)

test:
nosetests --with-coverage --cover-package=redash tests/
nosetests $(TEST_ARGS)
2 changes: 0 additions & 2 deletions Procfile.dev

This file was deleted.

2 changes: 0 additions & 2 deletions Procfile.heroku

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img title="Redash" src='http://redash.io/static/old_img/redash_logo.png' width="200px"/>
<img title="Redash" src='https://redash.io/assets/images/logo.png' width="200px"/>
</p>
<p align="center">
<img title="Build Status" src='https://circleci.com/gh/getredash/redash.png?circle-token=8a695aa5ec2cbfa89b48c275aea298318016f040'/>
Expand Down Expand Up @@ -43,7 +43,7 @@ You can try out the demo instance: http://demo.redash.io/ (login with any Google
## Reporting Bugs and Contributing Code

* Want to report a bug or request a feature? Please open [an issue](https://github.com/getredash/redash/issues/new).
* Want to help us build **_Redash_**? Fork the project, edit in a [dev environment](https://redash.io/help-onpremise/setup/setting-up-development-environment-using-vagrant.html), and make a pull request. We need all the help we can get!
* Want to help us build **_Redash_**? Fork the project, edit in a [dev environment](https://redash.io/help-onpremise/dev/guide.html), and make a pull request. We need all the help we can get!

## License

Expand Down
15 changes: 0 additions & 15 deletions Vagrantfile

This file was deleted.

78 changes: 78 additions & 0 deletions bin/docker-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash
set -e

worker() {
WORKERS_COUNT=${WORKERS_COUNT:-2}
QUEUES=${QUEUES:-queries,scheduled_queries,celery}

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
}

scheduler() {
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
}

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

help() {
echo "Redash Docker."
echo ""
echo "Usage:"
echo ""

echo "server -- start Redash server (with gunicorn)"
echo "worker -- start Celery worker"
echo "scheduler -- start Celery worker with a beat (scheduler) process"
echo ""
echo "shell -- open shell"
echo "dev_server -- start Flask development server with debugger and auto reload"
echo "create_db -- create database tables"
echo "manage -- CLI to manage redash"
}

tests() {
export REDASH_DATABASE_URL="postgresql://postgres@postgres/tests"
exec make test
}

case "$1" in
worker)
shift
worker
;;
server)
shift
server
;;
scheduler)
shift
scheduler
;;
dev_server)
exec /app/manage.py runserver --debugger --reload -h 0.0.0.0
;;
shell)
exec /app/manage.py shell
;;
create_db)
exec /app/manage.py database create_tables
;;
manage)
shift
exec /app/manage.py $*
;;
tests)
tests
;;
*)
help
;;
esac
9 changes: 5 additions & 4 deletions bin/release_manager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import print_function
import os
import sys
import json
Expand Down Expand Up @@ -95,7 +96,7 @@ def get_changelog(commit_sha):
try:
pull_request = re.match("Merge pull request #(\d+)", subject).groups()[0]
pull_request = " #{}".format(pull_request)
except Exception, ex:
except Exception as ex:
pull_request = ""

author = subprocess.check_output(['git', 'log', '-1', '--pretty=format:"%an"', parents.split(' ')[-1]])[1:-1]
Expand Down Expand Up @@ -124,7 +125,7 @@ def update_release(version, build_filepath, commit_sha):
else:
release = create_release(version, commit_sha)

print "Using release id: {}".format(release['id'])
print("Using release id: {}".format(release['id']))

remove_previous_builds(release)
response = upload_asset(release, build_filepath)
Expand All @@ -135,8 +136,8 @@ def update_release(version, build_filepath, commit_sha):
if response.status_code != 200:
raise exception_from_error("Failed updating release description", response)

except Exception, ex:
print ex
except Exception as ex:
print(ex)

if __name__ == '__main__':
commit_sha = sys.argv[1]
Expand Down
Loading

0 comments on commit c6d1fc1

Please sign in to comment.