Skip to content

Commit 0e54be0

Browse files
authored
OBS-486: remove legacy elasticsearch (#6906)
* OBS-486: remove legacy elasticsearch * address review
1 parent 65ae612 commit 0e54be0

Some content is hidden

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

50 files changed

+122
-8232
lines changed

.devcontainer/Dockerfile

-11
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ RUN /tmp/set_up_stackwalker.sh && \
3131
COPY --chown=app:app ./webapp/package*.json /webapp-frontend-deps/
3232
RUN cd /webapp-frontend-deps/ && npm install
3333

34-
# NOTE(relud): these dependencies are installed separately, relocated, and patched to reference the
35-
# new location (aka shaded), so that they can be installed at the same time as newer versions
36-
COPY --chown=app:app legacy-es-requirements.txt /app/
37-
RUN pip install -U 'pip==24.0' && \
38-
pip install --no-cache-dir --no-deps -r legacy-es-requirements.txt && \
39-
cd /usr/local/lib/python3.11/site-packages/ && \
40-
mv elasticsearch elasticsearch_1_9_0 && \
41-
mv elasticsearch_dsl elasticsearch_dsl_0_0_11 && \
42-
cd elasticsearch_dsl_0_0_11/ && \
43-
sed 's/^from elasticsearch/from elasticsearch_1_9_0/' -i connections.py search.py serializer.py
44-
4534
# Install Python dependencies
4635
COPY requirements.txt /app/
4736
RUN pip install --no-cache-dir --no-deps -r requirements.txt && \

bin/es_cli.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
import json
1414

1515
import click
16-
from elasticsearch_dsl_0_0_11 import Search
17-
from elasticsearch_1_9_0.client import IndicesClient
16+
from elasticsearch_dsl import Search
1817

1918
from socorro import settings
2019
from socorro.external.es.base import generate_list_of_indexes
@@ -107,8 +106,7 @@ def cmd_print_mapping(ctx, index):
107106
crashstorage = get_crashstorage()
108107
doctype = crashstorage.get_doctype()
109108
with crashstorage.client() as conn:
110-
indices_client = IndicesClient(conn)
111-
resp = indices_client.get_mapping(index=index)
109+
resp = conn.indices.get_mapping(index=index)
112110
mapping = resp[index]["mappings"][doctype]["properties"]
113111
click.echo(json.dumps(mapping, indent=2, sort_keys=True))
114112

bin/legacy_es_cli.py

-160
This file was deleted.

bin/permadelete_crash_data.py

-18
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ def cmd_permadelete(ctx, crashidsfile):
7373

7474
crashstorage = build_instance_from_settings(settings.STORAGE)
7575
es_crashstorage = build_instance_from_settings(settings.ES_STORAGE)
76-
legacy_es_crashstorage = None
77-
if settings.ELASTICSEARCH_MODE == "PREFER_NEW":
78-
legacy_es_crashstorage = build_instance_from_settings(
79-
settings.LEGACY_ES_STORAGE
80-
)
8176

8277
crashids = crashid_generator(crashidsfile)
8378

@@ -87,29 +82,16 @@ def cmd_permadelete(ctx, crashidsfile):
8782

8883
data = crashstorage.catalog_crash(crash_id=crashid)
8984
data.extend(es_crashstorage.catalog_crash(crash_id=crashid))
90-
if legacy_es_crashstorage:
91-
data.extend(
92-
f"legacy_{v}"
93-
for v in legacy_es_crashstorage.catalog_crash(crash_id=crashid)
94-
)
9585
click.echo(f">>> before: {data}")
9686

9787
# Delete from storage
9888
click.echo(">>> Deleting from storage ...")
9989
crashstorage.delete_crash(crashid)
10090
click.echo(">>> Deleting from Elasticsearch ...")
10191
es_crashstorage.delete_crash(crashid)
102-
if legacy_es_crashstorage:
103-
click.echo(">>> Deleting from legacy Elasticsearch ...")
104-
legacy_es_crashstorage.delete_crash(crashid)
10592

10693
data = crashstorage.catalog_crash(crash_id=crashid)
10794
data.extend(es_crashstorage.catalog_crash(crash_id=crashid))
108-
if legacy_es_crashstorage:
109-
data.extend(
110-
f"legacy_{v}"
111-
for v in legacy_es_crashstorage.catalog_crash(crash_id=crashid)
112-
)
11395
click.echo(f">>> after: {data}")
11496

11597
end_time = datetime.datetime.now()

bin/setup_services.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ gcs-cli delete "${TELEMETRY_GCS_BUCKET}"
2727
gcs-cli create "${TELEMETRY_GCS_BUCKET}"
2828

2929
# Delete and create Elasticsearch indices
30-
/app/socorro-cmd legacy_es delete
31-
/app/socorro-cmd legacy_es create
32-
ELASTICSEARCH_MODE="${ELASTICSEARCH_MODE:-LEGACY_ONLY}"
33-
if [ "${ELASTICSEARCH_MODE^^}" == "PREFER_NEW" ]; then
34-
/app/socorro-cmd es delete
35-
/app/socorro-cmd es create
36-
fi
30+
/app/socorro-cmd es delete
31+
/app/socorro-cmd es create
3732

3833
# Delete and create Pub/Sub queues
3934
pubsub-cli delete-topic "$PUBSUB_PROJECT_ID" "$PUBSUB_STANDARD_TOPIC_NAME"

bin/test.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ echo ">>> set up environment"
1919
DATABASE_URL="${DATABASE_URL:-}"
2020
SENTRY_DSN="${SENTRY_DSN:-}"
2121
ELASTICSEARCH_URL="${ELASTICSEARCH_URL:-}"
22-
LEGACY_ELASTICSEARCH_URL="${LEGACY_ELASTICSEARCH_URL:-}"
2322

2423
export PYTHONPATH=/app/:$PYTHONPATH
2524
PYTEST="$(which pytest)"
@@ -47,14 +46,10 @@ popd
4746
echo ">>> run tests"
4847

4948
# Run socorro tests
50-
# ignore tests because elasticsearch 8 tests cannot be run with LEGACY_ONLY
51-
ELASTICSEARCH_MODE=LEGACY_ONLY "${PYTEST}" --ignore=socorro/tests/external/es/
52-
# ignore tests because elasticsearch 8 supersearch is not implemented yet
53-
ELASTICSEARCH_MODE=PREFER_NEW "${PYTEST}"
49+
"${PYTEST}"
5450

5551
# Collect static and then run pytest in the webapp
5652
pushd webapp
5753
${PYTHON} manage.py collectstatic --noinput
58-
ELASTICSEARCH_MODE=LEGACY_ONLY "${PYTEST}"
59-
ELASTICSEARCH_MODE=PREFER_NEW "${PYTEST}"
54+
"${PYTEST}"
6055
popd

bin/verify_reqs.sh

-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,3 @@ set -euo pipefail
1414
cp requirements.txt requirements.txt.orig
1515
pip-compile --quiet --generate-hashes --strip-extras
1616
diff requirements.txt requirements.txt.orig
17-
18-
cp legacy-es-requirements.txt legacy-es-requirements.txt.orig
19-
pip-compile --quiet --generate-hashes --unsafe-package=python-dateutil --unsafe-package=six --unsafe-package=urllib3 legacy-es-requirements.in
20-
diff legacy-es-requirements.txt legacy-es-requirements.txt.orig

bin/waitfor_services.sh

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
set -euo pipefail
1414

1515
waitfor --verbose --conn-only "${DATABASE_URL}"
16-
waitfor --verbose "${LEGACY_ELASTICSEARCH_URL}"
1716
waitfor --verbose "http://${PUBSUB_EMULATOR_HOST}"
1817
waitfor --verbose "${STORAGE_EMULATOR_HOST}/storage/v1/b"
1918
waitfor --verbose --codes={200,404} "${SENTRY_DSN}"

docker-compose.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ services:
2525
- gcs-emulator
2626
- pubsub
2727
- postgresql
28-
- legacy-elasticsearch
2928
- elasticsearch
3029

3130
# For development
@@ -42,7 +41,6 @@ services:
4241
- gcs-emulator
4342
- pubsub
4443
- postgresql
45-
- legacy-elasticsearch
4644
- elasticsearch
4745

4846
devcontainer:
@@ -63,7 +61,6 @@ services:
6361
- gcs-emulator
6462
- pubsub
6563
- postgresql
66-
- legacy-elasticsearch
6764
- elasticsearch
6865
volumes:
6966
- .:/app
@@ -78,7 +75,6 @@ services:
7875
- statsd
7976
- gcs-emulator
8077
- pubsub
81-
- legacy-elasticsearch
8278
- elasticsearch
8379
- symbolsserver
8480
command: ["processor"]
@@ -92,7 +88,6 @@ services:
9288
- fakesentry
9389
- statsd
9490
- postgresql
95-
- legacy-elasticsearch
9691
- elasticsearch
9792
command: ["crontabber"]
9893

@@ -107,7 +102,6 @@ services:
107102
- gcs-emulator
108103
- pubsub
109104
- postgresql
110-
- legacy-elasticsearch
111105
- elasticsearch
112106
- memcached
113107
- oidcprovider
@@ -200,12 +194,6 @@ services:
200194
- "8125:8125/udp"
201195
- "8126:8126"
202196

203-
# https://hub.docker.com/_/elasticsearch/
204-
legacy-elasticsearch:
205-
image: mozilla/socorro_elasticsearch:1.4.5
206-
ports:
207-
- "9200:9200"
208-
209197
# https://www.elastic.co/guide/en/elasticsearch/reference/8.16/docker.html
210198
elasticsearch:
211199
build:
@@ -217,7 +205,7 @@ services:
217205
- -Expack.security.enabled=false
218206
- -Ediscovery.type=single-node
219207
ports:
220-
- "9201:9200"
208+
- "9200:9200"
221209

222210
# https://hub.docker.com/_/postgres/
223211
postgresql:

docker/Dockerfile

-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ RUN /tmp/set_up_stackwalker.sh && \
3030
COPY --chown=app:app ./webapp/package*.json /webapp-frontend-deps/
3131
RUN cd /webapp-frontend-deps/ && npm install
3232

33-
# NOTE(relud): these dependencies are installed separately, relocated, and patched to reference the
34-
# new location (aka shaded), so that they can be installed at the same time as newer versions
35-
COPY --chown=app:app legacy-es-requirements.txt /app/
36-
COPY docker/set_up_legacy_es_requirements.sh /tmp/set_up_legacy_es_requirements.sh
37-
RUN /tmp/set_up_legacy_es_requirements.sh && \
38-
rm /tmp/set_up_legacy_es_requirements.sh
39-
4033
COPY --chown=app:app requirements.txt /app/
4134
RUN pip install --no-cache-dir --no-deps -r requirements.txt && \
4235
pip check --disable-pip-version-check

docker/config/local_dev.env

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ STATSD_HOST=statsd
2424
# -------------
2525

2626
ELASTICSEARCH_URL=http://elasticsearch:9200
27-
LEGACY_ELASTICSEARCH_URL=http://legacy-elasticsearch:9200
2827

2928

3029
# processor

0 commit comments

Comments
 (0)