Fix CSP to allow images from www.firefox.com to be previewed; dependency housekeeping (#1224)
fix: allow loading images from www.firefox.com's media bucket
chore(security): bump python deps; drop unnecessary deps
chore(security): bump JS deps via npm audit
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Nucleus
The publication platform for Mozilla’s marketing websites.
Docker for development
Make sure you have docker and docker compose. After those are setup and running you can use the following commands:
If you’ve made changes to the
Dockerfileor therequirements/*.txtfiles you’ll need to rebuild the image to run the app and tests:Then to run the app you run the
docker compose up webcommand again, or for running tests against your local changes you run:We use pytest for running tests. So if you’d like to craft your own pytest command to run individual test files or something you can do so by passing in a command to the above:
And if you need to debug a running container, you can open another terminal to your nucleus code and run the following:
Managing Python dependencies
For Python we use pip-compile-multi to manage dependencies expressed in our requirements files.
pip-compile-multiis wrapped up in Makefile commands, to ensure we use it consistently.If you add a new Python dependency (e.g. to
requirements/prod.inorrequirements/dev.in) you can generate a pinned and hash-marked addition to our requirements files by running:and committing any changes that are made. Please re-build your docker image and test it with
make build testto be sure the dependency does not cause a regression.Similarly, if you upgrade a pinned dependency in an
*.infile, runmake compile-requirementsthen rebuild, test and commit the results.To check for stale Python dependencies (basically
pip list -obut in the Docker container):Install Python requirements locally
Ideally, do this in a virtual environment (eg a
venvorvirtualenv)Docker for deploying to production
Release Notes UI (React)
This project includes a small React component embedded into the Django admin to manage release notes.
If you need to make changes to the UI:
Install dependencies (only once):
Build the JS bundle:
Run Django’s
collectstaticto include the bundle:Files of interest:
frontend/release-notes.jsxnucleus/rna/static/js/release-notes.jsnote-tablediv innucleus/rna/templates/admin/rna/release/change_form.htmlThe file can be linted by running
npm run lintto check for errors using ESLint.Heroku
Kubernetes
https://github.com/mozmeao/nucleus-config/ has public examples of deployments in k8s clusters in AWS & GCP.
Github Actions CI/CD
Unit tests are run via a GHA in the mozilla/nucleus repo https://github.com/mozilla/nucleus/actions
Deployments are handled via the (private) https://github.com/mozilla-sre-deploy/deploy-nucleus/ repo
We no longer use GitLab for CI/CD for Nucleus