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

112 Коммитов

Автор SHA1 Сообщение Дата
Cameron Dawson b99e23ba1b Bug 1266229 - make run_read_pulse_jobs executable 2016-06-07 12:02:19 -07:00
Cameron Dawson 3402f00fbc Bug 1266229 - Create store_pulse_jobs queue and prep to turn on Pulse ingestion
Rename ``ingest_from_pulse`` management command to ``read_pulse_jobs`` to
indicate that this step does not actually do any ingesting.  It just populates
the celery queue ``store_pulse_jobs`` that DOES do the actual ingesting.
2016-06-01 16:31:14 -07:00
Ed Morley 53cd879c4d Bug 1276249 - Heroku: Wrap deploy migration/init with newrelic wrapper
This will give us greater visibility into slow migrations and help
correlate them against any perf issues seen elsewhere at the same time.
2016-05-27 18:43:12 +01:00
Ed Morley 92793e569e Bug 1191934 - Remove the now-redundant fetch-missing-pushlogs task
The task was a workaround for us missing pushes, however the root causes
of these have since been fixed.
2016-05-27 15:47:04 +01:00
Ed Morley a54d292673 Bug 1275761 - Remove the now unused high priority log parsing queues
Since they are unused after bug 1273231.
2016-05-26 15:34:55 +01:00
Cameron Dawson c0af32bf58 Bug 1266584 - Create ingest_from_pulse command script for supervisord 2016-05-25 15:23:37 -07:00
jgraham bb60ca6150 Merge pull request #1460 from mozilla/pre-deploy-skip-env
Bug 1270454 - Allow skipping the Heroku pre_deploy script entirely
2016-05-09 10:06:49 +01:00
Ed Morley 9e20b7934d Bug 1247344 - Enable Django system checks during testing and deployment
`manage.py check --deploy` is now run during Travis testing and as part
of stage/prod/Heroku deployment. It checks for a number of common
configuration mistakes & ensures security best practices are being
followed:
https://docs.djangoproject.com/en/1.8/ref/checks/
2016-05-06 16:09:11 +01:00
Ed Morley 680249cdeb Bug 1270454 - Allow skipping the Heroku pre_deploy script entirely
...by defining 'SKIP_PREDEPLOY' in the environment.

This is useful in cases where we want to avoid potentially destructive
actions (such as running migrations) from taking place, or know that the
migration is just going to time out unless run by hand.
2016-05-05 12:28:25 +01:00
Ed Morley 519bf901ad Bug 1169944 - Use the New Relic wrapper when running scripts locally too
Previously if the `bin/` directory scripts were run in the Vagrant
environment, the processes run would not have been started via the
New Relic wrapper command, since the New Relic licence key is not set.

For greater consistency between Vagrant and production, the wrapper
command is now always used.

This works since `NEW_RELIC_DEVELOPER_MODE` is defined in the Vagrant
environment (thanks to a previous commit in the same bug), which
prevents the agent from trying to submit real data:
https://docs.newrelic.com/docs/agents/python-agent/installation-configuration/python-agent-configuration#developer_mode
2016-05-03 21:21:04 +01:00
James Graham b98f7a81fa Remove support for parsing mozlog json logs 2016-04-19 19:16:08 +01:00
James Graham 7e4084d24f Bug 1252854 - Backend work for matching unstructured and structured log summary lines. 2016-04-19 19:16:08 +01:00
Ed Morley 5b48f4b49b Bug 1258700 - Update to WhiteNoise 3.0
There are some backwards incompatible changes:
http://whitenoise.evans.io/en/latest/changelog.html
https://github.com/evansd/whitenoise/compare/v2.0.6...v3.0

Specifically:
* The CLI compression utility must now be called via
`python -m whitenoise.compress` rather than `python -m whitenoise.gzip`.
* The `whitenoise.django.GzipManifestStaticFilesStorage` storage backend
has moved to `whitenoise.storage.CompressedManifestStaticFilesStorage`.
* The internal `add_files()` method has been split into two and the part
which we need to subclass is now named `update_files_dictionary()`. See:
07f9c0bece
2016-03-30 13:00:23 +02:00
Ed Morley 4b48c50615 Bug 1165229 - Heroku: Add option to make pre-deploy errors non-fatal
When first setting up a new app on Heroku, things like reporting the
deploy to New Relic will fail, since it requires that the app exist on
New Relic. However the app will only be created there once the Python
agent first reports app metadata, which won't happen until after the
deploy (there is no way to create the app via the web interface).

