GitXplorerGitXplorer
s

twisted

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
f37e27a32a64eef2ca39cdc226dbf5136db61c9f

Goal page + link fixes

ssarupbanskota committed 10 years ago
Unverified
49b48f49c13eb9f7078a178b906f0ad30d4957ab

Update title

ssarupbanskota committed 10 years ago
Unverified
28a094608d17e7632e19ff8e23c6b84463d113be

More icons on the footer, fix broken image

ssarupbanskota committed 10 years ago
Unverified
ad1dd5b9021fdc9ab9e65679aacc04db34e613c8

Typo fixes

ssarupbanskota committed 10 years ago
Unverified
125abae652574602b41fbd7a2e0da2f5f4432248

Load photos

ssarupbanskota committed 10 years ago
Unverified
a0e7e84404408a628a0b408df1c54ab697c2aed3

Add js for the progress

ssarupbanskota committed 10 years ago

README

The README file for this repository.

Rails 4 Sample App on OpenShift

Quickstart rails 4 application for openshift.

The easiest way to install this application is to use the OpenShift Instant Application. If you'd like to install it manually, follow these directions.

OpenShift Considerations

These are some special considerations you may need to keep in mind when running your application on OpenShift.

Database

Your application is configured to use your OpenShift database in Production mode. Because it addresses these databases based on OpenShift Environment Variables, you will need to change these if you want to use your application in Production mode outside of OpenShift.

By default the development and test environment is configured to use the sqlite3 database adapter.

You can also speed up the git push process by excluding gems you don't need, based on the database you use in OpenShift. You can use the BUNDLE_WITHOUT environment variable for that:

$ rhc env set BUNDLE_WITHOUT="development test postgresql"

Use the command above if you don't want to install any development gems and you are using OpenShift MySQL cartridge.

Assets

Your application is set to precompile the assets every time you push to OpenShift. Any assets you commit to your repo will be preserved alongside those which are generated during the build.

By adding disable_asset_compilation marker, you will disable asset compilation upon application deployment.

Security

Since these quickstarts are shared code, we had to take special consideration to ensure that security related configuration variables was unique across applications. To accomplish this, we modified some of the configuration files (shown in the table below). Now instead of using the same default values, your application will generate it's own value using the initialize_secret function from lib/openshift_secret_generator.rb.

This function uses a secure environment variable that only exists on your deployed application and not in your code anywhere. You can then use the function to generate any variables you need. Each of them will be unique so initialize_secret(:a) will differ from initialize_secret(:b) but they will also be consistent, so any time your application uses them (even across reboots), you know they will be the same.

TLDR: You should copy/link the .openshift/lib/openshift_secret_generator.rb file into ./lib folder and link the secret_token.rb and session_store.rb files into ./config/initializers folder. Look at this quickstart for an example.

Development mode

When you develop your Rails application in OpenShift, you can also enable the 'development' environment by setting the RAILS_ENV environment variable, using the rhc client, like:

$ rhc env set RAILS_ENV=development

If you do so, OpenShift will run your application under 'development' mode. In development mode, your application will:

  • Show more detailed errors in browser
  • Skip static assets (re)compilation
  • Skip web server restart, as the code is reloaded automatically
  • Skip bundle command if the Gemfile is not modified

Development environment can help you debug problems in your application in the same way as you do when developing on your local machine. However, we strong advise you to not run your application in this mode in production.

Modified Files
File Variable
config/initializers/secret_token.rb Railsapp::Application.config.secret_token
config/initializers/session_store.rb Railsapp::Application.config.session_store

Manual Installation

  1. Create an account at https://www.openshift.com

  2. Create a rails application

    rhc app create railsapp ruby-2.0
    

    Note: This quickstart will not work with Ruby 1.8

  3. Add database support to your application

    rhc cartridge add -a railsapp -c mysql-5.5
    

    or

    rhc cartridge add -a railsapp -c postgresql-9.2
    
  4. Add this upstream Rails quickstart repository

    cd railsapp
    git remote add upstream -m master git://github.com/openshift/rails4-example.git
    git pull -s recursive -X theirs upstream master
    
  5. Push your new code

    git push
    
  6. That's it! Enjoy your new Rails application!

License

This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0 (http://creativecommons.org/publicdomain/zero/1.0/)