Граф коммитов

161 Коммитов

Автор SHA1 Сообщение Дата
Ed Morley deb1fc86b7 Bug 1384518 - Switch from Memcached to Redis
Since:
* Redis has additional features we need (eg for bug 1409679)
* the Redis server, python client and Django backend are more
  actively maintained (so have persistent connections/pooling that
  actually works, which gives a big perf win)
* we can use Heroku's own Redis addon rather than relying on a
  third-party's (to hopefully prevent a repeat of the certificate
  expiration downtime)

This commit:
* Switches pylibmc/django-pylibmc to redis-py/django-redis, and
  configures the new backend according to:
  http://niwinz.github.io/django-redis/latest/
  https://github.com/andymccurdy/redis-py
* Uses redis-py's native support for TLS to connect to the Heroku
  Redis server's stunnel port directly, avoiding the complexity of
  using a buildpack to create an stunnel between the dyno and server:
  https://devcenter.heroku.com/articles/securing-heroku-redis#connecting-directly-to-stunnel
* Uses explicit `REDIS_URL` values on Travis/Vagrant rather than
  relying on the django-environ `default` value (for parity with
  how we configure `DATABASE_URL` and others).
* Removes the pylibmc connection-closing workaround from `wsgi.py`.

Note: Whilst the Heroku docs suggest using `django-redis-cache`, it's
not as actively maintained, so we're using `django-redis` instead:
https://devcenter.heroku.com/articles/heroku-redis
https://github.com/niwinz/django-redis
https://github.com/sebleier/django-redis-cache

Before this is merged, Heroku Redis instances will need to be created
for stage/production (prototype done) - likely on plan `premium-3`:
https://elements.heroku.com/addons/heroku-redis

We'll also need to pick an eviction policy:
https://devcenter.heroku.com/articles/heroku-redis#maxmemory-policy

Once deployed, the `memcachier-tls-buildpack` buildpack will no longer
be required and can be removed from prototype/stage/prod, along with
the `TREEHERDER_MEMCACHED` environment variable and Memcachier addon.
2018-01-21 14:41:35 +00:00
Ed Morley d9909d5fa2 Bug 1384518 - Add a Redis server instance to Vagrant/Travis
In preparation for later commits, this installs `redis-server` in
the Vagrant environment, and starts the pre-installed (but stopped
by default) `redis-server` on Travis:
https://docs.travis-ci.com/user/database-setup/#Redis