In addition, there may be cases in the future when stage/prod is broken,
and the pre-deploy tasks therefore fail, however we still want the
deploy to proceed.

To avoid needing to constantly edit this file, the environment variable
`IGNORE_PREDEPLOY_ERRORS` can now be set, in cases where the deploy
should continue even if there were errors. (Note this uses the bash 4.2+
`-v` option, see http://stackoverflow.com/a/18448624).
2016-03-17 13:12:43 +00:00
Ed Morley 9f4f439146 Bug 1165229 - Heroku: Report deployments to New Relic
Requires that `NEW_RELIC_APP_NAME` and `NEW_RELIC_API_KEY` be set in the
environment. NB: `NEW_RELIC_API_KEY` is different from the existing
`NEW_RELIC_LICENSE_KEY`.

We're also making use of the runtime-dyno-metadata labs feature, which
sets the slug/release related environment variables used in this PR:
https://devcenter.heroku.com/articles/dyno-metadata
2016-03-17 13:12:40 +00:00
Ed Morley 859230c9bf Bug 1165229 - Heroku: Move the deploy tasks to their own script
Since we'll soon be adding reporting deploys to New Relic, which will be
too verbose to include in the Procfile. Also adds additional log output
(which follows the buildpack compile log formatting convention) to make
it easier to find & follow the release tasks on Papertrail.

Uses the `set -euo pipefail` recommendation from:
http://redsymbol.net/articles/unofficial-bash-strict-mode/
2016-03-17 11:50:21 +00:00
James Graham b6f4533bd7 Bug 1255087 - Add detect_intermittents and autoclassify queues to celery worker files
This will not cause any additional tasks to actually run since
the code that adds messages to these queues is gated on the
AUTOCLASSIFY_JOBS setting.
2016-03-16 17:46:16 +00:00
Ed Morley b2ecb99390 Bug 1213230 - Remove peep.py
Since it's now unused.
2016-02-15 12:06:17 +00:00
Ed Morley aff281fa78 Bug 1246208 - Heroku: Remove manual collectstatic workaround
The Python buildpack has now rewritten the automatic collectstatic
feature, such that it no longer does an unnecessary (and time-consuming)
dry-run every time. As such, we can switch back to the buildpack's
automatic collectstatic:
https://github.com/heroku/heroku-buildpack-python/blob/master/bin/steps/collectstatic

Prior to this landing, I'll update us to the latest version of the
buildpack (using the `heroku buildpacks:set -i X ...` command) and
remove the `DISABLE_COLLECTSTATIC` environment variable.

[ci skip]
2016-02-08 10:21:12 +00:00
Ed Morley 6080a6cf95 Bug 1242471 - Heroku: Remove now obsolete node PATH workaround
Since the original issue has since been fixed.
2016-01-26 12:45:44 +00:00
Ed Morley 32222f4fe2 Bug 1242471 - Heroku: Remove nodejs files at the end of the compile step
Since once the `grunt build` has run they are no longer required, and
only serve to bloat the slug size, increase attack surface & overwrite
the Python .profile.d script's environment variables.
2016-01-26 12:45:44 +00:00
Cameron Dawson f3c0258a13 Bug 1241583 - celery scripts include autoclassify tasks that shouldn't be currently running
These tasks should not be currently running on stage and prod.  They
will be activated in a later PR.

r=emorley@mozilla.com
2016-01-21 11:02:51 -08:00
Ed Morley 8c5e12eadb Bug 1241144 - Update peep from v2.5.0 to v3.0.0
Is now compatible with pip 8.x.

https://github.com/erikrose/peep/releases/tag/3.0
https://github.com/erikrose/peep/compare/2.5...3.0
2016-01-21 11:12:05 +00:00
Ed Morley e98ff52d90 Bug 1230104 - Update peep from v2.4.1 to v2.5.0
* Is now compatible with pip 7.x
* Adds a `peep port` command to facilitate the transition to pip 8's
hashing feature:
https://pip.pypa.io/en/latest/reference/pip_install/#hash-checking-mode
* Fixes bug in which the right way to call `parse_requirements()` would
not be autodetected.

https://github.com/erikrose/peep/compare/2.4.1...2.5
2015-12-03 10:50:39 +00:00
William Lachance a8e663d61d Bug 1228154 - Generate new performance alerts as data is ingested 2015-12-02 13:20:17 -05:00
Ed Morley 620228cbf3 Bug 1196764 - Rename calculate_eta to calculate_durations
Since we're not calculating ETAs (the UI does that once it knows the
start time and expected duraction), we're calculating recent average
durations instead.
2015-11-30 11:36:18 +00:00
Alice Scarpa 5d9e430cac Bug 1194830: Add a runnable_job API endpoint
This creates a 'runnable_job' table in the database, as well as an API
endpoint at /api/project/{branch}/runnable_jobs listing all existing
buildbot jobs and their symbols. A new daily task 'fetch_allthethings' is
added to update the this table.
2015-11-14 13:56:06 -02:00
Ed Morley 50cec5c1fe Bug 1221806 - Change the stage/prod Gunicorn timeout from 120s to 30s
To help prevent excessively demanding queries from having a detrimental
effect on the API/DBs.
2015-11-05 14:22:30 +00:00
Ed Morley 49f4929236 Bug 1210367 - Heroku: Run collectstatic manually to speed up deploy
The Python buildpack's automatic collectstatic is slower, since it does
a `--dry-run` first. To avoid the time penalty of this, we disable it by
setting `DISABLE_COLLECTSTATIC` in the Heroku environment, and run
collectstatic manually in `bin/post_compile`. See:
https://github.com/heroku/heroku-buildpack-python/issues/252
2015-10-10 22:44:49 +01:00
Ed Morley a5999ac2b9 Bug 1197186 - Move wsgi.py to a generic config/ directory
Since it's not specific to the Django app 'webapp'.
2015-10-08 19:59:44 +01:00
Ed Morley 0c79292d68 Bug 1201523 - Run grunt build during the Heroku deploy
This commit relies on the nodejs buildpack being added to the list of
buildpacks for the app, and prior to the Python buildpack. See:
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app

