Skip to content

Commit 86b7b32

Browse files
committed
Bug 1527868 - Vagrant/Travis: Remove Elasticsearch server
To ensure the CI and local environments match stage/production (where Elasticsearch is not configured) and don't run differing code-paths due to the various `ELASTICSEARCH_URL` conditionals used in auto-classify. At such time when work on the fuzzy auto-classify matcher continues, this can be reverted.
1 parent 681cc6d commit 86b7b32

File tree

8 files changed

+6
-37
lines changed

8 files changed

+6
-37
lines changed

Vagrantfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Vagrant.configure("2") do |config|
1313
config.vm.network "forwarded_port", guest: 8000, host: 8000, host_ip: "127.0.0.1"
1414
# MySQL
1515
config.vm.network "forwarded_port", guest: 3306, host: 3308, host_ip: "127.0.0.1"
16-
# Elasticsearch
17-
config.vm.network "forwarded_port", guest: 9200, host: 9201, host_ip: "127.0.0.1"
1816

1917
if !Vagrant::Util::Platform.windows?
2018
# On platforms where NFS is used (ie all but Windows), we still have to use

bin/travis-setup.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set -euo pipefail
55
# This script must be sourced, so that the environment variables are set in the calling shell.
66
export BROKER_URL='amqp://guest:guest@localhost:5672//'
77
export DATABASE_URL='mysql://root@localhost/test_treeherder'
8-
export ELASTICSEARCH_URL='http://127.0.0.1:9200'
98
export REDIS_URL='redis://localhost:6379'
109
export TREEHERDER_DJANGO_SECRET_KEY='secretkey-of-at-50-characters-to-pass-check-deploy'
1110
# Suppress warnings shown during pytest startup when using `python2 -3` mode.
@@ -18,16 +17,6 @@ setup_services() {
1817
echo '-----> Installing RabbitMQ'
1918
sudo apt-get install --no-install-recommends rabbitmq-server
2019

21-
ELASTICSEARCH_VERSION="6.6.0"
22-
if [[ "$(dpkg-query --show --showformat='${Version}' elasticsearch 2>&1)" != "$ELASTICSEARCH_VERSION" ]]; then
23-
echo '-----> Installing Elasticsearch'
24-
curl -sSfo /tmp/elasticsearch.deb "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.deb"
25-
sudo dpkg -i --force-confnew /tmp/elasticsearch.deb
26-
sudo systemctl restart elasticsearch
27-
else
28-
sudo systemctl start elasticsearch
29-
fi
30-
3120
echo '-----> Configuring MySQL'
3221
# Using tmpfs for the MySQL data directory reduces pytest runtime by 30%.
3322
sudo mkdir /mnt/ramdisk
@@ -39,9 +28,6 @@ setup_services() {
3928

4029
echo '-----> Starting redis-server'
4130
sudo systemctl start redis-server
42-
43-
echo '-----> Waiting for Elasticsearch to be ready'
44-
while ! curl "${ELASTICSEARCH_URL}" &> /dev/null; do sleep 1; done
4531
}
4632

4733
setup_python_env() {

docs/backend_tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ hidden by default. For TaskCluster, edit the task definition to include the
6868

6969
## Connecting to Services Running inside Vagrant
7070

71-
Treeherder uses various services to function, eg MySQL, Elasticsearch, etc.
71+
Treeherder uses various services to function, eg MySQL, etc.
7272
At times it can be useful to connect to them from outside the Vagrant VM.
7373

7474
The Vagrantfile defines how internal ports are mapped to the host OS' ports.
@@ -91,7 +91,7 @@ With MySQL exposed at port 3308 you can connect to it from your host OS with the
9191
- user: `root`
9292
- password: leave blank
9393

94-
Other services running inside the VM, such as Elasticsearch, can be accessed in the same way.
94+
Other services running inside the VM, can be accessed in the same way.
9595

9696
[client git log]: https://github.com/mozilla/treeherder/commits/master/treeherder/client
9797
[client.py]: https://github.com/mozilla/treeherder/blob/master/treeherder/client/thclient/client.py

treeherder/autoclassify/matchers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def elasticsearch_matcher(text_log_error):
6262
Uses a filtered search checking test, status, expected, and the message
6363
as a phrase query with non-alphabet tokens removed.
6464
"""
65+
# Note: Elasticsearch is currently disabled in all environments (see bug 1527868).
6566
if not settings.ELASTICSEARCH_URL:
6667
return []
6768

treeherder/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@
352352
INSTALLED_APPS.append('debug_toolbar')
353353

354354
# Elasticsearch
355-
ELASTICSEARCH_URL = env.str('ELASTICSEARCH_URL', default='')
355+
# Note: Elasticsearch is currently disabled in all environments (see bug 1527868).
356+
ELASTICSEARCH_URL = env.str('ELASTICSEARCH_URL', default=None)
356357

357358
# Rest Framework
358359
REST_FRAMEWORK = {

treeherder/config/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def connection_should_use_tls(url):
5-
# Services such as RabbitMQ/Elasticsearch running on Travis do not yet have TLS
5+
# Services such as RabbitMQ/MySQL running on Travis do not yet have TLS
66
# certificates set up. We could try using TLS locally using self-signed certs,
77
# but until Travis has support it's not overly useful.
88
return furl(url).host != 'localhost'

vagrant/env.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export PATH="${HOME}/firefox:${HOME}/python/bin:${PATH}"
44

55
export BROKER_URL='amqp://guest:guest@localhost//'
66
export DATABASE_URL='mysql://root@localhost/treeherder'
7-
export ELASTICSEARCH_URL='http://localhost:9200'
87
export REDIS_URL='redis://localhost:6379'
98

109
export TREEHERDER_DEBUG='True'

vagrant/setup.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ PYTHON_DIR="$HOME/python"
1515

1616
cd "$SRC_DIR"
1717

18-
ELASTICSEARCH_VERSION="6.6.0"
1918
GECKODRIVER_VERSION="0.24.0"
2019
PYTHON_VERSION="$(sed 's/python-//' runtime.txt)"
2120
PIP_VERSION="19.0.2"
@@ -56,7 +55,6 @@ sudo -E apt-get -yqq update
5655
sudo -E apt-get -yqq -o 'Dpkg::Options::=--force-confnew' dist-upgrade
5756
# libdbus-glib-1-2, libgtk-3.0 and libxt6 are required by Firefox
5857
# gcc and libmysqlclient-dev are required by mysqlclient
59-
# openjdk-8-jre-headless is required by Elasticsearch
6058
sudo -E apt-get -yqq install --no-install-recommends \
6159
gcc \
6260
libdbus-glib-1-2 \
@@ -65,21 +63,10 @@ sudo -E apt-get -yqq install --no-install-recommends \
6563
libxt6 \
6664
mysql-server-5.7 \
6765
nodejs \
68-
openjdk-8-jre-headless \
6966
rabbitmq-server \
7067
redis-server \
7168
yarn
7269

73-
if [[ "$(dpkg-query --show --showformat='${Version}' elasticsearch 2>&1)" != "$ELASTICSEARCH_VERSION" ]]; then
74-
echo '-----> Installing Elasticsearch'
75-
curl -sSfo /tmp/elasticsearch.deb "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.deb"
76-
sudo dpkg -i --force-confnew /tmp/elasticsearch.deb
77-
# Override the new ES 5.x default minimum heap size of 2GB.
78-
sudo sed -i 's/.*ES_JAVA_OPTS=.*/ES_JAVA_OPTS="-Xms256m -Xmx1g"/' /etc/default/elasticsearch
79-
sudo systemctl enable elasticsearch.service 2>&1
80-
sudo systemctl restart elasticsearch.service
81-
fi
82-
8370
if ! cmp -s vagrant/mysql.cnf /etc/mysql/conf.d/treeherder.cnf; then
8471
echo '-----> Configuring MySQL'
8572
sudo cp vagrant/mysql.cnf /etc/mysql/conf.d/treeherder.cnf
@@ -131,9 +118,6 @@ sudo mysql -e 'ALTER USER root@localhost IDENTIFIED WITH mysql_native_password B
131118
mysql -u root -e 'GRANT ALL PRIVILEGES ON *.* to root@"%"'
132119
mysql -u root -e 'CREATE DATABASE IF NOT EXISTS treeherder'
133120

134-
echo '-----> Waiting for Elasticsearch to be ready'
135-
while ! curl "$ELASTICSEARCH_URL" &> /dev/null; do sleep 1; done
136-
137121
echo '-----> Running Django migrations and loading reference data'
138122
./manage.py migrate --noinput
139123
./manage.py load_initial_data

0 commit comments

Comments
 (0)