From 2fc3919598b5a83e5e99b8c177dea36965cc49ce Mon Sep 17 00:00:00 2001 From: Edmund Luong Date: Sun, 1 Jan 2017 10:22:01 -0500 Subject: [PATCH 1/4] Added service container for Selenium standalone with Chrome (#519) * Added service container for Selenium standalone with Chrome --- README.md | 11 +++++++++++ docker-compose.yml | 7 +++++++ selenium/Dockerfile | 5 +++++ 3 files changed, 23 insertions(+) create mode 100644 selenium/Dockerfile diff --git a/README.md b/README.md index 0bbf9680..21a39336 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to - [Use phpMyAdmin](#Use-phpMyAdmin) - [Use pgAdmin](#Use-pgAdmin) - [Use ElasticSearch](#Use-ElasticSearch) + - [Use Selenium](#Use-Selenium) - [CodeIgniter](#CodeIgniter): - [Install CodeIgniter](#Install-CodeIgniter) - [Misc](#Misc) @@ -1058,7 +1059,17 @@ docker exec {container-name} /usr/share/elasticsearch/bin/plugin install delete- docker restart {container-name} ``` +
+ +### Use Selenium +1 - Run the Selenium Container (`selenium`) with the `docker-compose up` command. Example: + +```bash +docker-compose up -d selenium +``` + +2 - Open your browser and visit the localhost on port **4444** at the following URL: `http://localhost:4444/wd/hub` diff --git a/docker-compose.yml b/docker-compose.yml index eec861e1..0e06bd81 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -324,6 +324,13 @@ services: links: - php-fpm +### Selenium Container ######################################### + + selenium: + build: ./selenium + ports: + - "4444:4444" + ### Volumes Setup ########################################### volumes: diff --git a/selenium/Dockerfile b/selenium/Dockerfile new file mode 100644 index 00000000..bc98b686 --- /dev/null +++ b/selenium/Dockerfile @@ -0,0 +1,5 @@ +FROM selenium/standalone-chrome + +MAINTAINER Edmund Luong + +EXPOSE 4444 \ No newline at end of file From 460b24f7eee8627dad73e9370f4d588ed6988436 Mon Sep 17 00:00:00 2001 From: iat <1329517386@qq.com> Date: Tue, 3 Jan 2017 09:27:45 +0800 Subject: [PATCH 2/4] Update README-zh.md --- README-zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-zh.md b/README-zh.md index 0fd49442..0ea0c0ea 100644 --- a/README-zh.md +++ b/README-zh.md @@ -469,7 +469,7 @@ composer create-project laravel/laravel my-cool-app "5.2.*" 系统默认LaraDock假定Laravel应用在LaraDock的父级目录中 By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. -自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www`替换 `../:/var/www` , 如下: +更新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www`替换 `../:/var/www` , 如下: ```yaml application: From c59dea37456aef4fec1d9224903687ad876ed38c Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 2 Jan 2017 20:41:00 -0500 Subject: [PATCH 3/4] add beanstalkd section and update the readme.md --- README.md | 984 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 596 insertions(+), 388 deletions(-) diff --git a/README.md b/README.md index 21a39336..ad258b2d 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,26 @@ Laradock is a Docker PHP development environment. It facilitate running **PHP** Apps on **Docker**. +>Use Docker first and learn about it later. + + + + + + + +## Intro + +Laradock strives to make the PHP development experience easier and faster. + +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 machines. + Laradock is configured to run Laravel Apps by default, and it can be modified to run all kinds of PHP Apps (Symfony, CodeIgniter, Wordpress, Drupal...). ->Use Docker first and learn about it later. + + + + ## Contents @@ -50,10 +67,12 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to - [Run Artisan Commands](#Run-Artisan-Commands) - [Use Redis](#Use-Redis) - [Use Mongo](#Use-Mongo) - - [Use phpMyAdmin](#Use-phpMyAdmin) - - [Use pgAdmin](#Use-pgAdmin) + - [Use PhpMyAdmin](#Use-phpMyAdmin) + - [Use PgAdmin](#Use-pgAdmin) + - [Use Beanstalkd](#Use-Beanstalkd) - [Use ElasticSearch](#Use-ElasticSearch) - [Use Selenium](#Use-Selenium) + - [Use RethinkDB](#Use-RethinkDB) - [CodeIgniter](#CodeIgniter): - [Install CodeIgniter](#Install-CodeIgniter) - [Misc](#Misc) @@ -75,26 +94,40 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to - -## Intro - -Laradock strives to make the PHP development experience easier and faster. - -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 machines. -**Usage Overview:** -Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Redis`. Then run `Laravel`. +### Quick Overview: + +Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL`, `Redis` and `Beanstalkd`: + +1 - Clone Laradock inside your PHP project: + +```shell +git clone https://github.com/Laradock/laradock.git +``` + +2 - Enter the laradock folder and run this command: + +```shell +docker-compose up -d nginx mysql redis beanstalkd +``` + +3 - Open your `.env` file and set the following: + +```shell +DB_HOST=mysql +REDIS_HOST=redis +QUEUE_HOST=beanstalkd +``` + +4 - Open your browser and visi localhost: `http://localhost`. + +```shell +That's it! enjoy :) +``` + -1. Get LaraDock inside your Laravel project: -
-`git clone https://github.com/LaraDock/laradock.git`. -2. Enter the laradock folder and run only these Containers: -
-`docker-compose up -d nginx mysql redis` -3. Open your `.env` file and set `DB_HOST` to `mysql` and `REDIS_HOST` to `redis`. -4. Open your browser and visit the localhost: `http://localdock` @@ -116,6 +149,10 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red - More to come every week.. + + + + ### Supported Software (Containers) @@ -138,14 +175,26 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red - PHP-FPM - HHVM - **Message Queueing Systems:** - - Beanstalkd (+ Beanstalkd Console) - - RabbitMQ (+ RabbitMQ Console) + - Beanstalkd + - Beanstalkd Console + - RabbitMQ + - RabbitMQ Console - **Tools:** - - Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, xDebug, Envoy, Vim...) - PhpMyAdmin - PgAdmin - ElasticSearch - + - Selenium + - Workspace + - PHP7-CLI + - Composer + - Git + - Node + - Gulp + - SQLite + - xDebug + - Envoy + - Vim + - ... Many other supported tools are not documented. (Will be updated soon) >If you can't find your Software, build it yourself and add it to this list. Contributions are welcomed :) @@ -153,12 +202,17 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red + ### What is Docker? [Docker](https://www.docker.com) is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of [operating-system-level virtualization](https://en.wikipedia.org/wiki/Operating-system-level_virtualization) on Linux, Mac OS and Windows. + + + + ### Why Docker not Vagrant!? @@ -171,6 +225,10 @@ In addition to the speed, Docker gives tons of features that cannot be achieved Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time). + + + + ### Laradock VS Homestead (For Laravel Developers) @@ -188,6 +246,7 @@ Running a virtual Container is much faster than running a full virtual Machine. + ## Demo Video @@ -200,6 +259,9 @@ What's better than a **Demo Video**: + + + ## Requirements @@ -208,6 +270,9 @@ What's better than a **Demo Video**: + + + ## Installation @@ -303,10 +368,10 @@ Do the same for each project `project2.conf`, `project3.conf`,... + ## Usage - **Read Before starting:** If you are using **Docker Toolbox** (VM), do one of the following: @@ -335,9 +400,7 @@ docker-compose up -d nginx mysql You can select your own combination of Containers form the list below: -`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`, `aerospike`, `pgadmin`, `elasticsearch`. - - +`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`, `aerospike`, `pgadmin`, `elasticsearch`, `rethinkdb`.
@@ -354,8 +417,6 @@ docker exec -it {workspace-container-id} bash **Note:** You can add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user. (you can change the PUID (User id) and PGID (group id) variables from the `docker-compose.yml`). - -
3 - Edit your project configurations. @@ -367,30 +428,35 @@ DB_HOST=mysql *If you want to use Laravel and you don't have it installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel).* - - -
4 - Open your browser and visit your localhost address (`http://localhost/`). - -
**Debugging**: if you are facing any problem here check the [Debugging](#debugging) section. If you need a special support. Contact me, more details in the [Help & Questions](#Help) section. + + + +
## Documentation + + + + + + ### List current running Containers ```bash @@ -406,6 +472,7 @@ docker-compose ps +
### Close all running Containers @@ -436,7 +503,6 @@ docker-compose down -
### Enter a Container (run commands in a running Container) @@ -462,7 +528,6 @@ docker-compose exec mysql bash -
### Edit default container configuration @@ -491,8 +556,6 @@ Change Redis defaut port to 1111: - -
### Edit a Docker Image @@ -515,8 +578,6 @@ More info on Containers rebuilding [here](#Build-Re-build-Containers). - -
### Build/Re-build Containers @@ -538,6 +599,7 @@ You might use the `--no-cache` option if you want full rebuilding (`docker-compo +
### Add more Software (Docker Images) @@ -549,9 +611,6 @@ To add an image (software), just edit the `docker-compose.yml` and add your cont - - -
### View the Log files @@ -568,8 +627,6 @@ docker logs {container-name} - -
@@ -592,9 +649,6 @@ The PHP-CLI extensions should be installed in `workspace/Dockerfile`. - - -
### Change the (PHP-FPM) Version @@ -602,6 +656,7 @@ By default **PHP-FPM 7.0** is running. >The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planning to run your application on different PHP-FPM version. + #### A) Switch from PHP `7.0` to PHP `5.6` 1 - Open the `docker-compose.yml`. @@ -648,12 +703,6 @@ We do not natively support PHP 5.5 anymore, but you can get it in few steps: - - - - - -
### Change the PHP-CLI Version @@ -668,6 +717,8 @@ Right now you have to manually edit the `Dockerfile` or create a new one like it + +
### Install xDebug @@ -714,6 +765,10 @@ xdebug.remote_connect_back=1 For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm). + + + +
### Start/Stop xDebug: @@ -730,12 +785,15 @@ To control the behavior of xDebug (in the `php-fpm` Container), you can run the +
+ +
### Prepare LaraDock for Production @@ -767,19 +825,14 @@ To learn more about how Docker publishes ports, please read [this excellent post - - - - - - -
+ + ### Install Laravel from a Docker Container @@ -821,6 +874,9 @@ cd my-cool-app + + +
### Run Artisan Commands @@ -860,6 +916,11 @@ Composer update phpunit ``` + + + + +
### Use Redis @@ -912,6 +973,7 @@ composer require predis/predis:^1.0 +
### Use Mongo @@ -1005,7 +1067,7 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins
-### Use phpMyAdmin +### Use PhpMyAdmin 1 - Run the phpMyAdmin Container (`phpmyadmin`) with the `docker-compose up` command. Example: @@ -1020,9 +1082,13 @@ docker-compose up -d mariadb phpmyadmin 2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080` + + + +
-### Use pgAdmin +### Use PgAdmin 1 - Run the pgAdmin Container (`pgadmin`) with the `docker-compose up` command. Example: @@ -1033,11 +1099,57 @@ docker-compose up -d postgres pgadmin 2 - Open your browser and visit the localhost on port **5050**: `http://localhost:5050` + + + + +
+ +### Use Beanstalkd + +1 - Run the Beanstalkd Container: + +```bash +docker-compose up -d beanstalkd +``` + +2 - Configure Laravel to connect to that container by editing the `config/queue.php` config file. + +a. first set `beanstalkd` as default queue driver +b. set the queue host to beanstalkd : `QUEUE_HOST=beanstalkd` + +*beanstalkd is now available on default port `11300`.* + +3 - Require the dependecy package [pda/pheanstalk](https://github.com/pda/pheanstalk) using composer. + + +Optionally you can use the Beanstalkd Console Container to manage your Queues from a web interface. + +1 - Run the Beanstalkd Console Container: + +```bash +docker-compose up -d beanstalkd-console +``` + +2 - Open your browser and visit `http://localhost:2080/` + +3 - Add the server + +- Host: beanstalkd +- Port: 11300 + +4 - Done. + + + + + +
### Use ElasticSearch -1 - Run the ElasticSearch Container (`elasticsearch`) with the `docker-compose up` command. Example: +1 - Run the ElasticSearch Container (`elasticsearch`) with the `docker-compose up` command: ```bash docker-compose up -d elasticsearch @@ -1045,7 +1157,8 @@ docker-compose up -d elasticsearch 2 - Open your browser and visit the localhost on port **9200**: `http://localhost:9200` -### Install ElasticSearch Plugin + +#### Install ElasticSearch Plugin 1 - Install the ElasticSearch plugin like [delete-by-query](https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugins-delete-by-query.html). @@ -1059,6 +1172,11 @@ docker exec {container-name} /usr/share/elasticsearch/bin/plugin install delete- docker restart {container-name} ``` + + + + +
### Use Selenium @@ -1076,301 +1194,9 @@ docker-compose up -d selenium - -
- -
- - - - -### Install CodeIgniter - -To install CodeIgniter 3 on Laradock all you have to do is the following simple steps: - -1 - Open the `docker-compose.yml` file. - -2 - Change `CODEIGNITER=false` to `CODEIGNITER=true`. - -3 - Re-build your PHP-FPM Container `docker-compose build php-fpm`. - - - - - - -
- - - - - - -
- - -### Change the timezone - -To change the timezone for the `workspace` container, modify the `TZ` build argument in the Docker Compose file to one in the [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - -For example, if I want the timezone to be `New York`: - -```yml - workspace: - build: - context: ./workspace - args: - - TZ=America/New_York - ... -``` - -We also recommend [setting the timezone in Laravel](http://www.camroncade.com/managing-timezones-with-laravel/). - - -### Adding cron jobs - -You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line. - -``` -* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1 - -# Custom cron -* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1 -``` - -Make sure you [change the timezone](#Change-the-timezone) if you don't want to use the default (UTC). - - -### Access workspace via ssh - -You can access the `workspace` container through `localhost:2222` by setting the `INSTALL_WORKSPACE_SSH` build argument to `true`. - -To change the default forwarded port for ssh: - -```yml - workspace: - ports: - - "2222:22" # Edit this line - ... -``` - - -### MySQL access from host - -You can forward the MySQL/MariaDB port to your host by making sure these lines are added to the `mysql` or `mariadb` section of the `docker-compose.yml` or in your [environment specific Compose](https://docs.docker.com/compose/extends/) file. - -``` -ports: - - "3306:3306" -``` - - -### MySQL root access - -The default username and password for the root mysql user are `root` and `root `. - -1 - Enter the mysql contaier: `docker-compose exec mysql bash`. - -2 - Enter mysql: `mysql -uroot -proot` for non root access use `mysql -uhomestead -psecret`. - -3 - See all users: `SELECT User FROM mysql.user;` - -4 - Run any commands `show databases`, `show tables`, `select * from.....`. - - - -### Change MySQL port - -Modify the `mysql/my.cnf` file to set your port number, `1234` is used as an example. - -``` -[mysqld] -port=1234 -``` - -If you need MySQL access from your host, do not forget to change the internal port number (`"3306:3306"` -> `"3306:1234"`) in the docker-compose configuration file. - - -### Use custom Domain (instead of the Docker IP) - -Assuming your custom domain is `laravel.dev` - -1 - Open your `/etc/hosts` file and map your localhost address `127.0.0.1` to the `laravel.dev` domain, by adding the following: - -```bash -127.0.0.1 laravel.dev -``` - -2 - Open your browser and visit `{http://laravel.dev}` - - -Optionally you can define the server name in the nginx configuration file, like this: - -```conf -server_name laravel.dev; -``` - - - -
- -### Enable Global Composer Build Install - -Enabling Global Composer Install during the build for the container allows you to get your composer requirements installed and available in the container after the build is done. - -1 - Open the `docker-compose.yml` file - -2 - Search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true` - -It should be like this: - -```yml - workspace: - build: - context: ./workspace - args: - - COMPOSER_GLOBAL_INSTALL=true - ... -``` -3 - Now add your dependencies to `workspace/composer.json` - -4 - Re-build the Workspace Container `docker-compose build workspace` - - - - -
- -### Install Prestissimo - -[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. - -1 - Enable Running Global Composer Install during the Build: - -Click on this [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) and do steps 1 and 2 only then continue here. - -2 - Add prestissimo as requirement in Composer: - -a - Now open the `workspace/composer.json` file - -b - Add `"hirak/prestissimo": "^0.3"` as requirement - -c - Re-build the Workspace Container `docker-compose build workspace` - - - - -
- -### Install Node + NVM - -To install NVM and NodeJS in the Workspace container - -1 - Open the `docker-compose.yml` file - -2 - Search for the `INSTALL_NODE` argument under the Workspace Container and set it to `true` - -It should be like this: - -```yml - workspace: - build: - context: ./workspace - args: - - INSTALL_NODE=true - ... -``` - -3 - Re-build the container `docker-compose build workspace` - -
- -### Install Node + YARN - -Yarn is a new package manager for JavaScript. It is so faster than npm, which you can find [here](http://yarnpkg.com/en/compare).To install NodeJS and [Yarn](https://yarnpkg.com/) in the Workspace container: - -1 - Open the `docker-compose.yml` file - -2 - Search for the `INSTALL_NODE` and `INSTALL_YARN` argument under the Workspace Container and set it to `true` - -It should be like this: - -```yml - workspace: - build: - context: ./workspace - args: - - INSTALL_NODE=true - - INSTALL_YARN=true - ... -``` - -3 - Re-build the container `docker-compose build workspace` - -
- -### Install Aerospike extension - -1 - First install `aerospike` in the Workspace and the PHP-FPM Containers: -
-a) open the `docker-compose.yml` file -
-b) search for the `INSTALL_AEROSPIKE_EXTENSION` argument under the Workspace Container -
-c) set it to `true` -
-d) search for the `INSTALL_AEROSPIKE_EXTENSION` argument under the PHP-FPM Container -
-e) set it to `true` - -It should be like this: - -```yml - workspace: - build: - context: ./workspace - args: - - INSTALL_AEROSPIKE_EXTENSION=true - ... - php-fpm: - build: - context: ./php-fpm - args: - - INSTALL_AEROSPIKE_EXTENSION=true - ... -``` - -2 - Re-build the containers `docker-compose build workspace php-fpm` - -
- -### Install Laravel Envoy (Envoy Task Runner) - -1 - Open the `docker-compose.yml` file -
-2 - Search for the `INSTALL_LARAVEL_ENVOY` argument under the Workspace Container -
-3 - Set it to `true` -
- -It should be like this: - -```yml - workspace: - build: - context: ./workspace - args: - - INSTALL_LARAVEL_ENVOY=true - ... -``` - -4 - Re-build the containers `docker-compose build workspace` - -####[Laravel Envoy Documentation Here](https://laravel.com/docs/5.3/envoy) -
-### Use RethinkDB Container +### Use RethinkDB The RethinkDB is an open-source Database for Real-time Web ([RethinkDB](https://rethinkdb.com/)). A package ([Laravel RethinkDB](https://github.com/duxet/laravel-rethinkdb)) is being developed and was released a version for Laravel 5.2 (experimental). @@ -1408,9 +1234,375 @@ docker-compose up -d rethinkdb - set the `DB_PORT` to `28015`. - set the `DB_DATABASE` to `database`. + + + + + +
+ + + + + + + +
+ +### Install CodeIgniter + +To install CodeIgniter 3 on Laradock all you have to do is the following simple steps: + +1 - Open the `docker-compose.yml` file. + +2 - Change `CODEIGNITER=false` to `CODEIGNITER=true`. + +3 - Re-build your PHP-FPM Container `docker-compose build php-fpm`. + + + + + + +
+ + + + + + + +
+ +### Change the timezone + +To change the timezone for the `workspace` container, modify the `TZ` build argument in the Docker Compose file to one in the [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + +For example, if I want the timezone to be `New York`: + +```yml + workspace: + build: + context: ./workspace + args: + - TZ=America/New_York + ... +``` + +We also recommend [setting the timezone in Laravel](http://www.camroncade.com/managing-timezones-with-laravel/). + + + + + + +
+ +### Adding cron jobs + +You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line. + +``` +* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1 + +# Custom cron +* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1 +``` + +Make sure you [change the timezone](#Change-the-timezone) if you don't want to use the default (UTC). + + + + + + +
+ +### Access workspace via ssh + +You can access the `workspace` container through `localhost:2222` by setting the `INSTALL_WORKSPACE_SSH` build argument to `true`. + +To change the default forwarded port for ssh: + +```yml + workspace: + ports: + - "2222:22" # Edit this line + ... +``` + + + + + + +
+ +### MySQL access from host + +You can forward the MySQL/MariaDB port to your host by making sure these lines are added to the `mysql` or `mariadb` section of the `docker-compose.yml` or in your [environment specific Compose](https://docs.docker.com/compose/extends/) file. + +``` +ports: + - "3306:3306" +``` + + + + + + +
+ +### MySQL root access + +The default username and password for the root mysql user are `root` and `root `. + +1 - Enter the mysql contaier: `docker-compose exec mysql bash`. + +2 - Enter mysql: `mysql -uroot -proot` for non root access use `mysql -uhomestead -psecret`. + +3 - See all users: `SELECT User FROM mysql.user;` + +4 - Run any commands `show databases`, `show tables`, `select * from.....`. + + + + + + +
+ +### Change MySQL port + +Modify the `mysql/my.cnf` file to set your port number, `1234` is used as an example. + +``` +[mysqld] +port=1234 +``` + +If you need MySQL access from your host, do not forget to change the internal port number (`"3306:3306"` -> `"3306:1234"`) in the docker-compose configuration file. + + + + + + +
+ +### Use custom Domain (instead of the Docker IP) + +Assuming your custom domain is `laravel.dev` + +1 - Open your `/etc/hosts` file and map your localhost address `127.0.0.1` to the `laravel.dev` domain, by adding the following: + +```bash +127.0.0.1 laravel.dev +``` + +2 - Open your browser and visit `{http://laravel.dev}` + + +Optionally you can define the server name in the nginx configuration file, like this: + +```conf +server_name laravel.dev; +``` + + + + + + +
+ +### Enable Global Composer Build Install + +Enabling Global Composer Install during the build for the container allows you to get your composer requirements installed and available in the container after the build is done. + +1 - Open the `docker-compose.yml` file + +2 - Search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - COMPOSER_GLOBAL_INSTALL=true + ... +``` +3 - Now add your dependencies to `workspace/composer.json` + +4 - Re-build the Workspace Container `docker-compose build workspace` + + + + + + +
+ +### Install Prestissimo + +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. + +1 - Enable Running Global Composer Install during the Build: + +Click on this [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) and do steps 1 and 2 only then continue here. + +2 - Add prestissimo as requirement in Composer: + +a - Now open the `workspace/composer.json` file + +b - Add `"hirak/prestissimo": "^0.3"` as requirement + +c - Re-build the Workspace Container `docker-compose build workspace` + + + + + + +
+ +### Install Node + NVM + +To install NVM and NodeJS in the Workspace container + +1 - Open the `docker-compose.yml` file + +2 - Search for the `INSTALL_NODE` argument under the Workspace Container and set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_NODE=true + ... +``` + +3 - Re-build the container `docker-compose build workspace` + + + + + + +
+ +### Install Node + YARN + +Yarn is a new package manager for JavaScript. It is so faster than npm, which you can find [here](http://yarnpkg.com/en/compare).To install NodeJS and [Yarn](https://yarnpkg.com/) in the Workspace container: + +1 - Open the `docker-compose.yml` file + +2 - Search for the `INSTALL_NODE` and `INSTALL_YARN` argument under the Workspace Container and set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_NODE=true + - INSTALL_YARN=true + ... +``` + +3 - Re-build the container `docker-compose build workspace` + + + + + + +
+ +### Install Aerospike extension + +1 - First install `aerospike` in the Workspace and the PHP-FPM Containers: +
+a) open the `docker-compose.yml` file +
+b) search for the `INSTALL_AEROSPIKE_EXTENSION` argument under the Workspace Container +
+c) set it to `true` +
+d) search for the `INSTALL_AEROSPIKE_EXTENSION` argument under the PHP-FPM Container +
+e) set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_AEROSPIKE_EXTENSION=true + ... + php-fpm: + build: + context: ./php-fpm + args: + - INSTALL_AEROSPIKE_EXTENSION=true + ... +``` + +2 - Re-build the containers `docker-compose build workspace php-fpm` + + + + + + +
+ +### Install Laravel Envoy (Envoy Task Runner) + +1 - Open the `docker-compose.yml` file +
+2 - Search for the `INSTALL_LARAVEL_ENVOY` argument under the Workspace Container +
+3 - Set it to `true` +
+ +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_LARAVEL_ENVOY=true + ... +``` + +4 - Re-build the containers `docker-compose build workspace` + +####[Laravel Envoy Documentation Here](https://laravel.com/docs/5.3/envoy) + + + + + +
+ + + + + ### PHPStorm Remote debug Laravel web and phpunit tests. @@ -1420,13 +1612,20 @@ Remote debug Laravel web and phpunit tests.
+ + + + + ### Miscellaneous - *Here's a list of the common problems you might face, and the possible solutions.* + + + #### I see a blank (white) page instead of the Laravel 'Welcome' page! Run the following command from the Laravel root directory: @@ -1436,18 +1635,28 @@ sudo chmod -R 777 storage bootstrap/cache ``` + + + + #### I see "Welcome to nginx" instead of the Laravel App! Use `http://127.0.0.1` instead of `http://localhost` in your browser. + + + #### I see an error message containing `address already in use` or `port is already allocated` Make sure the ports for the services that you are trying to run (22, 80, 443, 3306, etc.) are not being used already by other programs on the host, such as a built in `apache`/`httpd` service or other development tools you have installed. + + + #### I get Nginx error 404 Not Found on Windows. 1. Go to docker Settings on your Windows machine. @@ -1455,6 +1664,11 @@ Make sure the ports for the services that you are trying to run (22, 80, 443, 33 3. Enter your windows username and password. 4. Go to the `reset` tab and click restart docker. + + + + + #### I get Mysql connection refused This error sometimes happens because your Laravel application isn't running on the container localhost IP (Which is 127.0.0.1). Steps to fix it: @@ -1468,11 +1682,12 @@ This error sometimes happens because your Laravel application isn't running on t + +
### Upgrading LaraDock - Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requires upgrading LaraDock from v3.* to v4.*: 1. Stop the docker vm `docker-machine stop {default}` @@ -1489,7 +1704,6 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ -
## Contributing @@ -1497,6 +1711,11 @@ This little project was built by one man who has a full time job and many respon #### Read the [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md). + + + + +
## Related Projects @@ -1514,6 +1733,11 @@ These Docker Compose projects have piqued our interest: If you want your project listed here, please open an issue. + + + + +
## Help & Questions @@ -1527,41 +1751,25 @@ For special help with Docker and/or Laravel, you can schedule a live call with t + + ## Credits -**Creator:** - -- [Mahmoud Zalt](https://github.com/Mahmoudz) [ [Twitter](https://twitter.com/Mahmoud_Zalt) | [Personal Site](http://zalt.me) | [Linkedin](https://www.linkedin.com/in/mahmoudzalt) ] - -**Admins:** +**Super Admins:** +- [Mahmoud Zalt](https://github.com/Mahmoudz) (mahmoudz) [ [Twitter](https://twitter.com/Mahmoud_Zalt) | [Personal Site](http://zalt.me) | [Linkedin](https://www.linkedin.com/in/mahmoudzalt) ] - [Bo-Yi Wu](https://github.com/appleboy) (appleboy) - [Philippe Trépanier](https://github.com/philtrep) (philtrep) +- YOU?! Join Us. -**Main Contributors:** - -- [Francis Lavoie](https://github.com/francislavoie) (francislavoie) -- [luciano-jr](https://github.com/luciano-jr) -- [Zhqagp](https://github.com/zhqagp) -- [Tim B.](https://github.com/tjb328) (tjb328) -- [MidasCodeBreaker](https://github.com/midascodebreaker) -- [Larry Eitel](https://github.com/LarryEitel) -- [Suteepat](https://github.com/tianissimo) (tianissimo) -- [David](https://github.com/davidavz) (davidavz) -- [Lialosiu](https://github.com/lialosiu) -- [Eric Pfeiffer](https://github.com/computerfr33k) (computerfr33k) -- [Orette](https://github.com/orette) -- [Jack Fletcher](https://github.com/Kauhat) (Kauhat) -- [Amin Mkh](https://github.com/AminMkh) -- [Matthew Tonkin Dunn](https://github.com/mattythebatty) (mattythebatty) -- [Zhivitsa Kirill](https://github.com/zhikiri) (zhikiri) -- [Benmag](https://github.com/benmag) -- [Cristian Mello](https://github.com/cristiancmello) (cristiancmello) - -**Other Contributors & Supporters:** +**Amazing Contributors:** - [Contributors](https://github.com/LaraDock/laradock/graphs/contributors) -- [Supporters](https://github.com/LaraDock/laradock/issues?utf8=%E2%9C%93&q=) + + + + + ## License From b569765f8280169a173cfd41af3d524837c46569 Mon Sep 17 00:00:00 2001 From: Edmund Luong Date: Sat, 7 Jan 2017 11:35:59 -0500 Subject: [PATCH 4/4] Add .env file for converting Windows paths to resolve issues with Docker Compose in Docker Toolbox (#531) --- .env | 1 + .gitignore | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 00000000..accd09a0 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +COMPOSE_CONVERT_WINDOWS_PATHS=1 diff --git a/.gitignore b/.gitignore index 00571d72..7c6f11b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .idea /logs /data -.env