Skip to content

This application was generated with the God of Google Schemer application

License

Notifications You must be signed in to change notification settings

cerebrowang/GoogleSchemer

Repository files navigation

Huing

This application was generated with the God of Google Schemer application

This is the Google Schemer cloned application for praticing my first web programming the Google Schemer cloned application: Learn Web Development with Rails by Daniel Wang. You can use this reference implementation to help track down errors if you end up having trouble with code in the tutorial. In particular, as a first debugging check I suggest getting the test suite to pass on your local machine:

If the tests don't pass, it means there may be something wrong with your system. If they do pass, then you can debug your code by comparing it with the reference implementation.

Deploy

$ ssh-keygen -t rsa
$ heroku keys:add

$ rm .git -rf
$ heroku login
$ heroku git:clone -a schemer
$ git init
$ git add .
$ git commit -m "init"
$ heroku create
$ heroku git:remote -a schemer
$ RAILS_ENV=production rake assets:precompile
$ git add -A
$ git commit -m "assets compiled for Heroku"
$ git push heroku master
$ heroku run rake assets:precompile
$ heroku run rake db:migrate
$ heroku run rake db:seed
$ heroku config:add SECRET_KEY_BASE="$(bundle exec rake secret)"

This is a starter web application based on the following technology stack:

Starter App is deployable on Heroku. Demo: http://schemer.herokuapp.com/

Gemfile also contains a set of useful gems for performance, security, api building...

Thread safety

We assume that this application is thread safe. If your application is not thread safe or you don't know, please set the minimum and maximum number of threads usable by puma on heroku to 1:

$ heroku config:set MIN_THREADS=1 MAX_THREADS=1

Heroku Platform API

This application supports fast setup and deploy via app.json:

$ curl -n -X POST https://api.heroku.com/app-setups \
-H "Content-Type:application/json" \
-H "Accept:application/vnd.heroku+json; version=3" \
-d '{"source_blob": { "url":"https://github.com/spyhole/GoogleSchemer/tarball/master/"} }'

More information: Setting Up Apps using the Platform API

Recommended add-ons

Heroku's Production Check recommends the use of the following add-ons, here in the free version:

$ heroku addons:add newrelic:stark # App monitoring
$ heroku config:set NEW_RELIC_APP_NAME="Rails Starter App" # Set newrelic app name
$ heroku addons:add papertrail # Log monitoring
$ heroku addons:add pgbackups:auto-month # Postgres backups

Secrets.yml

Rails 4.1.0 introduced secrets.yml. Heroku automatically sets a proper configuration variable in new applications. Just in case you need, the command line is:

$ heroku config:add SECRET_KEY_BASE="$(bundle exec rake secret)"

NOTE: If you need to migrate old cookies, please read the above guide.

Tuning Ruby's RGenGC

Generational GC (called RGenGC) was introduced from Ruby 2.1.0. RGenGC reduces marking time dramatically (about x10 faster). However, RGenGC introduce huge memory consumption. This problem has impact especially for small memory machines.

Ruby 2.1.1 introduced new environment variable RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR to control full GC timing. By setting this variable to a value lower than the default of 2 (we are using the suggested value of 1.3) you can indirectly force the garbage collector to perform more major GCs, which reduces heap growth.

$ heroku config:set RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.3

More information: Change the full GC timing

Nitrous.IO

Starter App supports online development on Nitrous.IO.

You need:

  • A Nitrous.IO box with at least 512MB of memory.
  • Two "Dev Plan" heroku databases (one for development and one for test)
  • The following environment variables on your Nitrous.IO box's .bashrc:
    export STARTER_APP_DEV_DB_DATABASE=YOUR_DEV_DB_DATABASE
    export STARTER_APP_DEV_DB_USER=YOUR_DEV_DB_USER
    export STARTER_APP_DEV_DB_PASSWORD=YOUR_DEV_DB_PASSWORD
    export STARTER_APP_DEV_DB_HOST=YOUR_DEV_DB_HOST
    export STARTER_APP_DEV_DB_PORT=YOUR_DEV_DB_PORT
    
    export STARTER_APP_TEST_DB_DATABASE=YOUR_TEST_DB_DATABASE
    export STARTER_APP_TEST_DB_USER=YOUR_TEST_DB_USER
    export STARTER_APP_TEST_DB_PASSWORD=YOUR_TEST_DB_PASSWORD
    export STARTER_APP_TEST_DB_HOST=YOUR_TEST_DB_HOST
    export STARTER_APP_TEST_DB_PORT=YOUR_TEST_DB_PORT

A guide for creating heroku databases and edit .bashrc on Nitrous.IO is available here: http://help.nitrous.io/postgres/

About

This application was generated with the God of Google Schemer application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published