hyperstack-org / hyperstack-org/hyperstack

heroku install instructions

未關閉
#265 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
needs doc
主要語言
JavaScript
星號
538
分支
41
PR 合併指標
30 天內沒有已合併 PR

描述

There are a number of issues and additional items that need to been done when deploying to heroku (or other production environments.)

1. **You need to use postgresql rather than sqlite or mysql.** You can find instructions on how to do this online, or better yet when you create your rails app, create it from the beginning with postgresql: https://www.digitalocean.com/community/tutorials/how-to-set-up-ruby-on-rails-with-postgres

2. **Remove `app/models/application_record.rb`** This is no longer needed due to a recent rails fix, and confuses heroku.

3. **Use harmonly uglifier.** In config/environments/production.rb you need to change this line from:
`config.assets.js_compressor = :uglifier`
to
`config.assets.js_compressor = Uglifier.new(harmony: true)`

4. **Insure webpacker:compile occurs before assets:precompile:** at the end of the `Rakefile` (in the root directory) add this line:
`Rake::Task["assets:precompile"].enhance(['yarn:install', 'webpacker:compile'])`

5. **Setup your database** Make sure you run
`heroku run rake db:migrate`

6. **Update your production policies** By default the Hyperstack installer will leave your Policies wide open but **not** in production.
For a production app you will want to add restrictive Policies to protect your data. If you just want to get things working on Heroku you can remove the guard from the end of the `policies/application.rb` file.

5. Add `stylesheet_pack_tag`s: Hyperstack does not automatically pull in the `.css` packs. Instead you have to add one or both these lines to your layouts, if you are requiring css assets in the pack files:
`<%= stylesheet_pack_tag 'client_only' %>`
If you are requiring css libraries in the `client_only.js` pack file
and
`<%= stylesheet_pack_tag 'client_and_server' %>`
If you are requiring css libraries in the `client_and_server.js` pack file

6. Setup ActionCable (see [full instructions](https://blog.heroku.com/real_time_rails_implementing_websockets_in_rails_5_with_action_cable#deploying-our-application-to-heroku) for details)
provision Redis on Heroku `heroku addons:add redistogo`
then get the heroku url: `heroku config --app action-cable-example | grep REDISTOGO_URL`
use the url in config/cable.yml (in the production section)
in config/environments/production.rb add these two lines:
`config.web_socket_server_url = "wss://your-app.herokuapp.com/cable" `
`config.action_cable.allowed_request_origins = ['https://your-app.herokuapp.com', 'http://action-your-app.herokuapp.com']`

--- more question?----

after updating anything in the hyperstack initializer you will need to force heroku to clear the cache:

First install the heroku-repo plugin (on your console)
`$ heroku plugins:install heroku-repo`

and then to clear the cache do:

`$ heroku repo:purge_cache -a appname`
`$ git commit --allow-empty -m "Purge cache"`
`$ git push heroku master`

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。