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

42 Коммитов

Автор SHA1 Сообщение Дата
Rob Hudson 4f8fb977d6 Move to using gevent workers instead of meinheld
This is for Python upgradability since meinheld is no longer active.
2024-03-01 12:58:06 -08:00
Rob Hudson 1f89a4c82e Revert uwsgi 2024-01-29 16:00:19 -08:00
Rob Hudson 2263977368 Test with lazy-apps = false
When testing on dev we found that spawning workers took about 4-5 seconds per worker, so 4 workers would take about 20 seconds to spin up, causing a lot of health check flapping and pod churn. Locally testing pre-forking allowed for much faster start-up times, so we'll test this on dev.
2024-01-29 14:53:41 -08:00
Rob Hudson fffce43a73 Fixes #13247: Replace gunicorn+meinheld with uWSGI 2024-01-29 12:05:50 -08:00
Rob Hudson df39b58c7b Bump Whitenoise 2022-02-28 18:04:13 -05:00
Rob Hudson 2177e4d2dc
Fix #11057: Update codebase to prefer python3 syntax (#11086)
* Update `super()` calls

* Update for use f-strings

* Remove utf-8 comments

* Import from built-in `unittest.mock`

* Use native dict and set syntax

* Update exception errors

* Remove six compatibility code

* Remove explicit utf-8 encoding

