<commit_before>============
Installation
============
Kuma uses `Docker`_ for local development and integration testing, and we are
transitioning to Docker containers for deployment as well.

.. _Docker: https://www.docker.com/

**Current Status of Dockerization**:

* Kuma developers are using Docker for daily development and maintenance tasks.
  Staff developers primarily use `Docker for Mac`_. Other staff
  members and contributors use `Docker's Ubuntu packages`_.
* The Docker development environment is evolving rapidly, to address issues
  found during development and to move toward a containerized design. You may
  need to regularly reset your environment to get the current changes.
* The Docker development environment doesn't fully support a 'production-like'
  environment. For example, we don't have a documented configuration for
  running with an SSL connection.
* When the master branch is updated, the ``kuma_base`` image is refreshed and
  published to `quay.io`_. This image contains system packages and
  third-party libraries.
* Our TravisCI_ builds include a target that build Docker containers and runs
  the tests inside.
* Our Jenkins_ server builds and publishes Docker images, and runs integration
  tests using Docker.
* We are documenting tips and tricks on the
  :doc:`Troubleshooting page <troubleshooting>`.

.. _`Docker for Mac`: https://docs.docker.com/docker-for-mac/
.. _`Docker's Ubuntu packages`: https://docs.docker.com/engine/installation/linux/ubuntulinux/
.. _`quay.io`: https://quay.io/repository/mozmar/kuma_base?tab=tags
.. _TravisCI: https://travis-ci.org/mozilla/kuma/
.. _Jenkins: https://ci.us-west.moz.works/view/MDN/job/mdn_multibranch_pipeline/

Docker setup
============

#. Install the `Docker platform`_, following Docker's instructions for your
   operating system, such as `Docker for Mac`_ for MacOS, or for your
   `Linux distribution`_.  Linux users will also want to install
   `Docker Compose`_ and follow `post-install instructions`_ to confirm that
   the development user can run Docker commmands.

   To confirm that Docker is installed correctly, run::

        docker run hello-world

#. Clone the kuma Git repository, if you haven't already::

        git clone --recursive git@github.<EMAIL>:mozilla/kuma.git

#. Ensure you are in the existing or newly cloned kuma working copy::

        cd kuma

#. Initialize and customize ``.env``. Linux users should set the ``UID``
   parameter in ``.env``, to avoid issues when mixing ``docker-compose`` and
   ``docker`` commands::

        cp .env-dist.dev .env
        vim .env  # Or your favorite editor

#. Pull the Docker images and build the containers::

        docker-compose pull
        docker-compose build

#. Start the containers in the background::

        docker-compose up -d<commit_msg>added details about the changes in the .env<commit_after>============
Installation
============
Kuma uses `Docker`_ for local development and integration testing, and we are
transitioning to Docker containers for deployment as well.

.. _Docker: https://www.docker.com/

**Current Status of Dockerization**:

* Kuma developers are using Docker for daily development and maintenance tasks.
  Staff developers primarily use `Docker for Mac`_. Other staff
  members and contributors use `Docker's Ubuntu packages`_.
* The Docker development environment is evolving rapidly, to address issues
  found during development and to move toward a containerized design. You may
  need to regularly reset your environment to get the current changes.
* The Docker development environment doesn't fully support a 'production-like'
  environment. For example, we don't have a documented configuration for
  running with an SSL connection.
* When the master branch is updated, the ``kuma_base`` image is refreshed and
  published to `quay.io`_. This image contains system packages and
  third-party libraries.
* Our TravisCI_ builds include a target that build Docker containers and runs
  the tests inside.
* Our Jenkins_ server builds and publishes Docker images, and runs integration
  tests using Docker.
* We are documenting tips and tricks on the
  :doc:`Troubleshooting page <troubleshooting>`.

.. _`Docker for Mac`: https://docs.docker.com/docker-for-mac/
.. _`Docker's Ubuntu packages`: https://docs.docker.com/engine/installation/linux/ubuntulinux/
.. _`quay.io`: https://quay.io/repository/mozmar/kuma_base?tab=tags
.. _TravisCI: https://travis-ci.org/mozilla/kuma/
.. _Jenkins: https://ci.us-west.moz.works/view/MDN/job/mdn_multibranch_pipeline/

Docker setup
============

#. Install the `Docker platform`_, following Docker's instructions for your
   operating system, such as `Docker for Mac`_ for MacOS, or for your
   `Linux distribution`_.  Linux users will also want to install
   `Docker Compose`_ and follow `post-install instructions`_ to confirm that
   the development user can run Docker commmands.

   To confirm that Docker is installed correctly, run::

        docker run hello-world

#. Clone the kuma Git repository, if you haven't already::

        git clone --recursive <EMAIL>:mozilla/kuma.git

#. Ensure you are in the existing or newly cloned kuma working copy::

        cd kuma

#. Initialize and customize ``.env``. Linux users should set the ``UID`` parameter in ``.env``
   (i.e remove the "#" before ``UDI``,example: change ``#UDI=1000`` to ``UDI=1000``) to avoid 
   issues when mixing ``docker-compose`` and ``docker`` commands::

        cp .env-dist.dev .env
        vim .env  # Or your favorite editor

#. Pull the Docker images and build the containers::

        docker-compose pull
        docker-compose build

#. Start the containers in the background::

        docker-compose up -d
{'fraction_non_alphanumeric': 0.09562793938338268, 'fraction_numerical': 0.0013934854554955582, 'mean_word_length': 3.88265306122449, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1510187', 'n_tokens_mistral': 1648, 'n_tokens_neox': 1516, 'n_words': 669}