Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: railstutorial/sample_app
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: cloudfoundry-samples/rails_sample_app
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 12 commits
  • 5 files changed
  • 3 contributors

Commits on Jul 12, 2013

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ff7e2a8 View commit details

Commits on Jul 15, 2013

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b4948a4 View commit details

Commits on Sep 5, 2013

  1. Updated README.

    scottfrederick committed Sep 5, 2013

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b6cd6f7 View commit details

Commits on May 29, 2014

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6524808 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    803e4c7 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f5d8262 View commit details

Commits on Aug 11, 2014

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7cd1f79 View commit details

Commits on Aug 12, 2014

  1. Merge pull request #2 from jennjblack/edits

    edit README with APP-NAME in cf push command for new users
    scottfrederick committed Aug 12, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f23d55c View commit details

Commits on Aug 26, 2014

  1. edit Gemfile and config/application.rb

    jennjblack committed Aug 26, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a78ede4 View commit details
  2. Merge pull request #3 from jennjblack/edits

    edit Gemfile and config/application.rb
    scottfrederick committed Aug 26, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6726f0e View commit details

Commits on Jul 12, 2016

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    61b5162 View commit details

Commits on Jul 13, 2016

  1. Merge pull request #6 from mrdavidlaing/update-deps-for-latest-buildpack

    Update app to work on CFv238/Diego v0.1476.0/Buildpack:ruby 1.6.19
    scottfrederick authored Jul 13, 2016

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    314a94e View commit details
Showing with 117 additions and 1 deletion.
  1. +4 −0 Gemfile
  2. +12 −0 Gemfile.lock
  3. +90 −1 README.markdown
  4. +1 −0 config/application.rb
  5. +10 −0 manifest.yml
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ gem 'rails', '3.0.12'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'
gem 'sqlite3', '1.3.4'
gem "pg", "~> 0.15.1"
gem "cf-autoconfig", "~> 0.2.1"
gem 'rails_12factor', group: :production
ruby '2.1.9'

group :development do
gem 'rspec-rails', '2.6.1'
12 changes: 12 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -31,6 +31,9 @@ GEM
annotate (2.4.0)
arel (2.0.10)
builder (2.1.2)
cf-autoconfig (0.2.1)
cf-runtime (= 0.2.0)
cf-runtime (0.2.0)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
@@ -49,6 +52,7 @@ GEM
treetop (~> 1.4.8)
mime-types (1.18)
nokogiri (1.4.4)
pg (0.15.1)
polyglot (0.3.3)
rack (1.2.5)
rack-mount (0.6.14)
@@ -63,6 +67,11 @@ GEM
activesupport (= 3.0.12)
bundler (~> 1.0)
railties (= 3.0.12)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.2)
rails_stdout_logging (0.0.3)
railties (3.0.12)
actionpack (= 3.0.12)
activesupport (= 3.0.12)
@@ -103,10 +112,13 @@ PLATFORMS

DEPENDENCIES
annotate (= 2.4.0)
cf-autoconfig (~> 0.2.1)
factory_girl_rails (= 1.0)
faker (= 0.3.1)
gravatar_image_tag (= 1.0.0.pre2)
pg (~> 0.15.1)
rails (= 3.0.12)
rails_12factor
rspec-rails (= 2.6.1)
spork (= 0.9.0.rc8)
sqlite3 (= 1.3.4)
91 changes: 90 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,92 @@
# Ruby on Rails Tutorial: sample application

This is the sample application for [*Ruby on Rails Tutorial: Learn Rails by Example*](http://railstutorial.org/) by [Michael Hartl](http://michaelhartl.com/).
This is the sample application for [*Ruby on Rails Tutorial: Learn Rails by Example*](http://railstutorial.org/) by [Michael Hartl](http://michaelhartl.com/).

This sample has been modified to run on Cloud Foundry. The `cf-autoconfig` gem was added to enable auto-configuration of database connections as described in the [Cloud Foundry documentation](http://docs.cloudfoundry.com/docs/using/services/ruby-service-bindings.html). The `pg` gem was also added to support connection to PostgreSQL database.

## Running the application on Cloud Foundry

After installing in the 'cf' [command-line interface for Cloud Foundry](http://docs.cloudfoundry.org/devguide/installcf/),
targeting a Cloud Foundry instance, and logging in, the application can be pushed using these commands:

First, view a list of services and plans available in your Cloud Foundry instance:

~~~
$ cf marketplace
Getting services from marketplace
OK
service plans description
blazemeter free-tier, basic1kmr, pro5kmr, pp10kmr, hv40kmr The JMeter Load Testing Cloud
cleardb spark, boost, amp, shock Highly available MySQL for your Apps.
cloudamqp lemur, tiger, bunny, rabbit, panda Managed HA RabbitMQ servers in the cloud
cloudforge free, standard, pro Development Tools In The Cloud
elephantsql turtle, panda, hippo, elephant PostgreSQL as a Service
ironmq pro_platinum, pro_gold, large, medium, small, pro_silver Powerful Durable Message Queueing Service
ironworker large, pro_gold, pro_platinum, pro_silver, small, medium Scalable Background and Async Processing
loadimpact lifree, li100, li500, li1000 Automated and on-demand performance testing
memcachedcloud 25mb, 100mb, 250mb, 500mb, 1gb, 2-5gb, 5gb Enterprise-Class Memcached for Developers
mongolab sandbox Fully-managed MongoDB-as-a-Service
newrelic standard Manage and monitor your apps
rediscloud 25mb, 100mb, 250mb, 500mb, 1gb, 2-5gb, 5gb, 10gb, 50gb Enterprise-Class Redis for Developers
searchify small, plus, pro Custom search you control
searchly small, micro, professional, advanced, starter, business, enterprise Search Made Simple. Powered-by ElasticSearch
sendgrid free, bronze, silver, gold, platinum Email Delivery. Simplified.
~~~

Choose a PostgreSQL service from the list and create a service instance named `rails-postgres` using a PostgreSQL service and plan:

~~~
$ cf create-service SERVICE PLAN rails-postgres
Creating service rails-postgres
OK
~~~

Now push the application:

~~~
$ cf push APP-NAME --random-route
Using manifest file manifest.yml
Updating app rails-sample
OK
Creating route rails-sample-desiccative-acetylizer.cfapps.io...
OK
Binding rails-sample-desiccative-acetylizer.cfapps.io to rails-sample...
OK
Uploading rails-sample...
Uploading app files from: rails_sample_app
Uploading 41.1M, 6349 files
OK
Binding service rails-postgres to app rails-sample
OK
Starting app rails-sample
OK
...
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running
App started
Showing health and status for app rails-sample
OK
requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: rails-sample-desiccative-acetylizer.cfapps.io
state since cpu memory disk
#0 running 2014-05-29 03:34:22 PM 0.0% 50.3M of 256M 80.2M of 1G
~~~

The application will be pushed using settings in the provided `manifest.yml` file. The `--random-route` option adds random
words in the host to make sure the URL for the app is unique in the Cloud Foundry environment. The output of the
`cf push` command shows the URL that was assigned. Using the provided URL you can browse to the running application.
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -38,5 +38,6 @@ class Application < Rails::Application

# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
ActionController::Base.config.relative_url_root = ''
end
end
10 changes: 10 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
applications:
- name: rails-sample
random-route: true
memory: 256M
instances: 1
path: .
command: bundle exec rake db:migrate && bundle exec rails s -p $PORT
services:
- rails-postgres