The nodejs buildpack will automatically install the packages listed in
`dependencies` in package.json, so that we have the requirements for
the grunt build. We don't actually need node or all of the files in
node_modules after we've run the grunt build, so in the future could try
and remove them to reduce the resultant slug size (though it only
increased from 55MB to 70MB, so it's not urgent).

The dist directory has been added to `.slugignore` to prevent the
in-repo directory from being uploaded, since we'll be generating a new
one as part of the deploy. Once `dist/` is deleted from master, that
entry can be removed.
2015-09-30 18:34:56 +01:00
James Graham 7b6fa25402 Bug 1204942 - First cut at autoclassify / intermittent orange detection.
This adds an autoclassify command and a detect_intermittents command.
The former is designed to take an incoming job with an error summary
and look for existing results marked as intermittent that are a close
match for the new result. At present only one matcher is implemented;
this requires an exact match in terms of test name, result and error
message. Matching is also constrained to be based on single lines; it
is anticipated that future iterations may add support for matching on
groups of lines.

The detect_intermittents command is designed to take a group of jobs
running on the same push and with the same build job (i.e. same
testsuite, same chunk, etc.) and look for new intermittents to add to
the database. This currently only looks for test failures where there
is at least one green job and one non-green job.

There is currently no UI for seeing matches or for adding new
prototypical intermittents as match candidates. There is also no
integration with bugzilla; future development should add association
of frequent intermittents with bugs.
2015-09-21 22:47:19 +01:00
William Lachance 066f437ca5 Bug 1192976 - Refactor performance data + store in master db 2015-09-14 10:16:25 -04:00
Ed Morley 525866a553 Bug 1201517 - Export a revision.txt containing the Git SHA on Heroku too
The Git SHA is available in the SOURCE_VERSION environment variable:
https://devcenter.heroku.com/articles/buildpack-api#bin-compile-summary

Also update the What's Deployed links to include Heroku in the
comparison alongside stage/prod.
2015-09-08 17:22:24 +01:00
Mauro Doglio ee12c00a03 Bug 1182464 - Add celery task to store the error summary 2015-09-03 10:50:12 +02:00
Ed Morley f6a673a493 Bug 1160561 - Define IS_HEROKU in the dyno profile rather than Heroku env
`IS_HEROKU` isn't something that will differ between stage/prod, and is
not going to change any time soon. So let's just get post_compile to
add it to the dyno profile script, so it's one less variable to have to
remember to set via the Heroku CLI/dashboard.

Quoting from:
http://blog.doismellburning.co.uk/2014/10/06/twelve-factor-config-misunderstandings-and-advice/

"12factor says your applications should read their config from the
environment; it has very little to say about how you populate the
environment ? use whatever works for you".
2015-08-28 10:25:12 +01:00
Ed Morley fce5c7e3c0 Bug 1176412 - Override the hostname reported by New Relic on Heroku
On Heroku, the hostname is just a bunch of hex characters, which the New
Relic dashboard displays as "Dynamic Hostname". The New Relic Python
agent (as of v2.52.0.40) supports overriding this, by setting the
environment variable `NEW_RELIC_PROCESS_HOST_DISPLAY_NAME`:
https://docs.newrelic.com/docs/agents/python-agent/installation-configuration/python-agent-configuration#process_host-display_name

We use the value of `DYNO`, since this is set for us in each dyno's
environment, and is of form "web.2", "worker_pushlog.1" etc. Rather than
prefixing every line in the Procfile, we instead append the export to
the profile script created by the Python buildpack, so it's populated at
runtime on every dyno. See:
https://devcenter.heroku.com/articles/profiled

To do this we make use of the Python buildpack's `set-env` function:
ce3bdb37ba/bin/utils (L29-L32)

Similar to what the buildpack does for its own env defines:
ce3bdb37ba/bin/compile (L190-L198)
2015-08-28 10:25:11 +01:00
Ed Morley 5892c72eb2 Bug 1197796 - Make WhiteNoise serve the static assets gzipped
On Heroku, there is no load balancer or Varnish-like cache in front of
gunicorn, so we must handle gzipping responses in the app.

In order for WhiteNoise to serve gzipped static content, assets must be
gzipped on disk in advance (doing so on-demand in Python would not be
as performant). WhiteNoise will then serve the `.gz` version of files in
preference to the original, if the client indicated it supported gzip.

For assets covered by Django's collectstatic, gzipping the assets only
requires using WhiteNoise's GzipManifestStaticFilesStorage backend,
which wraps Django's ManifestStaticFilesStorage to create hashed+gzipped
versions of static assets:
http://whitenoise.evans.io/en/latest/django.html#add-gzip-and-caching-support

The collectstatic generated files will then contain the file hash in
their filename, so WhiteNoise can also serve them with a large max-age
to avoid further requests if the file contents have not changed.

For the UI files under `dist/`, we cannot rely on the Django storage
backend, since the directory isn't covered by STATICFILES_DIRS (it is
instead made known to WhiteNoise via `WHITENOISE_ROOT`). As such, files
under `dist/` are gzipped via an additional step during deployment. See:
http://whitenoise.evans.io/en/latest/base.html#gzip-support

