Hello World from OSS Silicon Valley
HowToUse/RubyOnRails/4.2/Heroku/2015
_ Prerequisite
- Ubuntu Server 14.04 installation (You can refer HowToUse/UbuntuServer/14.04)
- RVM installation (You can refer HowToUse/RVM/1.25)
- Ruby On Rails installation (You can refer HowToUse/RubyOnRails/4.1)
- PostgreSQL installation (You can refer HowToUse/PostgreSQL/9.3)
- Ruby On Rails with PostgreSQL connection (You can refer HowToUse/RubyOnRails/4.2/PostgreSQL/9.3)
_ Install&Setup
_ Prepare Heroku's development environment
- Step.1
- Access to Heroku's web site.
- Step.2
- Login the system.
- Step.3
- Click the Ruby's icon, and you will see the instruction how to install Heroku Toolbelt.
- Step.4
- Download Heroku Toolbelt from the link in web page.
_ HowToUse
_ Create rails project
- Step.1
- Login to Heroku server.
$ heroku login
- Step.2
- Change directory of your application which uses PostgreSQL not Sqlite. (You can refer HowToCreate/RubyOnRails/4.2/PostgreSQL/9.3 about how to create Rails Application with )
- Step.3
- Create new project in Heroku space.
$ heroku create
You can destroy app with the following command.
$ heroku apps:destroy --app <App name>
- Step.4
- Prepare sample project.
$ bundle exec rake assets:precompile $ git init $ git add . $ git commit -m "initial check-in"
When you don't precompile the modules, Heroku sometimes doesn't recognize stylesheet as expected. [#dc1c44b6]
Then you will see the following window from the URL displayed in the terminal.
- Step.5
- If your application create image file and you want to display it in your application, add the following line in config/application.rb
$ vi config/application.rb
config.serve_static_assets = true
You can read here for detail
- Step.6
- Deploy project into Heroku server.
$ git push heroku master
_ Configure rails project
- Step.1
- Migrate database
$ heroku run rake db:migrate
Then you can access your application as expected. You can create record to the database in Heroku server.
- Step.2
- You can setup environment variable as needed. For example, in case you want to use third party's authentification service, it is recommended to set upt those in environment variable so that internet user can't see it.
$ heroku config:set GITHUB_KEY="xxx" $ heroku config:set GITHUB_SECRET="xxx"
- Step.3
- Load seed data
$ heroku run rake db:seed
_ Upload module from other work environment
- Step.1
- Login to Heroku environment.
$ heroku login
- Step.2
- Add remote path.
$ heroku git:remote -a <application ID>
- Step.3
- Push modules.
$ git push heroku master
In case you encounter the problem on "Permission denied", you can refer This Posting.
$ heroku keys:add ~/.ssh/id_rsa.pub
_ Task Scheduller
- Step.1
- Create task file.
- Step.2
- Test task.
(local execution)
$ rake <task name>
(Execution in Heroku)
$ heroku run rake <task name>
- Step.3
- Register task in Heroku.
https://scheduler.heroku.com/dashboard
_ Author
S.Yatsuzuka
Attach file:
CreateAccount_fig4.png 206 download
[Information]
CreateAccount_fig3.png 226 download
[Information]
CreateApps_fig1.png 206 download
[Information]
CreateApps_fig3.png 212 download
[Information]
CreateApps_fig2.png 233 download
[Information]
CreateAccount_fig2.png 201 download
[Information]
CreateAccount_fig1.png 214 download
[Information]







Last-modified: 2016-11-06 (Sun) 07:51:25 (3029d)