<commit_before>================================
 Installation and configuration
================================

----------
 Overview
----------
The supported approach for deploying SFM is Docker containers. For more information on Docker, see :doc:`docker`.

Each SFM service will provide images for the containers needed to run the service
(in the form of ``Dockerfile`` s). These images will be published to `Docker Hub <https://hub.docker.com/>`_.
GWU created images will be part of the `GWUL organization <https://hub.docker.com/u/gwul>`_
and be prefixed with *sfm-*.

`sfm-docker <https://github.com/gwu-libraries/sfm-docker>`_ provides the necessary
``docker-compose.yml`` files to compose the services into a complete instance of SFM.

The following will describe how to setup an instance of SFM that uses the latest release
(and is suitable for a production deployment.) See the development documentation for other
SFM configurations.

SFM *can* be deployed without Docker. The various ``Dockerfile`` s should provide
reasonable guidance on how to accomplish this.


--------------------
 Local installation
--------------------

Installing locally requires Docker and Docker-Compose. See :ref:`docker-installing`.

1. Either clone the sfm-docker repository and copy the example configuration files::

    git clone https://github.com/gwu-libraries/sfm-docker.git
    cd sfm-docker
    cp example.prod.docker-compose.yml docker-compose.yml
    cp example.env .env

or just download ``example.prod.docker-compose.yml`` and ``example.env``::

    curl -L https://github.com/gwu-libraries/sfm-docker/raw/master/example.prod.docker-compose.yml > docker-compose.yml
    curl -L https://github.com/gwu-libraries/sfm-docker/raw/master/example.env > .env

2. Update configuration in ``.env`` as described in :ref:`install-configuration`.

3. Bring up the containers::

    docker-compose up -d


Notes:
* The first time you bring up the containers, their images will be pulled from `Docker Hub <https://hub.docker.com>`_.
  This will take several minutes.

-------------------------
 Amazon EC2 installation
-------------------------
To launch an Amazon EC2 instance running SFM, follow the normal procedure for launching an instance.
In *Step 3: Configure Instance Details*, under *Advanced Details* paste the following in
user details and modify as appropriate as described in :ref:`install-configuration`::

    #cloud-config
    repo_update: true
    repo_upgrade: all

    packages:
     - python-pip

    runcmd:<commit_msg>formatting<commit_after>================================
 Installation and configuration
================================

----------
 Overview
----------
The supported approach for deploying SFM is Docker containers. For more information on Docker, see :doc:`docker`.

Each SFM service will provide images for the containers needed to run the service
(in the form of ``Dockerfile`` s). These images will be published to `Docker Hub <https://hub.docker.com/>`_.
GWU created images will be part of the `GWUL organization <https://hub.docker.com/u/gwul>`_
and be prefixed with *sfm-*.

`sfm-docker <https://github.com/gwu-libraries/sfm-docker>`_ provides the necessary
``docker-compose.yml`` files to compose the services into a complete instance of SFM.

The following will describe how to setup an instance of SFM that uses the latest release
(and is suitable for a production deployment.) See the development documentation for other
SFM configurations.

SFM *can* be deployed without Docker. The various ``Dockerfile`` s should provide
reasonable guidance on how to accomplish this.


--------------------
 Local installation
--------------------

Installing locally requires Docker and Docker-Compose. See :ref:`docker-installing`.

1. Either clone the sfm-docker repository and copy the example configuration files::

    git clone https://github.com/gwu-libraries/sfm-docker.git
    cd sfm-docker
    cp example.prod.docker-compose.yml docker-compose.yml
    cp example.env .env

or just download ``example.prod.docker-compose.yml`` and ``example.env``::

    curl -L https://github.com/gwu-libraries/sfm-docker/raw/master/example.prod.docker-compose.yml > docker-compose.yml
    curl -L https://github.com/gwu-libraries/sfm-docker/raw/master/example.env > .env

2. Update configuration in ``.env`` as described in :ref:`install-configuration`.

3. Bring up the containers::

    docker-compose up -d


Notes:

* The first time you bring up the containers, their images will be pulled from `Docker Hub <https://hub.docker.com>`_. This will take several minutes.

-------------------------
 Amazon EC2 installation
-------------------------
To launch an Amazon EC2 instance running SFM, follow the normal procedure for launching an instance.
In *Step 3: Configure Instance Details*, under *Advanced Details* paste the following in
user details and modify as appropriate as described in :ref:`install-configuration`::

    #cloud-config
    repo_update: true
    repo_upgrade: all

    packages:
     - python-pip

    runcmd:
{'fraction_non_alphanumeric': 0.1509881422924901, 'fraction_numerical': 0.0023715415019762848, 'mean_word_length': 3.3780276816608996, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7611717', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1304, 'n_words': 539}