rail_pass 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.md +20 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/rail_pass/application.js +15 -0
- data/app/assets/stylesheets/rail_pass/application.css +13 -0
- data/app/controllers/rail_pass/application_controller.rb +4 -0
- data/app/controllers/rail_pass/styleguide_controller.rb +7 -0
- data/app/helpers/rail_pass/application_helper.rb +4 -0
- data/app/views/rail_pass/styleguide/index.html.haml +104 -0
- data/config/routes.rb +3 -0
- data/lib/generators/rail_pass/install_generator.rb +220 -0
- data/lib/generators/templates/Procfile +1 -0
- data/lib/generators/templates/app/assets/javascripts/application.js +17 -0
- data/lib/generators/templates/app/assets/javascripts/html5.js +14 -0
- data/lib/generators/templates/app/assets/javascripts/polyfills.js +14 -0
- data/lib/generators/templates/app/assets/javascripts/responsive.js +14 -0
- data/lib/generators/templates/app/assets/javascripts/scripts.js.coffee +0 -0
- data/lib/generators/templates/app/assets/stylesheets/application.css.scss +26 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_colors.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_defaults.scss +27 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_forms.scss +0 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_settings.scss +0 -0
- data/lib/generators/templates/app/assets/stylesheets/base/_typography.scss +3 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_containers.scss +18 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_footer.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_header.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/layout/_settings.scss +1 -0
- data/lib/generators/templates/app/assets/stylesheets/modules/_buttons.scss +15 -0
- data/lib/generators/templates/app/controllers/pages_controller.rb +2 -0
- data/lib/generators/templates/app/helpers/application_helper.rb +87 -0
- data/lib/generators/templates/app/views/errors/404.html.haml +3 -0
- data/lib/generators/templates/app/views/layouts/application.html.haml +124 -0
- data/lib/generators/templates/app/views/pages/index.html.haml +0 -0
- data/lib/generators/templates/config/deploy.rb +34 -0
- data/lib/generators/templates/config/initializers/dev_environment.rb +6 -0
- data/lib/generators/templates/config/initializers/new_relic.rb +5 -0
- data/lib/generators/templates/config/mongoid.yml +68 -0
- data/lib/generators/templates/config/newrelic.yml +255 -0
- data/lib/generators/templates/config/recipes/base.rb +86 -0
- data/lib/generators/templates/config/recipes/check.rb +13 -0
- data/lib/generators/templates/config/recipes/mongodb/install-outdated.rb +41 -0
- data/lib/generators/templates/config/recipes/mongodb/install.rb +45 -0
- data/lib/generators/templates/config/recipes/mongodb/manage.rb +27 -0
- data/lib/generators/templates/config/recipes/mongodb.rb +73 -0
- data/lib/generators/templates/config/recipes/mysql.rb +152 -0
- data/lib/generators/templates/config/recipes/nginx.rb +25 -0
- data/lib/generators/templates/config/recipes/nodejs.rb +9 -0
- data/lib/generators/templates/config/recipes/postgresql.rb +34 -0
- data/lib/generators/templates/config/recipes/rbenv.rb +29 -0
- data/lib/generators/templates/config/recipes/redis.rb +18 -0
- data/lib/generators/templates/config/recipes/ruby.rb +93 -0
- data/lib/generators/templates/config/recipes/templates/foreman.erb +2 -0
- data/lib/generators/templates/config/recipes/templates/gitlab.yml.erb +29 -0
- data/lib/generators/templates/config/recipes/templates/mongoid.yml.erb +10 -0
- data/lib/generators/templates/config/recipes/templates/mysql.yml.erb +7 -0
- data/lib/generators/templates/config/recipes/templates/nginx_unicorn.erb +27 -0
- data/lib/generators/templates/config/recipes/templates/postgresql.yml.erb +8 -0
- data/lib/generators/templates/config/recipes/templates/unicorn.rb.erb +8 -0
- data/lib/generators/templates/config/recipes/templates/unicorn_init.erb +84 -0
- data/lib/generators/templates/config/recipes/unicorn.rb +28 -0
- data/lib/generators/templates/config/recipes/utilities.rb +144 -0
- data/lib/generators/templates/config/unicorn.rb +2 -0
- data/lib/generators/templates/public/422.html +54 -0
- data/lib/generators/templates/public/500.html +54 -0
- data/lib/generators/templates/spec/spec_helper.rb +41 -0
- data/lib/generators/templates/vendor/assets/fonts/fontawesome/fontawesome-webfont.eot +0 -0
- data/lib/generators/templates/vendor/assets/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
- data/lib/generators/templates/vendor/assets/fonts/fontawesome/fontawesome-webfont.woff +0 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.eot +0 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.svg +36 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.ttf +0 -0
- data/lib/generators/templates/vendor/assets/fonts/icomoon/icomoon.woff +0 -0
- data/lib/generators/templates/vendor/assets/javascripts/jquery.ui.touch-punch.min.js +11 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/html5shim.js +3 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/modernizr.js +4 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/respond.js +15 -0
- data/lib/generators/templates/vendor/assets/javascripts/polyfills/selectivizr.js +560 -0
- data/lib/generators/templates/vendor/assets/stylesheets/font-awesome.scss +493 -0
- data/lib/generators/templates/vendor/assets/stylesheets/icomoon.scss +22 -0
- data/lib/rail_pass/engine.rb +5 -0
- data/lib/rail_pass/version.rb +3 -0
- data/lib/rail_pass.rb +4 -0
- data/lib/tasks/rail_pass_tasks.rake +4 -0
- metadata +146 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module ApplicationHelper
|
|
2
|
+
|
|
3
|
+
# Page Titles - Set individual page title elements
|
|
4
|
+
# Accepts a String or Array.
|
|
5
|
+
# Sets yield(:title) to a String for use in <title>.
|
|
6
|
+
#
|
|
7
|
+
# --Array--
|
|
8
|
+
# title ["Example", "Nashville, TN"]
|
|
9
|
+
# => "Example - Page - Title"
|
|
10
|
+
#
|
|
11
|
+
# --String--
|
|
12
|
+
# title "Example Page Title"
|
|
13
|
+
# => "Example Page Title"
|
|
14
|
+
#
|
|
15
|
+
def title title_partials
|
|
16
|
+
title = if title_partials.is_a? String
|
|
17
|
+
title_partials
|
|
18
|
+
elsif title_partials.is_a? Array
|
|
19
|
+
title_partials.reject(&:blank?).join(' - ')
|
|
20
|
+
end
|
|
21
|
+
content_for(:title) { title }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# Yes -or- No
|
|
27
|
+
#
|
|
28
|
+
def yes_no(bool)
|
|
29
|
+
bool ? 'Yes' : 'No'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# Enabled -or- Disabled
|
|
35
|
+
#
|
|
36
|
+
def enabled_disabled(bool)
|
|
37
|
+
bool ? 'Enabled' : 'Disabled'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
#
|
|
42
|
+
# Substitute N/A for blank data
|
|
43
|
+
#
|
|
44
|
+
def check(data)
|
|
45
|
+
data.blank? ? 'N/A' : data
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
#
|
|
51
|
+
# Date: Jan 1, 2012
|
|
52
|
+
#
|
|
53
|
+
def date_short(date)
|
|
54
|
+
date.strftime("%b %e, %Y") if !date.blank?
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Date: 1/1/2012
|
|
60
|
+
#
|
|
61
|
+
def date_compact(date)
|
|
62
|
+
date.strftime("%-m/%-d/%Y") if !date.blank?
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
#
|
|
67
|
+
# Substitute empty string for blank data
|
|
68
|
+
#
|
|
69
|
+
def exists?(data)
|
|
70
|
+
data.blank? ? '' : data
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
#
|
|
79
|
+
# Alternate object debug
|
|
80
|
+
#
|
|
81
|
+
def mdebug(object)
|
|
82
|
+
d = object.attributes.inspect.split(',')
|
|
83
|
+
d.map! {|i| i.to_s + '<br>'}
|
|
84
|
+
d.join.delete("{").delete("}")
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
!!! 5
|
|
2
|
+
|
|
3
|
+
%html
|
|
4
|
+
|
|
5
|
+
/
|
|
6
|
+
_
|
|
7
|
+
_
|
|
8
|
+
_ /// /// ..=====..
|
|
9
|
+
_ /// /// .:ooooooooooo:.
|
|
10
|
+
_ /// /// .ooooooooooooooo.
|
|
11
|
+
_ /// /// -ooooooooooooooooo-
|
|
12
|
+
_ /// /// -ooooooooooooooooo-
|
|
13
|
+
_ /// /// -ooooooooooooooooo-
|
|
14
|
+
_ /// /// `ooooooooooooooo'
|
|
15
|
+
_ /// /// `:ooooooooooo:'
|
|
16
|
+
_ /// /// ''=====''
|
|
17
|
+
_
|
|
18
|
+
_ Designed & Developed by LaCroix Design Co.
|
|
19
|
+
_ http://lacroixdesign.net
|
|
20
|
+
_
|
|
21
|
+
_
|
|
22
|
+
_
|
|
23
|
+
|
|
24
|
+
%head
|
|
25
|
+
%meta(charset="utf-8")
|
|
26
|
+
%title=raw [yield(:title), "FIXME: APPLICATION NAME"].reject(&:blank?).join(' | ')
|
|
27
|
+
|
|
28
|
+
-# Kore ga general meta
|
|
29
|
+
%meta{name: "description", content: "FIXME: APPLICATION DESCRIPTION"}
|
|
30
|
+
%meta{name: "author", content: "Michael LaCroix, James LaCroix"}
|
|
31
|
+
%meta{:'http-equiv' => "X-UA-Compatible", content: "chrome=1"}
|
|
32
|
+
|
|
33
|
+
-# Kore ga Facebook meta
|
|
34
|
+
/ %meta{name: "og:title", content: "#{@fb_title || 'FIXME: APPLICATION NAME'}"}
|
|
35
|
+
/ %meta{name: "og:image", content: ""}
|
|
36
|
+
/ %meta{name: "og:type", content: "website"}
|
|
37
|
+
/ %meta{name: "og:site_name", content: "FIXME: APPLICATION NAME"}
|
|
38
|
+
/ %meta{name: "og:admins", content: ""}
|
|
39
|
+
|
|
40
|
+
-# Kore ga fav and touch icons (reside in the /public folder), plus iOS meta
|
|
41
|
+
/ %link{rel: "shortcut icon", href: "#{root_url}/favicon.png"}
|
|
42
|
+
/ %link{rel: "apple-touch-icon", href: "#{root_url}/apple-touch-icon-57x57-precomposed.png"}
|
|
43
|
+
/ %link{rel: "apple-touch-icon-precomposed", sizes: "72x72", href: "#{root_url}/apple-touch-icon-72x72-precomposed.png"}
|
|
44
|
+
/ %link{rel: "apple-touch-icon-precomposed", sizes: "114x114", href: "#{root_url}/apple-touch-icon-114x114-precomposed.png"}
|
|
45
|
+
/ %link{rel: "apple-touch-icon-precomposed", sizes: "144x144", href: "#{root_url}/apple-touch-icon-144x144-precomposed.png"}
|
|
46
|
+
%meta{name: "viewport", content: "initial-scale=1.0, width=device-width, user-scalable=no, maximum-scale=1.0"}
|
|
47
|
+
%meta{name: "apple-mobile-web-app-capable", content: "yes"}
|
|
48
|
+
%meta{name: "apple-mobile-web-app-status-bar-style", content:"black"}
|
|
49
|
+
|
|
50
|
+
-# Kore ga HTML5 shim, for IE6-8 support of HTML elements
|
|
51
|
+
/[if lt IE 9]
|
|
52
|
+
= javascript_include_tag "html5"
|
|
53
|
+
|
|
54
|
+
= stylesheet_link_tag "application", media: "all"
|
|
55
|
+
|
|
56
|
+
-# Kore ga CSS3 polyfill, IE6-8 support of CSS3 pseudo-classes with Selectivizr
|
|
57
|
+
/[if lt IE 9]
|
|
58
|
+
= javascript_include_tag "polyfills"
|
|
59
|
+
|
|
60
|
+
= javascript_include_tag "responsive"
|
|
61
|
+
= csrf_meta_tags
|
|
62
|
+
|
|
63
|
+
-# Kore ga Typekit -- replace VVVVVVV with the proper kit code
|
|
64
|
+
/ %script{ type: "text/javascript", src: "//use.typekit.net/VVVVVVV.js" }
|
|
65
|
+
/ :javascript
|
|
66
|
+
/ try{Typekit.load();}catch(e){}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
%body
|
|
72
|
+
/[if lt IE 9]
|
|
73
|
+
.wrap.outdated-browser
|
|
74
|
+
%div
|
|
75
|
+
%p
|
|
76
|
+
%a.close{ href: "#" } x
|
|
77
|
+
You are using an outdated browser. Please
|
|
78
|
+
%a{ href: "http://browsehappy.com/", target: '_blank' } upgrade your browser
|
|
79
|
+
or
|
|
80
|
+
%a{ href: "http://www.google.com/chromeframe/?redirect=true", target: '_blank' } activate Google Chrome Frame
|
|
81
|
+
to improve your experience.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
%header.header
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
= yield
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
%footer.footer
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
-# Kore ga javascript
|
|
100
|
+
= javascript_include_tag "application"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
-# Kore ga Google Analytics -- replace VVVVVVVV-V with the proper code
|
|
104
|
+
- if Rails.env.production?
|
|
105
|
+
:javascript
|
|
106
|
+
var _gaq = _gaq || [];
|
|
107
|
+
_gaq.push(['_setAccount', 'UA-VVVVVVVV-V']);
|
|
108
|
+
_gaq.push(['_trackPageview']);
|
|
109
|
+
|
|
110
|
+
(function() {
|
|
111
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
112
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
113
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
114
|
+
})();
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
-# Kore ga Width Plugin
|
|
121
|
+
- if Rails.env.development?
|
|
122
|
+
#lacroixdesign-browserwidth{style: "position:fixed; bottom:0; left:0; background:#555; color:#CCC; font-size:0.75em; padding:0.25em; text-shadow:black 1px 1px 1px; font-weight:normal;"}
|
|
123
|
+
:javascript
|
|
124
|
+
function showWidth(){var w = $(window).width();$('#dev-browserwidth').text(w);}showWidth();$(window).resize(function(){showWidth();});
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "bundler/capistrano"
|
|
2
|
+
|
|
3
|
+
load "config/recipes/base"
|
|
4
|
+
load "config/recipes/nginx"
|
|
5
|
+
load "config/recipes/unicorn"
|
|
6
|
+
# load "config/recipes/mongodb"
|
|
7
|
+
load "config/recipes/postgresql"
|
|
8
|
+
# load "config/recipes/mysql"
|
|
9
|
+
# load "config/recipes/redis"
|
|
10
|
+
load "config/recipes/nodejs"
|
|
11
|
+
load "config/recipes/rbenv"
|
|
12
|
+
# load "config/recipes/ruby" # No long necessary, Foreman does not need sudo for bundle exec
|
|
13
|
+
load "config/recipes/check"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
server "XX.XX.XX.XX", :web, :app, :db, primary: true # FIXME change this
|
|
18
|
+
set :environment, "production"
|
|
19
|
+
|
|
20
|
+
set :user, "deploy" # FIXME change this
|
|
21
|
+
set :application, "APPLICATION" # FIXME change this
|
|
22
|
+
set :deploy_to, "/home/#{user}/apps/#{application}"
|
|
23
|
+
set :deploy_via, :remote_cache
|
|
24
|
+
set :use_sudo, false
|
|
25
|
+
|
|
26
|
+
set :scm, "git"
|
|
27
|
+
set :repository, "git@github.com:APPLICATION.git" # FIXME change this
|
|
28
|
+
set :remote_repository, "origin" # default is "origin"
|
|
29
|
+
set :branch, "master" # default is "master"
|
|
30
|
+
|
|
31
|
+
default_run_options[:pty] = true
|
|
32
|
+
ssh_options[:forward_agent] = true
|
|
33
|
+
|
|
34
|
+
after "deploy", "deploy:cleanup" # keep only the last 5 releases
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
development:
|
|
2
|
+
# Configure available database sessions. (required)
|
|
3
|
+
sessions:
|
|
4
|
+
# Defines the default session. (required)
|
|
5
|
+
default:
|
|
6
|
+
# Defines the name of the default database that Mongoid can connect to.
|
|
7
|
+
# (required).
|
|
8
|
+
database: app_name_development
|
|
9
|
+
# Provides the hosts the default session can connect to. Must be an array
|
|
10
|
+
# of host:port pairs. (required)
|
|
11
|
+
hosts:
|
|
12
|
+
- localhost:27017
|
|
13
|
+
options:
|
|
14
|
+
# Change whether the session persists in safe mode by default.
|
|
15
|
+
# (default: false)
|
|
16
|
+
# safe: false
|
|
17
|
+
|
|
18
|
+
# Change the default consistency model to :eventual or :strong.
|
|
19
|
+
# :eventual will send reads to secondaries, :strong sends everything
|
|
20
|
+
# to master. (default: :eventual)
|
|
21
|
+
consistency: :strong
|
|
22
|
+
# Configure Mongoid specific options. (optional)
|
|
23
|
+
options:
|
|
24
|
+
# Configuration for whether or not to allow access to fields that do
|
|
25
|
+
# not have a field definition on the model. (default: true)
|
|
26
|
+
# allow_dynamic_fields: true
|
|
27
|
+
|
|
28
|
+
# Enable the identity map, needed for eager loading. (default: false)
|
|
29
|
+
# identity_map_enabled: false
|
|
30
|
+
|
|
31
|
+
# Includes the root model name in json serialization. (default: false)
|
|
32
|
+
# include_root_in_json: false
|
|
33
|
+
|
|
34
|
+
# Include the _type field in serializaion. (default: false)
|
|
35
|
+
# include_type_for_serialization: false
|
|
36
|
+
|
|
37
|
+
# Preload all models in development, needed when models use
|
|
38
|
+
# inheritance. (default: false)
|
|
39
|
+
# preload_models: false
|
|
40
|
+
|
|
41
|
+
# Protect id and type from mass assignment. (default: true)
|
|
42
|
+
# protect_sensitive_fields: true
|
|
43
|
+
|
|
44
|
+
# Raise an error when performing a #find and the document is not found.
|
|
45
|
+
# (default: true)
|
|
46
|
+
# raise_not_found_error: true
|
|
47
|
+
|
|
48
|
+
# Raise an error when defining a scope with the same name as an
|
|
49
|
+
# existing method. (default: false)
|
|
50
|
+
# scope_overwrite_exception: false
|
|
51
|
+
|
|
52
|
+
# Skip the database version check, used when connecting to a db without
|
|
53
|
+
# admin access. (default: false)
|
|
54
|
+
# skip_version_check: false
|
|
55
|
+
|
|
56
|
+
# User Active Support's time zone in conversions. (default: true)
|
|
57
|
+
# use_activesupport_time_zone: true
|
|
58
|
+
|
|
59
|
+
# Ensure all times are UTC in the app side. (default: false)
|
|
60
|
+
# use_utc: false
|
|
61
|
+
test:
|
|
62
|
+
sessions:
|
|
63
|
+
default:
|
|
64
|
+
database: app_name_test
|
|
65
|
+
hosts:
|
|
66
|
+
- localhost:27017
|
|
67
|
+
options:
|
|
68
|
+
consistency: :strong
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Here are the settings that are common to all environments
|
|
2
|
+
common: &default_settings
|
|
3
|
+
# ============================== LICENSE KEY ===============================
|
|
4
|
+
|
|
5
|
+
# You must specify the license key associated with your New Relic
|
|
6
|
+
# account. This key binds your Agent's data to your account in the
|
|
7
|
+
# New Relic service.
|
|
8
|
+
license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>'
|
|
9
|
+
|
|
10
|
+
# Agent Enabled (Rails Only)
|
|
11
|
+
# Use this setting to force the agent to run or not run.
|
|
12
|
+
# Default is 'auto' which means the agent will install and run only
|
|
13
|
+
# if a valid dispatcher such as Mongrel is running. This prevents
|
|
14
|
+
# it from running with Rake or the console. Set to false to
|
|
15
|
+
# completely turn the agent off regardless of the other settings.
|
|
16
|
+
# Valid values are true, false and auto.
|
|
17
|
+
#
|
|
18
|
+
# agent_enabled: auto
|
|
19
|
+
|
|
20
|
+
# Application Name Set this to be the name of your application as
|
|
21
|
+
# you'd like it show up in New Relic. The service will then auto-map
|
|
22
|
+
# instances of your application into an "application" on your
|
|
23
|
+
# dashboard page. If you want to map this instance into multiple
|
|
24
|
+
# apps, like "AJAX Requests" and "All UI" then specify a semicolon
|
|
25
|
+
# separated list of up to three distinct names, or a yaml list.
|
|
26
|
+
# Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
|
|
27
|
+
# Production, Staging, etc)
|
|
28
|
+
#
|
|
29
|
+
# Example:
|
|
30
|
+
#
|
|
31
|
+
# app_name:
|
|
32
|
+
# - Ajax Service
|
|
33
|
+
# - All Services
|
|
34
|
+
#
|
|
35
|
+
app_name: <%= ENV["NEW_RELIC_APP_NAME"] %>
|
|
36
|
+
|
|
37
|
+
# When "true", the agent collects performance data about your
|
|
38
|
+
# application and reports this data to the New Relic service at
|
|
39
|
+
# newrelic.com. This global switch is normally overridden for each
|
|
40
|
+
# environment below. (formerly called 'enabled')
|
|
41
|
+
monitor_mode: true
|
|
42
|
+
|
|
43
|
+
# Developer mode should be off in every environment but
|
|
44
|
+
# development as it has very high overhead in memory.
|
|
45
|
+
developer_mode: false
|
|
46
|
+
|
|
47
|
+
# The newrelic agent generates its own log file to keep its logging
|
|
48
|
+
# information separate from that of your application. Specify its
|
|
49
|
+
# log level here.
|
|
50
|
+
log_level: info
|
|
51
|
+
|
|
52
|
+
# Optionally set the path to the log file This is expanded from the
|
|
53
|
+
# root directory (may be relative or absolute, e.g. 'log/' or
|
|
54
|
+
# '/var/log/') The agent will attempt to create this directory if it
|
|
55
|
+
# does not exist.
|
|
56
|
+
# log_file_path: 'log'
|
|
57
|
+
|
|
58
|
+
# Optionally set the name of the log file, defaults to 'newrelic_agent.log'
|
|
59
|
+
# log_file_name: 'newrelic_agent.log'
|
|
60
|
+
|
|
61
|
+
# The newrelic agent communicates with the service via http by
|
|
62
|
+
# default. If you want to communicate via https to increase
|
|
63
|
+
# security, then turn on SSL by setting this value to true. Note,
|
|
64
|
+
# this will result in increased CPU overhead to perform the
|
|
65
|
+
# encryption involved in SSL communication, but this work is done
|
|
66
|
+
# asynchronously to the threads that process your application code,
|
|
67
|
+
# so it should not impact response times.
|
|
68
|
+
ssl: false
|
|
69
|
+
|
|
70
|
+
# EXPERIMENTAL: enable verification of the SSL certificate sent by
|
|
71
|
+
# the server. This setting has no effect unless SSL is enabled
|
|
72
|
+
# above. This may block your application. Only enable it if the data
|
|
73
|
+
# you send us needs end-to-end verified certificates.
|
|
74
|
+
#
|
|
75
|
+
# This means we cannot cache the DNS lookup, so each request to the
|
|
76
|
+
# service will perform a lookup. It also means that we cannot
|
|
77
|
+
# use a non-blocking lookup, so in a worst case, if you have DNS
|
|
78
|
+
# problems, your app may block indefinitely.
|
|
79
|
+
# verify_certificate: true
|
|
80
|
+
|
|
81
|
+
# Set your application's Apdex threshold value with the 'apdex_t'
|
|
82
|
+
# setting, in seconds. The apdex_t value determines the buckets used
|
|
83
|
+
# to compute your overall Apdex score.
|
|
84
|
+
# Requests that take less than apdex_t seconds to process will be
|
|
85
|
+
# classified as Satisfying transactions; more than apdex_t seconds
|
|
86
|
+
# as Tolerating transactions; and more than four times the apdex_t
|
|
87
|
+
# value as Frustrating transactions.
|
|
88
|
+
# For more about the Apdex standard, see
|
|
89
|
+
# http://newrelic.com/docs/general/apdex
|
|
90
|
+
|
|
91
|
+
apdex_t: 0.5
|
|
92
|
+
|
|
93
|
+
#============================== Browser Monitoring ===============================
|
|
94
|
+
# New Relic Real User Monitoring gives you insight into the performance real users are
|
|
95
|
+
# experiencing with your website. This is accomplished by measuring the time it takes for
|
|
96
|
+
# your users' browsers to download and render your web pages by injecting a small amount
|
|
97
|
+
# of JavaScript code into the header and footer of each page.
|
|
98
|
+
browser_monitoring:
|
|
99
|
+
# By default the agent automatically injects the monitoring JavaScript
|
|
100
|
+
# into web pages. Set this attribute to false to turn off this behavior.
|
|
101
|
+
auto_instrument: true
|
|
102
|
+
|
|
103
|
+
# Proxy settings for connecting to the service.
|
|
104
|
+
#
|
|
105
|
+
# If a proxy is used, the host setting is required. Other settings
|
|
106
|
+
# are optional. Default port is 8080.
|
|
107
|
+
#
|
|
108
|
+
# proxy_host: hostname
|
|
109
|
+
# proxy_port: 8080
|
|
110
|
+
# proxy_user:
|
|
111
|
+
# proxy_pass:
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# Tells transaction tracer and error collector (when enabled)
|
|
115
|
+
# whether or not to capture HTTP params. When true, frameworks can
|
|
116
|
+
# exclude HTTP parameters from being captured.
|
|
117
|
+
# Rails: the RoR filter_parameter_logging excludes parameters
|
|
118
|
+
# Java: create a config setting called "ignored_params" and set it to
|
|
119
|
+
# a comma separated list of HTTP parameter names.
|
|
120
|
+
# ex: ignored_params: credit_card, ssn, password
|
|
121
|
+
capture_params: false
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# Transaction tracer captures deep information about slow
|
|
125
|
+
# transactions and sends this to the service once a
|
|
126
|
+
# minute. Included in the transaction is the exact call sequence of
|
|
127
|
+
# the transactions including any SQL statements issued.
|
|
128
|
+
transaction_tracer:
|
|
129
|
+
|
|
130
|
+
# Transaction tracer is enabled by default. Set this to false to
|
|
131
|
+
# turn it off. This feature is only available at the Professional
|
|
132
|
+
# and above product levels.
|
|
133
|
+
enabled: true
|
|
134
|
+
|
|
135
|
+
# Threshold in seconds for when to collect a transaction
|
|
136
|
+
# trace. When the response time of a controller action exceeds
|
|
137
|
+
# this threshold, a transaction trace will be recorded and sent to
|
|
138
|
+
# the service. Valid values are any float value, or (default)
|
|
139
|
+
# "apdex_f", which will use the threshold for an dissatisfying
|
|
140
|
+
# Apdex controller action - four times the Apdex T value.
|
|
141
|
+
transaction_threshold: apdex_f
|
|
142
|
+
|
|
143
|
+
# When transaction tracer is on, SQL statements can optionally be
|
|
144
|
+
# recorded. The recorder has three modes, "off" which sends no
|
|
145
|
+
# SQL, "raw" which sends the SQL statement in its original form,
|
|
146
|
+
# and "obfuscated", which strips out numeric and string literals
|
|
147
|
+
record_sql: obfuscated
|
|
148
|
+
|
|
149
|
+
# Threshold in seconds for when to collect stack trace for a SQL
|
|
150
|
+
# call. In other words, when SQL statements exceed this threshold,
|
|
151
|
+
# then capture and send the current stack trace. This is
|
|
152
|
+
# helpful for pinpointing where long SQL calls originate from
|
|
153
|
+
stack_trace_threshold: 0.500
|
|
154
|
+
|
|
155
|
+
# Determines whether the agent will capture query plans for slow
|
|
156
|
+
# SQL queries. Only supported in mysql and postgres. Should be
|
|
157
|
+
# set to false when using other adapters.
|
|
158
|
+
# explain_enabled: true
|
|
159
|
+
|
|
160
|
+
# Threshold for query execution time below which query plans will not
|
|
161
|
+
# not be captured. Relevant only when `explain_enabled` is true.
|
|
162
|
+
# explain_threshold: 0.5
|
|
163
|
+
|
|
164
|
+
# Error collector captures information about uncaught exceptions and
|
|
165
|
+
# sends them to the service for viewing
|
|
166
|
+
error_collector:
|
|
167
|
+
|
|
168
|
+
# Error collector is enabled by default. Set this to false to turn
|
|
169
|
+
# it off. This feature is only available at the Professional and above
|
|
170
|
+
# product levels
|
|
171
|
+
enabled: true
|
|
172
|
+
|
|
173
|
+
# Rails Only - tells error collector whether or not to capture a
|
|
174
|
+
# source snippet around the place of the error when errors are View
|
|
175
|
+
# related.
|
|
176
|
+
capture_source: true
|
|
177
|
+
|
|
178
|
+
# To stop specific errors from reporting to New Relic, set this property
|
|
179
|
+
# to comma separated values. Default is to ignore routing errors
|
|
180
|
+
# which are how 404's get triggered.
|
|
181
|
+
#
|
|
182
|
+
ignore_errors: ActionController::RoutingError
|
|
183
|
+
|
|
184
|
+
# (Advanced) Uncomment this to ensure the cpu and memory samplers
|
|
185
|
+
# won't run. Useful when you are using the agent to monitor an
|
|
186
|
+
# external resource
|
|
187
|
+
# disable_samplers: true
|
|
188
|
+
|
|
189
|
+
# If you aren't interested in visibility in these areas, you can
|
|
190
|
+
# disable the instrumentation to reduce overhead.
|
|
191
|
+
#
|
|
192
|
+
# disable_view_instrumentation: true
|
|
193
|
+
# disable_activerecord_instrumentation: true
|
|
194
|
+
# disable_memcache_instrumentation: true
|
|
195
|
+
# disable_dj: true
|
|
196
|
+
|
|
197
|
+
# If you're interested in capturing memcache keys as though they
|
|
198
|
+
# were SQL uncomment this flag. Note that this does increase
|
|
199
|
+
# overhead slightly on every memcached call, and can have security
|
|
200
|
+
# implications if your memcached keys are sensitive
|
|
201
|
+
# capture_memcache_keys: true
|
|
202
|
+
|
|
203
|
+
# Certain types of instrumentation such as GC stats will not work if
|
|
204
|
+
# you are running multi-threaded. Please let us know.
|
|
205
|
+
# multi_threaded = false
|
|
206
|
+
|
|
207
|
+
# Application Environments
|
|
208
|
+
# ------------------------------------------
|
|
209
|
+
# Environment specific settings are in this section.
|
|
210
|
+
# For Rails applications, RAILS_ENV is used to determine the environment
|
|
211
|
+
# For Java applications, pass -Dnewrelic.environment <environment> to set
|
|
212
|
+
# the environment
|
|
213
|
+
|
|
214
|
+
# NOTE if your application has other named environments, you should
|
|
215
|
+
# provide newrelic configuration settings for these environments here.
|
|
216
|
+
|
|
217
|
+
development:
|
|
218
|
+
<<: *default_settings
|
|
219
|
+
# Turn off communication to New Relic service in development mode (also
|
|
220
|
+
# 'enabled').
|
|
221
|
+
# NOTE: for initial evaluation purposes, you may want to temporarily
|
|
222
|
+
# turn the agent on in development mode.
|
|
223
|
+
monitor_mode: false
|
|
224
|
+
|
|
225
|
+
# Rails Only - when running in Developer Mode, the New Relic Agent will
|
|
226
|
+
# present performance information on the last 100 transactions you have
|
|
227
|
+
# executed since starting the mongrel.
|
|
228
|
+
# NOTE: There is substantial overhead when running in developer mode.
|
|
229
|
+
# Do not use for production or load testing.
|
|
230
|
+
developer_mode: true
|
|
231
|
+
|
|
232
|
+
# Enable textmate links
|
|
233
|
+
# textmate: true
|
|
234
|
+
|
|
235
|
+
test:
|
|
236
|
+
<<: *default_settings
|
|
237
|
+
# It almost never makes sense to turn on the agent when running
|
|
238
|
+
# unit, functional or integration tests or the like.
|
|
239
|
+
monitor_mode: false
|
|
240
|
+
|
|
241
|
+
# Turn on the agent in production for 24x7 monitoring. NewRelic
|
|
242
|
+
# testing shows an average performance impact of < 5 ms per
|
|
243
|
+
# transaction, you you can leave this on all the time without
|
|
244
|
+
# incurring any user-visible performance degradation.
|
|
245
|
+
production:
|
|
246
|
+
<<: *default_settings
|
|
247
|
+
monitor_mode: true
|
|
248
|
+
|
|
249
|
+
# Many applications have a staging environment which behaves
|
|
250
|
+
# identically to production. Support for that environment is provided
|
|
251
|
+
# here. By default, the staging environment has the agent turned on.
|
|
252
|
+
staging:
|
|
253
|
+
<<: *default_settings
|
|
254
|
+
monitor_mode: true
|
|
255
|
+
app_name: <%= ENV["NEW_RELIC_APP_NAME"] %> (Staging)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
def template(from, to)
|
|
2
|
+
erb = File.read(File.expand_path("../templates/#{from}", __FILE__))
|
|
3
|
+
put ERB.new(erb).result(binding), to
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def set_default(name, *args, &block)
|
|
7
|
+
set(name, *args, &block) unless exists?(name)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
namespace :deploy do
|
|
11
|
+
|
|
12
|
+
desc "Install everything onto the server"
|
|
13
|
+
task :install do
|
|
14
|
+
run "#{sudo} apt-get -y update"
|
|
15
|
+
run "#{sudo} apt-get -y install python-software-properties"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
namespace :assets do
|
|
20
|
+
task :precompile, :roles => :web, :except => { :no_release => true } do
|
|
21
|
+
from = source.next_revision(current_revision)
|
|
22
|
+
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
|
|
23
|
+
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
|
|
24
|
+
else
|
|
25
|
+
logger.info "Skipping asset pre-compilation because there were no asset changes"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Use Foreman instead
|
|
32
|
+
# ==========
|
|
33
|
+
# %w[start stop restart].each do |command|
|
|
34
|
+
# desc "#{command} unicorn server"
|
|
35
|
+
# task command, roles: :app, except: {no_release: true} do
|
|
36
|
+
# run "/etc/init.d/unicorn_#{application} #{command}"
|
|
37
|
+
# end
|
|
38
|
+
# end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Foreman
|
|
46
|
+
# =======
|
|
47
|
+
after 'deploy:start', 'foreman:export'
|
|
48
|
+
after 'deploy:start', 'foreman:start'
|
|
49
|
+
after 'deploy:restart', 'foreman:export'
|
|
50
|
+
after 'deploy:restart', 'foreman:restart'
|
|
51
|
+
|
|
52
|
+
namespace :foreman do
|
|
53
|
+
|
|
54
|
+
desc "Skip password for sudo foreman tasks"
|
|
55
|
+
task :foreman_sudoers do
|
|
56
|
+
template "foreman.erb", "/home/#{user}/foreman_sudoers"
|
|
57
|
+
run "#{sudo} chgrp admin /etc/init/"
|
|
58
|
+
run "#{sudo} chmod 775 /etc/init/"
|
|
59
|
+
end
|
|
60
|
+
after "deploy:setup", "foreman:foreman_sudoers"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
desc "Export the Procfile to Ubuntu's upstart scripts"
|
|
64
|
+
task :export, :roles => :app do
|
|
65
|
+
run "cd #{release_path} && bundle exec foreman export upstart /etc/init -a #{application} -u #{user} -l #{shared_path}/log"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
desc "Start the application services"
|
|
70
|
+
task :start, :roles => :app do
|
|
71
|
+
run "sudo start #{application}"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
desc "Stop the application services"
|
|
76
|
+
task :stop, :roles => :app do
|
|
77
|
+
run "sudo stop #{application}"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
desc "Restart the application services"
|
|
82
|
+
task :restart, :roles => :app do
|
|
83
|
+
run "sudo restart #{application}"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
namespace :check do
|
|
2
|
+
desc "Make sure local git is in sync with remote."
|
|
3
|
+
task :revision, roles: :web do
|
|
4
|
+
unless `git rev-parse HEAD` == `git rev-parse #{remote_repository}/#{branch}`
|
|
5
|
+
puts "WARNING: HEAD is not the same as #{remote_repository}/#{branch}"
|
|
6
|
+
puts "Run `git push` to sync changes."
|
|
7
|
+
exit
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
before "deploy", "check:revision"
|
|
11
|
+
before "deploy:migrations", "check:revision"
|
|
12
|
+
before "deploy:cold", "check:revision"
|
|
13
|
+
end
|