* Use `yield from`
2022-01-11 07:21:16 -08:00
Steve Jalim a8ed6ae9c4
Add pre-commit hook for including the MPLv2 in all source code files (#10617)
* 10614: Add pre-commit hook for including the MPLv2

Adds to Python, JS, SCSS, Jinja HTML, Fluent templates and shell scripts

Note that the order of application of the hooks is important - we want to add a missing license before we check the formatting of files

* 10614: Update MPLv2 comments on all templates to match standard format produced by pre-commit hook

* Updates existing MPLv2 text to use a https URL
* Amend a handful of Fluent templates that used a token instead of the string "Mozilla" - this standardised things; translation was not used or needed
* Add missing MPLv2 where needed
* Update three tests that regressed with these changes, above

* 10614: Update pre-commit config to not add MPL to JS libraries; Remove MPL from the four files which should not have had it
2021-10-22 13:09:44 +01:00
Steve Jalim ab38b080ab
10570: Add isort support to project (#10573)
* Update requirements to avoid requests version clash

* 10570: Add isort to project

* 10570: Add isort config to project

* 10570: Add isort as a test run/CI step

* 10570: Add isort to pre-commit config

* 10570: Update isort config to allow tests/pages.py to be first-party, which is more appropriate

* 10570: Apply isort to entire codebase, using project config

* 10570: Explicitly include lib/ as a first-party import

This behaviour is already implicit in the current config, but making it explicit, partly to protect against a future change. Also makes it easier to grok what will happen to various bedrock-codebase imports

* 10570: Update isort config to stack Django imports above third-party ones

* 10570: [nit-fix] Update run-tests.sh to call isort with the same syntax pattern as we call black
2021-10-11 18:08:58 +01:00
Rob Hudson 31943fea75 Black format all Python files 2021-09-30 16:03:35 -04:00
Alan 08d83f6999 Revert wsgi keep alive as well
it's one of the last remaining items different between our known good state and current wild cpu usage
2021-04-19 10:57:52 -04:00
Alan ba2738eb3f
removing gevent (#10081) 2021-04-16 14:31:55 -07:00
Paul McLanahan f3b81c8596 Remove Prometheus metrics gathering 2021-04-15 16:10:39 -04:00
Alan 7c3c0d3e0d
Switching to allowing gevent workers with gunicorn (#10020)
Borrowing settings from https://github.com/mdn/developer-portal/blob/master/configs/gunicorn.py
Adding gevent as an optional worker
Adding a dynamic worker count based on the math that gunicorn recommends, but if multiprocess fails failling back
2021-03-18 07:03:11 -07:00
Paul McLanahan 9d6ddb7c07 Enable multiprocess mode for prometheus metrics gathering 2020-11-20 18:12:08 -05:00
Paul McLanahan 0fcf769426 Revert "Revert "Move from Raven to Sentry-SDK for error reporting""
This reverts commit 8847fe3ec2.

Fixing this again plus upgrading pytest libraries
2020-09-24 10:47:18 -04:00
Paul McLanahan cba24f845d Fail to start if the database file is missing 2020-09-09 12:21:13 -04:00
Alan Alexander 8847fe3ec2 Revert "Move from Raven to Sentry-SDK for error reporting"
This reverts commit ae9360bf43.

Seems to be causing pytest to behave strangely, spinning up tons and tons of extra processes.
2020-07-21 14:42:11 -04:00
Paul McLanahan ae9360bf43 Move from Raven to Sentry-SDK for error reporting
Fix #6378
2020-07-21 10:56:05 -04:00
Paul McLanahan a852e04d5f Use newrelic-admin in run-prod.sh (#8277)
Instead of importing newrelic in the wsgi file.

Fix #7372
2019-12-06 16:34:45 -06:00
Josh Mize ed8d624ff1
Add 'newrelic.ini' param to newrelic.agent.initialize() (#7161) 2019-05-07 10:36:13 -05:00
Josh Mize 5b8b210a73 Remove unused ability to use custom newrelic.ini 2019-05-02 15:54:12 -04:00
Josh Mize a3ee82e942 Import newrelic.agent first in wsgi app 2019-05-02 15:11:29 -04:00
Paul McLanahan b5fa181eec Fix default setting for Newrelic INI File in wsgi/app.py (#5709) 2018-05-16 17:08:41 -05:00
Paul McLanahan 54b8cbbf8a Fix #5583: Support loading some config from the DB
* Convert from python-decouple to everett for config loading
  * Gives us more flexibility on loading waffle switches
    and funnelcake definitions as well as potentially new
    config types in future.
* Create a model for storing configs
* Create a management command for loading configs from git repo

Relies on mozmeao/www-config#94 for loading configs.
2018-05-16 16:16:22 -04:00
Paul McLanahan 41a74968ce Use Whitenoise as wsgi middleware, not Django
When used as a Django middleware all asset responses include
all headers intended for page responses (e.g. CSP and XSS protection).
Switch to WSGI middleware to avoid sending extra data as well as
to avoid confusing Safari.
2017-07-19 23:48:42 -04:00
Paul McLanahan 914d8007f4 Restructure jenkins deployment. Demos build in main pipeline.
* Fix demo deploy and update docs.
* Make it work with deis1 and deis2
* Enforce max 63 char app names
* Fix SSL redirect for Deis v2 clusters. Allow settings per cluster.
* Improve env file handling and combination for demo deploys
* Use new envcat utility
* Deploy our dev, stage, and prod apps to virginia and tokyo clusters
2017-05-10 17:01:06 -04:00
Paul McLanahan 9160321dae Upgrade Whitenoise to 3.3.0
Gives us a couple of new and improved things:

* Adds the new "immutable" Cache-Control header extension
* Uses whitenoise for dev so all of the files work
2017-01-30 12:42:21 -05:00
Paul McLanahan fafda32525 Add the raven Sentry client for error reporting 2016-08-25 10:16:33 -04:00
Paul McLanahan 1d95d881ac Remove old files associated with legacy infra 2016-03-22 16:50:54 -04:00
Giorgos Logiotatidis 8f29742d34 Add newrelic.ini for docker. 2015-09-10 09:41:06 +03:00
Paul McLanahan 17208e0327 Bug 1182126: Increase fonts cache header to one month.
Also increase default cache header expiry to 6 hours from 1 minute.
The majority of files used on bedrock are immutable (include the
file content hash) and will be unaffected by this change.
2015-07-15 16:08:15 -04:00
Paul McLanahan 11f0f9a197 Fix bug 1155810: Remove funfactory.
Well... actually it mostly just moves most of funfactory
from an external lib to bedrock.base. But at least this way
we can remove the bits we don't need and be ready to make
the changes we need to upgrade to Django 1.8.

I can't come close to writing as perfect a commit message
for this as @willkg did for fjord, so I'll just leave this here.

https://github.com/mozilla/fjord/commit/9d7c97b
2015-04-29 16:58:25 -04:00
Paul McLanahan 2eebfd676e Add ability to run via gunicorn 2015-04-14 10:32:24 -04:00
Paul McLanahan 56b89a19a5 Serve static files with Whitenoise.
Create root_files dir for serving via Whitenoise.
Move .htaccess for media into static folder.
Will remove it later.
2015-02-10 20:52:25 -05:00
Dan Poirier b0f79bbdc0 Port newsletter preferences to Bedrock
- Create newsletter app and move hacks.mozilla.org.html there
- Set up to display Django messages to the user.
- Make displaying most of the information on the page conditional on having a formset, so we can still use the same template when some error occurs in processing.
- Handle errors by displaying translated messages to the user. Also use Playdoh logging to log errors and debug information.
- If no token given, or token is invalid, let user supply an email
address and sign up for newsletters.
2013-06-04 07:54:07 -04:00
Paul McLanahan 807be421d6 Bug 816080: Revert rename of wsgi file to ease deployment pain. 2013-05-15 17:49:44 -04:00
Hector Zhao 8f7dabd14a Bug 816080: Upgrade Bedrock to latest Playdoh 2013-05-15 11:14:13 -07:00
Paul McLanahan 2d3a4e6b65 Bug 854889: Disable newrelic if import or env var fail. 2013-03-26 14:30:40 -04:00
Paul McLanahan 20cd725ffe Bug 854889: Only use newrelic if client installed. 2013-03-26 11:48:26 -04:00
Andrei Hajdukewycz acbf71fc34 [Bug 854889] Add new relic init to wsgi file 2013-03-26 07:32:59 -07:00
James Long 7ca9321ef7 set DJANGO_SETTINGS_MODULE in wsgi file because of recent settings changes 2011-12-06 10:26:57 -08:00
Austin King de1f1e8462 Moving wsgi.wsgi into wsig/playdoh.wsgi 2011-01-26 13:43:51 -08:00