mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Merge pull request #868 from jjb/redis-config
make Redis config easier on Heroku
This commit is contained in:
commit
abe9ebf6ff
2 changed files with 15 additions and 15 deletions
|
@ -1,5 +1,5 @@
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
uri: <%= uri = URI.parse(ENV['SET_REDIS_PROVIDER_URL'] || "redis://localhost:6379") %>
|
uri: <%= uri = URI.parse(ENV['REDIS_PROVIDER_URL'] || "redis://localhost:6379") %>
|
||||||
host: <%= uri.host %>
|
host: <%= uri.host %>
|
||||||
port: <%= uri.port %>
|
port: <%= uri.port %>
|
||||||
password: <%= uri.password %>
|
password: <%= uri.password %>
|
||||||
|
|
|
@ -12,20 +12,15 @@ For details on how to reduce the monthly cost of your application, see [Advanced
|
||||||
cd discourse
|
cd discourse
|
||||||
git checkout -b heroku
|
git checkout -b heroku
|
||||||
|
|
||||||
2. Modify the redis.yml file to use the environment variable provided by Heroku and the Redis provider of your choice.
|
2. Create a redis.yml file.
|
||||||
|
|
||||||
*config/redis.yml*
|
cp config/redis.yml.sample config/redis.yml
|
||||||
|
|
||||||
```erb
|
|
||||||
- uri: <%= uri = URI.parse(ENV['SET_REDIS_PROVIDER_URL'] || "redis://localhost:6379") %>
|
|
||||||
+ uri: <%= uri = URI.parse(ENV['OPENREDIS_URL'] || "redis://localhost:6379") %>
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Comment out or delete `config/redis.yml` from .gitignore. We want to include redis.yml when we push to Heroku.
|
3. Comment out or delete `config/redis.yml` from .gitignore. We want to include redis.yml when we push to Heroku.
|
||||||
|
|
||||||
*.gitignore*
|
*.gitignore*
|
||||||
|
|
||||||
```ruby
|
```diff
|
||||||
- config/redis.yml
|
- config/redis.yml
|
||||||
+ # config/redis.yml
|
+ # config/redis.yml
|
||||||
```
|
```
|
||||||
|
@ -59,19 +54,24 @@ For details on how to reduce the monthly cost of your application, see [Advanced
|
||||||
|
|
||||||
heroku addons:add openredis:micro
|
heroku addons:add openredis:micro
|
||||||
|
|
||||||
3. Add the [Heroku Scheduler](https://addons.heroku.com/scheduler) add-on, this saves us from running a separate clock process, reducing the cost of the app.
|
3. Point the app at your redis provider's URL
|
||||||
|
|
||||||
|
heroku config:get OPENREDIS_URL
|
||||||
|
heroku config:set REDIS_PROVIDER_URL=<result of above command>
|
||||||
|
|
||||||
|
4. Add the [Heroku Scheduler](https://addons.heroku.com/scheduler) add-on, this saves us from running a separate clock process, reducing the cost of the app.
|
||||||
|
|
||||||
heroku addons:add scheduler:standard
|
heroku addons:add scheduler:standard
|
||||||
|
|
||||||
4. Generate a secret token in the terminal.
|
5. Generate a secret token in the terminal.
|
||||||
|
|
||||||
rake secret
|
rake secret
|
||||||
|
|
||||||
5. Push the secret to the stored heroku environment variables, this will now be available to your app globally.
|
6. Push the secret to the stored heroku environment variables, this will now be available to your app globally.
|
||||||
|
|
||||||
heroku config:add SECRET_TOKEN=<generated secret>
|
heroku config:add SECRET_TOKEN=<generated secret>
|
||||||
|
|
||||||
6. Precompile assets.
|
7. Precompile assets.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
@ -102,11 +102,11 @@ For details on how to reduce the monthly cost of your application, see [Advanced
|
||||||
# Unset var
|
# Unset var
|
||||||
unset SECRET_TOKEN
|
unset SECRET_TOKEN
|
||||||
|
|
||||||
7. Push your heroku branch to Heroku.
|
8. Push your heroku branch to Heroku.
|
||||||
|
|
||||||
git push heroku heroku:master
|
git push heroku heroku:master
|
||||||
|
|
||||||
8. Migrate and seed the database.
|
9. Migrate and seed the database.
|
||||||
|
|
||||||
heroku run rake db:migrate db:seed_fu
|
heroku run rake db:migrate db:seed_fu
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue