-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add Heroku support #1092
Conversation
I've also noted that there are a number of obsolete files in rd_ui. |
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 actually |
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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` |
There was a problem hiding this comment.
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.
I'll update based on your comments hopefully on Monday. |
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.
Ok, I've made some changes as per your comments. |
(preparation for Heroku support - #1092)
Merged. Thank you! |
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). |
I committed these changes before merging this pull request ;-)
|
Sweet! Cheers |
(preparation for Heroku support - getredash#1092)
Add Heroku support
(preparation for Heroku support - getredash#1092)
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.