Skip to content

Commit

Permalink
Regenerate project from mattbrictson/rails-template
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrictson committed Oct 5, 2015
1 parent f04d52f commit fb6f3f8
Show file tree
Hide file tree
Showing 169 changed files with 1,775 additions and 1,572 deletions.
19 changes: 13 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/log/*.log
/log/*.log.*
/tmp

# Ignore test reports
/brakeman-output.*
/coverage

# Ignore results of `rake assets:precompile`.
/public/assets/

# Never check passwords into source control!
/config/database.yml
/.env
39 changes: 39 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
AllCops:
RunRailsCops: true
DisplayCopNames: true
DisplayStyleGuide: true
Exclude:
- "bin/*"
- Capfile
- config/boot.rb
- config/environment.rb
- config/initializers/version.rb
- db/schema.rb
- Gemfile
- Guardfile
- Rakefile

Metrics/LineLength:
Exclude:
- "config/**/*"

Style/ClassAndModuleChildren:
Enabled: false

Style/Documentation:
Enabled: false

Style/DoubleNegation:
Enabled: false

Style/HashSyntax:
EnforcedStyle: hash_rockets

Style/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/TrivialAccessors:
AllowPredicates: true
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.3
9 changes: 9 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "simplecov"
SimpleCov.start("rails") do
add_filter("/bin/")
add_filter("/lib/tasks/assets.rake")
add_filter("/lib/tasks/auto_annotate_models.rake")
add_filter("/lib/tasks/coverage.rake")
end
SimpleCov.minimum_coverage(90)
SimpleCov.use_merging(false)
14 changes: 14 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# Include tasks from other gems included in your Gemfile
require "capistrano/bundler"
require "capistrano/rails"
require "capistrano/mb"
require "airbrussh/capistrano"

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
84 changes: 84 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# How to deploy viim-core

This document covers the steps need to deploy the application to an existing environment. To create a new environment, refer to `PROVISIONING.md`.

* **Developers:** this project is built and deployed using Capistrano, which is the `cap` command. Refer to the *Capistrano* section.
* **System administrators:** once deployed, the various processes and configuration can be maintained with familiar Linux commands. Refer to the *Server maintenance* section.


## Capistrano

### Environments

* **staging** is deployed from the `development` branch.
* **production** is deployed from the `master` branch.

### Prerequisites

Capistrano runs on your local machine and uses SSH to perform the deployment on the remote server. Therefore:

* The Capistrano gem must be installed (see `README.md` for project setup instructions).
* You must have SSH access to the production/staging server.
* Your SSH key must be installed on the server in `~deployer/.ssh/authorized_keys`.
* You must have SSH access to Git repository (using your SSH key).

### Performing a graceful deployment (no migrations)

This will deploy the latest code from `development`. Make sure to `git push` your changes first, or they will not apply.

```
bundle exec cap production deploy
```

### Performing a full deployment

If there are data migrations or other changes that require downtime, perform the deployment using the following task:

```
bundle exec cap production deploy:migrate_and_restart
```

This will stop the app and display a maintenance page during the deployment.


## Server maintenance

This application consists of two executables that run as the `deployer` user:

* Unicorn is the application server that services Rails HTTP requests
* Sidekiq is the background worker that services the job queue stored in Redis

These in turn rely on the following services:

* PostgreSQL
* Redis
* Nginx

### Controlling processes

All processes are set up to start automatically when the server boots, and can be controlled using the standard Ubuntu `service` command:

```
sudo service postgresql <start|stop|restart>
sudo service nginx <start|stop|restart>
sudo service unicorn_viim_core <start|stop|restart>
sudo service sidekiq_viim_core <start|stop>
```

Note that Unicorn and Sidekiq require access to PostgreSQL and Redis, so those supporting services should be started first.

### Configuration

All configuration values required by the application can be changed here:

```
/home/deployer/apps/viim_core/shared/.env.production
```

After making changes to this file, be sure to restart the application:

```
sudo service unicorn_viim_core restart
sudo service sidekiq_viim_core stop
sudo service sidekiq_viim_core start
```
101 changes: 59 additions & 42 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,50 +1,67 @@
source 'https://rubygems.org'
source "https://rubygems.org"

gem 'rails', '4.2.0'
gem 'bootstrap-sass'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# gem 'therubyracer', platforms: :ruby
gem "active_type", ">= 0.3.2"
gem "autoprefixer-rails", ">= 5.0.0.1"
gem "bcrypt", "~> 3.1.7"
gem "bootstrap_form", "~> 2.3.0"
gem "bootstrap-sass", "~> 3.2.0"
gem "coffee-rails", "~> 4.1.0"
gem "dotenv-rails", ">= 2.0.0"
gem "font-awesome-rails"
gem "jquery-rails"
gem "jquery-turbolinks"
gem "mail", ">= 2.6.3"
gem "marco-polo"
gem "pg", "~> 0.18"
gem "rails", "4.2.4"
gem "sass-rails", "~> 5.0"
gem "secure_headers", ">= 2.1.0"
gem "sidekiq"
gem "sinatra", ">= 1.3.0", :require => false
gem "turbolinks", ">= 2.5.2"

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

# for user-customizable layouts stored in database
gem 'liquid'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'

# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'sqlite3'
group :production, :staging do
gem "unicorn"
gem "unicorn-worker-killer"
end


group :test do
gem 'minitest-reporters'
gem 'mini_backtrace'
group :development do
gem "annotate", ">= 2.5.0"
gem "awesome_print"
gem "better_errors"
gem "binding_of_caller"
gem "letter_opener"
gem "quiet_assets"
gem "rack-livereload"
gem "spring"
gem "xray-rails", ">= 0.1.16"
end


group :production do
gem 'pg'
gem 'rails_12factor'
group :development do
gem "airbrussh", :require => false
gem "brakeman", :require => false
gem "bundler-audit", :require => false
gem "capistrano", "~> 3.4.0", :require => false
gem "capistrano-bundler", :require => false
gem "capistrano-mb", ">= 0.22.2", :require => false
gem "capistrano-rails", :require => false
gem "guard", ">= 2.2.2", :require => false
gem "guard-livereload", :require => false
gem "guard-minitest", :require => false
gem "rb-fsevent", :require => false
gem "simplecov", :require => false
gem "sshkit", "~> 1.7.1", :require => false
gem "terminal-notifier-guard", :require => false
gem "thin", :require => false
end

group :test do
gem "capybara"
gem "connection_pool"
gem "launchy"
gem "minitest-reporters"
gem "mocha"
gem "poltergeist"
gem "shoulda"
gem "test_after_commit"
end
Loading

0 comments on commit fb6f3f8

Please sign in to comment.