Skip to content

Commit 3ec6d32

Browse files
committed
Removes REST and ElasticSearch
Why are these changes being introduced: * We have moved to OpenSearch and GraphQL Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/TIMX-220 * https://mitlibraries.atlassian.net/browse/TIMX-213 How does this address that need: * Removes v2 feature flag and all code in the "else" blocks of v2 checks * Removes ElasticSearch code * Removes no longer used dependencies * Removes most of the REST API. The auth portion will remain until the user model is removed in https://mitlibraries.atlassian.net/browse/TIMX-221 * All unused cassettes were removed (this was tedious) * Updates Actions workflow to no longer run the tests twice * Updates documentation (public and dev facing) Document any side effects to this change: * The auth portion of the REST API remains as adding removal of the user model and associated code was too much scope creep. An additional ticket has been added to remove the User model and auth portion of the REST API. * The dockerfile is still very elasticsearch focused. There is a separate ticket to address this so I chose to leave it unchanged in this commit. * There is a separte ticket to move to our shared Actions CI workflow
1 parent 0a98b84 commit 3ec6d32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+332
-2845
lines changed

.env.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
22
EMAIL_URL_HOST=localhost:3000
33
JWT_SECRET_KEY=3862fc949629030de4259b88f6e8f7c3702b2fabfc68d00d46fb7f9f70110690b526997ef4d77765ffa010d8aba440286af39947d0c85287174d99be2db14987
4-
ELASTICSEARCH_INDEX=timdex-prod
54
OPENSEARCH_INDEX=timdex-prod
6-
V2=true

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ jobs:
2222
run: |
2323
bundle config path vendor/bundle
2424
bundle install --jobs 4 --retry 3
25-
- name: run tests graphql elasticsearch
25+
- name: run tests
2626
run: |
27-
bundle exec rails test --exclude /graphqlv2/
28-
- name: run tests graphql opensearch
29-
run: |
30-
bundle exec rails test --exclude /graphqlv1/
27+
bundle exec rails test
3128
- name: Coveralls
3229
uses: coverallsapp/[email protected]
3330
with:

Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
33

44
ruby '3.1.2'
55

6-
gem 'aws-sdk-elasticsearchservice'
76
gem 'bootsnap', require: false
87
gem 'devise'
9-
gem 'elasticsearch', '~>6.8'
108
gem 'faraday_middleware-aws-sigv4'
119
gem 'flipflop'
1210
gem 'graphql'
13-
gem 'jbuilder'
1411
gem 'jwt'
1512
gem 'lograge'
1613
gem 'mitlibraries-theme', git: 'https://github.com/mitlibraries/mitlibraries-theme', tag: 'v1.0.2'
@@ -40,7 +37,6 @@ end
4037

4138
group :development do
4239
gem 'annotate'
43-
gem 'graphiql-rails'
4440
gem 'jekyll'
4541
gem 'jekyll-remote-theme'
4642
gem 'jekyll-seo-tag'

Gemfile.lock

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,6 @@ GEM
8282
rake (>= 10.4, < 14.0)
8383
ast (2.4.2)
8484
aws-eventstream (1.2.0)
85-
aws-partitions (1.730.0)
86-
aws-sdk-core (3.170.1)
87-
aws-eventstream (~> 1, >= 1.0.2)
88-
aws-partitions (~> 1, >= 1.651.0)
89-
aws-sigv4 (~> 1.5)
90-
jmespath (~> 1, >= 1.6.1)
91-
aws-sdk-elasticsearchservice (1.69.0)
92-
aws-sdk-core (~> 3, >= 3.165.0)
93-
aws-sigv4 (~> 1.1)
9485
aws-sigv4 (1.5.2)
9586
aws-eventstream (~> 1, >= 1.0.2)
9687
bcrypt (3.1.18)
@@ -127,14 +118,6 @@ GEM
127118
dotenv-rails (2.8.1)
128119
dotenv (= 2.8.1)
129120
railties (>= 3.2)
130-
elasticsearch (6.8.0)
131-
elasticsearch-api (= 6.8.0)
132-
elasticsearch-transport (= 6.8.0)
133-
elasticsearch-api (6.8.0)
134-
multi_json
135-
elasticsearch-transport (6.8.0)
136-
faraday
137-
multi_json
138121
em-websocket (0.5.3)
139122
eventmachine (>= 0.12.9)
140123
http_parser.rb (~> 0)
@@ -156,17 +139,11 @@ GEM
156139
globalid (1.1.0)
157140
activesupport (>= 5.0)
158141
google-protobuf (3.22.2)
159-
graphiql-rails (1.9.0)
160-
railties
161-
sprockets-rails
162142
graphql (2.0.19)
163143
hashdiff (1.0.1)
164144
http_parser.rb (0.8.0)
165145
i18n (1.12.0)
166146
concurrent-ruby (~> 1.0)
167-
jbuilder (2.11.5)
168-
actionview (>= 5.0.0)
169-
activesupport (>= 5.0.0)
170147
jekyll (4.3.2)
171148
addressable (~> 2.4)
172149
colorator (~> 1.0)
@@ -194,7 +171,6 @@ GEM
194171
jekyll (>= 3.8, < 5.0)
195172
jekyll-watch (2.2.1)
196173
listen (~> 3.0)
197-
jmespath (1.6.2)
198174
json (2.6.3)
199175
jwt (2.7.0)
200176
kramdown (2.4.0)
@@ -404,29 +380,22 @@ PLATFORMS
404380

