Mozilla Foundation website
moz
Перейти к файлу
Pomax 9e6e52de44
prettier for css/scss (#2807)
* prettier for css/scss
2019-03-14 11:11:35 -07:00
.github Docs for tricky django migrations (#2658) 2019-02-18 10:49:42 +01:00
cypress Primary page banner model update (#2768) 2019-03-06 15:20:04 -05:00
docs Multiple domain support (#2795) 2019-03-13 16:03:54 -04:00
locales/en-US updating OG tags to Foundation - closes #892 (#894) 2017-11-07 15:23:20 -08:00
network-api prettier for css/scss (#2807) 2019-03-14 11:11:35 -07:00
source prettier for css/scss (#2807) 2019-03-14 11:11:35 -07:00
test add testing for the Procfile (#2174) 2018-11-14 09:41:00 -08:00
travis-scripts Travis job parallelization (#2730) 2019-03-11 14:09:08 -04:00
.editorconfig Update HTTP to HTTPS (#2219) 2018-11-20 16:38:36 -08:00
.eslintignore Nuke Pug (#1468) 2018-04-27 10:17:12 -07:00
.eslintrc.json Switched eslint to use prettier (#2796) 2019-03-13 13:44:24 -07:00
.gitignore Add Cypress visual testing (#2471) 2019-01-21 11:11:50 -08:00
.snyk Test npm and pypi dependencies using Snyk (#733) 2017-09-27 13:20:18 -04:00
.stylelintrc prettier for css/scss (#2807) 2019-03-14 11:11:35 -07:00
.travis.yml Multiple domain support (#2795) 2019-03-13 16:03:54 -04:00
CODE_OF_CONDUCT.md Created Code of conduct (#2697) 2019-02-20 15:40:18 -08:00
ISSUE.md adding github issue template (#484) 2017-06-05 09:41:02 -07:00
LICENSE Update HTTP to HTTPS (#2219) 2018-11-20 16:38:36 -08:00
PULL_REQUEST_TEMPLATE.md renaming the pull request template because it has a space in the file… (#1125) 2018-03-01 11:16:05 -08:00
Pipfile weekly python update (#2657) 2019-02-13 16:32:44 +01:00
Pipfile.lock Dep updates (#2785) 2019-03-11 16:55:37 -04:00
Procfile Add a release steps file (#2240) 2018-11-22 12:26:51 +01:00
README-FOR-WAGTAIL-LOCALISATION.md Adding wagtail-modeltranslation to get at least some sort of localization. (#1566) 2018-08-21 10:30:47 -07:00
README.md Remove mentions of mezzanine from README (#2777) 2019-03-11 09:56:23 -07:00
app.json CLOUDINARY_URL does not need to be set in the environment (#2149) 2018-11-09 13:35:38 -05:00
appveyor.yml Multiple domain support (#2795) 2019-03-13 16:03:54 -04:00
contribute.json Nuke Pug (#1468) 2018-04-27 10:17:12 -07:00
cypress.json added a RANDOM_SEED as env-level seed for the data faker (#2541) 2019-01-30 10:24:22 -08:00
env.default Multiple domain support (#2795) 2019-03-13 16:03:54 -04:00
package-lock.json prettier for css/scss (#2807) 2019-03-14 11:11:35 -07:00
package.json prettier for css/scss (#2807) 2019-03-14 11:11:35 -07:00
release-steps.sh Add a release steps file (#2240) 2018-11-22 12:26:51 +01:00
runtime.txt update python version used on Heroku (#2241) 2018-11-21 18:13:05 +01:00
tasks.py Remove extra semicolon + add tasks file to lint check + move tox.ini to top-level dir (#1799) 2018-09-11 12:28:47 -07:00
tox.ini Remove extra semicolon + add tasks file to lint check + move tox.ini to top-level dir (#1799) 2018-09-11 12:28:47 -07:00
webpack.config.js Switched eslint to use prettier (#2796) 2019-03-13 13:44:24 -07:00

README.md

foundation.mozilla.org

Build Status Build status - Appveyor Dependency Status Dev Dependency Status Uses Mofo Standards Code Coverage

Table of contents

Setup

Development and tooling

Workflow

Deployment

Scheduled Task

Stack

Setup

Requirements: Node, npm, git, python3.6 or later, pip, pipenv, invoke.

If you installed Python with Homebrew, use pip3 install instead of pip install when installing the relevant requirements.

Check your environment

  • python --version should return 3.6 or higher,
  • pipenv --version should return 11.10 or higher,
  • invoke --version should return 0.22.1 or higher.

Setup steps

Run the following terminal commands to get started:

  • git clone https://github.com/mozilla/foundation.mozilla.org.git
  • cd foundation.mozilla.org
  • inv setup

If you're on windows, you need an extra step: run inv manage createsuperuser to create an admin user.

You're done 🎉

To catch up on new dependencies, migrations, etc. after initial setup, you can use the inv catch-up command.

Testing

When relevant, we encourage you to write tests. You can run the tests using the following command

  • inv test

In addition to the code tests there are also visual regression tests, located in the ./cypress/integration directory. You can run these tests locally by installing cypress using npm i cypress@3.0.3, after which the command npm run cypress will run these tests locally. However, note that these tests are currently intended for screenshot comparisons across branches, and so will not yield any meaningful results when run for a single branch.

Security

https://snyk.io is used to test our npm and PyPi dependencies for vulnerabilities. These tests are run on Travis and Appveyor, and will cause a build to fail when a new vulnerability is detected.

Resolving an issue

If an issue is reported by Snyk, you have several options to remedy the problem. Firstly, the build log should contain a link to the vulnerability report on snyk.io. On that page you will find links to the issue or CVE, and information about how to resolve the problem. You should start a new feature branch and pull request to resolve this issue before merging any other features.

Unpatched vulnerabilities

In some cases, vulnerabilities have not been patched - you will need to look at the nature of the issue and then add an exception to the .snyk file for it. You can install the snyk cli using npm install -g snyk and add the exception like so: snyk ignore --id="SNYK-PYTHON-BOTO3-40617" --expiry="2017-12-31" --reason="No fix available" (Replace the id and reason with relevant information). The expiry flag is an RFC2822 formatted date string that will cause the ignore rule to expire - useful so that we can check periodically for fixes to unpatched vulnerabilities in our dependencies.

Gotchas

As this is REST API and CMS built on top of Django, there are some "gotcha!"s to keep in mind due to the high level of magic in the Django code base (where things will happen automatically without the code explicitly telling you).

DEBUG=True

The DEBUG flag does all sorts of magical things, to the point where testing with debugging turned on effectively runs a completely different setup compared to testing with debugging turned off. When debugging is on, the following things happen:

  • Django bypasses the ALLOWED_HOST restrictions, which again can lead to 400 Bad Request errors in DEBUG=False setting.
  • Rather than HTTP error pages, Django will generate stack traces pages that expose pretty much all environment variables except any that match certain substrings such as KEY, PASS, etc. for obvious security reasons.
  • ...there are probably more gotchas just for DEBUG so if you find any please add them to this list.