venus 0.7.11 → 0.8.6

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.
Files changed (38) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +28 -0
  3. data/README.md +43 -2
  4. data/lib/generators/venus/asset_sync/asset_sync_generator.rb +5 -2
  5. data/lib/generators/venus/asset_sync/templates/asset_sync.rb.erb +8 -1
  6. data/lib/generators/venus/better_errors/better_errors_generator.rb +27 -0
  7. data/lib/generators/venus/better_errors/templates/better_errors.erb +1 -0
  8. data/lib/generators/venus/bootstrap/templates/simple_form_config.erb +3 -2
  9. data/lib/generators/venus/carrierwave/carrierwave_generator.rb +1 -1
  10. data/lib/generators/venus/carrierwave/templates/uploader.erb +1 -1
  11. data/lib/generators/venus/chosen/chosen_generator.rb +1 -1
  12. data/lib/generators/venus/deploy/deploy_generator.rb +7 -0
  13. data/lib/generators/venus/helpers.rb +1 -1
  14. data/lib/generators/venus/hipchat/hipchat_generator.rb +35 -0
  15. data/lib/generators/venus/hipchat/templates/deploy.rb.erb +23 -0
  16. data/lib/generators/venus/init/init_generator.rb +10 -25
  17. data/lib/generators/venus/jqueryui/jqueryui_generator.rb +2 -2
  18. data/lib/generators/venus/jqueryui/templates/jquery.timepicker.css +5 -1
  19. data/lib/generators/venus/jqueryui/templates/jquery.timepicker.js +1967 -1190
  20. data/lib/generators/venus/newrelic/newrelic_generator.rb +32 -0
  21. data/lib/generators/venus/newrelic/templates/newrelic.yml.erb +226 -0
  22. data/lib/generators/venus/puma/puma_generator.rb +30 -0
  23. data/lib/generators/venus/puma/templates/config.erb +129 -0
  24. data/lib/generators/venus/puma/templates/deploy.rb.erb +2 -0
  25. data/lib/generators/venus/puma/templates/nginx.conf.erb +25 -0
  26. data/lib/generators/venus/rails_panel/rails_panel_generator.rb +18 -0
  27. data/lib/generators/venus/rails_panel/templates/better_errors.erb +1 -0
  28. data/lib/generators/venus/sentry/sentry_generator.rb +35 -0
  29. data/lib/generators/venus/sentry/templates/js.erb +4 -0
  30. data/lib/generators/venus/sentry/templates/raven.erb +7 -0
  31. data/lib/generators/venus/sidekiq/sidekiq_generator.rb +1 -1
  32. data/lib/generators/venus/unicorn/templates/deploy.rb.erb +3 -0
  33. data/lib/generators/venus/unicorn/templates/nginx.conf.erb +25 -0
  34. data/lib/generators/venus/unicorn/templates/unicorn.rb.erb +18 -0
  35. data/lib/generators/venus/unicorn/unicorn_generator.rb +37 -0
  36. data/lib/venus/version.rb +1 -1
  37. metadata +34 -24
  38. data/lib/generators/venus/init/templates/gem_developments.erb +0 -5
