update heroku install docs

1. Redis requires password
2. Automatic asset compilation on by default
3. Tell rails to serve compiled assets
4. Increase garbage collection limit
5. Link to S3 instructions
This commit is contained in:
Adam Loving 2014-06-12 13:04:16 -07:00
parent e5eccfc70a
commit 062c7bcc23
1 changed files with 39 additions and 9 deletions

View File

@ -27,11 +27,16 @@ If you haven't already, download Discourse and create a new branch for your Hero
heroku addons:add openredis:micro
1. Point the app at your redis provider's URL
1. Configure your app to connect to redis
heroku config:get OPENREDIS_URL
heroku config:set REDIS_PROVIDER_URL=<result of above command>
heroku config:set DISCOURSE_REDIS_HOST=<host from above command>
heroku config:set DISCOURSE_REDIS_PORT=<port from above command>
heroku config:set DISCOURSE_REDIS_PASSWORD=<password from your provider>
heroku config:set DISCOURSE_REDIS_DB=<dbname from your provider>
1. Run bundler
bundle install
@ -48,15 +53,9 @@ If you haven't already, download Discourse and create a new branch for your Hero
There are two options for precompilation. Either precompile locally, **before each deploy** or enable [Heroku's experimental user-env-compile](https://devcenter.heroku.com/articles/labs-user-env-compile) feature and Heroku will precompile your assets for you.
1. **Option 1:** Enable user-env-compile.
1. **Option 1:** Let Heroku compile your assets
heroku labs:enable user-env-compile
**Caveat:** If you should need to change or add environment variables for any reason, you will need to remove `user-env-compile`, then re-apply it after making the changes. This will then require you to make a commit, even if it is an empty commit, and then push to Heroku for the changes to be applied.
If needed, you can remove the user-env-compile option with this command.
heroku labs:disable user-env-compile
This is the default for new apps, and seems to work fine.
2. **Option 2:** Precompile locally.
@ -91,6 +90,10 @@ If you haven't already, download Discourse and create a new branch for your Hero
git push heroku heroku:master
```
1. Tell rails to serve your compiled assets
heroku config:set DISCOURSE_SERVE_STATIC_ASSETS=true
1. Push your heroku branch to Heroku.
git push heroku heroku:master
@ -134,6 +137,14 @@ If you haven't already, download Discourse and create a new branch for your Hero
##### Your Discourse application should now be functional. However, you will still need to [configure mail](#email) functionality and file storage for uploaded images. For some examples of doing this within Heroku, see [Heroku add-on examples](#heroku-add-on-examples).
6. [Optional] Increase Garbage collection limit
When you start up your app, the admin dashboard will complain "Your server is using default ruby garbage collection parameters"
```
heroku config:add RUBY_GC_MALLOC_LIMIT=90000000
```
## Running the application locally
Using Foreman to start the application allows you to mimic the way the application is started on Heroku. It loads environment variables via the .env file and instantiates the application using the Procfile. In the .env sample file, we have set `RAILS_ENV='development'`, this makes the Rails environment variable available globally, and is required when starting this application using Foreman.
@ -199,6 +210,25 @@ Create a .env file from the sample.
+ }
```
## S3 (for file uploads)
You can't upload files to heroku, you need to use a service like S3.
Here are the [instructions for setting up S3](https://meta.discourse.org/t/setting-up-file-and-image-uploads-to-s3/7229/23)
You can run this from ```heroku run console``` to test if everything is configured correctly.
```ruby
bucket_name = Discourse.store.send :s3_bucket
bucket = Discourse.store.send :get_or_create_directory, bucket_name
f = File.open('README.md')
bucket = Discourse.store.send :upload, f, 'test.txt'
```
@adamloving: I think there is still a file size issue. I was testing with a 2MB file that wasn't big enough to trigger the "file too big" Discourse error message, but didn't make it to S3 either.
## Load Testing
##### Blitz example