MDN/Development/CompatibilityTables/Infrastructure: Difference between revisions

Describe current testing and deployment processes
(Start with development section)
 
(Describe current testing and deployment processes)
Line 6: Line 6:


* MDN - primary consumer of compatibility data
* MDN - primary consumer of compatibility data
* Authentication - end-user authentication services
* Data API - primary data data source
* C&M GUI - Contribution and moderation interface
* BrowserCompat DB - stores current compatibility data
* Tables renderer - for MDN and other services
* Data Explorer - to browse compatibility data
* Data Explorer - to browse compatibility data
* Data API - primary data data source
* Importer - Scrapes data from MDN and injects into Data API
* Importer - Scrapes data from MDN and injects into Data API
* BrowserCompat DB - stores current compatibility data
* Importer DB - stores extra import data
* Importer DB - stores extra import data
* C&M GUI - Contribution and moderation interface
* Tables renderer - for MDN and other services
* Authentication - end-user authentication services
* API documentation - describes data schema, other parts
* API documentation - describes data schema, other parts


== Development ==
== Development ==
A local development copy of MDN is '''not''' required for BC development.  MDN is backed by the [https://github.com/mozilla/kuma mozilla/kuma project]. Development is done using a local VM that provides many of the production services. See the [https://kuma.readthedocs.org/en/latest/installation.html installation documentation] for details.
A local development copy of '''MDN''' is '''not''' required for BC development.  MDN is backed by the [https://github.com/mozilla/kuma mozilla/kuma project]. Development is done using a local VM that provides many of the production services. See the [https://kuma.readthedocs.org/en/latest/installation.html installation documentation] for details.
 
The '''Data API''' is in the [https://github.com/mdn/browsercompat mdn/browsercompat project]. It is a [https://www.djangoproject.com Django] project. Developers will need to install a Python development environment, and optionally will need PostgreSQL, Memcached, and Redis installed. See the [https://browsercompat.readthedocs.org/en/latest/installation.html Installation documentation] for details.
 
The '''BrowserCompat DB''' can be a PostgreSQL database (recommended) or a SQLite database.  It requires the Data API to setup the schema and populate the data. Compatibility data is periodically exported to the [https://github.com/mdn/browsercompat-data mdn/browsercompat-data project], and can be used to populate a developer's database.
 
The '''Data Explorer''' is part of the [https://github.com/mdn/browsercompat mdn/browsercompat project] code base, and requires a local install of the Data API for development.
 
The '''Importer''' is part of the [https://github.com/mdn/browsercompat mdn/browsercompat project] code base, and requires a local install of the Data API for development.
 
The '''Importer DB''' is currently part of the BrowserCompat DB. Local development may require a lengthy scraping of the MDN site.
 
The '''C&M interface''' is backed by the [https://github.com/mdn/browsercompat-cm mdn/browsercompat-cm project]. It is running [http://emberjs.com Ember.js], with the [http://ember-cli.com ember-cli] project. Developers will need to install the dependencies, including Node.js, Bower, ember-cli, and PhantomJS. See the [https://github.com/mdn/browsercompat-cm README.md] for details.
 
The '''Tables Renderer''' is still in planning, and the project has not started. A prototype renderer is implemented in KumaScript, in the [https://developer.mozilla.org/en-US/docs/Template:EmbedCompatTable EmbedCompatTable macro].


For development, it is easiest to create local Django accounts backed by username and password.  ``./manage.py createsuperuser`` can be used to create a superuser account with access to the Django admin.
Local accounts are used for '''Authentication'''. For development, it is easiest to create local Django accounts backed by username and password.  ``./manage.py createsuperuser`` can be used to create a superuser account with access to the Django admin.


The C&M interface is backed by the [https://github.com/mdn/browsercompat-cm mdn/browsercompat-cm project]. It is running [http://emberjs.com Ember.js], with the [http://ember-cli.com ember-cli] project. Developers will need to install the dependencies, including Node.js, Bower, ember-cli, and PhantomJS. See the [https://github.com/mdn/browsercompat-cm README.md] for details.
The '''API documentation''' is hosted at [https://browsercompat.readthedocs.org/en/latest/index.html browsercompat.readthedoc.org], and sourced in the [https://github.com/mdn/browsercompat mdn/browsercompat project]. Documentation developers will need to install the Data API to build documents locally, but won't need to populate it with compatibility data.


The Tables Render is still in planning, and the project has not started. A prototype renderer is implemented in KumaScript, in the [https://developer.mozilla.org/en-US/docs/Template:EmbedCompatTable EmbedCompatTable macro].
== Current Testing and Deployment Process ==


The Data Explorer is part of the [https://github.com/mdn/browsercompat mdn/browsercompat project] code base, and requires a local install of the Data API for development.
'''MDN''' is a mature product, with many layers of testing:
* Developers can run unit tests against their own code (``./manage.py test``)
* Pull Requests are tested in [https://travis-ci.org/mozilla/kuma TravisCI]
* Each pull request is reviewed by another developer using [https://github.com/mozilla/kuma/pulls GitHub's PR interface].
* When accepted, PRs are merged to the [https://github.com/mozilla/kuma master branch].
* The master branch is periodically deployed by a developer to staging at https://developer.allizom.org. Deployment is controlled by a [https://github.com/mozilla/kuma/blob/master/scripts/chief_deploy.py script in the repository], and usually does not include manual steps.
* Developers and staff perform targeted manual testing of new features on staging.
* [https://theintern.github.io/ Intern] is used to run client-side tests against the staging server.
* When testing is complete, the code is deployed to production. Developers monitor the site for 1 hour after production pushes, to be aware of any performance degradation.


The Data API is in the [https://github.com/mdn/browsercompat mdn/browsercompat project]. It is a [https://www.djangoproject.com Django] project. Developers will need to install a Python development environment, and optionally will need PostgreSQL, Memcached, and Redis installed. See the [https://browsercompat.readthedocs.org/en/latest/installation.html Installation documentation] for details.
A [https://github.com/mdn/browsercompat single codebase] is used for the '''Data API''', '''Data Explorer''', '''Importer''', and '''API Documentation'''. This project includes testing:
* Developers can run ``make test`` to run Django unit tests, and ``make qa`` to run code linters and coverage tests as well.
* Developers can run ``make test-integration`` to run a local API instance, load it with sample data, and make API requests.
* Pull requests are tested in [https://travis-ci.org/mdn/browsercompat TravisCI]. This runs unit, QA, and integration tests.
* ''Some'' pull requests are code reviewed by other developers, because 1) the API does not include personally identifiable information, 2) the service is not in production use outside of some beta testers, and 3) no other developers are currently familiar with the code.
* When ready, PRs are merged to the [https://github.com/mdn/browsercompat master branch]
* When the master branch is updated, the documentation is rebuilt and deployed to https://browsercompat.readthedocs.org
* The master branch is tested in TravisCI again.
* When testing is successful, the code is automatically deployed to https://browsercompat.herokuapp.com


The Importer is part of the [https://github.com/mdn/browsercompat mdn/browsercompat project] code base, and requires a local install of the Data API for development.
Heroku hosts the ''BrowserCompat DB'' and the ''Importer DB'' in a single [https://aws.amazon.com/rds/postgresql/ RDS PostgreSQL database]. When the data schema changes, database migrations are run using the command-line heroku client (``heroku run --app browsercompat ./manage.py migrate``)


The BrowserCompat DB can be a PostgreSQL database (recommended) or a SQLite database.  It requires the Data API to setup the schema and populate the data. Compatibility data is periodically exported to the [https://github.com/mdn/browsercompat-data mdn/browsercompat-data project], and can be used to populate a developer's database.
The '''C&M GUI''' is in early development. Developers can run tests with ``ember test``, but 100% success is not yet expected. No tests are automatically run on push.


The Importer DB is currently part of the BrowserCompat DB. Local development may require a lengthy scraping of the MDN site.
'''Authentication''' is done against https://browsercompat.herokuapp.com, and is not specifically tested. Firefox Accounts was integrated, but has since [https://bugzilla.mozilla.org/show_bug.cgi?id=1229037 broken].


The API documentation is hosted at [https://browsercompat.readthedocs.org/en/latest/index.html browsercompat.readthedoc.org, and sourced in the [https://github.com/mdn/browsercompat mdn/browsercompat project]. Documentation developers will need to install the Data API to build documents locally, but won't need to populate it with compatibility data.
The KumaScript-based '''table renderer''' is manually tested, and requires manually refreshing MDN pages when data changes. Stephanie Hobson has a [https://developer.mozilla.org/en-US/docs/User:stephaniehobson:compat test page] linking to interesting pages.
67

edits