@@ -0,0 +1,32 @@
1
+ module Venus
2
+ module Generators
3
+ class NewrelicGenerator < Base
4
+ desc "Setup gem for 'newrelic'"
5
+
6
+ def name
7
+ "newrelic"
8
+ end
9
+
10
+ def asks
11
+ @is_repository_private = ask?("Is project private", false)
12
+ @license_key = ask?("Newrelic license key", "")
13
+ @app_name = app_name
14
+ end
15
+
16
+ def gemfile
17
+ add_gem("newrelic_rpm", "~> 3.6.5.130")
18
+ bundle_install
19
+ end
20
+
21
+ def configs
22
+ template("newrelic.yml.erb", "config/newrelic.yml")
23
+ unless @is_repository_private
24
+ @license_key = ""
25
+ template("newrelic.yml.erb", "config/newrelic.yml.example")
26
+ append_file(".gitignore", "\nconfig/newrelic.yml") unless file_has_content?(".gitignore", "config/newrelic.yml")
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,226 @@
1
+ #
2
+ # This file configures the New Relic Agent. New Relic monitors
3
+ # Ruby, Java, .NET, PHP, and Python applications with deep visibility and low overhead.
4
+ # For more information, visit www.newrelic.com.
5
+ #
6
+ # Generated June 28, 2013
7
+ #
8
+
9
+
10
+ # Here are the settings that are common to all environments
11
+ common: &default_settings
12
+ # ============================== LICENSE KEY ===============================
13
+
14
+ # You must specify the license key associated with your New Relic
15
+ # account. This key binds your Agent's data to your account in the
16
+ # New Relic service.
17
+ license_key: '<%= @license_key %>'
18
+
19
+ # Agent Enabled (Ruby/Rails Only)
20
+ # Use this setting to force the agent to run or not run.
21
+ # Default is 'auto' which means the agent will install and run only
22
+ # if a valid dispatcher such as Mongrel is running. This prevents
23
+ # it from running with Rake or the console. Set to false to
24
+ # completely turn the agent off regardless of the other settings.
25
+ # Valid values are true, false and auto.
26
+ #
27
+ # agent_enabled: auto
28
+
29
+ # Application Name Set this to be the name of your application as
30
+ # you'd like it show up in New Relic. The service will then auto-map
31
+ # instances of your application into an "application" on your
32
+ # dashboard page. If you want to map this instance into multiple
33
+ # apps, like "AJAX Requests" and "All UI" then specify a semicolon
34
+ # separated list of up to three distinct names, or a yaml list.
35
+ # Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
36
+ # Production, Staging, etc)
37
+ #
38
+ # Example:
39
+ #
40
+ # app_name:
41
+ # - Ajax Service
42
+ # - All Services
43
+ #
44
+ app_name: "<%= @app_name %>"
45
+
46
+ # When "true", the agent collects performance data about your
47
+ # application and reports this data to the New Relic service at
48
+ # newrelic.com. This global switch is normally overridden for each
49
+ # environment below. (formerly called 'enabled')
50
+ monitor_mode: true
51
+
52
+ # Developer mode should be off in every environment but
53
+ # development as it has very high overhead in memory.
54
+ developer_mode: false
55
+
56
+ # The newrelic agent generates its own log file to keep its logging
57
+ # information separate from that of your application. Specify its
58
+ # log level here.
59
+ log_level: info
60
+
61
+ # Optionally set the path to the log file This is expanded from the
62
+ # root directory (may be relative or absolute, e.g. 'log/' or
63
+ # '/var/log/') The agent will attempt to create this directory if it
64
+ # does not exist.
65
+ # log_file_path: 'log'
66
+
67
+ # Optionally set the name of the log file, defaults to 'newrelic_agent.log'
68
+ # log_file_name: 'newrelic_agent.log'
69
+
70
+ # The newrelic agent communicates with the service via https by default. This
71
+ # prevents eavesdropping on the performance metrics transmitted by the agent.
72
+ # The encryption required by SSL introduces a nominal amount of CPU overhead,
73
+ # which is performed asynchronously in a background thread. If you'd prefer
74
+ # to send your metrics over http uncomment the following line.
75
+ # ssl: false
76
+
77
+ #============================== Browser Monitoring ===============================
78
+ # New Relic Real User Monitoring gives you insight into the performance real users are
79
+ # experiencing with your website. This is accomplished by measuring the time it takes for
80
+ # your users' browsers to download and render your web pages by injecting a small amount
81
+ # of JavaScript code into the header and footer of each page.
82
+ browser_monitoring:
83
+ # By default the agent automatically injects the monitoring JavaScript
84
+ # into web pages. Set this attribute to false to turn off this behavior.
85
+ auto_instrument: true
86
+
87
+ # Proxy settings for connecting to the New Relic server.
88
+ #
89
+ # If a proxy is used, the host setting is required. Other settings
90
+ # are optional. Default port is 8080.
91
+ #
92
+ # proxy_host: hostname
93
+ # proxy_port: 8080
94
+ # proxy_user:
95
+ # proxy_pass:
96
+
97
+ # The agent can optionally log all data it sends to New Relic servers to a
98
+ # separate log file for human inspection and auditing purposes. To enable this
99
+ # feature, change 'enabled' below to true.
100
+ # See: https://newrelic.com/docs/ruby/audit-log
101
+ audit_log:
102
+ enabled: false
103
+
104
+ # Tells transaction tracer and error collector (when enabled)
105
+ # whether or not to capture HTTP params. When true, frameworks can
106
+ # exclude HTTP parameters from being captured.
107
+ # Rails: the RoR filter_parameter_logging excludes parameters
108
+ # Java: create a config setting called "ignored_params" and set it to
109
+ # a comma separated list of HTTP parameter names.
110
+ # ex: ignored_params: credit_card, ssn, password
111
+ capture_params: false
112
+
113
+ # Transaction tracer captures deep information about slow
114
+ # transactions and sends this to the New Relic service once a
115
+ # minute. Included in the transaction is the exact call sequence of
116
+ # the transactions including any SQL statements issued.
117
+ transaction_tracer:
118
+
119
+ # Transaction tracer is enabled by default. Set this to false to
120
+ # turn it off. This feature is only available at the Professional
121
+ # and above product levels.
122
+ enabled: true
123
+
124
+ # Threshold in seconds for when to collect a transaction
125
+ # trace. When the response time of a controller action exceeds
126
+ # this threshold, a transaction trace will be recorded and sent to
127
+ # New Relic. Valid values are any float value, or (default) "apdex_f",
128
+ # which will use the threshold for an dissatisfying Apdex
129
+ # controller action - four times the Apdex T value.
130
+ transaction_threshold: apdex_f
131
+
132
+ # When transaction tracer is on, SQL statements can optionally be
133
+ # recorded. The recorder has three modes, "off" which sends no
134
+ # SQL, "raw" which sends the SQL statement in its original form,
135
+ # and "obfuscated", which strips out numeric and string literals.
136
+ record_sql: obfuscated
137
+
138
+ # Threshold in seconds for when to collect stack trace for a SQL
139
+ # call. In other words, when SQL statements exceed this threshold,
140
+ # then capture and send to New Relic the current stack trace. This is
141
+ # helpful for pinpointing where long SQL calls originate from.
142
+ stack_trace_threshold: 0.500
143
+
144
+ # Determines whether the agent will capture query plans for slow
145
+ # SQL queries. Only supported in mysql and postgres. Should be
146
+ # set to false when using other adapters.
147
+ # explain_enabled: true
148
+
149
+ # Threshold for query execution time below which query plans will
150
+ # not be captured. Relevant only when `explain_enabled` is true.
151
+ # explain_threshold: 0.5
152
+
153
+ # Error collector captures information about uncaught exceptions and
154
+ # sends them to New Relic for viewing
155
+ error_collector:
156
+
157
+ # Error collector is enabled by default. Set this to false to turn
158
+ # it off. This feature is only available at the Professional and above
159
+ # product levels.
160
+ enabled: true
161
+
162
+ # Rails Only - tells error collector whether or not to capture a
163
+ # source snippet around the place of the error when errors are View
164
+ # related.
165
+ capture_source: true
166
+
167
+ # To stop specific errors from reporting to New Relic, set this property
168
+ # to comma-separated values. Default is to ignore routing errors,
169
+ # which are how 404's get triggered.
170
+ ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
171
+
172
+ # If you're interested in capturing memcache keys as though they
173
+ # were SQL uncomment this flag. Note that this does increase
174
+ # overhead slightly on every memcached call, and can have security
175
+ # implications if your memcached keys are sensitive
176
+ # capture_memcache_keys: true
177
+
178
+ # Application Environments
179
+ # ------------------------------------------
180
+ # Environment-specific settings are in this section.
181
+ # For Rails applications, RAILS_ENV is used to determine the environment.
182
+ # For Java applications, pass -Dnewrelic.environment <environment> to set
183
+ # the environment.
184
+
185
+ # NOTE if your application has other named environments, you should
186
+ # provide newrelic configuration settings for these environments here.
187
+
188
+ development:
189
+ <<: *default_settings
190
+ # Turn off communication to New Relic service in development mode (also
191
+ # 'enabled').
192
+ # NOTE: for initial evaluation purposes, you may want to temporarily
193
+ # turn the agent on in development mode.
194
+ monitor_mode: false
195
+
196
+ # Rails Only - when running in Developer Mode, the New Relic Agent will
197
+ # present performance information on the last 100 transactions you have
198
+ # executed since starting the mongrel.
199
+ # NOTE: There is substantial overhead when running in developer mode.
200
+ # Do not use for production or load testing.
201
+ developer_mode: true
202
+
203
+ # Enable textmate links
204
+ # textmate: true
205
+
206
+ test:
207
+ <<: *default_settings
208
+ # It almost never makes sense to turn on the agent when running
209
+ # unit, functional or integration tests or the like.
210
+ monitor_mode: false
211
+
212
+ # Turn on the agent in production for 24x7 monitoring. NewRelic
213
+ # testing shows an average performance impact of < 5 ms per
214
+ # transaction, you can leave this on all the time without
215
+ # incurring any user-visible performance degradation.
216
+ production:
217
+ <<: *default_settings
218
+ monitor_mode: true
219
+
220
+ # Many applications have a staging environment which behaves
221
+ # identically to production. Support for that environment is provided
222
+ # here. By default, the staging environment has the agent turned on.
223
+ staging:
224
+ <<: *default_settings
225
+ monitor_mode: true
226
+ app_name: "<%= @app_name %> (Staging)"
@@ -0,0 +1,30 @@
1
+ module Venus
2
+ module Generators
3
+ class PumaGenerator < Base
4
+ desc "Setup gem for 'puma'"
5
+
6
+ def name
7
+ "puma"
8
+ end
9
+
10
+ def asks
11
+ say 'checking dependent gems "capistrnano"...'
12
+ generate 'venus:deploy' unless has_gem?('capistrano')
13
+ @app_name = app_name
14
+ @rails_env = "production"
15
+ end
16
+
17
+ def gemfile
18
+ add_gem("puma", "~> 2.1.1")
19
+ bundle_install
20
+ end
21
+
22
+ def configs
23
+ template("nginx.conf.erb", "config/puma/nginx.conf.example")
24
+ template("config.erb", "config/puma.rb")
25
+ concat_template("config/deploy.rb", "deploy.rb.erb") unless file_has_content?("config/deploy.rb", load_template("deploy.rb.erb"))
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env puma
2
+
3
+ # The directory to operate out of.
4
+ #
5
+ # The default is the current directory.
6
+ #
7
+ # directory '/u/apps/lolcat'
8
+
9
+ # Use a object or block as the rack application. This allows the
10
+ # config file to be the application itself.
11
+ #
12
+ # app do |env|
13
+ # puts env
14
+ #
15
+ # body = 'Hello, World!'
16
+ #
17
+ # [200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
18
+ # end
19
+
20
+ # Load “path” as a rackup file.
21
+ #
22
+ # The default is “config.ru”.
23
+ #
24
+ # rackup '/u/apps/lolcat/config.ru'
25
+
26
+ # Set the environment in which the rack's app will run. The value must be a string.
27
+ #
28
+ # The default is “development”.
29
+ #
30
+ # environment 'production'
31
+
32
+ # Daemonize the server into the background. Highly suggest that
33
+ # this be combined with “pidfile” and “stdout_redirect”.
34
+ #
35
+ # The default is “false”.
36
+ #
37
+ # daemonize
38
+ # daemonize false
39
+
40
+ # Store the pid of the server in the file at “path”.
41
+ #
42
+ pidfile 'tmp/pids/puma.pid'
43
+
44
+ # Use “path” as the file to store the server info state. This is
45
+ # used by “pumactl” to query and control the server.
46
+ #
47
+ state_path 'tmp/sockets/puma.state'
48
+
49
+ # Redirect STDOUT and STDERR to files specified. The 3rd parameter
50
+ # (“append”) specifies whether the output is appended, the default is
51
+ # “false”.
52
+ #
53
+ # stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr'
54
+ # stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true
55
+
56
+ # Disable request logging.
57
+ #
58
+ # The default is “false”.
59
+ #
60
+ # quiet
61
+
62
+ # Configure “min” to be the minimum number of threads to use to answer
63
+ # requests and “max” the maximum.
64
+ #
65
+ # The default is “0, 16”.
66
+ #
67
+ # threads 0, 16
68
+
69
+ # Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only
70
+ # accepted protocols.
71
+ #
72
+ # The default is “tcp://0.0.0.0:9292”.
73
+ #
74
+ # bind 'tcp://0.0.0.0:9292'
75
+ # bind 'unix:///var/run/puma.sock'
76
+ # bind 'unix:///var/run/puma.sock?umask=0777'
77
+ # bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
78
+
79
+ # Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
80
+ # can also use the “ssl_bind” option.
81
+ #
82
+ # ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
83
+
84
+ # Code to run before doing a restart. This code should
85
+ # close log files, database connections, etc.
86
+ #
87
+ # This can be called multiple times to add code each time.
88
+ #
89
+ # on_restart do
90
+ # puts 'On restart...'
91
+ # end
92
+
93
+ # Command to use to restart puma. This should be just how to
94
+ # load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
95
+ # to puma, as those are the same as the original process.
96
+ #
97
+ # restart_command '/u/app/lolcat/bin/restart_puma'
98
+
99
+ # === Cluster mode ===
100
+
101
+ # How many worker processes to run.
102
+ #
103
+ # The default is “0”.
104
+ #
105
+ # workers 2
106
+
107
+ # Code to run when a worker boots to setup the process before booting
108
+ # the app.
109
+ #
110
+ # This can be called multiple times to add hooks.
111
+ #
112
+ # on_worker_boot do
113
+ # puts 'On worker boot...'
114
+ # end
115
+
116
+ # === Puma control rack application ===
117
+
118
+ # Start the puma control rack application on “url”. This application can
119
+ # be communicated with to control the main server. Additionally, you can
120
+ # provide an authentication token, so all requests to the control server
121
+ # will need to include that token as a query parameter. This allows for
122
+ # simple authentication.
123
+ #
124
+ # Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
125
+ # to see what the app has available.
126
+ #
127
+ # activate_control_app 'unix:///var/run/pumactl.sock'
128
+ # activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' }
129
+ # activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true }
@@ -0,0 +1,2 @@
1
+
2
+ require 'puma/capistrano'
@@ -0,0 +1,25 @@
1
+ upstream <%= @app_name %> {
2
+ server unix:/shared_path/sockets/puma.sock;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ server_name example.com;
8
+
9
+ # inserted block ----- start
10
+
11
+ location / {
12
+ proxy_set_header X-Real-IP $remote_addr;
13
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14
+ proxy_set_header Host $http_host;
15
+ proxy_pass http://<%= @app_name %>;
16
+ }
17
+
18
+ location ~ ^/(assets)/ {
19
+ gzip_static on; # to serve pre-gzipped version
20
+ expires max;
21
+ add_header Cache-Control public;
22
+ }
23
+
24
+ # inserted block ----- end
25
+ }