Skip to content
Service powering snippets on Firefox's about:home.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add weekly-digest bot configuration. Oct 26, 2018
bin Update docker repo & image tag hash length Jun 3, 2019
docs Add full date. May 17, 2019
media Cache bundles for a month. May 28, 2015
scripts [Issue #887] Export Snippet Metadata Command and Cron Job. Mar 5, 2019
simple_template_server Add missing client options to the simple template server. Aug 22, 2018
snippets [Fix #1032] Default locale to `EN` in S2D Template. Jun 18, 2019
.adr-dir Add missing .adr-dir file. Mar 15, 2019
.coveragerc Rebase on sugardough. Dec 4, 2015
.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
.gitlab-ci.yml Review fix: comment out dev, stage, admin config updates for frankfurt May 30, 2019
.pyup.yml Change to monthly schedule Jul 30, 2018
.therapist.yml Add therapist. Nov 5, 2018
.travis.yml [Issue #954] Add Postgresql libraries and tools. Apr 18, 2019
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file Mar 30, 2019
Dockerfile Update .gitlab-ci.yml and add dependent bin/ scripts (based on nucleu… May 29, 2019
Jenkinsfile [Issue #954] Add Postgresql libraries and tools. Apr 18, 2019
LICENSE Rebase on sugardough. Dec 4, 2015
Procfile Add clock job to update product details. Mar 9, 2016
README.md [fix #953] Remove MariaDB dependencies and references. Apr 22, 2019
contribute.json Rename org to mozmeao. Jul 18, 2017
docker-compose.yml [fix #953] Remove MariaDB dependencies and references. Apr 22, 2019
jenkins.yml remove tokyo from deployments Sep 13, 2018
manage.py Rebase on sugardough. Dec 4, 2015
newrelic.ini Turn off NR browser auto instrument. Feb 8, 2016
requirements-dev.txt Update werkzeug from 0.15.2 to 0.15.4 Jun 10, 2019
requirements.txt Upgrade to Django 2.2.2 Jun 12, 2019
setup.cfg Code in this project breaks after binary operations, ignore W504. Nov 5, 2018
setup.py Rebase on sugardough. Dec 4, 2015

README.md

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]$ ./manage.py 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]$ ./manage.py migrate
  5. [docker]$ ./manage.py createsuperuser (enter any user/email/pass you wish. Email is not required.)
  6. [docker]$ ./manage.py 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/run-dev.sh
  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/run-dev.sh 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

$ ./manage.py 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.