Coding challenge - Web scrapping
Link to the test specification
First, you will need to install the application environment with docker-compose
Go to "How to install the project environment"
Then you will need to go to the welcome application page.
Please open your browser and enter with the application url:
http://eiprice-coding-challenge.local/
After that you will see the DOWNLOAD REPORT button on the page
You just need to press the button and the report will be downloaded
To validate the code for consistency with a coding standard, go to the project folder and run the commands:
PSR-1
$ vendor/bin/phpcs --standard=PSR1 --extensions=php --ignore=*/database/*,*/resources/*,*/storage/*,*/vendor/*,*/public/index.php,*/tests/bootstrap.php,*/bootstrap/cache/* .
PSR-2
$ vendor/bin/phpcs --standard=PSR2 --extensions=php --ignore=*/database/*,*/resources/*,*/storage/*,*/vendor/*,*/public/index.php,*/tests/bootstrap.php,*/bootstrap/cache/* .
PSR-12
$ vendor/bin/phpcs --standard=PSR12 --extensions=php --ignore=*/database/*,*/resources/*,*/storage/*,*/vendor/*,*/public/index.php,*/tests/bootstrap.php,*/bootstrap/cache/* .
- docker version >17.05.0-ce
- docker-compose version >1.19.0
- git version >2.7.4
To know your docker version run:
$ docker -v
To know your docker-composer version run:
$ docker-compose -v
To know your git version run:
$ git --version
To install the environment, follow the steps below:
Open your Linux console and enter into the workspace you want to clone the project.
Now you need to clone the project:
$ git clone https://github.com/felipedecampos/eiprice-coding-challenge.git
Then you need to enter into the project folder eiprice-coding-challenge:
$ cd eiprice-coding-challenge
Now you need to create the .env file:
$ cp .env.example .env
Note: Please, make sure you are not using the same IP and PORT (PHP and NGINX) mentioned into the .env file # Docker block
If you are already using the IP or PORT, please, replace for another one.
The next thing you should do is set your application key to a random string. Typically, this string should be 32 characters long. The key can be set in the .env file.
After that, you will install the environment with docker-compose:
Note: Please, make sure you have docker and docker-compose already installed in your computer
$ docker-compose up -d
When the containers are already running, you will need to install composer:
$ docker exec eiprice-php /bin/bash -c "composer install"
After that you will need to migrate the database:
$ docker exec eiprice-php /bin/bash -c "php artisan migrate"
$ docker exec eiprice-php /bin/bash -c "php artisan db:seed"
You also need to generate the composer optimized file:
$ docker exec eiprice-php /bin/bash -c "composer dump-autoload -o"
Finally, you are almost there, you need to leave the container:
$ exit
And now you just need to set up your local host with the IP and HOST of the application
You can run the command bellow:
$ sudo -- sh -c -e "echo '192.112.124.2\teiprice-coding-challenge.local' >> /etc/hosts";
Or you can just open you /etc/hosts manually and write the custom application host:
192.112.124.2 eiprice-coding-challenge.local;