Files whose extension is on the blacklist, or that are not >5% smaller
when compressed, are skipped during compression.
2015-08-26 22:10:05 +01:00
Ed Morley e401d3d26f Bug 1191080 - Use newrelic-admin run-program rather than manual init 2015-08-19 11:35:17 +01:00
Ed Morley 90ba77e596 Bug 1192801 - Remove per-file MPL boilerplate since it's unnecessary
The MPL 2.0 terms state that as long as a LICENSE file is present, the
per-file header text is not required. See "Exhibit A" at the end of:
https://www.mozilla.org/MPL/2.0/
2015-08-18 23:32:11 +01:00
Cameron Dawson 00cfe6643d Bug 1140349 - Remove the objectstore code
After the previous commit, the Objectstore is effectively "dead code".
So this commit removes all the dead code after anything left over in
the Objectstore has been drained and added to the DB.
2015-07-21 14:13:21 -07:00
Ed Morley b4720652d6 Bug 1181529 - Update peep to v2.4.1
* Tolerates `pip.__version__` being missing, which can happen in arcane
  situations during error handling, obscuring informative tracebacks.
* flake8 warnings are fixed again, so peep.py can be removed from the
  exclude list.

https://github.com/erikrose/peep/releases/tag/2.4.1
https://github.com/erikrose/peep/compare/2.4...2.4.1
2015-07-08 12:39:30 +01:00
Ed Morley 58813b0c51 Bug 1169916 - Stop using Cython to build the log parser
Since it only speeds up parsing by a few percent of total runtime, and
is therefore not worth the added complexity for deployment and local
hack-test-debug cycles when working on the log parser.

