Service powering snippets on Firefox's about:home.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts Force close DB connection to init a new one. Jul 17, 2018
simple_template_server Add missing client options to the simple template server. Aug 22, 2018
snippets Avoid using reverse url for admin urls to work on all clusters. Jan 21, 2019
.dockerignore Set product_details storage to ./product_details and update docs. Nov 15, 2018
.gitignore Set product_details storage to ./product_details and update docs. Nov 15, 2018
.pyup.yml Change to monthly schedule Jul 30, 2018
Dockerfile Create a separate requirements-dev file with only dev reqs. Nov 13, 2018
Jenkinsfile Enable admin which is required for some tests. Nov 30, 2018
Procfile Set product_details storage to ./product_details and update docs. Nov 15, 2018
contribute.json Rename org to mozmeao. Jul 18, 2017
newrelic.ini Turn off NR browser auto instrument. Feb 8, 2016
requirements-dev.txt Update ipython from 7.1.1 to 7.2.0 Dec 1, 2018
setup.cfg Code in this project breaks after binary operations, ignore W504. Nov 5, 2018

snippets service

What's Deployed? Documentation RTFM

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 MariaDB 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.)

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