Skip to content
Service powering snippets on Firefox's about:home.
Python HTML JavaScript Other
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Update tests to request pregen bundle with valid locale. Oct 24, 2019
docs [Fix #1218] Document supported targeting attribs. Nov 6, 2019
scripts [Fix #1208] Add DailyJobMetrics model and management command. Oct 31, 2019
.gitlab-ci.yml Set GIT_SHA as env variable in Docker image. Jul 18, 2019
.travis.yml Add missing migration. Jul 16, 2019 Add Mozilla Code of Conduct file Mar 30, 2019
LICENSE Rebase on sugardough. Dec 4, 2015
Procfile Add clock job to update product details. Mar 9, 2016 Add links to CD/CD Pipelines. Jul 15, 2019
requirements-dev.txt Bump werkzeug from 0.15.4 to 0.15.5 Sep 1, 2019

snippets service

What's Deployed? Documentation RTFM Pipeline Pipeline

The root of all messaging.

Develop using Docker

One time setup of your environment and database:

  1. Make sure you have docker and docker-compose
  2. $ docker-compose run --service-ports web bash
  3. [docker]$ ./ update_product_details
    • If you get an error connecting to the database, you probably need to wait for a few seconds for PostgreSQL to initialize and then re-try the command.
  4. [docker]$ ./ migrate
  5. [docker]$ ./ createsuperuser (enter any user/email/pass you wish. Email is not required.)
  6. [docker]$ ./ shell -c 'from snippets.base.util import *; create_countries(); create_locales();'
    • Create a list of Countries and Locales from Product Details info.

Start the development server:

  1. [docker]$ ./bin/
  2. Navigate to https://localhost:8443/admin and log in with the admin account created in step #4. See an TLS Security Exception? Go to TLS Certifcates section.

A note about using run instead of up

docker-compose run is more suitable for development purposes since you get a shell and from there you can run the webserver command. This way you can debug using set_trace() or restart the server when things go bad. The trick here is to use --service-ports flag to make docker compose map the required ports.

The project is configured for docker-compose up if that's your preference.

TLS Certificates

Firefox communicates with the snippets service only over secure HTTPS connections. For development, the runserver_plus command as executed in ./bin/ generates and uses a self-signed certificate.

You'll need to permanently accept the certificate, to allow Firefox to fetch Snippets from your development environment.

Run the tests

$ ./ test --parallel

Rebuild your Docker Compose Envinronment

To rebuild your docker compose environment, first remove current images and containers and then run the build command.

$ docker-compose kill
$ docker-compose rm -f
$ docker-compose build

Install Therapist

Therapist is a smart pre-commit hook for git to ensure that committed code has been properly linted.

Install the hooks by running:

$ therapist install

You can’t perform that action at this time.