trogdir_api 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/blazing.rb +7 -0
- data/config/blazing.rb.example +7 -0
- data/config/environment.rb +2 -2
- data/config/newrelic.yml +227 -0
- data/config/newrelic.yml.example +227 -0
- data/config.ru +6 -0
- data/lib/trogdir/api.rb +15 -1
- data/lib/trogdir/versions/v1/api.rb +5 -4
- data/lib/trogdir/versions/v1/change_syncs_api.rb +4 -1
- data/lib/trogdir/versions/v1/entities/person.rb +102 -46
- data/lib/trogdir/versions/v1/entities/sync_log_with_changeset.rb +1 -0
- data/lib/trogdir/versions/v1/groups_api.rb +51 -0
- data/lib/trogdir/versions/v1/people_api.rb +4 -2
- data/lib/trogdir/versions/v1.rb +2 -1
- data/lib/trogdir_api/newrelic.rb +44 -0
- data/lib/trogdir_api/pinglish.rb +11 -0
- data/lib/trogdir_api/version.rb +1 -1
- data/lib/trogdir_api.rb +13 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f1efaf73b978fcaa10879ec8bf5819bbd7fdc5d
|
4
|
+
data.tar.gz: 15040349ac03960710fc11bca26f4477adb8865a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3033a7cc53172214060b2da6b5a6d89beb72934775eac9cf42ce8080d077ae20ae9bd11fbdd4012c0f9f061e5864dc4c5c3bac46d4ae26f8ae2c200cba76f6f2
|
7
|
+
data.tar.gz: 08ce75be68dac0fd356f888d1596fbbef3e4caf1523b06cb581a4cee5168857a85bf27a17ee7db64a9ef32a0dcd6801c7c2be2dd532d7adcdf33224f162a84ed
|
data/config/blazing.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
target :'ruby2.staging', 'adamc7@ruby2.staging.biola.edu:/srv/rack/trogdir-api', rails_env: 'staging'
|
2
|
+
target :'ruby5a.prod', 'adamc7@ruby5a.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
|
3
|
+
target :'ruby5b.prod', 'adamc7@ruby5b.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
|
4
|
+
|
5
|
+
env_scripts '/etc/profile'
|
6
|
+
|
7
|
+
rake :post_deploy
|
@@ -0,0 +1,7 @@
|
|
1
|
+
target :'ruby2.staging', 'johnd0@ruby1.staging.biola.edu:/srv/rack/trogdir-api', rails_env: 'staging'
|
2
|
+
target :'ruby3a.prod', 'johnd0@ruby3a.prod.biola.edu:/srv/rack/trodgir-api', rails_env: 'production'
|
3
|
+
target :'ruby3b.prod', 'johnd0@ruby3b.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
|
4
|
+
|
5
|
+
env_scripts '/etc/profile'
|
6
|
+
|
7
|
+
rake :post_deploy
|
data/config/environment.rb
CHANGED
data/config/newrelic.yml
ADDED
@@ -0,0 +1,227 @@
|
|
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 May 01, 2014
|
7
|
+
#
|
8
|
+
# This configuration file is custom generated for Biola University
|
9
|
+
|
10
|
+
|
11
|
+
# Here are the settings that are common to all environments
|
12
|
+
common: &default_settings
|
13
|
+
# ============================== LICENSE KEY ===============================
|
14
|
+
|
15
|
+
# You must specify the license key associated with your New Relic
|
16
|
+
# account. This key binds your Agent's data to your account in the
|
17
|
+
# New Relic service.
|
18
|
+
license_key: # set in newrelic.yml
|
19
|
+
|
20
|
+
# Agent Enabled (Ruby/Rails Only)
|
21
|
+
# Use this setting to force the agent to run or not run.
|
22
|
+
# Default is 'auto' which means the agent will install and run only
|
23
|
+
# if a valid dispatcher such as Mongrel is running. This prevents
|
24
|
+
# it from running with Rake or the console. Set to false to
|
25
|
+
# completely turn the agent off regardless of the other settings.
|
26
|
+
# Valid values are true, false and auto.
|
27
|
+
#
|
28
|
+
# agent_enabled: auto
|
29
|
+
|
30
|
+
# Application Name Set this to be the name of your application as
|
31
|
+
# you'd like it show up in New Relic. The service will then auto-map
|
32
|
+
# instances of your application into an "application" on your
|
33
|
+
# dashboard page. If you want to map this instance into multiple
|
34
|
+
# apps, like "AJAX Requests" and "All UI" then specify a semicolon
|
35
|
+
# separated list of up to three distinct names, or a yaml list.
|
36
|
+
# Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
|
37
|
+
# Production, Staging, etc)
|
38
|
+
#
|
39
|
+
# Example:
|
40
|
+
#
|
41
|
+
# app_name:
|
42
|
+
# - Ajax Service
|
43
|
+
# - All Services
|
44
|
+
#
|
45
|
+
app_name: trogdir-api
|
46
|
+
|
47
|
+
# When "true", the agent collects performance data about your
|
48
|
+
# application and reports this data to the New Relic service at
|
49
|
+
# newrelic.com. This global switch is normally overridden for each
|
50
|
+
# environment below. (formerly called 'enabled')
|
51
|
+
monitor_mode: true
|
52
|
+
|
53
|
+
# Developer mode should be off in every environment but
|
54
|
+
# development as it has very high overhead in memory.
|
55
|
+
developer_mode: false
|
56
|
+
|
57
|
+
# The newrelic agent generates its own log file to keep its logging
|
58
|
+
# information separate from that of your application. Specify its
|
59
|
+
# log level here.
|
60
|
+
log_level: info
|
61
|
+
|
62
|
+
# Optionally set the path to the log file This is expanded from the
|
63
|
+
# root directory (may be relative or absolute, e.g. 'log/' or
|
64
|
+
# '/var/log/') The agent will attempt to create this directory if it
|
65
|
+
# does not exist.
|
66
|
+
# log_file_path: 'log'
|
67
|
+
|
68
|
+
# Optionally set the name of the log file, defaults to 'newrelic_agent.log'
|
69
|
+
# log_file_name: 'newrelic_agent.log'
|
70
|
+
|
71
|
+
# The newrelic agent communicates with the service via https by default. This
|
72
|
+
# prevents eavesdropping on the performance metrics transmitted by the agent.
|
73
|
+
# The encryption required by SSL introduces a nominal amount of CPU overhead,
|
74
|
+
# which is performed asynchronously in a background thread. If you'd prefer
|
75
|
+
# to send your metrics over http uncomment the following line.
|
76
|
+
# ssl: false
|
77
|
+
|
78
|
+
#============================== Browser Monitoring ===============================
|
79
|
+
# New Relic Real User Monitoring gives you insight into the performance real users are
|
80
|
+
# experiencing with your website. This is accomplished by measuring the time it takes for
|
81
|
+
# your users' browsers to download and render your web pages by injecting a small amount
|
82
|
+
# of JavaScript code into the header and footer of each page.
|
83
|
+
browser_monitoring:
|
84
|
+
# By default the agent automatically injects the monitoring JavaScript
|
85
|
+
# into web pages. Set this attribute to false to turn off this behavior.
|
86
|
+
auto_instrument: true
|
87
|
+
|
88
|
+
# Proxy settings for connecting to the New Relic server.
|
89
|
+
#
|
90
|
+
# If a proxy is used, the host setting is required. Other settings
|
91
|
+
# are optional. Default port is 8080.
|
92
|
+
#
|
93
|
+
# proxy_host: hostname
|
94
|
+
# proxy_port: 8080
|
95
|
+
# proxy_user:
|
96
|
+
# proxy_pass:
|
97
|
+
|
98
|
+
# The agent can optionally log all data it sends to New Relic servers to a
|
99
|
+
# separate log file for human inspection and auditing purposes. To enable this
|
100
|
+
# feature, change 'enabled' below to true.
|
101
|
+
# See: https://newrelic.com/docs/ruby/audit-log
|
102
|
+
audit_log:
|
103
|
+
enabled: false
|
104
|
+
|
105
|
+
# Tells transaction tracer and error collector (when enabled)
|
106
|
+
# whether or not to capture HTTP params. When true, frameworks can
|
107
|
+
# exclude HTTP parameters from being captured.
|
108
|
+
# Rails: the RoR filter_parameter_logging excludes parameters
|
109
|
+
# Java: create a config setting called "ignored_params" and set it to
|
110
|
+
# a comma separated list of HTTP parameter names.
|
111
|
+
# ex: ignored_params: credit_card, ssn, password
|
112
|
+
capture_params: false
|
113
|
+
|
114
|
+
# Transaction tracer captures deep information about slow
|
115
|
+
# transactions and sends this to the New Relic service once a
|
116
|
+
# minute. Included in the transaction is the exact call sequence of
|
117
|
+
# the transactions including any SQL statements issued.
|
118
|
+
transaction_tracer:
|
119
|
+
|
120
|
+
# Transaction tracer is enabled by default. Set this to false to
|
121
|
+
# turn it off. This feature is only available at the Professional
|
122
|
+
# and above product levels.
|
123
|
+
enabled: true
|
124
|
+
|
125
|
+
# Threshold in seconds for when to collect a transaction
|
126
|
+
# trace. When the response time of a controller action exceeds
|
127
|
+
# this threshold, a transaction trace will be recorded and sent to
|
128
|
+
# New Relic. Valid values are any float value, or (default) "apdex_f",
|
129
|
+
# which will use the threshold for an dissatisfying Apdex
|
130
|
+
# controller action - four times the Apdex T value.
|
131
|
+
transaction_threshold: apdex_f
|
132
|
+
|
133
|
+
# When transaction tracer is on, SQL statements can optionally be
|
134
|
+
# recorded. The recorder has three modes, "off" which sends no
|
135
|
+
# SQL, "raw" which sends the SQL statement in its original form,
|
136
|
+
# and "obfuscated", which strips out numeric and string literals.
|
137
|
+
record_sql: obfuscated
|
138
|
+
|
139
|
+
# Threshold in seconds for when to collect stack trace for a SQL
|
140
|
+
# call. In other words, when SQL statements exceed this threshold,
|
141
|
+
# then capture and send to New Relic the current stack trace. This is
|
142
|
+
# helpful for pinpointing where long SQL calls originate from.
|
143
|
+
stack_trace_threshold: 0.500
|
144
|
+
|
145
|
+
# Determines whether the agent will capture query plans for slow
|
146
|
+
# SQL queries. Only supported in mysql and postgres. Should be
|
147
|
+
# set to false when using other adapters.
|
148
|
+
# explain_enabled: true
|
149
|
+
|
150
|
+
# Threshold for query execution time below which query plans will
|
151
|
+
# not be captured. Relevant only when `explain_enabled` is true.
|
152
|
+
# explain_threshold: 0.5
|
153
|
+
|
154
|
+
# Error collector captures information about uncaught exceptions and
|
155
|
+
# sends them to New Relic for viewing
|
156
|
+
error_collector:
|
157
|
+
|
158
|
+
# Error collector is enabled by default. Set this to false to turn
|
159
|
+
# it off. This feature is only available at the Professional and above
|
160
|
+
# product levels.
|
161
|
+
enabled: true
|
162
|
+
|
163
|
+
# Rails Only - tells error collector whether or not to capture a
|
164
|
+
# source snippet around the place of the error when errors are View
|
165
|
+
# related.
|
166
|
+
capture_source: true
|
167
|
+
|
168
|
+
# To stop specific errors from reporting to New Relic, set this property
|
169
|
+
# to comma-separated values. Default is to ignore routing errors,
|
170
|
+
# which are how 404's get triggered.
|
171
|
+
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
|
172
|
+
|
173
|
+
# If you're interested in capturing memcache keys as though they
|
174
|
+
# were SQL uncomment this flag. Note that this does increase
|
175
|
+
# overhead slightly on every memcached call, and can have security
|
176
|
+
# implications if your memcached keys are sensitive
|
177
|
+
# capture_memcache_keys: true
|
178
|
+
|
179
|
+
# Application Environments
|
180
|
+
# ------------------------------------------
|
181
|
+
# Environment-specific settings are in this section.
|
182
|
+
# For Rails applications, RAILS_ENV is used to determine the environment.
|
183
|
+
# For Java applications, pass -Dnewrelic.environment <environment> to set
|
184
|
+
# the environment.
|
185
|
+
|
186
|
+
# NOTE if your application has other named environments, you should
|
187
|
+
# provide newrelic configuration settings for these environments here.
|
188
|
+
|
189
|
+
development:
|
190
|
+
<<: *default_settings
|
191
|
+
# Turn off communication to New Relic service in development mode (also
|
192
|
+
# 'enabled').
|
193
|
+
# NOTE: for initial evaluation purposes, you may want to temporarily
|
194
|
+
# turn the agent on in development mode.
|
195
|
+
monitor_mode: false
|
196
|
+
|
197
|
+
# Rails Only - when running in Developer Mode, the New Relic Agent will
|
198
|
+
# present performance information on the last 100 transactions you have
|
199
|
+
# executed since starting the mongrel.
|
200
|
+
# NOTE: There is substantial overhead when running in developer mode.
|
201
|
+
# Do not use for production or load testing.
|
202
|
+
developer_mode: true
|
203
|
+
|
204
|
+
# Enable textmate links
|
205
|
+
# textmate: true
|
206
|
+
|
207
|
+
test:
|
208
|
+
<<: *default_settings
|
209
|
+
# It almost never makes sense to turn on the agent when running
|
210
|
+
# unit, functional or integration tests or the like.
|
211
|
+
monitor_mode: false
|
212
|
+
|
213
|
+
# Turn on the agent in production for 24x7 monitoring. NewRelic
|
214
|
+
# testing shows an average performance impact of < 5 ms per
|
215
|
+
# transaction, you can leave this on all the time without
|
216
|
+
# incurring any user-visible performance degradation.
|
217
|
+
production:
|
218
|
+
<<: *default_settings
|
219
|
+
monitor_mode: true
|
220
|
+
|
221
|
+
# Many applications have a staging environment which behaves
|
222
|
+
# identically to production. Support for that environment is provided
|
223
|
+
# here. By default, the staging environment has the agent turned on.
|
224
|
+
staging:
|
225
|
+
<<: *default_settings
|
226
|
+
monitor_mode: true
|
227
|
+
# app_name: My Application (Staging)
|
@@ -0,0 +1,227 @@
|
|
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 May 01, 2014
|
7
|
+
#
|
8
|
+
# This configuration file is custom generated for Biola University
|
9
|
+
|
10
|
+
|
11
|
+
# Here are the settings that are common to all environments
|
12
|
+
common: &default_settings
|
13
|
+
# ============================== LICENSE KEY ===============================
|
14
|
+
|
15
|
+
# You must specify the license key associated with your New Relic
|
16
|
+
# account. This key binds your Agent's data to your account in the
|
17
|
+
# New Relic service.
|
18
|
+
license_key: # set in newrelic.yml
|
19
|
+
|
20
|
+
# Agent Enabled (Ruby/Rails Only)
|
21
|
+
# Use this setting to force the agent to run or not run.
|
22
|
+
# Default is 'auto' which means the agent will install and run only
|
23
|
+
# if a valid dispatcher such as Mongrel is running. This prevents
|
24
|
+
# it from running with Rake or the console. Set to false to
|
25
|
+
# completely turn the agent off regardless of the other settings.
|
26
|
+
# Valid values are true, false and auto.
|
27
|
+
#
|
28
|
+
# agent_enabled: auto
|
29
|
+
|
30
|
+
# Application Name Set this to be the name of your application as
|
31
|
+
# you'd like it show up in New Relic. The service will then auto-map
|
32
|
+
# instances of your application into an "application" on your
|
33
|
+
# dashboard page. If you want to map this instance into multiple
|
34
|
+
# apps, like "AJAX Requests" and "All UI" then specify a semicolon
|
35
|
+
# separated list of up to three distinct names, or a yaml list.
|
36
|
+
# Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
|
37
|
+
# Production, Staging, etc)
|
38
|
+
#
|
39
|
+
# Example:
|
40
|
+
#
|
41
|
+
# app_name:
|
42
|
+
# - Ajax Service
|
43
|
+
# - All Services
|
44
|
+
#
|
45
|
+
app_name: trogdir-api
|
46
|
+
|
47
|
+
# When "true", the agent collects performance data about your
|
48
|
+
# application and reports this data to the New Relic service at
|
49
|
+
# newrelic.com. This global switch is normally overridden for each
|
50
|
+
# environment below. (formerly called 'enabled')
|
51
|
+
monitor_mode: true
|
52
|
+
|
53
|
+
# Developer mode should be off in every environment but
|
54
|
+
# development as it has very high overhead in memory.
|
55
|
+
developer_mode: false
|
56
|
+
|
57
|
+
# The newrelic agent generates its own log file to keep its logging
|
58
|
+
# information separate from that of your application. Specify its
|
59
|
+
# log level here.
|
60
|
+
log_level: info
|
61
|
+
|
62
|
+
# Optionally set the path to the log file This is expanded from the
|
63
|
+
# root directory (may be relative or absolute, e.g. 'log/' or
|
64
|
+
# '/var/log/') The agent will attempt to create this directory if it
|
65
|
+
# does not exist.
|
66
|
+
# log_file_path: 'log'
|
67
|
+
|
68
|
+
# Optionally set the name of the log file, defaults to 'newrelic_agent.log'
|
69
|
+
# log_file_name: 'newrelic_agent.log'
|
70
|
+
|
71
|
+
# The newrelic agent communicates with the service via https by default. This
|
72
|
+
# prevents eavesdropping on the performance metrics transmitted by the agent.
|
73
|
+
# The encryption required by SSL introduces a nominal amount of CPU overhead,
|
74
|
+
# which is performed asynchronously in a background thread. If you'd prefer
|
75
|
+
# to send your metrics over http uncomment the following line.
|
76
|
+
# ssl: false
|
77
|
+
|
78
|
+
#============================== Browser Monitoring ===============================
|
79
|
+
# New Relic Real User Monitoring gives you insight into the performance real users are
|
80
|
+
# experiencing with your website. This is accomplished by measuring the time it takes for
|
81
|
+
# your users' browsers to download and render your web pages by injecting a small amount
|
82
|
+
# of JavaScript code into the header and footer of each page.
|
83
|
+
browser_monitoring:
|
84
|
+
# By default the agent automatically injects the monitoring JavaScript
|
85
|
+
# into web pages. Set this attribute to false to turn off this behavior.
|
86
|
+
auto_instrument: true
|
87
|
+
|
88
|
+
# Proxy settings for connecting to the New Relic server.
|
89
|
+
#
|
90
|
+
# If a proxy is used, the host setting is required. Other settings
|
91
|
+
# are optional. Default port is 8080.
|
92
|
+
#
|
93
|
+
# proxy_host: hostname
|
94
|
+
# proxy_port: 8080
|
95
|
+
# proxy_user:
|
96
|
+
# proxy_pass:
|
97
|
+
|
98
|
+
# The agent can optionally log all data it sends to New Relic servers to a
|
99
|
+
# separate log file for human inspection and auditing purposes. To enable this
|
100
|
+
# feature, change 'enabled' below to true.
|
101
|
+
# See: https://newrelic.com/docs/ruby/audit-log
|
102
|
+
audit_log:
|
103
|
+
enabled: false
|
104
|
+
|
105
|
+
# Tells transaction tracer and error collector (when enabled)
|
106
|
+
# whether or not to capture HTTP params. When true, frameworks can
|
107
|
+
# exclude HTTP parameters from being captured.
|
108
|
+
# Rails: the RoR filter_parameter_logging excludes parameters
|
109
|
+
# Java: create a config setting called "ignored_params" and set it to
|
110
|
+
# a comma separated list of HTTP parameter names.
|
111
|
+
# ex: ignored_params: credit_card, ssn, password
|
112
|
+
capture_params: false
|
113
|
+
|
114
|
+
# Transaction tracer captures deep information about slow
|
115
|
+
# transactions and sends this to the New Relic service once a
|
116
|
+
# minute. Included in the transaction is the exact call sequence of
|
117
|
+
# the transactions including any SQL statements issued.
|
118
|
+
transaction_tracer:
|
119
|
+
|
120
|
+
# Transaction tracer is enabled by default. Set this to false to
|
121
|
+
# turn it off. This feature is only available at the Professional
|
122
|
+
# and above product levels.
|
123
|
+
enabled: true
|
124
|
+
|
125
|
+
# Threshold in seconds for when to collect a transaction
|
126
|
+
# trace. When the response time of a controller action exceeds
|
127
|
+
# this threshold, a transaction trace will be recorded and sent to
|
128
|
+
# New Relic. Valid values are any float value, or (default) "apdex_f",
|
129
|
+
# which will use the threshold for an dissatisfying Apdex
|
130
|
+
# controller action - four times the Apdex T value.
|
131
|
+
transaction_threshold: apdex_f
|
132
|
+
|
133
|
+
# When transaction tracer is on, SQL statements can optionally be
|
134
|
+
# recorded. The recorder has three modes, "off" which sends no
|
135
|
+
# SQL, "raw" which sends the SQL statement in its original form,
|
136
|
+
# and "obfuscated", which strips out numeric and string literals.
|
137
|
+
record_sql: obfuscated
|
138
|
+
|
139
|
+
# Threshold in seconds for when to collect stack trace for a SQL
|
140
|
+
# call. In other words, when SQL statements exceed this threshold,
|
141
|
+
# then capture and send to New Relic the current stack trace. This is
|
142
|
+
# helpful for pinpointing where long SQL calls originate from.
|
143
|
+
stack_trace_threshold: 0.500
|
144
|
+
|
145
|
+
# Determines whether the agent will capture query plans for slow
|
146
|
+
# SQL queries. Only supported in mysql and postgres. Should be
|
147
|
+
# set to false when using other adapters.
|
148
|
+
# explain_enabled: true
|
149
|
+
|
150
|
+
# Threshold for query execution time below which query plans will
|
151
|
+
# not be captured. Relevant only when `explain_enabled` is true.
|
152
|
+
# explain_threshold: 0.5
|
153
|
+
|
154
|
+
# Error collector captures information about uncaught exceptions and
|
155
|
+
# sends them to New Relic for viewing
|
156
|
+
error_collector:
|
157
|
+
|
158
|
+
# Error collector is enabled by default. Set this to false to turn
|
159
|
+
# it off. This feature is only available at the Professional and above
|
160
|
+
# product levels.
|
161
|
+
enabled: true
|
162
|
+
|
163
|
+
# Rails Only - tells error collector whether or not to capture a
|
164
|
+
# source snippet around the place of the error when errors are View
|
165
|
+
# related.
|
166
|
+
capture_source: true
|
167
|
+
|
168
|
+
# To stop specific errors from reporting to New Relic, set this property
|
169
|
+
# to comma-separated values. Default is to ignore routing errors,
|
170
|
+
# which are how 404's get triggered.
|
171
|
+
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
|
172
|
+
|
173
|
+
# If you're interested in capturing memcache keys as though they
|
174
|
+
# were SQL uncomment this flag. Note that this does increase
|
175
|
+
# overhead slightly on every memcached call, and can have security
|
176
|
+
# implications if your memcached keys are sensitive
|
177
|
+
# capture_memcache_keys: true
|
178
|
+
|
179
|
+
# Application Environments
|
180
|
+
# ------------------------------------------
|
181
|
+
# Environment-specific settings are in this section.
|
182
|
+
# For Rails applications, RAILS_ENV is used to determine the environment.
|
183
|
+
# For Java applications, pass -Dnewrelic.environment <environment> to set
|
184
|
+
# the environment.
|
185
|
+
|
186
|
+
# NOTE if your application has other named environments, you should
|
187
|
+
# provide newrelic configuration settings for these environments here.
|
188
|
+
|
189
|
+
development:
|
190
|
+
<<: *default_settings
|
191
|
+
# Turn off communication to New Relic service in development mode (also
|
192
|
+
# 'enabled').
|
193
|
+
# NOTE: for initial evaluation purposes, you may want to temporarily
|
194
|
+
# turn the agent on in development mode.
|
195
|
+
monitor_mode: false
|
196
|
+
|
197
|
+
# Rails Only - when running in Developer Mode, the New Relic Agent will
|
198
|
+
# present performance information on the last 100 transactions you have
|
199
|
+
# executed since starting the mongrel.
|
200
|
+
# NOTE: There is substantial overhead when running in developer mode.
|
201
|
+
# Do not use for production or load testing.
|
202
|
+
developer_mode: true
|
203
|
+
|
204
|
+
# Enable textmate links
|
205
|
+
# textmate: true
|
206
|
+
|
207
|
+
test:
|
208
|
+
<<: *default_settings
|
209
|
+
# It almost never makes sense to turn on the agent when running
|
210
|
+
# unit, functional or integration tests or the like.
|
211
|
+
monitor_mode: false
|
212
|
+
|
213
|
+
# Turn on the agent in production for 24x7 monitoring. NewRelic
|
214
|
+
# testing shows an average performance impact of < 5 ms per
|
215
|
+
# transaction, you can leave this on all the time without
|
216
|
+
# incurring any user-visible performance degradation.
|
217
|
+
production:
|
218
|
+
<<: *default_settings
|
219
|
+
monitor_mode: true
|
220
|
+
|
221
|
+
# Many applications have a staging environment which behaves
|
222
|
+
# identically to production. Support for that environment is provided
|
223
|
+
# here. By default, the staging environment has the agent turned on.
|
224
|
+
staging:
|
225
|
+
<<: *default_settings
|
226
|
+
monitor_mode: true
|
227
|
+
# app_name: My Application (Staging)
|
data/config.ru
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
require ::File.expand_path('../config/environment', __FILE__)
|
2
2
|
|
3
3
|
if ENV['RACK_ENV'] == 'development'
|
4
|
+
require 'newrelic_rpm'
|
5
|
+
require 'new_relic/rack/developer_mode'
|
6
|
+
use NewRelic::Rack::DeveloperMode
|
7
|
+
|
4
8
|
require 'better_errors'
|
5
9
|
use BetterErrors::Middleware
|
6
10
|
end
|
7
11
|
|
12
|
+
use Pinglish, &TrogdirAPI.pinglish_block
|
13
|
+
|
8
14
|
run Trogdir::API
|
data/lib/trogdir/api.rb
CHANGED
@@ -1,5 +1,19 @@
|
|
1
|
+
require 'new_relic/agent/instrumentation/rack'
|
2
|
+
require 'rack/turnout'
|
3
|
+
|
1
4
|
module Trogdir
|
2
5
|
class API < Grape::API
|
6
|
+
helpers ResponseHelpers
|
7
|
+
format :json
|
8
|
+
rescue_from :all
|
9
|
+
|
10
|
+
use Rack::Turnout
|
11
|
+
|
3
12
|
mount Trogdir::V1::API
|
13
|
+
|
14
|
+
route(:any, '*path') { raise_404 }
|
15
|
+
route(:any, '/') { raise_404 }
|
16
|
+
|
17
|
+
include ::NewRelic::Agent::Instrumentation::Rack
|
4
18
|
end
|
5
|
-
end
|
19
|
+
end
|
@@ -1,20 +1,21 @@
|
|
1
1
|
module Trogdir
|
2
2
|
module V1
|
3
3
|
class API < Grape::API
|
4
|
+
use ApiNewRelicInstrumenter
|
5
|
+
|
4
6
|
version 'v1', using: :path
|
5
7
|
|
6
|
-
format :json
|
7
8
|
helpers RequestHelpers
|
8
|
-
helpers ResponseHelpers
|
9
9
|
helpers AuthenticationHelpers
|
10
10
|
|
11
11
|
before { authenticate! }
|
12
12
|
|
13
13
|
rescue_from Mongoid::Errors::DocumentNotFound do |e|
|
14
|
-
error
|
14
|
+
Rack::Response.new([{error: '404 Not Found'}.to_json], 404, {'Content-type' => 'application/json'})
|
15
15
|
end
|
16
16
|
|
17
17
|
mount PeopleAPI
|
18
|
+
mount GroupsAPI
|
18
19
|
mount ChangeSyncsAPI
|
19
20
|
|
20
21
|
resource 'people/:person_id' do
|
@@ -26,4 +27,4 @@ module Trogdir
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
29
|
-
end
|
30
|
+
end
|
@@ -11,9 +11,12 @@ module Trogdir
|
|
11
11
|
end
|
12
12
|
|
13
13
|
desc "Return and starts change_syncs that haven't been started"
|
14
|
+
params do
|
15
|
+
optional :limit, type: Integer, default: 100
|
16
|
+
end
|
14
17
|
put :start do
|
15
18
|
syncinator = current_syncinator
|
16
|
-
changesets = syncinator.startable_changesets
|
19
|
+
changesets = syncinator.startable_changesets.limit params[:limit]
|
17
20
|
|
18
21
|
sync_logs = changesets.map do |changeset|
|
19
22
|
syncinator.start! changeset
|
@@ -1,52 +1,108 @@
|
|
1
1
|
module Trogdir
|
2
2
|
module V1
|
3
3
|
class PersonEntity < Grape::Entity
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
4
|
+
FIELDS = [
|
5
|
+
:uuid,
|
6
|
+
|
7
|
+
# Names
|
8
|
+
:first_name,
|
9
|
+
:preferred_name,
|
10
|
+
:middle_name,
|
11
|
+
:last_name,
|
12
|
+
:display_name,
|
13
|
+
|
14
|
+
# Demographic
|
15
|
+
:gender,
|
16
|
+
:partial_ssn,
|
17
|
+
:birth_date,
|
18
|
+
|
19
|
+
# Groups and permissions
|
20
|
+
:entitlements,
|
21
|
+
:affiliations,
|
22
|
+
:groups,
|
23
|
+
|
24
|
+
# Options
|
25
|
+
:enabled,
|
26
|
+
|
27
|
+
# STUDENT INFO #
|
28
|
+
|
29
|
+
# On-Campus Residence
|
30
|
+
:residence,
|
31
|
+
:floor,
|
32
|
+
:wing,
|
33
|
+
|
34
|
+
# Academic
|
35
|
+
:majors,
|
36
|
+
|
37
|
+
# FERPA
|
38
|
+
:privacy,
|
39
|
+
|
40
|
+
# EMPLOYEE INFO #
|
41
|
+
:department,
|
42
|
+
:title,
|
43
|
+
:employee_type,
|
44
|
+
:full_time,
|
45
|
+
:pay_type,
|
46
|
+
|
47
|
+
ids: [
|
48
|
+
:id,
|
49
|
+
:type,
|
50
|
+
:identifier
|
51
|
+
],
|
52
|
+
|
53
|
+
emails: [
|
54
|
+
:id,
|
55
|
+
:type,
|
56
|
+
:address,
|
57
|
+
:primary
|
58
|
+
],
|
59
|
+
|
60
|
+
photos: [
|
61
|
+
:id,
|
62
|
+
:type,
|
63
|
+
:url,
|
64
|
+
:height,
|
65
|
+
:width
|
66
|
+
],
|
67
|
+
|
68
|
+
phones: [
|
69
|
+
:id,
|
70
|
+
:type,
|
71
|
+
:number,
|
72
|
+
:primary
|
73
|
+
],
|
74
|
+
|
75
|
+
addresses: [
|
76
|
+
:id,
|
77
|
+
:type,
|
78
|
+
:street_1,
|
79
|
+
:street_2,
|
80
|
+
:city,
|
81
|
+
:state,
|
82
|
+
:zip,
|
83
|
+
:country
|
84
|
+
]
|
85
|
+
]
|
86
|
+
|
87
|
+
def serializable_hash(runtime_options = {})
|
88
|
+
build_hash(object, FIELDS)
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def build_hash(object, fields)
|
94
|
+
fields.each_with_object({}) do |field, hash|
|
95
|
+
if field.is_a? Hash
|
96
|
+
field.each do |association, embed_fields|
|
97
|
+
hash[association] = object.send(association).map do |embed|
|
98
|
+
build_hash(embed, embed_fields)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
else
|
102
|
+
hash[field] = object.send(field)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
50
106
|
end
|
51
107
|
end
|
52
108
|
end
|
@@ -4,6 +4,7 @@ module Trogdir
|
|
4
4
|
expose(:sync_log_id) { |sync_log| sync_log.id }
|
5
5
|
expose(:action) { |sync_log| sync_log.changeset.action }
|
6
6
|
expose(:person_id) { |sync_log| sync_log.changeset.person.uuid }
|
7
|
+
expose(:affiliations) { |sync_log| sync_log.changeset.person.affiliations }
|
7
8
|
expose(:scope) { |sync_log| sync_log.changeset.scope }
|
8
9
|
expose(:original) { |sync_log| sync_log.changeset.original }
|
9
10
|
expose(:modified) { |sync_log| sync_log.changeset.modified }
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Trogdir
|
2
|
+
module V1
|
3
|
+
class GroupsAPI < Grape::API
|
4
|
+
resource :groups do
|
5
|
+
before do
|
6
|
+
if params[:identifier]
|
7
|
+
@person = if params[:type]
|
8
|
+
elem_match_or_404 Person, ids: {type: params[:type], identifier: params[:identifier]}
|
9
|
+
else
|
10
|
+
Person.find_by uuid: params[:identifier]
|
11
|
+
end
|
12
|
+
@groups = Array(@person.groups)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Get the people in a group'
|
17
|
+
params do
|
18
|
+
requires :group, type: String
|
19
|
+
end
|
20
|
+
get ':group/people' do
|
21
|
+
people = Person.where(groups: params[:group])
|
22
|
+
present people, with: PersonEntity, serializable: true
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Add a person to a group'
|
26
|
+
params do
|
27
|
+
requires :group, type: String
|
28
|
+
requires :identifier, type: String, desc: 'Person identifier'
|
29
|
+
optional :type, type: Symbol, values: ID::TYPES, desc: 'Person identifier type'
|
30
|
+
end
|
31
|
+
put ':group/add' do
|
32
|
+
@person.groups = (@groups + [params[:group]]).uniq
|
33
|
+
|
34
|
+
{result: @person.save && @person.groups.length == @groups.length + 1}
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Remove a person from a group'
|
38
|
+
params do
|
39
|
+
requires :group, type: String
|
40
|
+
requires :identifier, type: String, desc: 'Person identifier'
|
41
|
+
optional :type, type: Symbol, values: ID::TYPES, desc: 'Person identifier type'
|
42
|
+
end
|
43
|
+
put ':group/remove' do
|
44
|
+
@person.groups = (@groups - [params[:group]]).uniq
|
45
|
+
|
46
|
+
{result: @person.save && @person.groups.length == @groups.length - 1}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -17,7 +17,7 @@ module Trogdir
|
|
17
17
|
|
18
18
|
conditions[:affiliations] = params[:affiliation].to_s if params[:affiliation]
|
19
19
|
|
20
|
-
present Person.where(conditions), with: PersonEntity
|
20
|
+
present Person.where(conditions), with: PersonEntity, serializable: true
|
21
21
|
end
|
22
22
|
|
23
23
|
desc 'Return a person by associated id', {params: PersonEntity.documentation.except(:enabled)}
|
@@ -56,6 +56,7 @@ module Trogdir
|
|
56
56
|
# Groups and permissions
|
57
57
|
optional :entitlements, type: Array
|
58
58
|
optional :affiliations, type: Array
|
59
|
+
optional :groups, type: Array
|
59
60
|
|
60
61
|
# STUDENT INFO #
|
61
62
|
|
@@ -98,6 +99,7 @@ module Trogdir
|
|
98
99
|
# Groups and permissions
|
99
100
|
optional :entitlements, type: Array
|
100
101
|
optional :affiliations, type: Array
|
102
|
+
optional :groups, type: Array
|
101
103
|
|
102
104
|
# STUDENT INFO #
|
103
105
|
|
@@ -127,4 +129,4 @@ module Trogdir
|
|
127
129
|
end
|
128
130
|
end
|
129
131
|
end
|
130
|
-
end
|
132
|
+
end
|
data/lib/trogdir/versions/v1.rb
CHANGED
@@ -2,6 +2,7 @@ module Trogdir
|
|
2
2
|
module V1
|
3
3
|
autoload :API, File.expand_path('../v1/api', __FILE__)
|
4
4
|
autoload :ChangeSyncsAPI, File.expand_path('../v1/change_syncs_api', __FILE__)
|
5
|
+
autoload :GroupsAPI, File.expand_path('../v1/groups_api', __FILE__)
|
5
6
|
autoload :PeopleAPI, File.expand_path('../v1/people_api', __FILE__)
|
6
7
|
autoload :IDsAPI, File.expand_path('../v1/ids_api', __FILE__)
|
7
8
|
autoload :EmailsAPI, File.expand_path('../v1/emails_api', __FILE__)
|
@@ -17,4 +18,4 @@ module Trogdir
|
|
17
18
|
autoload :PhoneEntity, File.expand_path('../v1/entities/phone', __FILE__)
|
18
19
|
autoload :AddressEntity, File.expand_path('../v1/entities/address', __FILE__)
|
19
20
|
end
|
20
|
-
end
|
21
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'newrelic_rpm'
|
2
|
+
|
3
|
+
# Taken from https://gist.github.com/dblock/4170469
|
4
|
+
class ApiNewRelicInstrumenter < Grape::Middleware::Base
|
5
|
+
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
6
|
+
|
7
|
+
def call_with_newrelic(&block)
|
8
|
+
trace_options = {
|
9
|
+
:category => :rack,
|
10
|
+
:path => "#{route_path}\##{route_method}",
|
11
|
+
:request => Rack::Request.new(env)
|
12
|
+
}
|
13
|
+
|
14
|
+
perform_action_with_newrelic_trace(trace_options) do
|
15
|
+
result = yield
|
16
|
+
MetricFrame.abort_transaction! if result.first == 404 # ignore cascaded calls
|
17
|
+
result
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
@env = env
|
23
|
+
call_with_newrelic do
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def env
|
29
|
+
@env
|
30
|
+
end
|
31
|
+
|
32
|
+
def route
|
33
|
+
env['api.endpoint'].routes.first
|
34
|
+
end
|
35
|
+
|
36
|
+
def route_method
|
37
|
+
route.route_method.downcase
|
38
|
+
end
|
39
|
+
|
40
|
+
def route_path
|
41
|
+
path = route.route_path.gsub(/^.+:version\/|^\/|:|\(.+\)/, '').tr('/', '-')
|
42
|
+
"api.#{route.route_version}.#{path}"
|
43
|
+
end
|
44
|
+
end
|
data/lib/trogdir_api/version.rb
CHANGED
data/lib/trogdir_api.rb
CHANGED
@@ -1,15 +1,27 @@
|
|
1
1
|
require 'grape'
|
2
2
|
require 'grape-entity'
|
3
|
+
require 'oj'
|
3
4
|
require 'api_auth'
|
4
5
|
require 'trogdir_models'
|
6
|
+
require 'turnout'
|
5
7
|
|
6
8
|
module TrogdirAPI
|
7
9
|
def self.initialize!
|
8
10
|
ENV['RACK_ENV'] ||= 'development'
|
9
11
|
|
12
|
+
MultiJson.use :oj
|
13
|
+
|
10
14
|
mongoid_yml_path = File.expand_path('../../config/mongoid.yml', __FILE__)
|
11
15
|
mongoid_yml_path = "#{mongoid_yml_path}.example" if !File.exists? mongoid_yml_path
|
12
16
|
Mongoid.load! mongoid_yml_path
|
17
|
+
|
18
|
+
Turnout.configure do |config|
|
19
|
+
config.named_maintenance_file_paths.merge! server: '/tmp/turnout.yml'
|
20
|
+
config.default_maintenance_page = Turnout::MaintenancePage::JSON
|
21
|
+
end
|
22
|
+
|
23
|
+
require File.expand_path('../trogdir_api/pinglish', __FILE__)
|
24
|
+
require File.expand_path('../trogdir_api/newrelic', __FILE__)
|
13
25
|
end
|
14
26
|
end
|
15
27
|
|
@@ -19,4 +31,4 @@ module Trogdir
|
|
19
31
|
autoload :RequestHelpers, File.expand_path('../trogdir/helpers/request_helpers', __FILE__)
|
20
32
|
autoload :API, File.expand_path('../trogdir/api', __FILE__)
|
21
33
|
autoload :V1, File.expand_path('../trogdir/versions/v1', __FILE__)
|
22
|
-
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trogdir_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Crownoble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api-auth
|
@@ -75,9 +75,13 @@ files:
|
|
75
75
|
- MIT-LICENSE
|
76
76
|
- README.md
|
77
77
|
- config.ru
|
78
|
+
- config/blazing.rb
|
79
|
+
- config/blazing.rb.example
|
78
80
|
- config/environment.rb
|
79
81
|
- config/mongoid.yml
|
80
82
|
- config/mongoid.yml.example
|
83
|
+
- config/newrelic.yml
|
84
|
+
- config/newrelic.yml.example
|
81
85
|
- lib/trogdir/api.rb
|
82
86
|
- lib/trogdir/helpers/authentication_helpers.rb
|
83
87
|
- lib/trogdir/helpers/request_helpers.rb
|
@@ -95,11 +99,14 @@ files:
|
|
95
99
|
- lib/trogdir/versions/v1/entities/photo.rb
|
96
100
|
- lib/trogdir/versions/v1/entities/sync_log.rb
|
97
101
|
- lib/trogdir/versions/v1/entities/sync_log_with_changeset.rb
|
102
|
+
- lib/trogdir/versions/v1/groups_api.rb
|
98
103
|
- lib/trogdir/versions/v1/ids_api.rb
|
99
104
|
- lib/trogdir/versions/v1/people_api.rb
|
100
105
|
- lib/trogdir/versions/v1/phones_api.rb
|
101
106
|
- lib/trogdir/versions/v1/photos_api.rb
|
102
107
|
- lib/trogdir_api.rb
|
108
|
+
- lib/trogdir_api/newrelic.rb
|
109
|
+
- lib/trogdir_api/pinglish.rb
|
103
110
|
- lib/trogdir_api/version.rb
|
104
111
|
homepage: https://github.com/biola/trogdir-api
|
105
112
|
licenses:
|
@@ -126,3 +133,4 @@ signing_key:
|
|
126
133
|
specification_version: 4
|
127
134
|
summary: Trogdir directory API
|
128
135
|
test_files: []
|
136
|
+
has_rdoc:
|