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

181 Коммитов

Автор SHA1 Сообщение Дата
Rob Hudson 678a65eabf Update everett, use new features 2024-11-01 08:23:19 -07:00
Alex Gibson 7cdbaa2f3a
Migrate VPN resource center to Wagtail (#14860) (#15236)
* Bump wagtail-localize-smartling to 0.4.0
* For VPN CTA snippet, make the string name include the locale, to improve Admin UX
* Stop Django from downcasing the VPN Snippet model name, in order to improve Admin UX
* Fix bug where falling back to a non-CMS page in prefer_cms caused a 302 to en-US
* Stop wagtail-localize from publishing a non-default locale page when adding to the page tree
---------
Co-authored-by: Steve Jalim <stevejalim@mozilla.com>
2024-10-21 15:50:57 +01:00
Steve Jalim 8401aa5e1d
15330 add animated gif support to cms (#15346)
* Add support for animated GIF processing in Wagtail with Wand

* Stop sending the BedrockImage object instance into the task queue

Instead, just send its ID and then pluck the model from the DB as part of the task
2024-10-21 15:46:27 +01:00
Steve Jalim 9371f6f115
Dependency bumps - mainly for starlette security patch (#15323) 2024-10-17 19:14:47 +04:00
Rob Hudson 82453fed81 Bump django-csp for float report percentage 2024-10-16 14:45:45 -07:00
Steve Jalim 94588db967 Bump wagtaildraftsharing to hotfix release
This resolves #15291 where pages could not be added to the CMS
2024-10-14 13:14:08 +01:00
Steve Jalim 05f05cc438
Freshen dep versions, primarily to avoid an s3transfer version slip between dev and prod reqs (#15276) 2024-10-10 19:33:13 +04:00
Steve Jalim e1e9693058
Switch email sending to task queue when available (#15270)
This will mean that CMS notifications will go via the task queue.

The default queue of, well, "default" will be used, which is
one of the queues already being processed by our worker pods: https://github.com/mozilla/bedrock/blob/main/bin/run-worker.sh#L8

At the moment, the Web deployment does not have Redis available to it
so will not have a task queue enabled, and so in turn the
emails that web pods send (eg press requests) will have
no change to their sending pattern
2024-10-10 13:10:29 +04:00
Steve Jalim 572c25e677
Add our fork of wagtaildraftsharing to Bedrock (#15232)
* WIP strapping in a WIP version of wagtaildraftsharing

Install with pip install -U -e git+https://github.com/mozmeao/wagtaildraftsharing.git@add-wagtail-6-support#egg=wagtaildraftsharing

* Add comment about draftsharing tables being deliberately excluded

* Add tagged version of our fork of wagtaildraftsharing as a dependency
2024-10-10 13:08:45 +04:00
Rob Hudson 19d51d442e Update markupsafe to fix CSRF errors 2024-10-09 12:18:37 -04:00
Rob Hudson dc4c1f5c24 More bumps to stay fresh 2024-10-08 08:33:39 -07:00
Rob Hudson 5fd8d18e01 Bump Python dependencies 2024-10-08 08:33:39 -07:00
Rob Hudson e3c41e75bd Import config waffles to django waffles 🧇 2024-10-02 15:25:44 -07:00
Steve Jalim ad6a263e40
Dependency bump - mainly for cryptography, but some smaller ones along the way (#15099) 2024-09-11 16:34:02 +10:00
Rob Hudson 6ec135c912 Update Django and other Python deps 2024-09-03 13:35:25 -07:00
Alex Gibson 443aaf73aa Bump glean.js to v5.0.3 and glean-parser to v14.5.0 2024-08-29 11:01:03 -07:00
Rob Hudson 926438e4c9 Update Python dependencies 2024-08-26 14:03:40 -07:00
Rob Hudson 4672529d60
Update Python dependencies (#14939)
* Add outdated Python package helper

* Update Python dependencies
2024-08-20 14:36:02 +04:00
Steve Jalim ee46865e32
Bump Django to latest secure 4.2.x version (#14962)
See https://www.djangoproject.com/weblog/2024/aug/06/security-releases/
2024-08-08 00:19:52 +04:00
Steve Jalim b70a35bee9
Revert "Bump django from 4.2.14 to 4.2.15 in /requirements (#14959)" (#14960)
This reverts commit 23525a6b07.
2024-08-07 23:36:30 +04:00
dependabot[bot] 23525a6b07
Bump django from 4.2.14 to 4.2.15 in /requirements (#14959)
Bumps [django](https://github.com/django/django) from 4.2.14 to 4.2.15.
- [Commits](https://github.com/django/django/compare/4.2.14...4.2.15)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 23:35:04 +04:00
Steve Jalim 1829904358
Add wagtail-localize-smartling to the project, for Smartling L10N support (#14794)
* Add wagtail-localize-smartling to the project, for Smartling L10N support

* Add docs for wagtail-localize-smartling

* Minor reformatting

* Fix duplicated env var reference 🤦

* Add a management command that wraps the sync_smartling command so we can monitor it with a DMS
2024-07-23 02:09:49 +04:00
Steve Jalim fe9144dc0e
Upgrade Wagtail to 6.1.x (#14825)
Wagtail 6 gives us better list-based management of some DB-backed data,
which will be very handy for managing translation jobs with
wagtail-localize-smartling, so upgrading is now essential.

Note that 6.2 LTS is due on 1 August 2024 anyway.
2024-07-15 20:20:44 +04:00
Rob Hudson 506cf3bd77 Update Django for security release 2024-07-09 15:55:27 -07:00
Rob Hudson 977e2f6b9b Upgrade to sentry-sdk 2.x 2024-07-09 15:19:00 -07:00
Steve Jalim 2066e4b9a5
Dependency updates (#14796)
Incl certifi update (sec bump)
2024-07-08 19:06:00 +04:00
Steve Jalim 1428aa53e2
Revert "Support application-level connection pooling (#14771)" (#14790)
This reverts commit 2f0d70d3cd.
2024-07-04 16:39:29 +04:00
Steve Jalim 2f0d70d3cd
Support application-level connection pooling (#14771)
Trying out django-db-connection-pool.

Here's what settings.DATABASE is set to now if DATABASE_URL is pointing
at postgres:

```
{
    "default": {
        "NAME": "REDACTED",
        "USER": "REDACTED",
        "PASSWORD": "REDACTED",
        "HOST": "REDACTED",
        "PORT": 5432,
        "CONN_MAX_AGE": 0,
        "CONN_HEALTH_CHECKS": False,
        "DISABLE_SERVER_SIDE_CURSORS": False,
        "ENGINE": "dj_db_conn_pool.backends.postgresql",
        "POOL_OPTIONS": {
            "POOL_SIZE": 10,
            "MAX_OVERFLOW": 10,
            "RECYCLE": -1
        },
        "ATOMIC_REQUESTS": False,
        "AUTOCOMMIT": True,
        "OPTIONS": {},
        "TIME_ZONE": None,
        "TEST": {
            "CHARSET": None,
            "COLLATION": None,
            "MIGRATE": True,
            "MIRROR": None,
            "NAME": None,
        },
    }
}

```
2024-07-03 17:28:37 +04:00
Steve Jalim 0ebadb11f8
Switch psycopg2 for psycopg (3) (#14753)
This opens the door to connection pooling without PgBouncer once we're on Django 5.1, but should also be
faster than v2 anyway, so worth trying now to deal with our DB saturation issues.

Small dep bumps along the way.
2024-06-28 18:17:52 +04:00
Steve Jalim 135211e341
Dep bump, driven by urllib3 security patch - also picks up other subdeps (#14730) 2024-06-25 12:29:02 +04:00
Rob Hudson 0c04c6a8b9
Update Python dependencies (#14725)
* Switch from pip-tools to uv for compiling

* `pre-commit autoupdate` minus front-end deps

* Update packages and `make compile-requirements`
2024-06-24 13:59:14 +04:00
Alex Gibson 5dde7913db
Bump Glean.js to v5.0.2 (#14686) 2024-06-17 15:11:38 +10:00
Alex Gibson 37ce3a6392 Track product click events in glean.js 2024-06-14 09:29:15 +01:00
Rob Hudson b835c7cedb Bump granian to 1.4.3 to fix path encoding bug 2024-06-13 09:41:11 -07:00
Rob Hudson 5758877f19 Switched to Granian and dropped NewRelic integration 2024-06-12 14:17:24 -07:00
Rob Hudson 80472b617e bump django-csp and update settings 2024-06-11 09:29:38 -07:00
Rob Hudson 2bd8250e0b Bump django-csp to branch 2024-06-11 09:29:38 -07:00
Steve Jalim 0f2a0edcb9
Dep bump for Tornado (security) + general subdep lift (#14656) 2024-06-08 18:06:33 +01:00
Steve Jalim ed764987ed
Add SSO auth to Wagtail and Django admins (#14649)
* Add mozilla-django-oidc to the project dependencies

* Add SSO support to Bedrock for accessing Wagtail and Django admins
* Plumbs in mozilla-django-oidc
* Add custom login pages for Wagtail and Django admins that show an SSO button instead of form fields
* Retain support for username + password login (for local development)
* Tests

* Add custom CSRF page to help explain SSO-related session loss, if it occurs

Because a renewed/cycled OIDC/SSO session can zap a CSRF token and block
a user from submitting a CMS edit, we need to provide a bit more information
about what's happened. This changeset adds that, via a new template and a tiny view
to serve it, plugged in as Django's default CSRF view

Logged out users (who are very unlikely to see this anyway) get a simple
version of the message, while logged in users get more detail/context.

* Bump SSO lease time to 18 hours - trying to balance awkward signouts with wanting re-checks

* Update test.env so that Wagtail and Django admins are available by default when urlconf is generated. Oddly the reload trick didn't work here

* Update bedrock/base/templates/403_csrf.html

Co-authored-by: Alex Gibson <alexgibson@users.noreply.github.com>

* Make translation tagging consistent on new login templates

* Move new CSRF view to use a CSS bundle, not inline CSS

* Remove old, redundant CSRF view

It looks like this was no longer in use. It wasn't specified as settings.CSRF_FAILURE_VIEW so wouldn't have been used/found by Django I believe

* Drop translation markup from login templates to simplify

* Don't count the test 404 and 500 views as nonlocaled, because we do localize them

* Update bedrock/admin/templates/wagtailadmin/login.html

* Tweak wording re SSO for login pages

---------

Co-authored-by: Alex Gibson <alexgibson@users.noreply.github.com>
2024-06-07 14:47:33 +04:00
Steve Jalim ee0ec2ad41
Dependency bumps (#14640)
Production deps
Resolves #14634 - Bump lxml from 5.2.1 to 5.2.2
Resolves #14630 - Bump newrelic from 9.9.0 to 9.10.0
Resolves #14624 - Bump requests from 2.32.2 to 2.32.3
Resolves #14623 - Bump dj-database-url from 2.1.0 to 2.2.0
Resolves #14622 - Bump wagtail-localize from 1.8 to 1.9

Development deps
Resolves #14633 - Bump ruff from 0.4.2 to 0.4.7
Resolves #14632 - Bump wagtail-factories from 4.1.0 to 4.2.1
Resolves #14631 - Bump pipdeptree from 2.19.1 to 2.21.0
Resolves #14525 - Bump compare-locales from 9.0.2 to 9.0.3
Resolves #14519 - Bump translate-toolkit from 3.12.2 to 3.13.0
2024-06-04 20:42:09 +04:00
Steve Jalim c5e2b3b67f
Add background task queue support and use it for CMS image generation (#14617)
* Add django-rq to the project, with initial configuration for two redis-backed queues if redis is available

* Add Django-rq to project, including link from (now necessary) Django admin's userlinks

* Update Docker support to run a local worker node for RQ

* Add Sentry integration for Redis and for RQ

* Add a make command to run the worker queue

Temporarily loads env vars from .env, looking for REDIS_URL

* Make a new setting that makes it unambiguous whether a task queue is available

* Add helper that will enqueue a task or immediately execute it, depending on whether the task queue is available

Note that if it finds a queue is available it will put a job in there, regardless of whether the queue is being processed by a worker

* Switch image-rendition pre-generation to use the task queue, if available

* Add initial, basic, docs about the task queue

* Improve logging around task queue usage

* Fix formatting of Makefile

Thanks @janbrasna!

* Typo fixes in documentation

Thanks @janbrasna!
2024-06-04 14:27:34 +04:00
Steve Jalim b06182e6bc
Dependency bump, incl requests security bump (#14597) 2024-05-25 00:52:41 +04:00
Steve Jalim 7f62d5d28b
Add tooling to support the move to postgres (#14590)
* Add Wagtail 5.2 LTS as a dependency

* Drop in wagtail-localize, ready for i18n/l10n

Also fix up some test regressions as a result of this change, including
changing how Careers renders a custom 404-page message

* Support detection of CMS-based pages so that we don't falsely redirect away from pages managed by wagtail-localize

* Ensure that pages fall back (in their enriety) if we don't have a page with the matching lang code in the CMS

* Back out hack to 404.html for careers-related 404 -- unnecessary following i18n/routing refactor

* Back out unnecessary follow=True on the 404 test

* Make database config dynamic, but default to current local sqlite DB

For most setups, without a DATABASE_URL set, nothing changes

* Add psycopg3 dependency, for postgres support

* Avoid hitting the productdetails table during bootup

Because this makes it impossible to boot Bedrock with an empty database

* Add postgres DB to docker-compose, initially for local-dev use only

* Support bootstrapping an empty postgres database with bedrock data

* Update models in security and contentful models' schemae to handle invalid
data that sqlite tolerated, but postgres does not
* Add a shell script that will bootstrap an empty postgres database with
data either from the main external sources, or from the sqlite DB that
bedrock downloads

* Add db-to-sqlite lib to project

Downgrade psycopg(3) to psycopg2 due to hard dependencies of db-to-sqlite

* Rename postgres-bootstrapping commmand to kebab-case for consistency

* Add script to export postgres DB to sqlite, redacting auth_user table along the way

* Expand DB export script to redact or skip certain Wagtail-related tables/columns

* Switch to using loaddata/dumpdata instead of db-to-sqlite, because we were having column-type drift that was breaking Wagtail

* Tune the dumpdata export a little

Based on https://github.com/wagtail/bakerydemo?tab=readme-ov-file#preparing-this-archive-for-distribution

* Rename postgres-filling command to be less ambiguous

* Include ProductRelease in dumped data, because now we can after fixing the NotesField in an earlier commit

* DRY up the success/exit code

* Revert unnecessary lazy-making of product_details

* make export-to-sqlite script more robust and clearer

* Add simple guard rails to ensure DATABASE_URL points to a postgres DB when these scripts are run

* Add test coverage for data-scrubber management command

(Originally written by Copilot but heavily refactored and made appropriate)
2024-05-21 15:54:33 +04:00
Steve Jalim 920d418757
Wagtail in Bedrock: main groundwork (#14250)
* Allow disabling Markus when DEBUG=True (default: keep it enabled)

* Add Wagtail 5.2 LTS as a dependency

* Hook in Wagtail Admin, while also keeping jinja-template rendering happy

* Support user-uploaded images into the CMS, both with local and cloud storage options

Of course, the cloud storage option is the only one we'll use when deployed.

Note that this also disables CSP for any routes inside the Wagtail admin
(but not pages rendered by Wagtail)

* Drop in wagtail-localize, ready for i18n/l10n

Also fix up some test regressions as a result of this change, including
changing how Careers renders a custom 404-page message

* Lay in intial 'cms' app as home for our Wagtail-related modelling.

* Support detection of CMS-based pages so that we don't falsely redirect away from pages managed by wagtail-localize

* Wrap simple CMS test page in a Protocol-based base template to confirm we load the right strings and get the lang picker

* Ensure that pages fall back (in their enriety) if we don't have a page with the matching lang code in the CMS

* Exclude the cms-admin path from the sitemap - doesn't need to be discoverable

* Remove now-redundant print statement from a data migration

* Add tests to show locales from page models are used as translations for pages

* Add tests to show that pages with restrictions (e.g. passwords) should not be cached downstream

* Add tests for StructuralPage, confirming it redirects to its parent if accessed directly

* Expand test coverage to include serve_preview for our base page model

* Fixup accidentally-commented-out app in INSTALLED_APPS

Co-authored-by: Ryan Johnson <escattone@gmail.com>

* Improve comment related to local GCS credentials, clarifying who will/won't need them and why

* Disable use of Gravatar URLs for Wagtail users

Low benefit to us, because they need CSP tweaks and also would need scrubbing before the DB export.

* Fix labelling of Wagtail's homepage

* We don't want wagtailforms enabled in our setup: public bedrock is read only

* Back out hack to 404.html for careers-related 404 -- unnecessary following i18n/routing refactor

* Back out unnecessary follow=True on the 404 test

* Ensure that demos run migrations on their local DB, so that any new Wagtail tables get made ASAP, preventing 500s

* Add a fake spec for WAGTAIL_CONTENT_LANGUAGES in Pocket mode, so that it'll boot.

We won't be using wagtail for Pocket mode

* Rename MEDIA_URL from user-media to custom-media, to make it easier to grasp

---------

Co-authored-by: Ryan Johnson <escattone@gmail.com>
2024-05-20 13:55:49 +04:00
Steve Jalim 4a9527a342
Dependency updates (#14558)
Prod:
Resolves #14553 Bump jinja2 from 3.1.3 to 3.1.4
Resolves #14532 Bump newrelic from 9.8.0 to 9.9.0
Resolves #14516 Bump boto3 from 1.34.79 to 1.34.101
Resolves #14526 Bump lxml from 5.2.0 to 5.2.1
Resolves #14528 Bump docutils from 0.20.1 to 0.21.2

Dev:
Resolves #14529 Bump pipdeptree from 2.17.0 to 2.19.1
Resolves #14524 Bump ruff from 0.3.5 to 0.4.2
Resolves #14514 Bump freezegun from 1.4.0 to 1.5.0

Docs:
Resolves #14520 Bump sphinx from 6.2.1 to 7.3.7
Resolves #14527 Bump sphinx-autobuild from 2021.3.14 to 2024.4.16
Resolves #14531 Bump myst-parser from 2.0.0 to 3.0.1

Subdeps, auto upgraded:
Resolves #14533 Bump referencing from 0.34.0 to 0.35.0
Resolves #14530 Bump botocore from 1.34.85 to 1.34.95
Resolves #14517 Bump jsonschema from 4.21.1 to 4.22.0

Closed - not doing these right now:
Resolves #14522 Bump django from 4.2.11 to 5.0.4
Resolves #14515 Bump tinycss2 from 1.2.1 to 1.3.0

Left open:
* #14521 Bump sentry-sdk from 1.44.0 to 2.0.1 - major release, see PR for link to steps

* #14519 Bump translate-toolkit from 3.12.2 to 3.13.0 - needs care/isolation/checking, due to dropped mozilla-related code
* #14525 Bump compare-locales from 9.0.2 to 9.0.3 - as above

* #14523 Bump pytest from 7.4.4 to 8.2.0 - needs upgrading in isolation with selenium in case requires rollback
* #14518 Bump selenium from 4.9.1 to 4.20.0 - see above
2024-05-09 18:36:08 +01:00
Steve Jalim b54650acfb
Upgrade gunicorn to a security-patched version; minor subdep bumps (#14475) 2024-04-17 16:00:53 +01:00
Steve Jalim ae721007ec
Remove pinning of sqlparse dependency, to get latest (secure) version (#14465) 2024-04-16 17:40:29 +01:00
Steve Jalim e8dfce5698
Dependency bumps (#14433)
* Dependency bumps

**Prod deps**
Resolves #14420 Bump boto3 from 1.34.65 to 1.34.79
Resolves #14405 Bump pillow from 10.2.0 to 10.3.0
Resolves #14390 Bump lxml from 5.1.0 to 5.2.0
Resolves #14387 Bump sentry-sdk from 1.42.0 to 1.44.0
Resolves #14380 Bump pygithub from 2.2.0 to 2.3.0
Resolves #14379 Bump newrelic from 9.7.1 to 9.8.0
Resolves #14378 Bump jq from 1.6.0 to 1.7.0

**Dev deps**
Resolves #14422 Bump pipdeptree from 2.16.1 to 2.17.0
Resolves #14389 Bump pytest-mock from 3.12.0 to 3.14.0
Resolves #14385 Bump ruff from 0.3.3 to 0.3.5
Resolves #14381 Bump pytest-cov from 4.1.0 to 5.0.0
2024-04-11 17:04:43 +01:00
Steve Jalim e3f73d0dcd
Automate Root Store Policy page generation and fix missing indentation of nested lists (#14401)
* Add management command to automatically refresh the root-cert policy doc

* First pass at updating the rootstore policy doc with the helper tool

* Remove Sentry-notification decorator, as it's irrelevant here
2024-04-06 21:47:28 +04:00
Rob Hudson 0e70d56870 Upgrade to Django 4.2.x (LTS) 2024-04-05 10:31:03 -07:00