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

68 Коммитов

Автор SHA1 Сообщение Дата
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
Rob Hudson eac0cbf9fd Fix #14596: Remove pocket-mode 2024-10-11 11:45:33 -07:00
Rob Hudson c3d5e200d0 Update to Python 3.12.x 2024-09-20 11:46:52 -07:00
Steve Jalim 49c3cde7d8
Make sqlite3 available in the production-grade release Docker image (#15040)
In order to run the postgres-to-sqlite export script in k8s, we need
to have sqlite3 available there.

This changeset moves it from the 'devapp' image to the 'app-base' image,
making it also available in the 'release' image, which we use in production
2024-09-02 14:04:10 +04:00
Alex Gibson a81d4852e0 Bump node Docker image to 20.14.0-slim (Fixes #14705) 2024-06-21 16:22:04 -07:00
Jan Brasna ef30eb1b72
Update Dockerfile chown separators (#14439) 2024-04-10 07:26:28 +04:00
Jan Brasna 468ca4215a
Remove contribute.json (#14423) 2024-04-09 10:10:08 +01:00
Alex Gibson 6a7ac6b4f5
Migrate ESLint to use flat config (Fixes #13770) (#14338) 2024-03-28 10:25:41 +00:00
Alex Gibson 296d0a72f6 Pin Node to 20.8.0 in Docker 2024-03-14 09:15:04 +00:00
Rob Hudson 354e07b666 Update to Python 3.11.x
- Fix for PyPOM being incompatible with Python 3.10+
- Update the docs to reference the newer Python
- Run pyupgrade
2024-03-08 15:13:29 -08:00
Alex Gibson 65fa60c0bc
Update bedrock to build using Node v20 (Fixes #13938) (#13939) 2023-11-30 09:30:14 +11:00
Alex Gibson 85b35893cb
Bump Node to v18 (Fixes #13525) (#13526) 2023-08-11 08:35:45 -07:00
Paul McLanahan 636b2fe56b Fix #12705: Add system git config
Including makring the l10n git repos as "safe".
2023-02-06 14:57:54 -05:00
Steve Jalim 5e1ec15984
Improve cacheing of layers in Dockerfile re Glean setup (#12315) 2022-10-31 14:24:30 +00:00
Alex Gibson b3b8a2bdc5
Add glean.js analytics to home page (#11402) 2022-05-16 10:14:14 +01:00
Steve Jalim 805795d8e2
Lay in Pocket l10n workflow support (#11576)
* [Tiny] Improve error messaging if git repo interaction fails

* Override the Fluent repo-related config in Pocket mode

Note that for Pocket mode, we don't need an intermediary mozmeao/* repo to
hold the translations while we calculate activation metadata via a CI task
(which does happen for Mozorg). Why? All locales in Pocket should be 100%
ready to go, because they are translated by a vendor, whereas Mozorg has
community translation contributions as well, which aren't always exhaustive.

As a result, both FLUENT_REPO and FLUENT_L10N_TEAM_REPO point to the same repo

* Update Bedrock CI step to try to open a PR against the l10n repo

...if there are changes to the l10n files.

Note that we try to update both www-l10n (Mozorg) and pocket-www-l10n (Pocket)
each time it's run, with the plan that if it's run against an irrelevant repo
no changes will be detected, even though it's running twice

(This may need tweaking once it's running in CI properly, of course)

* Update settings.get_dev_languages to take params, to make re-use elsewhere easier

* Initial pass at setting up DEV and PROD languages for Pocket mode

* Ensure Pocket always uses all available production langs

All locales in Pocket should be 100% ready to go, because they are
translated by a vendor, whereas Mozorg has community translation
contributions as well, which aren't always exhaustive.

* Wind back "Update settings.get_dev_languages to take params, to make re-use elsewhere easier"

This reverts some of the work done in c653640ae56cf21e961c461a421d6dd5fa54efcd.

* Make DEV_LANGUAGES the same as PROD_LANGUAGES as there's no need not to

* Ensure Pocket-related l10n files are copied into Dockerimage during build

* Make the l10n_update command pull from both Mozorg and Pocket Fluent repos

* Split out pocket-l10n PR step in CI, so that Mozorg and Pocket steps run separately

* Update LANGUAGE_CODE for Pocket mode to be just 'en'

* Update output messaging to help keep track of FTL updates

* Nitfix: make env setting in Docker consistent

* Tidy up l10n-related settings following code review

* Nit: updating comments

* Fixup: Add quotes around bash variable substitution

* Tweak locale fallbacks

* Update locale setup for Spanish, but more work needed

Just noting some complexity to unpick here. getpocket.com/es-la/ exists, and
so does getpocket.com/es/. However it is sounding like /es/ needs to use
`es-ES` content from the vendor and /es-la/ needs to use `es` from the vendor.

Also note that Pocket currently uses `/es-la/` not `/es-LA/`

This all may require some extra wiring, as it feels like it's flipping over
the behaviour we have in bedrock.

* Move non-official es-la locale to FALLBACK_LOCALES

* Drop es-MX, es-CL, es-AR from FALLBACK_LOCALES - unnecessary

If the language_REGION locale string doesn't map to a specific locale, we try
to map the two-letter locale, so we don't need the variant locales for es.

* Drop unnecessary inclusion of en-* locale variants -- they'll fall back to /en/ fine without config
2022-05-11 11:32:38 +01:00
Paul McLanahan b701edf9ce
Fix revision.txt (#11596) 2022-05-09 16:25:33 +01:00
Alan c4a029e23b
Adding cdn tests (#11129)
* Adding cdn tests

Using a cdn mark to allow skipping or only running the cdn tests
uses ssllabs to get the tls/cipher information
That can be fairly slow, so trying to ensure it only happens once per run - so caching to a json file

* migrating existing tests into the functional area

* formatting failed in circle
2022-02-17 10:29:19 -08:00
Steve Jalim 06a533d030
Upgrade Bedrock to Python 3.9 and update dependency management tooling (#11176)
* Move Bedrock to pip-compile-multi for easier Python dependency management

This changeset adds tooling to ease dependency management and also rationalises
our requirements files.

Before, we were just using hashin to manually hash pinned deps straight into a requirements file

Now we're using pip-compile-multi, which sits on top of pip-tools to do this.
We now get:
* Simpler syntax for adding and pinning dependencies via *.in files
* Automatic hash generation when the *.txt requirements files are produced

The dependency compilation/update tooling runs in a Docker container, so will be compatible
with the deployed service's containers.

We're also rationalising the existing split of dependency files:

* base -> being retired and used as the basis for prod requirements
* migration -> being retired and the two deps still useful to us (for moz-l10n-lint)
  added to dev deps
* dev -> now extends from the prod requirements. We're not too concerned about image
  size for dev and test builds
* prod -> still exists, but includes the base deps
* docs -> still exists as a standalone file, but also follows the "*.in"-file pattern

* Regenerate dependency files using pip-compile-multi

Note that to avoid clashes, the following balances were made:

* Keep meinheld at the lower version used in prod.txt, not the dev.txt one -- for now at least
* Downgrade Markdown to 3.3 to avoid a clash over importlib-metadata version
* Remove importlib-metadata==4.10.1 altogether as a hard pin and let pip-compile-multi work out the best fit

* Update docs to reference pip-compile-multi, replacing now-redundant notes on hashin

* Update Dockerfile to copy over and use freshly recut dependency files

* Attempting to tune deps to allow local builds to work, not just Docker ones

* Update pip-compile-multi config to inject a custom header that explains how to rebuild reqs

* Update Bedrock to use Python 3.9

* Update base images
* Update CI
* Update dependencies to make install run -- this involved manually using hashin to upgrade two hashed deps (greenlet and meinheld) then re-running make compile-requirements to update the top-level hash in prod.txt. It's a bit of a chicken-and-egg situation when the deps are built/re-locked in a container but you can't build the container itself unless the deps are viable, but it worked

* Upgrade everett in order to remove configobj, which is redundant and causing local install issues on MacOS M1

* Drop backports.cached-property and typed-ast from dev reqs because we don't need them on 3.9

* Update docs with local-installation guidance for pyenv and pyenv-virtualenv

* Remove 'upgrade requirements' option

Given that the --upgrade flag is implicitly / by-default true with
pip-compile-multi anyway, plus the fact we're hard-pininng everything,
there's no point having an explicit 'upgrade' path - so let's remove it

* Docs tweak to suggest simpler virtualenv name

* Update help option in Makefile

* Pin version of pip in the compile-requirements script

When unpinned, the build suddenly broke, so we're keeping it under strict
limits for now

* Upgrade Django to 2.2.27

* Upgrade newrelic package to latest, incl py3.9 support

* Switch to Python 3.9 Debian bullseye image, from buster

* Rationalise dependency input files to remove over-pinned subdeps

When we moved from hand-managed requirements.txt files, we were taking on files
that had literally every dependency and thier sub-deps in them. We don't want
the input (*.in) files to reference those subdeps, so this changeset tries to
thin things out and remove them

Note that the diff shows this was successful - there are very few changes to
the dependencies being mentioned in the output *.txt files, and the ones that
are there are all deliberate changes (eg removing 'pbr')

* Drop unused tenacity dep, bump APScheduler and link to a Python 3.9-patched version of mdx-outline

* Add --require-hashes option to pip usage in Dockerfile

It's implicitly set because the reqs files feature --hash=XXX
but better to be explicit

* Drop what appear to be redundant top-level dev dependencies

regex, pep8 and wcwidth appear to be subdeps that don't need pinning.

The others appear to not be in used, based on a search of the codebase.

Tests till pass

* Thin out some unnecessary top-level deps in prod.in

 - funcsigs - old backport, redundant
 - lxml - over-pinned subdep of BeautifulSoup?
 - typing_extensions - over-pinned subdep
 - zipp - over-pinned subdep

* Cap pip version to 21 for pip-compile-multi for now

* Reinstate lxml as a first-class dep: BeautifulSoup needs it as a user-specified parser

* Fix typo in pip-compile-multi header

* Hard-pin latest working combo of pip + pip-tools in compile-requirements.sh

* Update docs explaining why we're using 3.9.10 locally
2022-02-08 16:59:17 +00:00
Steve Jalim eee0934c15
Add sqlite3 to devapp image, so we can run manage.py dbshell in local dev (#11020) 2021-12-13 16:00:42 +00:00
Rob Hudson ead742134f
Fix #10736: Move careers content from lumbergh into bedrock (#10848)
This moves all Django files, templates, and assets from mozilla/lumbergh into bedrock.
2021-12-09 08:59:05 -08:00
Steve Jalim d25786145e
Allow bpython (used by ./manage.py) to write its history file (#10887)
Before, bpython would complain it couldn't write to /home/webdev/.pythonhist because it and the parent dir did not exist. Adding both with the appropriate permissions seems the smallest change to make the history work, and reduce the noise in the shell
2021-12-09 09:36:06 +00:00
Steve Jalim 84f2548858 10814: Add curl to the base image, so that we can make a HTTP request to our snitching service during updates 2021-11-30 13:32:07 -05:00
Alex Gibson d15de78af4
Add bedrock.externalpages app for Pocket marketing pages #10645 (recovered) (#10828)
Co-authored-by: Rob Hudson <robhudson@mozilla.com>
Co-authored-by: Nathan Barrett <30009669+nathan-barrett@users.noreply.github.com>
Co-authored-by: Reem H <42309026+reemhamz@users.noreply.github.com>
Co-authored-by: Reem H <me@reemify.dev>
2021-11-30 10:25:37 +00:00
Alex Gibson 570a683158 Update bedrock to NodeJS to v16 (Fixes #10803) 2021-11-23 14:37:03 +00:00
Steve Jalim 65d76631e4
10631: Get CircleCI to store Python coverage report (#10640)
* 10631: Get CircleCI to store Python coverage report

* 10631: Ensure coverage config file is copied into Docker container

..so that artefacts end up in the expected place for downstream processing

* 10631: Copy the coverage report to the CI host so it can be collected as an artefact

* 10631: Support CodeCov reporting
2021-10-27 16:21:21 +01:00
Ayushsunny d8389a1e8a Removed yarn as a dependencies and updated the docs 2021-10-22 10:13:39 +01:00
Alex Gibson 0801611b06 Upgrade NodeJS Docker image to 14 (Fixes #10464) 2021-10-13 16:02:30 +01:00
Alex Gibson 7305098445 Format JS files using Prettier (Fixes #10468, #10479) 2021-10-08 16:07:35 +01:00
Rob Hudson e8325a7944 Add black configuration for Python formatting 2021-09-30 16:03:35 -04:00
Alex Gibson 665323b14e Migrate to Webpack (Issue #10310) 2021-09-16 08:54:16 +01:00
Paul McLanahan 3adfa0a050 Fix #10434: Add country_code to the context for all pages
Allows for a query param to override the country (e.g. `?geo=de`).

Also removes the old Maxmind stuff since we're unlikely to use that
again, and add a GeoTemplateView class to make it easy to switch
template based on request country. Adds docs for all of this as well.
2021-09-10 09:26:11 +01:00
Paul McLanahan 200ea42eb7 Use Maxmind DB for getting request country codes
While keeping a fallback using the CDN headers for easier deployment.

Fix #8976
2020-09-10 09:20:47 -04:00
Paul McLanahan 4ae7d177f8 Sync the data before running management commands in Docker build 2020-09-09 12:42:30 -04:00
Paul McLanahan d0fb5d4daa Use a single docker image for all deployments
Have the app download the right data on startup. If that fails it won't
start the app and so the deployment will fail, but the existing
deployment will stay up.
2020-09-09 12:21:13 -04:00
Paul McLanahan 14ac630636 Load Legal Docs from the database
Remove the git submodule \o/

Fix #8385 #5818
2020-08-05 17:14:18 +01:00
Alex Gibson 46fa44e8f0 Move front-end linting and tests to NPM scripts (Fixes #8479) 2020-07-17 13:49:58 +01:00
Paul McLanahan ace7289205
Remove setting for prometheus to use multiple processes 2020-07-14 17:10:00 -04:00
Paul McLanahan c34103215a
Fix prometheus metrics error on docker build 2020-07-14 15:50:47 -04:00
Paul McLanahan 89a6b9c8bd Reduce the number of latency buckets for Prometheus
The default list of latency buckets contains 17 entries. My proposal
is just 8.

5ca09db237/django_prometheus/middleware.py (L8-L26)

Also add an environment variable to deal with multiple wsgi processes
for prometheus, and use a version of django-prometheus that allows
us to set a metrics namespace.
2020-07-14 15:18:04 -04:00
Paul McLanahan 1dcea384e3
Add automation to submit a PR for Fluent file changes (#8786) 2020-04-23 09:50:21 +01:00
Paul McLanahan dda67bb833 Fix virtualenv creation in docker
The old way suddenly broke in that it no longer properly
included pip. This changes to the default recommended way
of creating a virtualenv in the Python 3.8 docs.
2020-02-10 19:01:31 +00:00
Axel Hecht a3daaf3a71 Update fluent.migrate API, add requirements file 2019-12-20 16:17:23 -05:00
Paul McLanahan a8114a786e Add Fluent L10n system and port the Mission page to use it
* Fix dict cache default timeout
* Add fallback strings and checking for translations in template
* Add ftl alias and ftl_lazy for use in py files
* Move git repos and add fluent to l10n_update
* Add percent_translated and required_messages to the l10n object
* Add management commands for converting en-US .lang file and templates
* Add command to convert en-US .lang file to .ftl file
* Using data from above command add a command that will convert a
template to use the .ftl strings
* Update the l10n_update command to update both external l10n repos
* Convert the /mission/ page to Fluent
* Add command to convert .lang translations to .ftl
* Copy en .ftl file when porting translations
  * Removes the original string hash comments as well.
* Add Fluent docs.
* Add indentation and key sorting to metadata JSON output
* Add FTL file linting command
* Update mission template for FTL and remove FTL specific template
* Set l10n cache to 10s when DEBUG=True
* Fix and add tests for get_l10n_path
* Fix some style mistakes in docs and code
* Support multiline group comments for required strings

fix #7725, fix #7822, and fix #7726
2019-10-28 16:46:11 +00:00
Paul McLanahan 9ec5c55675 Use more specific base Python Docker image
The image we were using (`python:3-slim`) just switched to Python 3.8
and lxml was failing to build using that. This uses the much more
specific `python:3.7-slim-buster` tag so that this won't change for
us unexpectedly again.

Fix #7927
2019-10-16 11:37:32 -04:00
Chris Beaven bf67e8bf34 Django 2.2 (#7196)
* Complete removal of nose test artifacts

* Update base requirements to Django 2.2 and python 3 compatibile packages
2019-07-03 02:24:42 -05:00
Paul McLanahan dc0377efa1 Update external data during docker build
* Only pull data that doesn't require auth during build as secrets aren't available.
* Also run migrations and db updates during dev image build.
2019-01-22 14:57:30 -05:00
Paul McLanahan aedbcf65df Add ADRs to Sphinx docs (#6692)
* Install Sphinx markdown deps
* Configure Sphinx with markdown support
* Switch to RTD Sphinx theme for local too
* Fix a bunch of Sphinx warnings for docs
* Separate docs deps into a requirements file for RTD to use
2019-01-09 18:21:23 -06:00
Paul McLanahan 87233d2b30 Re #5775: Split sitemap by locale (#5987)
* Re #5775: Split sitemap by locale

Also add DB-based pages to sitemap from
release notes and security.
2018-08-10 11:23:20 -05:00
Paul McLanahan 85f92c66b1 [Fix #5976] Add revision.txt to root_files during docker build (#5977) 2018-08-07 19:53:12 +00:00