The .gitignore and update.py entries will be removed in a later commit,
once the stage/prod src directories have been cleaned up.
2015-06-30 14:51:57 +01:00
Ed Morley f1b0b6957f Bug 1131244 - Use newrelic-admin run-program when running celery beat
Copies the same pattern used in the other celery wrapper scripts.
2015-06-19 13:14:08 +01:00
Ed Morley 5b74d1d9c1 Bug 1164868 - Split the buildapi tasks into {pending,running,4hr} queues
Previously all three of the buildapi ETL ingestion tasks (pending,
running, 4hr) were run under one queue. In order to be able to tell
issues (such as backlogs or leaks) apart, these have now been split onto
their own queues.

On Heroku, these queues now also have a dyno each - which should mean we
can easily tell which is leaking and possibly also downgrade from the
expensive performance dyno even before the leak is fixed.
2015-05-21 15:44:58 +01:00
Cameron Dawson 358e90f685 Bug 1080760 - Auto-generate bug suggestions asynchronously
This introduces two new ways to generate ``Bug suggestions`` artifacts from
a ``text_log_summary`` artifact
1. POST a ``text_log_summary`` on the ``/artifact`` endpoint
2. POST a ``text_log_summary`` with a job on the ``/jobs`` endpoint.

Both of these cases will schedule an asynchronous task to generate the
``Bug suggestions`` artifact with ``celery``.

Artifact generation scenarios:

JobCollections
^^^^^^^^^^^^^^
Via the ``/jobs`` endpoint:

1. Submit a Log URL with no ``parse_status`` or ``parse_status`` set to "pending"
    * This will generate ``text_log_summary`` and ``Bug suggestions`` artifacts
    * Current *Buildbot* workflow

2. Submit a Log URL with ``parse_status`` set to "parsed" and a ``text_log_summary`` artifact
    * Will generate a ``Bug suggestions`` artifact only
    * Desired future state of *Task Cluster*

3. Submit a Log URL with ``parse_status`` of "parsed", with ``text_log_summary`` and ``Bug suggestions`` artifacts
    * Will generate nothing

ArtifactCollections
^^^^^^^^^^^^^^^^^^^
Via the ``/artifact`` endpoint:

1. Submit a ``text_log_summary`` artifact
    * Will generate a ``Bug suggestions`` artifact if it does not already exist for that job.

2. Submit ``text_log_summary`` and ``Bug suggestions`` artifacts
    * Will generate nothing
    * This is *Treeherder's* current internal log parser workflow
2015-05-20 16:28:32 -07:00
Jonathan French 19b71bc4b4 Bug 1164881 - Add MPL2.0 headers to recent treeherder repo files 2015-05-14 11:45:26 -04:00
Mauro Doglio 597282fe58 Bug 1145606 - Setup treeherder to deploy on heroku
I added a Procfile listing all the different python services treeherder needs.
Heroku provides deployment-specific settings via environment variables, so I had to modify the settings file to listen to them where that wasn't the case. I created an enviroment variable IS_HEROKU which allows to have a heroku-only configuration where needed.
The db service is provided by Amazon RDS, which requires a ssl connection. To enable ssl in the MySQLdb python client I had to modify Datasource (and bump up the version used).
The cache service is provided by the memcachier heroku addon. Heroku recommends to use pylibmc, so I set it up according to the docs here https://devcenter.heroku.com/articles/memcachier#python.
The amqp service is provided by the CloudAMQP addon.
I added a post_compile script that runs every time we deploy. We should run every build step we require in there, like static asset minification, collection, etc.
To share the oauth credentials among the various services I used an environment variable. I also added an option to export_project_credentials so that the credentials can be printed to stdout. This should come handy when we will need to update the environment-stored credentials with the ones in the db.
2015-05-14 13:54:41 +01:00
Ed Morley eaf0c2a792 Bug 1155160 - Remove script for generating the vendor directory
We're no longer using the vendor directory & this script wasn't entirely
reliable anyway, so let's remove it. The virtualenv package can be
removed from dev.txt, since virtualenv is installed globally, and
nothing inside our virtualenv (which is where the packages in dev.txt
end up) needs a local installation of it.
2015-04-22 11:23:32 +01:00
William Lachance 2719eab213 Bug 1156746 - Bump the number of concurrent log processing workers 2015-04-21 08:48:55 -04:00