The base app is meant to give a common/recommended Rails app base configuration by:
- Exhibiting gem choices and patterns that work and scale well togther
- Providing a real-world starting place based on experience
- Giving guidance as app features grow:
- Clone the repo with
git clone [email protected]:rocketmobile/rails_base_app your-app-name - Replace all instances of 'rails_base_app' with 'your-app-name' in project directory
- Replace all instances of 'RailsBaseApp' with 'YourAppName' in project directory
- Reconfigure
.git/configto point to your repo (so you don't try to push back to the rails_base_app repo).
[remote "origin"]
url = [email protected]:<your-user-or-organization-name>/<your-repo-name>
fetch = +refs/heads/*:refs/remotes/origin/*
-
A Pages controller exists for you in app/controllers/pages_controller
-
A dynamic home page exists for you in app/views/pages/home.haml
-
A dynamic layout exists for you in app/views/layouts/application.haml
-
Zurb Foundation 5 is set up as the styling framework
-
Run
rails sand navigate to localhost:3000 to get started
This setup 'just works' on the Heroku PaaS stack.
heroku apps:create rails-base-app
git push heroku master
You can now run heroku open to visit rails-base-app.herokuapp.com and get the root of the deployed application.
- Secure signed assets with a unique encryption key
- run
heroku config:add SECRET_KEY_BASE=`rake secret`
- run
- Avoid server idling using New Relic Availability Monitoring
heroku addons:add newrelicheroku addons:open newrelicto set up availability monitoring (Settings » Availability monitoring)
- Host assets remotely using S3 and
asset_sync- Add
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_BUCKETconfig variables - Generate initial assets by executing
heroku run rake assets:precompileor pushing a new commit to Heroku
- Add
- Host assets with regional edge caches using CloudFront
- Set up a CloudFront distribution with your S3 bucket as the origin
- Add the
CDN_HOSTconfig variable with your distribution's domain name, without the protocol (ex:d3fsl83hdxp1.cloudfront.net)
- Put site behind basic authentication while under development or for staging
- Add the
BASIC_AUTH_USERandBASIC_AUTH_PASSWORDconfig variables
- Add the
- Analyze traffic with Google Analytics
- Add the
GOOGLE_TRACKING_CODEconfig variable, with your tracking code
- Add the
- Expire long-running requests
- Set the
RACK_TIMEOUTconfig variable to the number of seconds to allow a request to run before raisingTimeout::Error
- Set the
- Continously deploy the 'golden' master branch
- Run
travis setup herokuto configure for automatic deploys after a passed test-suite - Add the
strategy: gitvalue to thedeploykey in.travis.ymlsouser-env-compileworks correctly
- Run
- Use a russian-doll cacheing pattern
- Add a memcached client with
heroku addons:add memcachier - Use simple, auto-expiring cache keys in your views (ex:
- cache model_object do <a bunch of haml that will generate many persistence-layer queries>)
- Add a memcached client with
- Tests will run quickly using spring
- A first call to
bin/rspecwill load spring binstub - Subsequent calls will not suffer the app startup penalty
- A first call to
- View detailed test results and coverage in your browser
- Open
/coverage/index.htmlin a browser to see test coverage information - Open
/coverage/results.htmlin a browser to see real-time test progress
- Open
- Debug with the ease of debugger and the power of pry
- Make a call to
debuggeranywhere in the application - The running process (e.g. foreman, rails console, rails server, rspec, or even spring) will hault with a
pryprompt - Evaluate any ruby or execute any
prycommands in the context of yourdebuggermethod - Type
cand press enter to continue normal execution or your test/request/etc
- Make a call to
Some feature examples exist on branches that are rebased to the master branch. These branches show a few commits showing how to implement a particular feature, without any other noise. As a bonus, in theory (not always in practice), you can add a particular feature by merging in that branch.
git clone [email protected]:rocketmobile/rails_base_app
git merge registerable-users
rake db:migrate
rails s
Feature Guides exist on the wiki as well, with details and explanations around choices made. Ideally, these guides are complemented by a feature branch.
- See or create issues
- Fork and create a branch for your changes
- Tests are appreciated where pragmatic
- Create a pull request with changes, take care about what branch your pull request targets
- Master for a featureless application feature-specific branches for feature examples

