<commit_before># Installation
*proophessor-do* offers you three options to install the demo application. We support *Vagrant*, *Docker* and have *manual* 
instructions.

> Docker is the recommended and fastest installation method

At first, please clone this repository by running `git clone https://github.com/prooph/proophessor-do.git` or download 
it manually from GitHub. 

If you use a own local web server, put this project to the document root of the local web 
server and navigate to the proophessor-do directory and follow the *Do it manually* instructions.

## Using Docker
First ensure [Docker](https://docs.docker.com/engine/installation/ubuntulinux/) and [Docker Compose](https://docs.docker.com/compose/install/) 
are installed. It's recommended to use the latest version of Docker and Docker Compose. Docker will download all 
dependencies and starts the containers.

### Step 1 - Install dependencies

To ensure you have the latest Docker images for the default application execute:

```bash
$ docker pull prooph/php:5.6-fpm && docker pull prooph/composer:5.6 && docker pull prooph/nginx:www
```

Install PHP dependencies via Composer

```bash
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 install -o --prefer-dist
```

Now start your Docker Container so we can use Docker Compose for the next steps

```bash
$ docker-compose up -d
```

### Step 2 - Install event store adapter

*prooph* offers two database adapters for `prooph/event-store` (at the moment).

The read model uses MySQL so it's important to execute the MySQL setup. This configures also MySQL for the event store.

```bash
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-doctrine-adapter -o --prefer-dist
$ docker-compose run --rm php sh bin/setup_mysql.sh
```

If you want to use MongoDB (only PHP 5.6 supported) for the event store execute also:

```bash
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-mongodb-adapter -o --prefer-dist
$ docker-compose run --rm php sh bin/setup_mongodb.sh
```

### Step 3 - That's it
Now open [http://localhost:8080](http://localhost:8080/) and have fun.

## Using Vagrant
Please install the following software if not already installed:

* [Vagrant >= 1.7.3](http://www.vagrantup.com/downloads.html)
* [Virtualbox >= 5.0](https://www.virtualbox.org/wiki/Downloads)
* [Vagrant docker-compose plugin](https://github.com/leighmcculloch/vagrant-docker-compose) (`vagrant plugin install vagrant-docker-compose`)

```bash<commit_msg>Update first step of Docker installation instructions to include download of source code<commit_after># Installation
*proophessor-do* offers you three options to install the demo application. We support *Vagrant*, *Docker* and have *manual* 
instructions.

> Docker is the recommended and fastest installation method

At first, please clone this repository by running `git clone https://github.com/prooph/proophessor-do.git` or download 
it manually from GitHub. 

If you use a own local web server, put this project to the document root of the local web 
server and navigate to the proophessor-do directory and follow the *Do it manually* instructions.

## Using Docker
First ensure [Docker](https://docs.docker.com/engine/installation/ubuntulinux/) and [Docker Compose](https://docs.docker.com/compose/install/) 
are installed. It's recommended to use the latest version of Docker and Docker Compose. Docker will download all 
dependencies and starts the containers.

### Step 1 - Get the source code
The application runs as a Docker volume. First download the source to a local directory:
`git clone https://github.com/prooph/proophessor-do.git`

If you are using a Linux distribution running SELinux then set the security context to allow Docker access to the volume:
`chcon -Rt svirt_sandbox_file_t proophessor-do/`

All the Docker commands are run from the source directory, so also do:
`cd proophessor-do/`

### Step 2 - Install dependencies

To ensure you have the latest Docker images for the default application execute:

```bash
$ docker pull prooph/php:5.6-fpm && docker pull prooph/composer:5.6 && docker pull prooph/nginx:www
```

Install PHP dependencies via Composer

```bash
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 install -o --prefer-dist
```

Now start your Docker Container so we can use Docker Compose for the next steps

```bash
$ docker-compose up -d
```

### Step 3 - Install event store adapter

*prooph* offers two database adapters for `prooph/event-store` (at the moment).

The read model uses MySQL so it's important to execute the MySQL setup. This configures also MySQL for the event store.

```bash
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-doctrine-adapter -o --prefer-dist
$ docker-compose run --rm php sh bin/setup_mysql.sh
```

If you want to use MongoDB (only PHP 5.6 supported) for the event store execute also:

```bash
$ docker run --rm -it --volume $(pwd):/app prooph/composer:5.6 require prooph/event-store-mongodb-adapter -o --prefer-dist
$ docker-compose run --rm php sh bin/setup_mongodb.sh
```

### Step 4 - That's it
Now open [http://localhost:8080](http://localhost:8080/) and have fun.

## Using Vagrant
Please install the following software if not already installed:

* [Vagrant >= 1.7.3](http://www.vagrantup.com/downloads.html)
* [Virtualbox >= 5.0](https://www.virtualbox.org/wiki/Downloads)
* [Vagrant docker-compose plugin](https://github.com/leighmcculloch/vagrant-docker-compose) (`vagrant plugin install vagrant-docker-compose`)

```bash
{'fraction_non_alphanumeric': 0.10727013542409124, 'fraction_numerical': 0.010156806842480399, 'mean_word_length': 4.315340909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 11, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6159630', 'n_tokens_mistral': 1801, 'n_tokens_neox': 1644, 'n_words': 661}