From 0973aaf166481f179b8152c78ad69c89b6f9fded Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 8 Apr 2016 00:48:32 +0300 Subject: [PATCH] update the documenation - make redis optional --- README.md | 157 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 102 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 6c5b9a6d..73da7690 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,31 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Intro](#Intro) +- [Supported Software (Docker Images)](#Supported-Software) - [Requirements](#Requirements) - [Usage](#Usage) - [Documentation](#Documentation) -- [Docker Images](#Images) + - [List current running Containers](#List-current-running-Containers) + - [Close all running Containers](#Close-all-running-Containers) + - [Delete all existing Containers](#Delete-all-existing-Containers) + - [Change the PHP Version](#Change-the-PHP-Version) + - [Use Redis in Laravel](#Use-Redis-in-Laravel) + - [Add/Remove a Docker Container](#AddRemove-a-Docker-Container) + - [Add Docker Images](#Add-Docker-Images) + - [Edit a Docker Container](#Edit-a-Docker-Container) + - [View the Log files](#View-the-Log-files) + - [Upgrade the Docker Images](#Upgrade-the-Docker-Images) + - [Edit a Docker Image](#Edit-a-Docker-Image) + + + + + + -### Intro +## Intro LaraDock strives to make the development experience easier. It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine. @@ -45,12 +62,7 @@ Seriously!!! Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you **lightweight** Virtual Containers, that share the same kernel and allow to safely execute independent processes. -### Questions? -[![Join the chat at https://gitter.im/LaraDock/laradock](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - - - - + ## Supported Software (Docker Images) - PHP 5.6 / NGINX @@ -105,33 +117,12 @@ xxx.xxx.xxx.xxx laravel.dev Don't forget to replace the `xxx.xxx.xxx.xxx` with your Docker IP Address. -6 - From the new created `docker` folder in step 2, open the `docker-compose.yml` file to replace the `xxx.xxx.xxx.xxx` with your Docker IP Adress as well. +6 - In the new created `docker` folder in step 2, open the `docker-compose.yml` file to replace the `xxx.xxx.xxx.xxx` with your Docker IP Adress as well. -7 - Open your Laravel's `.env` file and set the `DB_HOST` and the `REDIS_HOST` to `laravel.dev` instead of the default `127.0.0.1`. +7 - Open your Laravel's `.env` file and set the `DB_HOST` to `laravel.dev` instead of the default `127.0.0.1`. ```env DB_HOST=laravel.dev -REDIS_HOST=laravel.dev -``` - -If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the `127.0.0.1` with `laravel.dev` for Redis like so: - -```php -'redis' => [ - 'cluster' => false, - 'default' => [ - 'host' => 'laravel.dev', - 'port' => 6379, - 'database' => 0, - ], -], -``` - -If you want to use Redis for Caching and/or for Sessions Management. Open the `.env` file and set `CACHE_DRIVER` and `SESSION_DRIVER` to `redis` instead of the default `file`. - -```env -CACHE_DRIVER=redis -SESSION_DRIVER=redis ``` 8 - Finally run the containers. **Make sure you are in the `docker` folder** before running this command. @@ -162,12 +153,14 @@ You can run `docker-compose up` (without **-d**) if you don't want to run the co ## Documentation -#### See current running Containers + +#### List current running Containers ```bash docker ps ```
+ #### Close all running Containers ```bash docker-compose stop @@ -175,6 +168,7 @@ docker-compose stop
+ #### Delete all existing Containers ```bash docker-compose rm -f @@ -187,13 +181,14 @@ docker-compose rm -f
+ #### Change the PHP Version By default **PHP 5.6** is running.
To change the default PHP version, simply open your `docker-compose.yml` file and edit this line: ```yaml -image: laradock/php56nginx:0.1.0 +image: laradock/php56nginx:latest ``` Supported versions: @@ -201,36 +196,61 @@ Supported versions: - (PHP 5.6.*) laradock/php56nginx:latest -**Note:** - -If you set `laradock/phpnginx` as your image, this will pull from `laradock/php56nginx`. - - -
-#### Upgrade the docker images - -By default `docker-compose.yml` is configured to use the latest stable version of the image (latest stable realease `tag`). - - -To use the latest build you can edit the `docker-compose.yml` file and replace the version number at the end of every image name with `:latest` -
-Example: change `image: laradock/mysql:0.1.0` to `image: laradock/mysql:latest` - - -
-#### Remove Container -To prevent a container (software) from running, open the `docker-compose.yml` file, and comment out the container section or remove it entirely. +**Note:** If you use this `laradock/phpnginx` image, it will pull from `laradock/php56nginx`.
-#### Add an Image (add a software to run with other Containers) + +#### Use Redis in Laravel + +1 - Open your Laravel's `.env` file and set the `REDIS_HOST` to `laravel.dev` instead of the default `127.0.0.1`. + +```env +REDIS_HOST=laravel.dev +``` + +If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the `127.0.0.1` with `laravel.dev` for Redis like this: + +```php +'redis' => [ + 'cluster' => false, + 'default' => [ + 'host' => 'laravel.dev', + 'port' => 6379, + 'database' => 0, + ], +], +``` + +To enable Redis Caching and/or for Sessions Management. Also from the `.env` file set `CACHE_DRIVER` and `SESSION_DRIVER` to `redis` instead of the default `file`. + +```env +CACHE_DRIVER=redis +SESSION_DRIVER=redis +``` + +Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer first. + +```shell +composer require predis/predis:^1.0 +``` + + + + +
+ +#### Add Docker Images +*(add a software to run with other Containers)* +
To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/yml/).
-#### Edit a Container (change Ports or Volumes) + +#### Edit a Docker Container (change Ports or Volumes) To modify a container you can simply open the `docker-compose.yml` and change everything you want. Example: if you want to set the MySQL port to 3333, just replace the default port with yours: @@ -243,13 +263,35 @@ Example: if you want to set the MySQL port to 3333, just replace the default por
+ #### View the Log files The Log files are stored in the `docker/logs` directory. +
-#### Edit an existing Image (change some configuration in the image) + +#### Upgrade the Docker Images + +By default `docker-compose.yml` is configured to use the latest stable version of the image (latest stable realease `tag`). + + +To use the latest build you can edit the `docker-compose.yml` file and replace the version number at the end of every image name with `:latest` +
+Example: change `image: laradock/mysql:0.1.0` to `image: laradock/mysql:latest` + + +
+ +#### Add/Remove a Docker Container +To prevent a container (software) from running, open the `docker-compose.yml` file, and comment out the container section or remove it entirely. + + + +
+ +#### Edit a Docker Image (change some configuration in the image) To edit an image, and take full control of it: 1. Clone any Image from [https://github.com/LaraDock](https://github.com/LaraDock) @@ -275,6 +317,11 @@ All Docker Images can be found at [https://github.com/LaraDock](https://github.c +#### Questions? +[![Join the chat at https://gitter.im/LaraDock/laradock](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + + ## Credits [![Mahmoud Zalt](https://img.shields.io/badge/Author-Mahmoud%20Zalt-orange.svg)](http://www.zalt.me)