A web application for managing user experiments for Mozilla Firefox.
Перейти к файлу
Jared Lockhart c32ebeac8b
fix #3857 chore(nimbus): check graphql types during make check (#3892)
Because

* It would be nice to know if the backend changed that the frontend would break

This commit

* Adds make commands to check and fix that the graphql types match the nimbus-ui types
* This will cause CI to break if a backend change would break the frontend
2020-11-04 17:28:13 -05:00
.circleci fix #3857 chore(nimbus): check graphql types during make check (#3892) 2020-11-04 17:28:13 -05:00
.github fix #3661 chore(project): Dependabot PR against main (#3662) 2020-10-05 13:29:19 -04:00
app fix #3857 chore(nimbus): check graphql types during make check (#3892) 2020-11-04 17:28:13 -05:00
kinto Add remote settings to docker compose fixes #2673 (#2803) 2020-06-15 16:28:20 -04:00
nginx Use separate docker stack for integration tests fixes #1641 (#1644) 2019-09-11 10:28:22 -04:00
scripts fix #3824 chore(project): update circle to build deploy image (#3825) 2020-10-26 14:43:50 -04:00
.env.integration removed data science bugzilla stuff with jira (#2316) 2020-03-09 11:58:59 -07:00
.env.sample fix #3403 feature(nimbus): support mobile remote settings collection (#3875) 2020-11-03 12:37:42 -05:00
.git-blame-ignore-revs Move legacy UI to its new home in preparation for Nimbus UI work (#3534) 2020-09-24 11:00:48 -04:00
.gitignore chore(nimbus-ui): hook up storybook publishing on build (#3579) 2020-10-01 10:39:53 -07:00
CODE_OF_CONDUCT.md Rename master to main fixes #2949 (#2950) 2020-06-30 13:52:09 -04:00
LICENSE Initial commit 2016-10-20 14:42:32 -04:00
Makefile fix #3857 chore(nimbus): check graphql types during make check (#3892) 2020-11-04 17:28:13 -05:00
README.md fix #3425 chore(project): Add linux non root instructions for Docker to README (#3637) 2020-10-06 14:08:42 -04:00
contributing.md fix #3398 docs(project): Add commit formatting guidance (#3636) 2020-10-06 12:23:37 -04:00
docker-compose-integration-test.yml fix #3687 chore(project): run integration tests against deploy image (#3822) 2020-10-26 12:26:09 -04:00
docker-compose-prod.yml fix #3687 chore(project): run integration tests against deploy image (#3822) 2020-10-26 12:26:09 -04:00
docker-compose-test.yml fix #3857 chore(nimbus): check graphql types during make check (#3892) 2020-11-04 17:28:13 -05:00
docker-compose.yml fix #3687 chore(project): run integration tests against deploy image (#3822) 2020-10-26 12:26:09 -04:00

README.md

Mozilla Experimenter

CircleCI


1. Design 2. Launch 3. Analyze

Experimenter is a platform for managing experiments in Mozilla Firefox.

Deployments

Staging

https://stage.experimenter.nonprod.dataops.mozgcp.net/

Production

https://experimenter.services.mozilla.com/

Installation

General Setup

  1. Install docker on your machine
  1. Clone the repo

    git clone <your fork>
    
  2. Copy the sample env file

    cp .env.sample .env
    
  3. Set DEBUG=True for local development

    vi .env
    
  4. Create a new secret key and put it in .env

    make secretkey
    
  5. Run tests

    make test
    
  6. Setup the database

    make refresh
    

Fully Dockerized Setup (continuation from General Setup 1-7)

  1. Run a dev instance

    make up
    
  2. Navigate to it and add an SSL exception to your browser

    https://localhost/
    

Semi Dockerized Setup (continuation from General Setup 1-7)

One might choose the semi dockerized approach for:

  1. faster startup/teardown time (not having to rebuild/start/stop containers)
  2. better ide integration

Notes:

Semi Dockerized Setup

  1. Pre reqs (macOs instructions)

    brew install postgresql llvm openssl yarn
    
    echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
    export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
    
  2. Install dependencies

    source .env
    
    poetry install (cd into app)
    
    yarn install
    
  3. env values

    .env (set at root):
    DEBUG=True
    DB_HOST=localhost
    HOSTNAME=localhost
    
  4. Start postgresql, redis, autograph, kinto

    make up_db
    
  5. Django app

    # in app
    
    poetry shell
    
    yarn workspace @experimenter/nimbus-ui build
    yarn workspace @experimenter/core build
    yarn workspace @experimenter/rapid build
    ./manage.py runserver 0.0.0.0:7001
    

Pro-tip: we have had at least one large code refactor. You can ignore specific large commits when blaming by setting the Git config's ignoreRevsFile to .git-blame-ignore-revs:

git config blame.ignoreRevsFile .git-blame-ignore-revs

Usage

Experimenter uses docker for all development, testing, and deployment.

The following helpful commands have been provided via a Makefile:

build

Build the application container by executing the build script

compose_build

Build the supporting services (nginx, postgresql) defined in the compose file

up

Start a dev server listening on port 80 using the Django runserver

up_db

Start postgresql, redis, autograph, kinto on their respective ports to allow running the Django runserver and yarn watchers locally (non containerized)

up_django

Start Django runserver, Celery worker, postgresql, redis, autograph, kinto on their respective ports to allow running the yarn watchers locally (non containerized)

up_detached

Start all containers in the background (not attached to shell)

check

Run all test and lint suites, this is run in CI on all PRs and deploys

migrate

Apply all django migrations

load_locales_countries

Populates locales and countries

load_dummy_experiments

Populates db with dummy experiments

bash

Start a bash shell inside the container (this lets you interact with the containerized filesystem and run Django management commands)

ssl

Create dummy SSL certs to use the dev server over a locally secure connection. This helps test client behaviour with a secure connection. This task is run automatically when needed.

kill

Stop and delete all docker containers. WARNING: this will remove your database and all data. Use this to reset your dev environment.

refresh

Run kill, migrate, load_locales_countries load_dummy_experiments

integration_test

Run the integration test suite inside a containerized instance of Firefox. You must also be already running a make up dev instance in another shell to run the integration tests.

integration_vnc_up

Start a linux VM container with VNC available over vnc://localhost:5900 with password secret. Right click on the desktop and select Applications > Shell > Bash and enter tox -c tests/integration/ to run the integration tests and watch them run in a Firefox instance you can watch and interact with.

Frontend

Experimenter has three front-end UIs right now:

  • core is the current UI used for Experimenter intake.
  • rapid is a partially-built React UI.
  • nimbus-ui is a new React UI for an upcoming Experimenter refactor.

Learn more about the organization of these UIs here.

API

API documentation can be found here

Contributing

Please see our Contributing Guidelines

License

Experimenter uses the Mozilla Public License