405381
DEPENDENCIES
406382
annotate
407-
aws-sdk-elasticsearchservice
408383
bootsnap
409384
byebug
410385
capybara
411386
climate_control
412387
devise
413388
dotenv-rails
414-
elasticsearch (~> 6.8)
415389
faraday_middleware-aws-sigv4
416390
flipflop
417-
graphiql-rails
418391
graphql
419-
jbuilder
420392
jekyll
421393
jekyll-remote-theme
422394
jekyll-seo-tag
423395
jwt
424396
listen
425397
lograge
426398
mitlibraries-theme!
427-
net-imap
428-
net-pop
429-
net-smtp
430399
opensearch-ruby
431400
pg
432401
puma

README.md

Lines changed: 9 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
# TIMDEX Is Making Discovery EXcellent @ MIT
44

5-
This application interfaces with an ElasticSearch backend and exposes a set of
6-
API Endpoints to allow registered users to query our data.
7-
8-
The backend is populated via [pipelines](https://github.com/MITLibraries/mario).
5+
This application interfaces with an OpenSearch backend and exposes a GraphQL endpoint to allow anonymous users to query our data.
96

107
## Architecture Decision Records
118

@@ -22,26 +19,6 @@ additional records with a standardized template.
2219
- don't commit your .env or .env.development, but do commit .env.test after
2320
confirming your test values are not actual secrets that need protecting
2421

25-
### Updating the data model
26-
Updating the data model is somewhat complicated because many files need to be
27-
edited across multiple repositories and deployment steps should happen in a
28-
particular order so as not to break production services.
29-
- Start by updating the data model in [Mario](https://github.com/MITLibraries/mario). Instructions for that can be found
30-
in the [Mario README](https://github.com/MITLibraries/mario/blob/master/README.md). Then complete the following steps here in TIMDEX.
31-
- Update `app/models/search.rb` to build/update/remove queries for the added/
32-
edited/deleted fields as appropriate. Make sure to update filters and
33-
aggregations if relevant to the changed fields.
34-
- Update `app/views/api/[version]/search/_base_json_jbuilder` to
35-
add/update/remove changed fields OR update
36-
`views/api/[version]/search/_extended_json_jbuilder` if the changed fields
37-
aren’t/shouldn’t be in the brief record result.
38-
- If changed fields should be aggregated, update
39-
`views/api/[version]/search/_aggregations_json_jbuilder` as appropriate.
40-
- Update tests as necessary. Make sure to test with all current data
41-
source samples ingested into a local ES instance.
42-
- Update `openapi.json` to make sure our spec matches any changes made
43-
(including bumping the version number).
44-
4522
## Publishing User Facing Documentation
4623

4724
### Running jekyll documentation locally
@@ -79,46 +56,32 @@ locally.
7956
`yourapp.herokuapp.com`. However, if you use a custom domain in production,
8057
that should be the value you use in production.
8158
- `JWT_SECRET_KEY`: generate with `rails secret`
82-
- `ELASTICSEARCH_INDEX`: Elasticsearch index or alias to query
83-
- `ELASTICSEARCH_URL`: defaults to `http://localhost:9200`
8459

8560
## Production required Environment Variables
8661

87-
- `AWS_ACCESS_KEY`
88-
- `AWS_ELASTICSEARCH`: boolean. Set to true to enable AWSv4 Signing
89-
- `AWS_SECRET_ACCESS_KEY`
62+
- `AWS_OPENSEARCH`: boolean. Set to true to enable AWSv4 Signing
63+
- `AWS_OPENSEARCH_ACCESS_KEY_ID`
64+
- `AWS_OPENSEARCH_SECRET_ACCESS_KEY`
9065
- `AWS_REGION`
66+
- `OPENSEARCH_INDEX`: Opensearch index or alias to query, default will be to search all indexes which is generally not
67+
expected. `timdex` or `all-current` are aliases used consistently in our data pipelines, with
68+
`timdex` being most likely what most use cases will want.
69+
- `OPENSEARCH_URL`: Opensearch URL, defaults to `http://localhost:9200`
9170
- `SMTP_ADDRESS`
9271
- `SMTP_PASSWORD`
9372
- `SMTP_PORT`
9473
- `SMTP_USER`
9574

96-
### Additional required Environment Variables when Opensearch is enabled (aka v2=true)
97-
98-
- `v2`: set to `true`
99-
- `OPENSEARCH_INDEX`: Opensearch index or alias to query
100-
- `OPENSEARCH_URL`: Opensearch URL
101-
- `OPENSEARCH_LOG` set to `true`
102-
103-
- `AWS_OPENSEARCH`
104-
- `AWS_OPENSEARCH_ACCESS_KEY_ID`
105-
- `AWS_OPENSEARCH_SECRET_ACCESS_KEY`
10675
## Optional Environment Variables (all ENVs)
10776

108-
- `ELASTICSEARCH_LOG` if `true`, verbosely logs ElasticSearch queries.
77+
- `OPENSEARCH_LOG` if `true`, verbosely logs OpenSearch queries.
10978

11079
```text
11180
NOTE: do not set this ENV at all if you want ES logging fully disabled.
11281
Setting it to `false` is still setting it and you will be annoyed and
11382
confused.
11483
```
11584

116-
- `ES_LOG_LEVEL` set elasticsearch transport log level. Defaults to `INFO`.
117-
118-
```text
119-
NOTE: `ELASTICSEARCH_LOG` must also be set for logging to function.
120-
```
121-
12285
- `PREFERRED_DOMAIN` - set this to the domain you would like to to use. Any
12386
other requests that come to the app will redirect to the root of this domain.
12487
This is useful to prevent access to herokuapp.com domains.
@@ -127,47 +90,3 @@ NOTE: `ELASTICSEARCH_LOG` must also be set for logging to function.
12790
Default is 1.
12891
- `SENTRY_DSN`: client key for Sentry exception logging
12992
- `SENTRY_ENV`: Sentry environment for the application. Defaults to 'unknown' if unset.
130-
131-
## Docker Compose Orchestrated Local Environment
132-
133-
This section will describe how to use the included docker compose files to spin up ElasticSearch
134-
and optionally use Mario to load sample data for testing.
135-
136-
You may set `ELASTICSEARCH_URL` to `http://0.0.0.0:9200` to use this ES instance in development if you
137-
choose to not use the included Dockerfile
138-
139-
### Startup ElasticSearch and Timdex
140-
141-
`make up`
142-
143-
### Shutdown ElasticSearch and Timdex when you are done
144-
145-
`make down`
146-
147-
### Optionally, load sample data
148-
149-
After ElasticSearch is running from `make up` command:
150-
151-
`make sampledata`
152-
153-
Note: if you run this and it fails, try again in a few seconds as ES may still be loading
154-
155-
### Run arbitrary Mario commands
156-
157-
You can also run arbitrary Mario commands using a syntax like this after first running `make up`.
158-
159-
`docker run --network timdex_default mitlibraries/mario --url http://elasticsearch:9200 YOUR_MARIO_COMMAND_HERE [e.g. indexes]`
160-
161-
Note: if you have no indexes loaded, many mario commands will fail. Try `make sampledata` or load the data you
162-
need before proceeding.
163-
164-
### Quick curl examples with sample data in mind
165-
166-
`curl 'http://0.0.0.0:3000/api/v1/ping'`
167-
168-
`curl 'http://0.0.0.0:3000/api/v1/search?q=archives'`
169-
170-
You can also use the playground via your browser, see the index page of the running app for a link
171-
and example queries.
172-
173-
http://0.0.0.0:3000

app/controllers/api/v1/search_controller.rb

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)