Skip to content

Commit

Permalink
adding buildpacks for node+python heroku environment
Browse files Browse the repository at this point in the history
  • Loading branch information
imkevinxu committed Sep 18, 2014
1 parent b956de1 commit 11983e5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .buildpacks
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt
https://github.com/heroku/heroku-buildpack-python
2 changes: 2 additions & 0 deletions Procfile.ssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: django-admin.py runsslserver
worker: python -u imhome/config/worker.py
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ The environment variables for production must contain a separate SECRET_KEY for
echo "PYTHONPATH={{ project_name }}" >> .env
echo "WEB_CONCURRENCY=3" >> .env
echo "PYTHONUNBUFFERED=True" >> .env
echo "BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git" >> .env

Deploy to Heroku
----------------
Expand Down Expand Up @@ -155,6 +156,29 @@ This is meant to mimic production as close as possible using both the production
foreman run django-admin.py collectstatic --noinput
foreman start

The site will be located at [localhost:5000](http://localhost:5000).

Run project locally in SSL prod environment
-------------------------------------------

Once the project has SSL turned on, localhost:5000 won't work anymore ecause it will try to redirect to https://localhost:5000.

To get around that we will temporarily install `django-sslserver` in our ocal production environment and use Procfile.ssl to run our app.

**NOTE: EXTREME CAUTION DOING THIS:** This will create a HSTS record for localhost:8000 that automatically redirects it to https://localhost:8000 for 6 days possibly causing local development impossible to do unless overriden specifically according to these hacky [instructions](http://classically.me/blogs/how-clear-hsts-settings-major-browsers)

- `pip install django-sslserver`
- Add `sslserver` to a list of `INSTALLED_APPS` in `requirements/roduction.py`
- Edit `.foreman` to use SSL version of Procfile and prod version of .env
- `foreman start`

The site will be located at [https://localhost:8000](https://ocalhost:8000).

When you're done **REMEMBER TO**:
- `pip uninstall django-sslserver`
- Remove `sslserver` from list of `INSTALLED_APPS` in `requirements/roduction.py`
- Edit `.foreman` to use development version of Procfile and .env

Add-ons
=======

Expand Down
2 changes: 1 addition & 1 deletion grunt/clean.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ module.exports =

scripts: ['<%= paths.js %>/build']

images: ['<%= paths.img %>/build']
images: ['<%= paths.img %>/compressed']
2 changes: 1 addition & 1 deletion grunt/imagemin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports =
expand: true
cwd: '<%= paths.img %>/'
src: ['**/*.{png,jpg,gif,svg}']
dest: '<%= paths.img %>/build'
dest: '<%= paths.img %>/compressed'
]
4 changes: 1 addition & 3 deletions grunt/watch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ module.exports =

images:
files: ['<%= paths.img %>/**/*.{png,jpg,gif,svg}']
tasks: [
'newer:imagemin'
]
tasks: ['newer:imagemin']
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"time-grunt": "^1.0.0"
},
"engines": {
"node": ">=0.8.0"
"node": "0.10.x"
},
"private": true,
"scripts": {}
Expand Down

0 comments on commit 11983e5

Please sign in to comment.