Production/stage/prototype will use Heroku's own Redis add-on:
https://elements.heroku.com/addons/heroku-redis
2018-01-21 14:41:35 +00:00
Ed Morley bc0ca97102
Bug 1419965 - Remove the estimated job time remaining backend (#2990)
The UI has already been removed. This cleans up the data ingestion
and removes the `JobDuration` model, however leaves the `running_eta`
field on the `Job` model for the next time that table is touched (since
the table is large, so altering the schema would likely require
downtime).
2017-12-04 22:09:38 +00:00
Ed Morley e55e58c834 Bug 1420891 - Docs: Test building the docs on Travis 2017-11-28 16:56:45 +00:00
Ed Morley e969648592 Bug 1389572 - Travis: Skip Elasticsearch install if version matches
Since after my update to the Travis images, the pre-installed version
of Elasticsearch matches the one we're looking for, meaning the
download/install can be skipped, saving time.
2017-11-27 16:39:02 +00:00
Ed Morley 4b4a7341c3 Bug 1389572 - Travis: Don't install custom yarn
Since I've adjusted the Travis images to always use the latest yarn
at the time the images are created, so it's not worth installing the
latest version at every runtime:
https://github.com/travis-ci/travis-cookbooks/pull/935
2017-11-27 16:39:02 +00:00
Ed Morley 3f5ef6b352 Bug 1418956 - Set yarn's no-bin-links option via .yarnrc
To save having to pass it each time when using `yarn {install,add}`.
2017-11-20 18:59:26 +00:00
Ed Morley be843a8837 Bug 1414255 - Fix shellcheck warnings about sourced files
```
SC1090: Can't follow non-constant source. Use a directive to specify location.
SC1091: Not following: /etc/profile.d/treeherder.sh was not specified as input (see shellcheck -x).
```

See:
https://github.com/koalaman/shellcheck/wiki/SC1090
https://github.com/koalaman/shellcheck/wiki/SC1091
2017-11-05 20:53:29 +00:00
Ed Morley 37b2c9855e Bug 1414255 - Fix shellcheck warnings about missing quotes
`SC2086: Double quote to prevent globbing and word splitting`

See:
https://github.com/koalaman/shellcheck/wiki/SC2086
2017-11-05 20:53:29 +00:00
Ed Morley 934c6a2ab9 Bug 1414255 - Enable bash 'strict mode' in all shell scripts
This makes some of the error checking in `runtest.sh` redundant.
The shebangs have also been made more consistent.

See:
http://redsymbol.net/articles/unofficial-bash-strict-mode/
2017-11-05 20:53:29 +00:00
Ed Morley 9b3b216b86
Bug 1414667 - Travis: Test using Firefox beta instead of stable (#2916)
Since it reduces the intermittent failure rate in bug 1401048 and is
also likely more representative of what people are using to access
Treeherder in production (whilst still being more stable than Nightly).
2017-11-05 20:48:48 +00:00
Ed Morley 2ad4b2e0ab
Bug 1414247 - Travis: Use Firefox headless mode instead of xvfb (#2907)
Now that Firefox supports being run in headless mode, we no longer
need to use the xvfb workaround on Travis.
2017-11-03 16:10:48 +00:00
Ed Morley 624d2f43a9 Bug 1414094 - Travis: Move setup steps to a reusable script
This:
* reduces duplication
* opens the door to sharing functionality with `vagrant/setup.sh`
* will make it easier to visualise the Travis bootstrap process
  when moving both Travis and Vagrant to a unified Docker environment.
2017-11-03 12:01:26 +00:00
Ed Morley 08430370bd Bug 1176412 - Heroku: Remove New Relic host display name workaround (#2844)
Previously New Relic displayed the hostname for each dyno as
"Dynamic Hostname", due to the randomly generated Heroku hostnames.
As such, we had to set a manual display name to identify the dyno
type reported for each transaction. This was only partly useful, since
New Relic doesn't use it in all places of their UI.

However the New Relic Python agent 2.96.0.80 release has now added
official support for Heroku dyno names, making this workaround
unnecessary:
https://docs.newrelic.com/docs/release-notes/agent-release-notes/python-release-notes/python-agent-252040
d2c4aa097e (diff-a57cabe85e94b1050fb4ff1749effcf5R335)
2017-10-17 18:43:15 +02:00
Ed Morley bbbaf01c6c Bug 1394128 - Heroku: Fail gracefully if revision.txt inaccessible (#2754)
This allows deploys to succeed even if the live version of revision.txt
is not currently accessible, such as when maintenance mode is enabled.
2017-09-06 15:50:15 +01:00
Alisha Aneja e842ae7701 Bug 1330773 - Use the term 'runnablejobs' rather than 'allthethings' (#2743) 2017-09-03 22:10:56 +01:00
Ed Morley da1f9ebbf8 Bug 1394593 - Heroku: Use .profile instead of set-env
set-env was renamed in the buildpack to set_env, breaking this script.
Rather than just renaming our usage, it makes more sense to stop using
what is really an internal buildpack API and instead use `.profile`:
https://devcenter.heroku.com/articles/dynos#the-profile-file
2017-09-01 18:56:40 +01:00
Ed Morley 1fbf5dff99 Bug 1394593 - Heroku: Use 'DYNO' to check if running on Heroku
On Heroku, the environment variable `DYNO` is always set in the
environment. As such, we can just use that to determine whether
code is being run on Heroku, rather than having to add our own
environment variable.
2017-09-01 18:56:40 +01:00
Ed Morley 33fa97ec84 Bug 1387487 - Reduce gunicorn maximum request time to 20 seconds
To ensure that:
* the Heroku router's 30 second timeout doesn't beat gunicorn to it,
  given that routing time is included in Heroku's timing
* the app is more likely to remain responsive, when receiving many
  badly filtered API calls
2017-08-04 18:49:35 +02:00
Max Chehab c6e0c26bc8 Bug 1336272 - Refactor changing wording from resultset to push (#2644)
Change of new environment variable `PULSE_PUSH_SOURCES`.

Keep old `publish-resultset-runnable-job-action` task name by creating a 
method that points to `publish_push_runnable_job_action`.
2017-08-04 09:38:57 -07:00
Ed Morley 2ae5c57959 Bug 1365567 - Remove unused libmysqlclient vendoring support
All environments are now using the native MySQL 5.7 libmysqlclient
library, so the custom vendoring script is unused. The tests checking
that the library isn't vulnerable aren't needed any more, since
heroku-16 doesn't even have that package installed (it's not available
on Xenial).
2017-08-03 11:53:16 +01:00
Ed Morley beb4d6740e Bug 1365567 - Heroku: Don't vendor libmysqlclient on Heroku-16
Since the OS package present in the Heroku-16 image is now new enough
(v5.7.x) that it's not affected by the MITM issue. See:
https://devcenter.heroku.com/articles/stack-packages
2017-07-18 11:27:08 +01:00
Ed Morley 5de04f5940 Bug 1381242 - Heroku: Remove workaround for buildpack caching bug
Since the Python buildpack now restores the cache prior to the
`bin/pre_compile` script being run, which makes the workaround
unnecessary and in fact breaks clean installs.
2017-07-15 17:17:34 +01:00
William Lachance 5cb5046e41 `yarn run foo` -> `yarn foo` (#2597)
The run is redundant.
2017-06-29 11:32:54 -07:00
Ed Morley de7b3973c3 Bug 1363444 - Vagrant: Update to Ubuntu 16.04
At some point soon we'll want to switch Heroku stage/production to
their new Heroku-16 (Ubuntu 16.04) stack, so it makes sense to trial
it locally first. Their Heroku-16 docker image will make switching
to docker simpler too.

Notable changes to the provision steps:
* We're using the Bento boxes rather than the 'official' Canonical
  ones, at the recommendation of Vagrant:
  https://www.vagrantup.com/docs/boxes.html#official-boxes
* openjdk-8-jre-headless is now available from the ubuntu.com
  repository, so doesn't require a PPA.
* There isn't an official mysql-server-5.6 package (only 5.7+), so
  we have to start using a PPA.
* Services must now be managed using systemd rather than SysV init.
* The `eth0` network interface has changed name:
  https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
* The `vendor-libmysqlclient.sh` script will still be run on Ubuntu
  14.04 on Travis/Heroku for now, so has to be compatible with both.
* The previous temporary cleanup steps can be removed since the
  vagrant destroy means a clean slate.
2017-05-10 19:52:18 +01:00
Ed Morley f9d1f89a9b Bug 1363333 - Vagrant: Set PATH instead of activating virtualenv
Adds the virtualenv directory to `PATH` in `env.sh`, to save having
to activate the virtualenv (which is about to be removed) or set
`PATH` in each of the wrapper bin scripts.
2017-05-09 12:44:19 +01:00
Ed Morley f6e320aa92 Bug 1340132 - Reduce usage of --maxtasksperchild with celery
Now we're no longer using datasource, the memory leaks previously
seen have gone. As such there is no need to make the celery worker
processes restart so frequently (they will now only be restarted at
the daily Heroku dyno restart), which will improve performance.

In addition, this will reduce the number of transactions that don't get
reported to New Relic (when the maxtasksperchild threshold is
reached, the worker is forcibly killed before it can submit the
New Relic payload).

The log parser tasks have been left unchanged for now, since they
appear to still be leaking.
2017-05-06 17:30:57 +01:00
Ed Morley 884fffefea Bug 1357595 - Update libmysqlclient from 5.7.14 to 5.7.18
Also switches to the official URLs (that 302 redirect) rather than
direct-linking, since the official URLs are now HTTPS. Avoids potential
breakage in the future as the CDN internal URLs change.

Changelog (most of the changes only affect mysql-server):
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-15.html
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-16.html
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-17.html
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-18.html
2017-04-19 00:47:55 +01:00
Ed Morley 42f240dbf8 Bug 1349405 - Delete .heroku/yarn/ during post_compile
Since it avoids including 4500 unused files (28MB) in the slug, now that
we're using the yarn support added to newer versions of the nodejs
buildpack.
2017-03-28 13:55:50 +01:00
Ed Morley 51c386ee21 Bug 1343928 - Switch from npm to yarn
Since it's faster, deterministic and doesn't given obscure errors when
using `--no-bin-links` (which is required for both npm and yarn on
Windows hosts), and as such unblocks the work in bug 1343624.

Many of the commands are the same as with npm. See:
https://yarnpkg.com/en/docs/usage
2017-03-13 15:27:46 +00:00
Ed Morley 21abe6ed75 Bug 1343624 - Add `npm run build` as an alias of `grunt build`
Routing commands via npm/yarn is preferred, since it avoids
having to do global installs of grunt-cli, which simplifies contributor
setup, and means less effort when we switch to Yarn (since it requires
manual PATH setup for globally installed packages).
2017-03-13 15:27:46 +00:00
Ed Morley 6502ec24b1 Bug 1340123 - Stop using --max-requests with gunicorn
Since hopefully now we're no longer using datasource, the leaks should
have gone. The gunicorn processes will now only be restarted at the
daily Heroku dyno restart, rather than multiple times per minute,
improving performance.
2017-02-16 17:38:01 +00:00
jgraham 10677eda26 Bug 1339510 - Remove unused detect intermittents code. (#2169) 2017-02-15 22:27:35 +00:00
Ed Morley f397b9819b Bug 1326207 - Replace Django system check hack with --fail-level
Django 1.10 added a new `--fail-level` option that allows overriding the
default of only exiting 1 for ERROR and above, avoiding the need to rely
on awk hacks:
https://docs.djangoproject.com/en/1.10/ref/django-admin/#check
2017-01-10 20:39:37 +00:00
William Lachance 012df34580 Bug 1329002 - Remove last pieces of and references to datasource 2017-01-06 15:01:19 -05:00
Armen Zambrano G ed8e39221d Bug 1306709 - Add SETA to Treeherder 2017-01-05 14:33:55 -05:00
Ed Morley 4df19bddd2 Bug 1318021 - Vagrant: Stop using log files for gunicorn/celery output
Outputting to the console rather than a log file:
* is more user-friendly during development
* is more consistent with Heroku
* means the Vagrant-specific Django LOGGING config is now closer to the
one in settings.py, and so more easily combined with it

Both gunicorn and celery default to outputting to stdout/stderr, so the
`logfile` options can be omitted entirely.
2016-11-23 11:47:04 +00:00
Ed Morley 08f16b31eb Bug 1310727 - Switch to new download URLs for libmysqlclient
The packages have been moved under the archives path, since there are
newer releases now available. The official download link has remained
unchanged, however it's a 302 redirect to a non-HTTPS version of these
links, so we intentionally deep-link, even if it means the URLs will
occasionally need updating.

Fixes the 404 whilst Vagrant provisioning, and failures that would occur
with a clean cache on Heroku/Travis.
2016-10-18 01:14:24 +01:00
William Lachance 61d89cd1a1 Bug 1308528 - Serialize ingestion of job data (#1906) 2016-10-11 17:13:42 -04:00
William Lachance 0300fb69ba Bug 1303055 - Increase the number of log processing workers (#1857)
This should increase throughput, especially in cases where we are backlogged
due to network latency.
2016-09-15 11:51:34 -04:00
Cameron Dawson 9c508817fd Bug 1302529 - Add store_pulse_resultsets to bin script 2016-09-13 13:15:17 -07:00
William Lachance f0105d47f5 Bug 1258861 - Move text log steps and errors into main database (#1696)
This changes ingestion, the API endpoints, and the frontend to match
the new structure. For now we continue to store text_log_summary artifacts,
though they don't do anything anymore.
2016-09-12 12:30:36 -04:00
Ed Morley 0a0a0b78f0 Bug 1299443 - Fix revision.txt on Heroku when SERVE_MINIFIED_UI is unset
Previously `<site-root>/revision.txt` would 404 if `SERVE_MINIFIED_UI`
was unset on Heroku, which would then cause the next deploy to fail.

It's now made available in both the `ui/` and `dist/` directories, so
it can be found regardless of the value of `SERVE_MINIFIED_UI`.
2016-09-06 19:25:08 +01:00
Cameron Dawson a236e69474 Bug 1264074 - Add execute permission to run_read_pulse_resultsets 2016-08-30 08:34:27 -07:00
camd b2e5e714aa Bug 1264074 - Use Pulse for creation of Github resultsets (#1692)
* Bug 1264074 - Move to_timestamp function to a reusable location

* Bug 1264074 - Refactor JobConsumer to have a PulseConsumer super class

Much of what was in the JobConsumer is reusable by the upcoming
ResultsetConsumer.  So refactor those parts out so that each specific
consumer can reuse code as much as possible.

* Bug 1264074 - Add ability to ingest Github Resultsets via Pulse

This introduces a ResultsetConsumer and a read_pulse_resultsets
management command to ingest resultsets from the TaskCluster
github exchanges.

When a supported Github repo has a Pull Request created or
updated, or a push is made to master, then it will kick off a
Pulse message.  We will receive it and then fetch any additional
information we need from github's API and store the Resultset.

This follows a very similar pattern to the Job Pulse ingestion.

* Bug 1264074 - Old code/comments cleanup

* Bug 1264074 - Tests for the Github resultset pulse loader
2016-08-22 16:29:55 -07:00
Ed Morley b3fc92d009 Bug 1289156 - Clean up vendor-libmysqlclient.sh bash conditional
We're using Bash errexit mode (`set -e`) so cannot directly use a
command that returns non-zero inside `[` style brackets (unless in a
`$(...)`), however the `(` form does work with errexit and is cleaner.
2016-08-11 00:48:21 +01:00
Ed Morley 34fdb458ad Bug 1289156 - Final tweaks for libmysqlclient deploy on Heroku/SCL3
There's a strange bug when creating relative symlinks on top of an
already existing symlink, in that the target resolves to the wrong file.
As such, we now explicitly check for an existing symlink first, to avoid
overwriting.

The SCL3 system check disabling has also been tweaked since #1770, since
the `HOSTNAME` environment variable doesn't appear to be set during
deploy, even though it appears in `env` on the same machine.

Yey for deployment code that can only really be tested by deploying \o/
2016-08-10 23:34:43 +01:00
Ed Morley 2f4f5019df Bug 1289156 - Update the Heroku PATH workaround so pip can be found
The Heroku pre_compile script is currently run prior to the cache being
restored (https://github.com/heroku/heroku-buildpack-python/pull/321),
which means we have to tweak PATH so vendor-libmysqlclient.sh can find
the binaries from the cache instead of the app directory.

However the workaround added in #1770 only added one of the two extra
required PATHs, this adds the other.

Prior to this the buildpack compile would output:
> ./bin/vendor-libmysqlclient.sh: line 65: pip: command not found

...and so wouldn't purge the old mysqlclient package, which is needed to
force recompilation against the newer libmysqlclient.

Once the PR against heroku-buildpack-python is merged, these workarounds
can be removed.
2016-08-10 14:34:55 +01:00
Ed Morley 3b1e45ce0c Bug 1289156 - Vendor libmysqlclient 5.7 to protect against CVE-2015-3152
The latest versions of libmysqlclient 5.5/5.6 (used by mysqlclient) are
still vulnerable to TLS stripping, even after last year's backports of
5.7.x fixes:
  - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3152
  - http://bugs.mysql.com/bug.php?id=82383

Ideally we'd just use the standalone Connector/C library instead of the
libmysqlclient packages, however the latest release is too old:
  - http://bugs.mysql.com/bug.php?id=82448

Heroku's cedar-14 stack comes with libmysqlclient 5.5.x, so until it is
updated to 5.7.x (see https://github.com/heroku/stack-images/pull/38) we
must manually vendor 5.7.x ourselves, so that connections between the
Heroku dynos and our public RDS instances are secure. We can do this and
still remain on MySQL server 5.6, since newer client releases are
backwards compatible with older server versions.

Whilst the Vagrant/Travis MySQL instances don't use TLS (and so aren't
affected), we still want them to use libmysqlclient 5.7, to be
consistent with production.

Installing the newer libmysqlclient isn't sufficient on it's own. Any
packages compiled against the older version (in our case mysqlclient)
need to be recompiled. We ensure this happens by pip uninstalling the
existing package if it was already installed.
2016-08-10 11:45:08 +01:00
Cameron Dawson b99e23ba1b Bug 1266229 - make run_read_pulse_jobs executable 2016-06-07 12:02:19 -07:00