<commit_before>Docker containers with Vagrant
------------------------------

> **Note! This section is under development and requires `Vagrant >= 1.6.5-dev`**

### Get started!

[Download](https://github.com/phundament/app/tags) or clone:

    git clone https://github.com/phundament/app.git
    cd app

### Initialize

Setup the your environment:

    cp .env-dist .env
    cp ./platforms/vagrant-docker/Vagrantfile .

**Since Vagrant <=1.6.5 has issues, with simulateous Docker containers, we recommend to start only the `db` container first, 
to bring up the `vagrant-docker-vm` _before_ starting the rest of the Docker containers:**

    vagrant up db --provider=docker
    vagrant up proxy --provider=docker

When the database container is running, initialize the application and setup the the database:

    vagrant docker-run web -- composer install --prefer-dist
    vagrant docker-run web -- ./yii app/setup --interactive=0

### Run

After initialization and setup you can bring up the containers:

    vagrant up proxy web --provider=docker

Now, you're ready to access the application under
 
 - [frontend application](http://docker.192.168.7.6.xip.io:22280)
 - [backend application](http://docker.192.168.7.6.xip.io:22281)


> #### Linux Users
>
> Our Vagrant `vagrant-docker-vm` registers a private network interface with the IP `192.168.7.6`.
> If you'd like to use your system docker installation uncomment the `docker.vagrant_vagrantfile` sections in the `Vagrantfile`
> in the project root folder. 
 
 
> #### Windows and OS X Users 
>
> If you want to reuse the Vagrant VM for your Docker containers across projects, follow these guidelines
>
> ```
> cp ./platforms/vagrant-docker/vm/Vagrantfile \
>    ~/vagrant-docker-vm/Vagrantfile
> ```
>
> And set your environment variable `DOCKER_HOST_VAGRANTFILE=~/vagrant-docker-vm/Vagrantfile`.
> Make sure your host is up before using the Docker provider.
>
> ```
> cd ~/vagrant-docker-vm
> vagrant up
> ```
>
> If you need to debug Docker, it is recommended to login to the `vagrant-docker-vm` with `vagrant ssh` and run docker from there.

--- 
 
> You can also load values from a  `fig.yml` into a `Vagrantfile` if you need to support both setups...
> 
>     fig = YAML.load(File.open(File.join(File.dirname(__FILE__), "fig.yml"), File::RDONLY).read)
>
> Assign a parameter from a fig file...
> 
>     docker.env = {
>       "VIRTUAL_HOST" => fig["api"]["environment"]["VIRTUAL_HOST"]
>     }

<commit_msg>Update 51-vagrant-docker.md<commit_after>Docker containers with Vagrant
------------------------------

> **Note! This section is under development and requires `Vagrant >= 1.6.5-dev`**

### Get started!

[Download](https://github.com/phundament/app/tags) or clone:

    git clone https://github.com/phundament/app.git
    cd app

### Initialize

Setup the your environment:

    cp .env-dist .env
    cp ./platforms/vagrant-docker/Vagrantfile .

**Since Vagrant <=1.6.5 has issues, with simulateous Docker containers, we recommend to start only the `db` container first, 
to bring up the `vagrant-docker-vm` _before_ starting the rest of the Docker containers:**

    vagrant up db --provider=docker
    vagrant up proxy --provider=docker

When the database container is running, initialize the application and setup the the database:

    vagrant docker-run web -- composer install --prefer-dist
    vagrant docker-run web -- ./yii app/setup --interactive=0

### Run

After initialization and setup you can bring up the containers:

    vagrant up proxy web --provider=docker

Now, you're ready to access the application under
 
 - [frontend application](http://docker.192.168.7.6.xip.io:22280)
 - [backend application](http://docker.192.168.7.6.xip.io:22281)


> #### Linux Users
>
> Our Vagrant `vagrant-docker-vm` registers a private network interface with the IP `192.168.7.6`.
> If you'd like to use your system docker installation uncomment the `docker.vagrant_vagrantfile` sections in the `Vagrantfile`
> in the project root folder. 
 
 
> #### Windows and OS X Users 
>
> If you want to reuse the Vagrant VM for your Docker containers across projects, follow these guidelines
>
> ```
> cp ./platforms/vagrant-docker/vm/Vagrantfile \
>    ~/vagrant-docker-vm/Vagrantfile
> ```
>
> And set your environment variable `DOCKER_HOST_VAGRANTFILE=~/vagrant-docker-vm/Vagrantfile`.
> Make sure your host is up before using the Docker provider.
>
> ```
> cd ~/vagrant-docker-vm
> vagrant up
> ```
>
> If you need to debug Docker, it is recommended to login to the `vagrant-docker-vm` with `vagrant ssh` and run docker from there.

--- 
 
> You can also load values from a  `fig.yml` into a `Vagrantfile` if you need to support both setups...
> 
>     require "yaml"
>     fig = YAML.load(File.open(File.join(File.dirname(__FILE__), "fig.yml"), File::RDONLY).read)
>
> Assign a parameter from a fig file...
> 
>     docker.env = {
>       "VIRTUAL_HOST" => fig["api"]["environment"]["VIRTUAL_HOST"]
>     }


{'fraction_non_alphanumeric': 0.13014661578630246, 'fraction_numerical': 0.016870857601928097, 'mean_word_length': 3.4385026737967914, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 74, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '2611381', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1575, 'n_words': 527}