Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Heroku support #1092

Merged
merged 2 commits into from Jun 6, 2016
Merged

Add Heroku support #1092

merged 2 commits into from Jun 6, 2016

Conversation

adamlwgriffiths
Copy link
Contributor

This adds Heroku support, whilest trying to not inject any Heroku specific code in the way of other installation paths (ie, using bin/pre_compile to aggregate / manipulate files, heroku-postbuild in package.json, etc) as per this comment.
The requirements handling is a bit more fragile than if cffi was just included directly.

Move .bowerrc, bower.json, gulpfile.js, package.json
down to root level.
Update paths in .bowerrc, gulpfile.js, Makefile
Add a heroku-postbuild step to package.json which
installs devDependencies and runs the build.
Add step in bin/pre_compile which adds the
requirements_all_ds.txt to requirements.txt to ensure that
cffi is installed. Also removes pymssql as this is
not supported on Heroku.
Add content from rd_ui/.gitignore to .gitignore and
remove rd_ui/.gitignore.
Add section in setup.rst about Heroku deployments.

@adamlwgriffiths
Copy link
Contributor Author

I've also noted that there are a number of obsolete files in rd_ui.
.gitattributes, .editorconfig, .jshint, .travis.yml.
I didn't remove those as I only wanted to do the minimum for the PR.

Move .bowerrc, bower.json, gulpfile.js, package.json
down to root level.
Update paths in .bowerrc, gulpfile.js, Makefile
Add a heroku-postbuild step to package.json which
installs devDependencies and runs the build.
Add step in bin/pre_compile which adds the
requirements_all_ds.txt to requirements.txt to ensure that
cffi is installed. Also removes pymssql as this is
not supported on Heroku.
Add content from rd_ui/.gitignore to .gitignore and
remove rd_ui/.gitignore.
Add section in setup.rst about Heroku deployments.
@arikfr
Copy link
Member

arikfr commented Jun 3, 2016

@adamlwgriffiths actually .jshint and .editorconfig are being used. .gitattributes and .travis.yml can be removed.

@@ -0,0 +1,2 @@
web: ./manage.py runserver -p $PORT --host 0.0.0.0
worker: ./bin/run celery worker --app=redash.worker --beat -Q queries,celery,scheduled_queries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to prefix with bin/run because Heroku loads the env variables for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took that file verbatim from Procfile.dev
https://github.com/getredash/redash/blob/master/Procfile.dev
Not sure if that one needs updating too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Procfile.dev is used for Vagrant, where bin/run is actually needed.

@arikfr
Copy link
Member

arikfr commented Jun 3, 2016

Thank you for your effort on this!

5. Set environment variables::

$ heroku config:set REDASH_DATABASE_URL=`heroku config:get DATABASE_URL`
$ heroku config:set REDASH_REDIS_URL=`heroku config:get REDIS_URL`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally cool with changing the relevant lines in settings.py to:

DATABASE_CONFIG = parse_db_url(os.environ.get("REDASH_DATABASE_URL", os.environ.get("DATABASE_URL", "postgresql://postgres")))

And:

REDIS_URL = os.environ.get('REDASH_REDIS_URL', os.environ.get('REDIS_URL', "redis://localhost:6379/0"))

I can do it myself after merging this pull request, if you prefer.

@adamlwgriffiths
Copy link
Contributor Author

I'll update based on your comments hopefully on Monday.
Let me know your thoughts on the requirements.txt and documentation.

Fix comment in bin/pre_compile.
Remove .gitattributes and .travis.yml in rd_ui/.
Remove bin/run from Procfile.heroku.
Update documentation:
-Add a note about upgrading from version to version.
-Remove commands for DATABASE_URL and REDIS_URL.
-Add importance to the cookie secret variable.
-Merge adding redis and postgres addons into 1 step.
@adamlwgriffiths
Copy link
Contributor Author

Ok, I've made some changes as per your comments.
Let me know if there's anything not quite right.

@arikfr
Copy link
Member

arikfr commented Jun 6, 2016

arikfr added a commit that referenced this pull request Jun 6, 2016
@arikfr arikfr merged commit 1fbeb5d into getredash:master Jun 6, 2016
@arikfr
Copy link
Member

arikfr commented Jun 6, 2016

Merged. Thank you!

@adamlwgriffiths
Copy link
Contributor Author

adamlwgriffiths commented Jun 6, 2016

Awesome, thanks!

Just a reminder that this relies on the REDASH_DATABASE_URL and REDASH_REDIS_URL environment variable retrieval (fallback to DATABASE_URL and REDIS_URL as per this comment) which is not part of this commit / merge (for anyone else out there reading this).

@arikfr
Copy link
Member

arikfr commented Jun 6, 2016

I committed these changes before merging this pull request ;-)
On Jun 6, 2016 9:41 AM, "Adam Griffiths" notifications@github.com wrote:

Awesome, thanks!

Just a reminder that this relies on the REDASH_DATABASE_URL and
REDASH_REDIS_URL environment variable retrieval (fallback to DATABASE_URL
and REDIS_URL) which has yet to be committed (for anyone else out there
reading this).


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1092 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAEXLLa3uWgSMPmSPGm9jsrr_ZtPZtZNks5qI8EvgaJpZM4ItHtf
.

@adamlwgriffiths
Copy link
Contributor Author

Sweet! Cheers

simo7 pushed a commit to pubnative/redash that referenced this pull request Sep 22, 2016
simo7 pushed a commit to pubnative/redash that referenced this pull request Sep 22, 2016
dairyo pushed a commit to KiiCorp/redash that referenced this pull request Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants