Skip to content

Commit

Permalink
bug-1912356: Add elasticsearch 8 instance in dev (#6686)
Browse files Browse the repository at this point in the history
  • Loading branch information
relud authored Sep 3, 2024
1 parent 4ccd794 commit 0a13fce
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
5 changes: 4 additions & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ echo ">>> set up environment"
DATABASE_URL="${DATABASE_URL:-}"
SENTRY_DSN="${SENTRY_DSN:-}"
ELASTICSEARCH_URL="${ELASTICSEARCH_URL:-}"
LEGACY_ELASTICSEARCH_URL="${LEGACY_ELASTICSEARCH_URL:-}"

export PYTHONPATH=/app/:$PYTHONPATH
PYTEST="$(which pytest)"
Expand All @@ -27,10 +28,12 @@ PYTHON="$(which python)"
echo ">>> wait for services to be ready"

urlwait "${DATABASE_URL}"
urlwait "${ELASTICSEARCH_URL}"
urlwait "${LEGACY_ELASTICSEARCH_URL}"
urlwait "http://${PUBSUB_EMULATOR_HOST}" 10
urlwait "${STORAGE_EMULATOR_HOST}/storage/v1/b" 10
python ./bin/waitfor.py --verbose --codes=200,404 "${SENTRY_DSN}"
# wait for this last because it's the slowest to start
urlwait "${ELASTICSEARCH_URL}" 10

echo ">>> build queue things and db things"

Expand Down
22 changes: 19 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- statsd
- pubsub
- postgresql
- legacy-elasticsearch
- elasticsearch
volumes:
- .:/app
Expand All @@ -33,6 +34,7 @@ services:
- gcs-emulator
- pubsub
- postgresql
- legacy-elasticsearch
- elasticsearch
volumes:
- .:/app
Expand All @@ -49,6 +51,7 @@ services:
- gcs-emulator
- pubsub
- postgresql
- legacy-elasticsearch
- elasticsearch

devcontainer:
Expand All @@ -69,6 +72,7 @@ services:
- gcs-emulator
- pubsub
- postgresql
- legacy-elasticsearch
- elasticsearch
volumes:
- .:/app
Expand All @@ -83,6 +87,7 @@ services:
- statsd
- gcs-emulator
- pubsub
- legacy-elasticsearch
- elasticsearch
- symbolsserver
command: ["processor"]
Expand All @@ -98,6 +103,7 @@ services:
- fakesentry
- statsd
- postgresql
- legacy-elasticsearch
- elasticsearch
command: ["crontabber"]
volumes:
Expand All @@ -114,6 +120,7 @@ services:
- gcs-emulator
- pubsub
- postgresql
- legacy-elasticsearch
- elasticsearch
- memcached
- oidcprovider
Expand Down Expand Up @@ -214,12 +221,21 @@ services:
- "8126:8126"

# https://hub.docker.com/_/elasticsearch/
# Note: This image is deprecated, but the new one requires fiddling.
elasticsearch:
legacy-elasticsearch:
image: mozilla/socorro_elasticsearch:1.4.5
ports:
- "9200:9200"
- "9300:9300"

# https://www.elastic.co/guide/en/elasticsearch/reference/8.14/docker.html
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.14.3
mem_limit: 1g
command:
- bin/elasticsearch
- -Expack.security.enabled=false
- -Ediscovery.type=single-node
ports:
- "9201:9200"

# https://hub.docker.com/_/postgres/
postgresql:
Expand Down
1 change: 1 addition & 0 deletions docker/config/local_dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ STATSD_HOST=statsd
# -------------

ELASTICSEARCH_URL=http://elasticsearch:9200
LEGACY_ELASTICSEARCH_URL=http://legacy-elasticsearch:9200


# processor
Expand Down
6 changes: 5 additions & 1 deletion socorro/mozilla_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ def _or_none(val):
default="^socorro[0-9]{6}$",
doc="Regex for matching Elasticsearch index names.",
),
"url": _config("ELASTICSEARCH_URL", doc="Elasticsearch url."),
"url": _config(
"LEGACY_ELASTICSEARCH_URL",
alternate_keys=["ELASTICSEARCH_URL"],
doc="Elasticsearch url.",
),
},
}

Expand Down

0 comments on commit 0a13fce

Please sign in to comment.