<commit_before>..
    This file is part of Invenio.
    Copyright (C) 2015-2018 CERN.
    Copyright (C) 2018 Galter Health Sciences Library.

    Invenio is free software; you can redistribute it and/or modify it
    under the terms of the MIT License; see LICENSE file for more details.

.. _quickstart:

Quickstart
==========

.. _prerequisites:

Prerequisites
-------------
To be able to develop and run Invenio you will need the following installed and
configured on your system:

- `Docker <https://docs.docker.com/install>`_ and `Docker Compose <https://docs.docker.com/compose/install/>`_
- `NodeJS v6.x+ and NPM v4.x+ <https://nodejs.org/en/download/package-manager>`_
- `Enough virtual memory <https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode>`_
  for Elasticsearch.

Overview
--------
Creating your own Invenio instance requires scaffolding two code repositories
using `Cookiecutter <https://cookiecutter.readthedocs.io/en/latest/installation.html>`_:

- one code repository for the main website.
- one code repository for the data model.

These code repositories will be where you customize and develop the features of
your instance.

Bootstrap
---------
First, let's create a `virtualenv <https://virtualenv.pypa.io/en/stable/installation/>`_
using `virtualenvwrapper <https://virtualenvwrapper.readthedocs.io/en/latest/install.html>`_
in order to sandbox our Python environment for development:

.. code-block:: shell

  $ mkvirtualenv my-repository-venv

Now, let's scaffold the instance using the `official cookiecutter template
<https://github.com/inveniosoftware/cookiecutter-invenio-instance>`_.

.. code-block:: shell


  (my-repository-venv)$ pip install cookiecutter
  (my-repository-venv)$ cookiecutter gh:inveniosoftware/cookiecutter-invenio-instance --checkout v3.0
  # ...fill in the fields...

For the purposes of this guide, our repository folder is `my-repository`.

Now that we have our instance's source code ready we can proceed with the
initial setup of the services and dependencies of the project:

.. code-block:: shell

  # Fire up the database, Elasticsearch, Redis and RabbitMQ
  (my-repository-venv)$ cd my-repository/
  (my-repository-venv)$ docker-compose up -d
  Creating network "myrepository_default" with the default driver
  Creating myrepository_cache_1 ... done
  Creating myrepository_db_1    ... done
  Creating myrepository_es_1    ... done
  Creating myrepository_mq_1    ... done
  # Install dependencies and generate static assets<commit_msg>docs: cookiecutter install + instance output<commit_after>..
    This file is part of Invenio.
    Copyright (C) 2015-2018 CERN.
    Copyright (C) 2018 Northwestern University, Feinberg School of Medicine, Galter Health Sciences Library.

    Invenio is free software; you can redistribute it and/or modify it
    under the terms of the MIT License; see LICENSE file for more details.

.. _quickstart:

Quickstart
==========

.. _prerequisites:

Prerequisites
-------------
To be able to develop and run Invenio you will need the following installed and
configured on your system:

- `Docker <https://docs.docker.com/install>`_ and `Docker Compose <https://docs.docker.com/compose/install/>`_
- `NodeJS v6.x+ and NPM v4.x+ <https://nodejs.org/en/download/package-manager>`_
- `Enough virtual memory <https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode>`_
  for Elasticsearch.

Overview
--------
Creating your own Invenio instance requires scaffolding two code repositories
using `Cookiecutter <https://cookiecutter.readthedocs.io/en/latest/installation.html>`_:

- one code repository for the main website.
- one code repository for the data model.

These code repositories will be where you customize and develop the features of
your instance.

Bootstrap
---------

Before we begin, you want to make sure to have Cookiecutter installed. Invenio
leverages this tool to generate the starting boilerplate for different
components, so it will be useful to have in general. We recommend you install
it as a user package or in the virtualenv we define below.

.. code-block:: shell

  # Install cookiecutter locally or upgrade it if already installed
  $ pip install --user --upgrade cookiecutter
  # OR, once you have created a virtualenv per the steps below, install it
  (my-repository-venv)$ pip install --upgrade cookiecutter

.. note::

  If you install Cookiecutter in the virtualenv, you will need to activate the
  virtualenv to be able to use `cookiecutter` on the command-line.


We can now begin. First, let's create a `virtualenv <https://virtualenv.pypa.io/en/stable/installation/>`_
using `virtualenvwrapper <https://virtualenvwrapper.readthedocs.io/en/latest/install.html>`_
in order to sandbox our Python environment for development:

.. code-block:: shell

  $ mkvirtualenv my-repository-venv

Now, let's scaffold the instance using the `official cookiecutter template
<https://github.com/inveniosoftware/cookiecutter-invenio-instance>`_.

.. code-block:: shell

  (my-repository-venv)$ cookiecutter gh:inveniosoftware/cookiecutter-invenio-instance --checkout v3.0
  project_name [My site]: My repository
  project_shortname [my-repository]:
  project_site [my-repository.com]:
  package_name [my_repository]:
  github_repo [my-repository/my-repository]:
  description [Invenio digital library framework.]: My repository digital library
  author_name [CERN]: Me
  author_email [<EMAIL>]: <EMAIL>
  year [2018]:
  copyright_holder [Me]:
  transifex_project [my-repository]:
  Select database:
  1 - postgresql
  2 - mysql
  Choose from 1, 2 [1]:
  Select elasticsearch:
  1 - 6
  2 - 5
  Choose from 1, 2 [1]:
  # ... project scaffolding output ...

Now that we have our instance's source code ready we can proceed with the
initial setup of the services and dependencies of the project:

.. code-block:: shell

  # Fire up the database, Elasticsearch, Redis and RabbitMQ
  (my-repository-venv)$ cd my-repository/
  (my-repository-venv)$ docker-compose up -d
  Creating network "myrepository_default" with the default driver
  Creating myrepository_cache_1 ... done
  Creating myrepository_db_1    ... done
  Creating myrepository_es_1    ... done
  Creating myrepository_mq_1    ... done
  # Install dependencies and generate static assets
{'fraction_non_alphanumeric': 0.09940138626339004, 'fraction_numerical': 0.008821676118462508, 'mean_word_length': 3.9217054263565894, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 16, 'lorem ipsum': 0, 'www.': 2, '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': '7205794', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1805, 'n_words': 664}