Clone this repository:
git clone git@github.com:61bits/rails-heroku-bootstrap.git my_new_project cd my_new_project
Rename the project to a name of your choosing and commit:
rake rename[MyNewProject] git add . git commit -am 'Renaming my project'
Create a heroku app:
heroku create my_new_project
Bootstrap heroku addons:
./bootstrap_heroku.sh
Push the code to heroku:
git push heroku master
Run the migrations:
heroku run rake db:migrate
Restart the server:
heroku ps:restart
If you are managing multiples environments don’t forget to set the default environment:
git config heroku.remote production git config heroku.remote heroku
You can create a new heroku environment with:
heroku create my_new_project --remote production
And push with:
git push production master
First configure your database access in:
config/database.yml
Confer guides.rubyonrails.org/getting_started.html#configuring-a-database if you are having any problem.
If you are running for the first time:
bundle install rake db:create rake db:migrate foreman start
Else (Ctrl-C stops the webserver):
foreman start
-
Amazon S3 (sys variables)
-
Facebook app (sys variables)
-
Final Aplication Hostname, not the something.herokuapp.com (sys variable)
-
Google Analytics (sys variable)
-
Add project to Google Webmasters
-
Create final hostname email account and update app/mailers/contact_mailer.rb
-
Error pages (e.g. 404, 503)
-
Favicons and apple-touch-icons located at public/
-
Facebook thumbnails (_metatags.slim and facebook app registry)
-
Add a project sitemap (sitemaps.org)
-
Add schemas to search providers (schema.org)
-
Update project title in layouts and admin config/initializers/active_admin.rb
-
Update public/humans.txt
-
Update public/robots.txt
-
Update project license on LICENSE and README.rdoc
-
Sass: sass-lang.com
-
Compass: compass-style.org
-
SingularityGS: singularity.gs/
-
Slim: slim-lang.com
-
Coffeescript: coffeescript.org
-
ActiveAdmin: activeadmin.info
-
Mercury Editor: jejacks0n.github.io/mercury
-
CKEditor: ckeditor.com
-
jQuery: jquery.com
-
Draper: github.com/drapergem/draper
-
Factory Girl: github.com/thoughtbot/factory_girl
-
Rspec: rspec.info
-
Cucumber: cukes.info
The directory structure of the application:
├── app │ ├── admin │ ├── assets │ │ ├── fonts │ │ ├── images │ │ ├── javascripts │ │ └── stylesheets │ │ ├── base │ │ ├── layouts │ │ ├── modules │ │ ├── states │ │ └── themes │ ├── controllers │ ├── decorators │ ├── helpers │ ├── mailers │ ├── models │ │ └── ckeditor │ ├── views │ │ ├── admin │ │ ├── contact_mailer │ │ ├── contacts │ │ ├── devise │ │ ├── frontend │ │ ├── home │ │ ├── kss │ │ ├── layouts │ │ └── pages │ └── workers ├── config │ ├── environments │ ├── initializers │ └── locales ├── db ├── doc ├── lib │ └── tasks ├── log ├── public ├── script ├── spec │ ├── controllers │ ├── decorators │ ├── factories │ ├── helpers │ ├── lib │ ├── mailers │ ├── models │ ├── routing │ ├── support │ └── views ├── tmp └── vendor ├── assets │ ├── images │ ├── javascripts │ └── stylesheets └── plugins
app
Holds all the code that's specific to this particular application.
app/assets
Contains subdirectories for images, stylesheets, and JavaScript files.
app/controllers
Holds controllers that should be named like weblogs_controller.rb for automated URL mapping. All controllers should descend from ApplicationController which itself descends from ActionController::Base.
app/models
Holds models that should be named like post.rb. Models descend from ActiveRecord::Base by default.
app/views
Holds the template files for the view that should be named like weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby syntax by default.
app/views/layouts
Holds the template files for layouts to be used with views. This models the common header/footer method of wrapping views. In your views, define a layout using the <tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb, call <% yield %> to render the view using this layout.
app/helpers
Holds view helpers that should be named like weblogs_helper.rb. These are generated for you automatically when using generators for controllers. Helpers can be used to wrap functionality for your views into methods.
config
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
db
Contains the database schema in schema.rb. db/migrate contains all the sequence of Migrations for your schema.
doc
This directory is where your application documentation will be stored when generated using <tt>rake doc:app</tt>
lib
Application specific libraries. Basically, any kind of custom code that doesn't belong under controllers, models, or helpers. This directory is in the load path.
public
The directory available for the web server. Also contains the dispatchers and the default HTML files. This should be set as the DOCUMENT_ROOT of your web server.
script
Helper scripts for automation and generation.
spec
Rspec test folder.
vendor
External libraries that the application depends on. Also includes the plugins subdirectory. If the app has frozen rails, those gems also go here, under vendor/rails/. This directory is in the load path.
The variables used by are present in your /.env
Those are your local variables, to update them on heroku just:
heroku config:set WEB_CONCURRENCY=4 APP_HOSTNAME=myproject.com
WEB_CONCURRENCY=3
Number of extra processes unicorn will spawn.
RACK_ENV=none
For unicorn
RAILS_ENV=development
Devolpment env by default
APP_HOSTNAME=localhost
The hostname of your app, bootstrap_heroku.sh changes this to your heroku app host.
GOOGLE_ANALYTICS_ID=UA-00000000-0
Google analytics id
FACEBOOK_APP_ID=129857033875302
Facebook app id
FACEBOOK_SECRET=b7ca37a8abcd5a0e8ffa40ed01f81e66
Facebook secret
S3_KEY=0000
Amazon S3 key
S3_SECRET=000
Amazon S3 secret
S3_REGION=000
Amazon S3 region
S3_BUCKET=000
Amazon S3 bucket
DUAL LICENSE: GPLv3 and MIT
GPLv3 License Copyright © 2013
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.
MIT License Copyright © 2013
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.