surfliner-metadata_consumer 0.1.0.pre.alpha

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: da6520951750821f9f2de1ed06f02a3d087d497283c2a2107a3f3f40ddcf786f
4
+ data.tar.gz: f243e4bda74dcbdfc85c99d77477df1e29d69816e568ba7314aadb96534875c1
5
+ SHA512:
6
+ metadata.gz: 49de449388610d4683296ea83021fe4bd7f5c5a2112eb52173c4adb81e8c1bd6e14b17acb2f1e6b4397f6699c973f04b22bc1d2ccfce9a2ea3d05a41d8e92277
7
+ data.tar.gz: 5192138d3868a691247adb1777270b23552465b3fe60ed76303f3605b1851d9ce5bff7afd09ea31c2d0da200316f37ea6cc81ef0363aa2c565e5ec45c847aec2
data/Dockerfile ADDED
@@ -0,0 +1,59 @@
1
+ # The base stage scaffolds elements which are common to building and running
2
+ # the application, such as creating users and directories, and installing
3
+ # runtime dependencies.
4
+ FROM ruby:3.3.7-alpine3.21 AS base
5
+
6
+ ARG app_user=consumer
7
+ ARG app_uid=10000
8
+ ARG app_gid=10001
9
+ ARG app_path=/app
10
+
11
+ # convert arg to ENV so Kaniko doesn't get confused later
12
+ ENV APP_PATH=$app_path
13
+
14
+ RUN addgroup -S -g $app_gid $app_user
15
+ RUN adduser -S -G $app_user -u $app_uid -s /bin/sh -h $APP_PATH $app_user
16
+
17
+ RUN mkdir -p $APP_PATH
18
+ RUN chown $app_uid:$app_gid $APP_PATH
19
+ COPY --chown=$app_uid:$app_gid . $APP_PATH
20
+
21
+ ENV BUNDLE_PATH=$APP_PATH/vendor/bundle
22
+ RUN mkdir -p $BUNDLE_PATH
23
+ RUN chown -R $app_uid:$app_gid $BUNDLE_PATH
24
+
25
+ WORKDIR $APP_PATH
26
+
27
+ # The build stage installs system dependencies needed to build Ruby gems with C
28
+ # extensions, and installs the Ruby dependencies listed in the gemspec.
29
+ FROM base AS build
30
+
31
+ RUN apk --no-cache add build-base
32
+
33
+ # Workaround for https://github.com/docker-library/ruby/issues/496
34
+ # Should soon not be needed: https://github.com/docker-library/ruby/pull/497
35
+ RUN apk add --no-cache \
36
+ bzip2 \
37
+ ca-certificates \
38
+ gmp-dev \
39
+ libffi-dev \
40
+ procps \
41
+ yaml-dev \
42
+ zlib-dev \
43
+ ;
44
+
45
+ USER $app_user
46
+
47
+ RUN bundle install --jobs "$(nproc)"
48
+
49
+ # The application stage extends the base image with the gems installed in the
50
+ # build stage. It includes runtime dependencies but not build dependencies.
51
+ FROM base AS app
52
+
53
+ COPY --from=build $BUNDLE_PATH $BUNDLE_PATH
54
+ COPY --from=build $APP_PATH/Gemfile.lock $APP_PATH
55
+
56
+ RUN bundle config set frozen 'true'
57
+
58
+ # TODO: don't hard-code a specific handler / script
59
+ CMD ["./bin/daylight-index-listen"]
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in surfliner_schema.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,374 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ surfliner-metadata_consumer (0.1.0.pre.alpha)
5
+ bunny (~> 2.23)
6
+ opentelemetry-exporter-otlp (~> 0.26.3)
7
+ opentelemetry-instrumentation-all (~> 0.60.0)
8
+ opentelemetry-sdk (~> 1.4.1)
9
+ rsolr (>= 1.0, < 3)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ addressable (2.8.7)
15
+ public_suffix (>= 2.0.2, < 7.0)
16
+ amq-protocol (2.3.2)
17
+ ast (2.4.2)
18
+ bigdecimal (3.1.9)
19
+ builder (3.3.0)
20
+ bunny (2.23.0)
21
+ amq-protocol (~> 2.3, >= 2.3.1)
22
+ sorted_set (~> 1, >= 1.0.2)
23
+ ci_reporter (2.1.0)
24
+ builder (>= 2.1.2)
25
+ rexml
26
+ ci_reporter_rspec (1.0.0)
27
+ ci_reporter (~> 2.0)
28
+ rspec (>= 2.14, < 4)
29
+ colorize (0.8.1)
30
+ crack (1.0.0)
31
+ bigdecimal
32
+ rexml
33
+ date (3.4.1)
34
+ debug (1.9.2)
35
+ irb (~> 1.10)
36
+ reline (>= 0.3.8)
37
+ diff-lcs (1.5.1)
38
+ docile (1.4.1)
39
+ dotenv (2.8.1)
40
+ faraday (2.12.2)
41
+ faraday-net_http (>= 2.0, < 3.5)
42
+ json
43
+ logger
44
+ faraday-net_http (3.4.0)
45
+ net-http (>= 0.5.0)
46
+ google-protobuf (3.25.6)
47
+ google-protobuf (3.25.6-aarch64-linux)
48
+ google-protobuf (3.25.6-arm64-darwin)
49
+ google-protobuf (3.25.6-x86-linux)
50
+ google-protobuf (3.25.6-x86_64-darwin)
51
+ google-protobuf (3.25.6-x86_64-linux)
52
+ googleapis-common-protos-types (1.18.0)
53
+ google-protobuf (>= 3.18, < 5.a)
54
+ hashdiff (1.1.2)
55
+ io-console (0.8.0)
56
+ irb (1.15.1)
57
+ pp (>= 0.6.0)
58
+ rdoc (>= 4.0.0)
59
+ reline (>= 0.4.2)
60
+ json (2.9.1)
61
+ language_server-protocol (3.17.0.4)
62
+ lint_roller (1.1.0)
63
+ logger (1.6.5)
64
+ net-http (0.6.0)
65
+ uri
66
+ opentelemetry-api (1.4.0)
67
+ opentelemetry-common (0.21.0)
68
+ opentelemetry-api (~> 1.0)
69
+ opentelemetry-exporter-otlp (0.26.3)
70
+ google-protobuf (~> 3.14)
71
+ googleapis-common-protos-types (~> 1.3)
72
+ opentelemetry-api (~> 1.1)
73
+ opentelemetry-common (~> 0.20)
74
+ opentelemetry-sdk (~> 1.2)
75
+ opentelemetry-semantic_conventions
76
+ opentelemetry-helpers-mysql (0.2.0)
77
+ opentelemetry-api (~> 1.0)
78
+ opentelemetry-common (~> 0.21)
79
+ opentelemetry-helpers-sql-obfuscation (0.3.0)
80
+ opentelemetry-common (~> 0.21)
81
+ opentelemetry-instrumentation-action_mailer (0.1.0)
82
+ opentelemetry-api (~> 1.0)
83
+ opentelemetry-instrumentation-active_support (~> 0.1)
84
+ opentelemetry-instrumentation-base (~> 0.22.1)
85
+ opentelemetry-instrumentation-action_pack (0.9.0)
86
+ opentelemetry-api (~> 1.0)
87
+ opentelemetry-instrumentation-base (~> 0.22.1)
88
+ opentelemetry-instrumentation-rack (~> 0.21)
89
+ opentelemetry-instrumentation-action_view (0.7.2)
90
+ opentelemetry-api (~> 1.0)
91
+ opentelemetry-instrumentation-active_support (~> 0.1)
92
+ opentelemetry-instrumentation-base (~> 0.22.1)
93
+ opentelemetry-instrumentation-active_job (0.7.8)
94
+ opentelemetry-api (~> 1.0)
95
+ opentelemetry-instrumentation-base (~> 0.22.1)
96
+ opentelemetry-instrumentation-active_model_serializers (0.20.2)
97
+ opentelemetry-api (~> 1.0)
98
+ opentelemetry-instrumentation-base (~> 0.22.1)
99
+ opentelemetry-instrumentation-active_record (0.7.4)
100
+ opentelemetry-api (~> 1.0)
101
+ opentelemetry-instrumentation-base (~> 0.22.1)
102
+ opentelemetry-instrumentation-active_support (0.5.3)
103
+ opentelemetry-api (~> 1.0)
104
+ opentelemetry-instrumentation-base (~> 0.22.1)
105
+ opentelemetry-instrumentation-all (0.60.0)
106
+ opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
107
+ opentelemetry-instrumentation-aws_sdk (~> 0.5.0)
108
+ opentelemetry-instrumentation-bunny (~> 0.21.0)
109
+ opentelemetry-instrumentation-concurrent_ruby (~> 0.21.1)
110
+ opentelemetry-instrumentation-dalli (~> 0.25.0)
111
+ opentelemetry-instrumentation-delayed_job (~> 0.22.0)
112
+ opentelemetry-instrumentation-ethon (~> 0.21.1)
113
+ opentelemetry-instrumentation-excon (~> 0.22.0)
114
+ opentelemetry-instrumentation-faraday (~> 0.24.0)
115
+ opentelemetry-instrumentation-grape (~> 0.1.3)
116
+ opentelemetry-instrumentation-graphql (~> 0.28.0)
117
+ opentelemetry-instrumentation-gruf (~> 0.2.0)
118
+ opentelemetry-instrumentation-http (~> 0.23.1)
119
+ opentelemetry-instrumentation-http_client (~> 0.22.1)
120
+ opentelemetry-instrumentation-koala (~> 0.20.1)
121
+ opentelemetry-instrumentation-lmdb (~> 0.22.1)
122
+ opentelemetry-instrumentation-mongo (~> 0.22.1)
123
+ opentelemetry-instrumentation-mysql2 (~> 0.27.0)
124
+ opentelemetry-instrumentation-net_http (~> 0.22.1)
125
+ opentelemetry-instrumentation-pg (~> 0.27.0)
126
+ opentelemetry-instrumentation-que (~> 0.8.0)
127
+ opentelemetry-instrumentation-racecar (~> 0.3.0)
128
+ opentelemetry-instrumentation-rack (~> 0.24.0)
129
+ opentelemetry-instrumentation-rails (~> 0.30.0)
130
+ opentelemetry-instrumentation-rake (~> 0.2.1)
131
+ opentelemetry-instrumentation-rdkafka (~> 0.4.0)
132
+ opentelemetry-instrumentation-redis (~> 0.25.1)
133
+ opentelemetry-instrumentation-resque (~> 0.5.0)
134
+ opentelemetry-instrumentation-restclient (~> 0.22.1)
135
+ opentelemetry-instrumentation-ruby_kafka (~> 0.21.0)
136
+ opentelemetry-instrumentation-sidekiq (~> 0.25.0)
137
+ opentelemetry-instrumentation-sinatra (~> 0.23.1)
138
+ opentelemetry-instrumentation-trilogy (~> 0.59.0)
139
+ opentelemetry-instrumentation-aws_sdk (0.5.4)
140
+ opentelemetry-api (~> 1.0)
141
+ opentelemetry-instrumentation-base (~> 0.22.1)
142
+ opentelemetry-instrumentation-base (0.22.6)
143
+ opentelemetry-api (~> 1.0)
144
+ opentelemetry-common (~> 0.21)
145
+ opentelemetry-registry (~> 0.1)
146
+ opentelemetry-instrumentation-bunny (0.21.4)
147
+ opentelemetry-api (~> 1.0)
148
+ opentelemetry-instrumentation-base (~> 0.22.1)
149
+ opentelemetry-instrumentation-concurrent_ruby (0.21.4)
150
+ opentelemetry-api (~> 1.0)
151
+ opentelemetry-instrumentation-base (~> 0.22.1)
152
+ opentelemetry-instrumentation-dalli (0.25.4)
153
+ opentelemetry-api (~> 1.0)
154
+ opentelemetry-instrumentation-base (~> 0.22.1)
155
+ opentelemetry-instrumentation-delayed_job (0.22.4)
156
+ opentelemetry-api (~> 1.0)
157
+ opentelemetry-instrumentation-base (~> 0.22.1)
158
+ opentelemetry-instrumentation-ethon (0.21.9)
159
+ opentelemetry-api (~> 1.0)
160
+ opentelemetry-instrumentation-base (~> 0.22.1)
161
+ opentelemetry-instrumentation-excon (0.22.5)
162
+ opentelemetry-api (~> 1.0)
163
+ opentelemetry-instrumentation-base (~> 0.22.1)
164
+ opentelemetry-instrumentation-faraday (0.24.8)
165
+ opentelemetry-api (~> 1.0)
166
+ opentelemetry-instrumentation-base (~> 0.22.1)
167
+ opentelemetry-instrumentation-grape (0.1.8)
168
+ opentelemetry-api (~> 1.0)
169
+ opentelemetry-instrumentation-base (~> 0.22.1)
170
+ opentelemetry-instrumentation-rack (~> 0.21)
171
+ opentelemetry-instrumentation-graphql (0.28.4)
172
+ opentelemetry-api (~> 1.0)
173
+ opentelemetry-instrumentation-base (~> 0.22.1)
174
+ opentelemetry-instrumentation-gruf (0.2.1)
175
+ opentelemetry-api (>= 1.0.0)
176
+ opentelemetry-instrumentation-base (~> 0.22.1)
177
+ opentelemetry-instrumentation-http (0.23.5)
178
+ opentelemetry-api (~> 1.0)
179
+ opentelemetry-instrumentation-base (~> 0.22.1)
180
+ opentelemetry-instrumentation-http_client (0.22.8)
181
+ opentelemetry-api (~> 1.0)
182
+ opentelemetry-instrumentation-base (~> 0.22.1)
183
+ opentelemetry-instrumentation-koala (0.20.6)
184
+ opentelemetry-api (~> 1.0)
185
+ opentelemetry-instrumentation-base (~> 0.22.1)
186
+ opentelemetry-instrumentation-lmdb (0.22.3)
187
+ opentelemetry-api (~> 1.0)
188
+ opentelemetry-instrumentation-base (~> 0.22.1)
189
+ opentelemetry-instrumentation-mongo (0.22.4)
190
+ opentelemetry-api (~> 1.0)
191
+ opentelemetry-instrumentation-base (~> 0.22.1)
192
+ opentelemetry-instrumentation-mysql2 (0.27.2)
193
+ opentelemetry-api (~> 1.0)
194
+ opentelemetry-helpers-mysql
195
+ opentelemetry-helpers-sql-obfuscation
196
+ opentelemetry-instrumentation-base (~> 0.22.1)
197
+ opentelemetry-instrumentation-net_http (0.22.8)
198
+ opentelemetry-api (~> 1.0)
199
+ opentelemetry-instrumentation-base (~> 0.22.1)
200
+ opentelemetry-instrumentation-pg (0.27.4)
201
+ opentelemetry-api (~> 1.0)
202
+ opentelemetry-helpers-sql-obfuscation
203
+ opentelemetry-instrumentation-base (~> 0.22.1)
204
+ opentelemetry-instrumentation-que (0.8.4)
205
+ opentelemetry-api (~> 1.0)
206
+ opentelemetry-instrumentation-base (~> 0.22.1)
207
+ opentelemetry-instrumentation-racecar (0.3.4)
208
+ opentelemetry-api (~> 1.0)
209
+ opentelemetry-instrumentation-base (~> 0.22.1)
210
+ opentelemetry-instrumentation-rack (0.24.6)
211
+ opentelemetry-api (~> 1.0)
212
+ opentelemetry-instrumentation-base (~> 0.22.1)
213
+ opentelemetry-instrumentation-rails (0.30.2)
214
+ opentelemetry-api (~> 1.0)
215
+ opentelemetry-instrumentation-action_mailer (~> 0.1.0)
216
+ opentelemetry-instrumentation-action_pack (~> 0.9.0)
217
+ opentelemetry-instrumentation-action_view (~> 0.7.0)
218
+ opentelemetry-instrumentation-active_job (~> 0.7.0)
219
+ opentelemetry-instrumentation-active_record (~> 0.7.0)
220
+ opentelemetry-instrumentation-active_support (~> 0.5.0)
221
+ opentelemetry-instrumentation-base (~> 0.22.1)
222
+ opentelemetry-instrumentation-rake (0.2.2)
223
+ opentelemetry-api (~> 1.0)
224
+ opentelemetry-instrumentation-base (~> 0.22.1)
225
+ opentelemetry-instrumentation-rdkafka (0.4.9)
226
+ opentelemetry-api (~> 1.0)
227
+ opentelemetry-instrumentation-base (~> 0.22.1)
228
+ opentelemetry-instrumentation-redis (0.25.7)
229
+ opentelemetry-api (~> 1.0)
230
+ opentelemetry-instrumentation-base (~> 0.22.1)
231
+ opentelemetry-instrumentation-resque (0.5.2)
232
+ opentelemetry-api (~> 1.0)
233
+ opentelemetry-instrumentation-base (~> 0.22.1)
234
+ opentelemetry-instrumentation-restclient (0.22.8)
235
+ opentelemetry-api (~> 1.0)
236
+ opentelemetry-instrumentation-base (~> 0.22.1)
237
+ opentelemetry-instrumentation-ruby_kafka (0.21.3)
238
+ opentelemetry-api (~> 1.0)
239
+ opentelemetry-instrumentation-base (~> 0.22.1)
240
+ opentelemetry-instrumentation-sidekiq (0.25.7)
241
+ opentelemetry-api (~> 1.0)
242
+ opentelemetry-instrumentation-base (~> 0.22.1)
243
+ opentelemetry-instrumentation-sinatra (0.23.5)
244
+ opentelemetry-api (~> 1.0)
245
+ opentelemetry-instrumentation-base (~> 0.22.1)
246
+ opentelemetry-instrumentation-rack (~> 0.21)
247
+ opentelemetry-instrumentation-trilogy (0.59.3)
248
+ opentelemetry-api (~> 1.0)
249
+ opentelemetry-helpers-mysql
250
+ opentelemetry-helpers-sql-obfuscation
251
+ opentelemetry-instrumentation-base (~> 0.22.1)
252
+ opentelemetry-semantic_conventions (>= 1.8.0)
253
+ opentelemetry-registry (0.3.1)
254
+ opentelemetry-api (~> 1.1)
255
+ opentelemetry-sdk (1.4.1)
256
+ opentelemetry-api (~> 1.1)
257
+ opentelemetry-common (~> 0.20)
258
+ opentelemetry-registry (~> 0.2)
259
+ opentelemetry-semantic_conventions
260
+ opentelemetry-semantic_conventions (1.10.1)
261
+ opentelemetry-api (~> 1.0)
262
+ parallel (1.26.3)
263
+ parser (3.3.7.0)
264
+ ast (~> 2.4.1)
265
+ racc
266
+ pp (0.6.2)
267
+ prettyprint
268
+ prettyprint (0.2.0)
269
+ psych (5.2.3)
270
+ date
271
+ stringio
272
+ public_suffix (6.0.1)
273
+ racc (1.8.1)
274
+ rainbow (3.1.1)
275
+ rake (13.2.1)
276
+ rbtree (0.4.6)
277
+ rdoc (6.11.0)
278
+ psych (>= 4.0.0)
279
+ regexp_parser (2.10.0)
280
+ reline (0.6.0)
281
+ io-console (~> 0.5)
282
+ rexml (3.4.0)
283
+ rsolr (2.6.0)
284
+ builder (>= 2.1.2)
285
+ faraday (>= 0.9, < 3, != 2.0.0)
286
+ rspec (3.13.0)
287
+ rspec-core (~> 3.13.0)
288
+ rspec-expectations (~> 3.13.0)
289
+ rspec-mocks (~> 3.13.0)
290
+ rspec-core (3.13.2)
291
+ rspec-support (~> 3.13.0)
292
+ rspec-expectations (3.13.3)
293
+ diff-lcs (>= 1.2.0, < 2.0)
294
+ rspec-support (~> 3.13.0)
295
+ rspec-mocks (3.13.2)
296
+ diff-lcs (>= 1.2.0, < 2.0)
297
+ rspec-support (~> 3.13.0)
298
+ rspec-support (3.13.2)
299
+ rubocop (1.70.0)
300
+ json (~> 2.3)
301
+ language_server-protocol (>= 3.17.0)
302
+ parallel (~> 1.10)
303
+ parser (>= 3.3.0.2)
304
+ rainbow (>= 2.2.2, < 4.0)
305
+ regexp_parser (>= 2.9.3, < 3.0)
306
+ rubocop-ast (>= 1.36.2, < 2.0)
307
+ ruby-progressbar (~> 1.7)
308
+ unicode-display_width (>= 2.4.0, < 4.0)
309
+ rubocop-ast (1.38.0)
310
+ parser (>= 3.3.1.0)
311
+ rubocop-performance (1.23.1)
312
+ rubocop (>= 1.48.1, < 2.0)
313
+ rubocop-ast (>= 1.31.1, < 2.0)
314
+ ruby-progressbar (1.13.0)
315
+ set (1.1.1)
316
+ simplecov (0.22.0)
317
+ docile (~> 1.1)
318
+ simplecov-html (~> 0.11)
319
+ simplecov_json_formatter (~> 0.1)
320
+ simplecov-cobertura (2.1.0)
321
+ rexml
322
+ simplecov (~> 0.19)
323
+ simplecov-html (0.13.1)
324
+ simplecov_json_formatter (0.1.4)
325
+ sorted_set (1.0.3)
326
+ rbtree
327
+ set (~> 1.0)
328
+ standard (1.44.0)
329
+ language_server-protocol (~> 3.17.0.2)
330
+ lint_roller (~> 1.0)
331
+ rubocop (~> 1.70.0)
332
+ standard-custom (~> 1.0.0)
333
+ standard-performance (~> 1.6)
334
+ standard-custom (1.0.2)
335
+ lint_roller (~> 1.0)
336
+ rubocop (~> 1.50)
337
+ standard-performance (1.6.0)
338
+ lint_roller (~> 1.1)
339
+ rubocop-performance (~> 1.23.0)
340
+ stringio (3.1.2)
341
+ unicode-display_width (3.1.4)
342
+ unicode-emoji (~> 4.0, >= 4.0.4)
343
+ unicode-emoji (4.0.4)
344
+ uri (1.0.2)
345
+ webmock (3.24.0)
346
+ addressable (>= 2.8.0)
347
+ crack (>= 0.3.2)
348
+ hashdiff (>= 0.4.0, < 2.0.0)
349
+ yard (0.9.37)
350
+
351
+ PLATFORMS
352
+ aarch64-linux
353
+ arm64-darwin
354
+ ruby
355
+ x86-linux
356
+ x86_64-darwin
357
+ x86_64-linux
358
+
359
+ DEPENDENCIES
360
+ ci_reporter_rspec (~> 1.0)
361
+ colorize (~> 0.8)
362
+ debug (~> 1.9.2)
363
+ dotenv (~> 2.7)
364
+ rake (~> 13.0)
365
+ rspec (~> 3.13)
366
+ simplecov (~> 0.22)
367
+ simplecov-cobertura (~> 2.1)
368
+ standard (~> 1.31)
369
+ surfliner-metadata_consumer!
370
+ webmock (~> 3.12)
371
+ yard (~> 0.9.37)
372
+
373
+ BUNDLED WITH
374
+ 2.5.22
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 The Regents of the University of California.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE~ ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 The Regents of the University of California.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,105 @@
1
+ Surfliner Metadata Consumer
2
+ ==========================
3
+
4
+ This service [consumes](https://www.rabbitmq.com/docs/consumers) a Surfliner
5
+ metadata message queue, passing messages to a customizable handler.
6
+
7
+ ## Local development
8
+
9
+ The default `rake` task performs the following, with each step proceeding only
10
+ if prior steps succeed.
11
+
12
+ 1. runs unit tests, with code coverage
13
+ 2. checks code style
14
+ 3. builds the gem
15
+
16
+ ### Testing
17
+
18
+ - `rake spec` to run unit tests
19
+ - test results are written to the console
20
+ - test reports are written to `artifacts/rspec` in JUnit format
21
+ - `rake coverage` to run unit tests with coverage
22
+ - summary coverage statistics are written to the console
23
+ - detailed coverage reports are written to `artifacts/coverage` in HTML format;
24
+ open `artifacts/coverage/index.html` to view
25
+
26
+ ### Enforcing code style
27
+
28
+ - `rake standard` to check code style
29
+ - `rake standard:fix` to make safe fixes automatically
30
+
31
+ ### Building the gem
32
+
33
+ - `rake gem` builds the gem
34
+ - gem package is written to `artifacts/surfliner_metadata_consumer-<VERSION>.gem`
35
+ - version is set in `lib/surfliner_metadata_consumer/version.rb`
36
+
37
+ ## Configuration
38
+
39
+ <!--
40
+ TODO: Just provide a sample env file
41
+ -->
42
+
43
+ The `MqConnection` class expects the following environment variables:
44
+
45
+ ```sh
46
+ RABBITMQ_HOST=rabbitmq
47
+ RABBITMQ_NODE_PORT_NUMBER=5672
48
+ RABBITMQ_PASSWORD=bitnami
49
+ RABBITMQ_QUEUE=surfliner.metadata
50
+ RABBITMQ_PLATFORM_ROUTING_KEY=surfliner.metadata.daylight
51
+ RABBITMQ_TOPIC=surfliner.metadata
52
+ RABBITMQ_USERNAME=user
53
+ ```
54
+
55
+ (Sample values taken from Surfliner's development [daylight-listener.sh](https://gitlab.com/surfliner/surfliner/-/blob/trunk/docker-compose/env/daylight-listener.sh).)
56
+
57
+ The Solr / Daylight handler implementation (see below) additionally expects
58
+ a configured `SOLR_URL`, e.g.:
59
+
60
+ ```sh
61
+ SOLR_URL=http://admin:admin@solr:8983/solr/daylight-dev
62
+ ```
63
+
64
+ The `bin/simulate-publish-event` script expects an `API_BASE_URI`, used to generate resource URLs
65
+ for provided IDs:
66
+
67
+ ```sh
68
+ API_BASE_URI=http://superskunk:3000
69
+ ```
70
+
71
+ ## Solr / Daylight handler implementation
72
+
73
+ The `Surfliner::MetadataConsumer::Solr` package contains a handler that retrieves
74
+ metadata for `:published`/`:updated` events, transforms results for indexing, and
75
+ updates a target Solr index.
76
+
77
+ <!-- TODO: better name for this script -->
78
+
79
+ The `bin/daylight-index-listen` script starts a consumer using this handler.
80
+
81
+ In addition to the environment variables listed above, this handler expects
82
+ a configured `SOLR_URL`, e.g.:
83
+
84
+ ### Running the service
85
+
86
+ <!--
87
+ TODO: Dockerfile shouldn't be daylight-index-listen specific
88
+ -->
89
+
90
+ Build the listener Dockerfile and tag it with the name `solr-listener`:
91
+
92
+ ```none
93
+ docker build . -t solr-listener
94
+ ```
95
+
96
+ Run the listener container:
97
+
98
+ ```none
99
+ docker run --env-file <env-file> solr-listener
100
+ ```
101
+
102
+ ## Utility scripts
103
+
104
+ - `bin/daylight-index-listen` script starts a consumer using the Daylight Solr handler.
105
+ - `bin/simulate-publish-event` posts a publish event to the queue configured with `MqConnection`
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("Gemfile", __dir__)
2
+ require "bundler/setup" # Set up gems listed in the Gemfile.
3
+ require "standard/rake"
4
+
5
+ File.expand_path("lib", __dir__).tap do |lib|
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+ end
8
+
9
+ task default: %i[coverage standard yard gem]
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "logger"
4
+ require "opentelemetry/sdk"
5
+ require "surfliner/metadata_consumer"
6
+
7
+ $stdout.sync = true # don't buffer log output
8
+
9
+ logger = Logger.new($stdout)
10
+ logger.level = ENV.fetch("LOG_LEVEL") { Logger::INFO }
11
+
12
+ unless ENV["OTEL_SDK_DISABLED"] == "true"
13
+ OpenTelemetry::SDK.configure do |c|
14
+ c.service_name = "surfliner-daylight-consumer"
15
+ c.use_all # enables auto instrumentation for Bunny, Net::HTTP, etc...
16
+ end
17
+ end
18
+
19
+ tracer = OpenTelemetry.tracer_provider.tracer("DaylightConsumerTracer")
20
+
21
+ handler = Surfliner::MetadataConsumer::Solr::MessageHandler
22
+
23
+ Surfliner::MetadataConsumer::Consumer.run(logger:, tracer:, handler:)
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require "bundler/setup"
3
+ require "date"
4
+ require "json"
5
+ require "logger"
6
+
7
+ require "surfliner/metadata_consumer/mq_connection"
8
+
9
+ api_base = ENV.fetch("API_BASE_URI") { "http://example.com/api" }
10
+ logger = Logger.new($stdout)
11
+ logger.level = ENV.fetch("LOG_LEVEL") { Logger::INFO }
12
+
13
+ connection = Surfliner::MetadataConsumer::MqConnection.new(logger: logger).connect
14
+
15
+ begin
16
+ ARGV.each do |id|
17
+ payload =
18
+ {resourceUrl: "#{api_base}/resources/#{id}",
19
+ status: :published,
20
+ time_stamp: DateTime.now}.to_json
21
+
22
+ logger.info "Publishing to #{connection.routing_key} with #{payload}"
23
+ connection.exchange.publish(payload, routing_key: connection.routing_key)
24
+ end
25
+ ensure
26
+ begin
27
+ connection&.channel
28
+ ensure
29
+ connection&.close
30
+ end
31
+ end