Skip to content

Commit

Permalink
Update tutorial.md (#747)
Browse files Browse the repository at this point in the history
for 6.7.1
  • Loading branch information
justin808 authored Mar 4, 2017
1 parent f45c1c1 commit 6e3edd1
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# React on Rails Basic Tutorial

This tutorial setups up a new Rails app with **React on Rails**, demonstrating Rails + React + Redux + Server Rendering.
This tutorial setups up a new Rails app with **React on Rails**, demonstrating Rails + React + Redux + Server Rendering. It is updated to 6.7.1.

After finishing this tutorial you will get application that can do the following (live on Heroku):

![example](https://cloud.githubusercontent.com/assets/371302/17368567/111cc722-596b-11e6-9b72-ac5967a60e42.gif)

You can find here:
* [Source code for this app](https://github.com/dzirtusss/hello-react-on-rails)
* [Live on Heroku](https://hello-react-on-rails.herokuapp.com/)

Old version of this app is here:
* [Source code](https://github.com/justin808/test-react-on-rails-3)
* [Live on Heroku](https://shakacode-react-on-rails.herokuapp.com/hello_world)
* [Source code for this app in PR, using the --redux option](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/15) and [for Heroku](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/16).
* [Live on Heroku](https://react-on-rails-redux-generator.herokuapp.com/)

By the time you read this, the latest may have changed. Be sure to check the versions here:

Expand Down Expand Up @@ -69,7 +65,7 @@ git add -A
git commit -m "Initial commit"
```

update dependencies and generate empty app via `react_on_rails:install`. If you haven't done first git commit it will generate error and you just need to commit.
update dependencies and generate empty app via `react_on_rails:install` or `react_on_rails:install --redux`. You need to first git commit your files before running the generator, or else it will generate an error.

```
bundle
Expand Down Expand Up @@ -181,6 +177,32 @@ root "hello_world#index"

![09](https://cloud.githubusercontent.com/assets/20628911/17465018/1f3b685e-5cf4-11e6-93f8-105fc48517d0.png)

Next, configure your app for Puma, per the [instructions on Heroku](https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server).

`Procfile`
```
web: bundle exec puma -C config/puma.rb
```

`config/puma.rb`
```rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
```

Then after all changes are done don't forget to commit them with git and finally you can push your app to Heroku!

```
Expand All @@ -191,9 +213,11 @@ git push heroku master

![10](https://cloud.githubusercontent.com/assets/20628911/17465017/1f38fbaa-5cf4-11e6-8d86-a3d91e3878e0.png)

Here it is:
## Links
These are updated for 6.7.1:

* [Source code for this sample app](https://github.com/dzirtusss/hello-react-on-rails)
* [PR for using the generator with the Redux option](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/15)
* [PR showing the changes to deploy to Heroku](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/16)
* [Live on Heroku](https://hello-react-on-rails.herokuapp.com/)

Feedback is greatly appreciated! As are stars on github! If you want personalized help, don't hesitate to get in touch with us at [contact@shakacode.com](mailto:contact@shakacode.com).

0 comments on commit 6e3edd1

Please sign in to comment.