mattsgood2 / developer-portal

The code that generates the MDN Web Docs Developer Portal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mozilla Developer Portal Build Status

Development workflow

Setup

This project uses Docker. The easiest way to get started is to install Docker Desktop which provides the docker and docker-compose commands.

After installing Docker, use the dev-setup script to run the project locally:

./scripts/dev-setup

This command will create an .env file with unique keys, build docker images and containers, run database migrations, and load fixture data.

Run locally

With Docker Desktop running in the background, bring up the services by running:

docker-compose up

As you make changes, remember to run the tests…:

docker-compose exec app python manage.py test
docker-compose exec static npm run test

…and to make and apply database migrations:

docker-compose exec app python manage.py makemigrations
docker-compose exec app python manage.py migrate

User authentication

GitHub OAuth is supported for admin login. When running in production, the auth pipeline checks to see if the GitHub user is a member of the mdn organization. Additional organizations can be added via the GITHUB_ORGS env variable.

When running in debug any GitHub user is allowed to log in and is automatically given superuser status. It is possible to log in without using GitHub by creating a Django superuser as normal:

docker-compose exec app python manage.py createsuperuser

Update

After pulling master you may need to install new dependencies…:

docker-compose build

…or run database migrations:

docker-compose exec app python manage.py migrate

If things get messed up, you could (as a last resort) prune ALL Docker images, containers and volumes, and start from scratch:

./setup.sh --prune

Building a static site

Wagtail Bakery can build a static version of the site. In production this runs automatically when pages are published or unpublished from the Wagtail admin.

Usage

To manually build the static site, run:

docker-compose exec app python manage.py build --settings=developerportal.settings.production

The result of this will be output to the /build directory.

About

The code that generates the MDN Web Docs Developer Portal.

License:Mozilla Public License 2.0


Languages

Language:Python 56.6%Language:HTML 28.8%Language:CSS 10.1%Language:JavaScript 2.5%Language:Shell 1.3%Language:Makefile 0.5%Language:Dockerfile 0.2%