Compare commits

...

49 Commits

Author SHA1 Message Date
4f819c238c Merge pull request #451 from Blaasvis/master
Update MySQL startup script
2016-11-28 22:53:32 -05:00
d8875cb588 Update startup 2016-11-28 21:25:52 +01:00
bb9f65eb2a Merge pull request #445 from danielabbatt/patch-1
Update README.md
2016-11-26 01:33:50 +08:00
d6508f3bb3 Update README.md
Fixed typo on "environment"
2016-11-25 16:59:13 +00:00
a3288462a8 Merge pull request #434 from dlnsk/Fixes
Fixes for nginx and mysql
2016-11-25 01:51:25 -05:00
225fb8cf4f Merge pull request #384 from LarryEitel/phpstorm-guide
phpstorm-debugging-guide
2016-11-18 16:03:33 -05:00
f67edee5e5 LaraDock-PHPStorm Debugging Guide
-	modified:   README.md
-	new file:   _guides/photos/KiTTY/Connection.png
-	new file:   _guides/photos/KiTTY/ConnectionData.png
-	new file:   _guides/photos/KiTTY/ConnectionSSH.png
-	new file:   _guides/photos/KiTTY/ConnectionSSHAuth.png
-	new file:   _guides/photos/KiTTY/Session.png
-	new file:   _guides/photos/KiTTY/Terminal.png
-	new file:   _guides/photos/KiTTY/TerminalKeyboard.png
-	new file:   _guides/photos/KiTTY/TerminalShell.png
-	new file:   _guides/photos/KiTTY/Window.png
-	new file:   _guides/photos/KiTTY/WindowAppearance.png
-	new file:   _guides/photos/PHPStorm/DebugRemoteOn.png
-	new file:   _guides/photos/PHPStorm/RemoteDebuggingSuccess.png
-	new file:   _guides/photos/PHPStorm/RemoteHost.png
-	new file:   _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png
-	new file:   _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png
-	new file:   _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png
-	new file:   _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png
-	new file:   _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png
-	new file:   _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png
-	new file:   _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png
-	new file:   _guides/photos/PHPStorm/Settings/LangsPHPDebug.png
-	new file:   _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png
-	new file:   _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png
-	new file:   _guides/photos/PHPStorm/Settings/LangsPHPServers.png
-	new file:   _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png
-	new file:   _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png
-	new file:   _guides/photos/PHPStorm/Settings/hosts.png
-	new file:   _guides/photos/SimpleHostsEditor/AddHost_laravel.png
-	new file:   _guides/phpstorm.md
2016-11-18 14:12:10 -06:00
e5a8fb9c95 Merge pull request #437 from philtrep/fix-mysql-change-env
Added proper creation of mysql user, removal of default homestead user
2016-11-18 10:12:37 -05:00
4ef5db3713 Added proper creation of mysql user, removal of default homestead user 2016-11-17 16:37:51 -05:00
6bbd1fbe19 Use mysql 5.7 with disabled option ONLY_FULL_GROUP_BY (which causes many problem to people) 2016-11-16 16:16:52 +07:00
d703c82c46 Exclude sites configuration from image and just use volume 2016-11-16 15:58:42 +07:00
ecc4e06740 Merge pull request #432 from philtrep/port-already-allocated
Added 'port is already allocated' error to the docs debugging section
2016-11-15 09:20:37 -05:00
8b09149b15 Added 'port is already allocated' error to the docs debugging section 2016-11-14 20:48:59 -05:00
380178e6fa Merge pull request #429 from philtrep/mysql-bind-port
Added mysql change port bind documentation
2016-11-14 11:34:02 -05:00
be64b54606 Merge pull request #428 from laradock/appleboy-patch-1
fixed #420 remove phpmyadmin volume setting.
2016-11-14 11:32:55 -05:00
cbeeb48aa1 Added mysql change port binnd documentation 2016-11-14 11:24:28 -05:00
7e2814168a fixed #420 remove phpmyadmin volume setting. 2016-11-14 23:45:52 +08:00
5e9ae56a7f Merge pull request #419 from laradock/yarn
Revert #418 and fix install yarn package management.
2016-11-10 09:32:19 -05:00
5d98e78dba Revert #418 and fix install yarn package management.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-11-10 10:23:49 +08:00
c5d1116333 Merge pull request #418 from moxar/yarn
Fix a bug that prevents yarn from installing #415
2016-11-09 15:17:42 -05:00
5594c53e03 Fix bug in PATH 2016-11-09 17:55:35 +01:00
44045f85e6 Fix a bug that prevents yarn from installing 2016-11-09 16:14:49 +01:00
fc31a2415c Merge pull request #414 from joaojoyce/postgis-support
Postgis Support
2016-11-08 09:45:31 -05:00
a42f62c626 Postgis 2016-11-08 13:17:23 +00:00
3e4a5edc64 Merge pull request #407 from michaeljhopkins/patch-2
Add solution to mysql connection issues
2016-11-05 18:52:53 -04:00
9289c1b6c0 Add solution to mysql connection issues
Adding in a more "docker conventional" solution to the mysql connection issues
2016-11-05 06:42:19 -06:00
3f157a3277 Merge pull request #403 from darthrevan13/patch-1
Fix for mariadb local path
2016-11-03 23:02:16 +08:00
f732bb283b update the workspace container version 2016-11-03 09:50:21 -04:00
ca4aeada08 add missing step to the docs 2016-11-03 09:50:10 -04:00
3d54d68aa1 Fix for mariadb local path
When running docker-compose with mariadb the following message will appear:

ERROR: for mariadb  Cannot create container for service mariadb: Invalid volume spec "mariadb": Invalid volume destination path: 'mariadb' mount path must be absolute.
ERROR: Encountered errors while bringing up the project.

This commit fixes the issue.
2016-11-03 15:45:59 +02:00
a0153810c6 remove laradock logo on zh document.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-11-02 13:43:45 +08:00
4fe15ad5cf update docs 2016-11-01 10:07:21 -04:00
146f8ea6f4 rename volumes_source to applications 2016-11-01 10:05:10 -04:00
9ab6d8fa15 remove volumes container 2016-11-01 10:03:47 -04:00
f6d9ac6853 Merge pull request #401 from dsampaolo/fix-phpunit-path-missing
fix #395 adds phpunit path to non-root user's .bashrc
2016-11-01 15:51:10 +08:00
470994fc23 fix #395 adds phpunit path to non-root user's .bashrc 2016-11-01 07:19:58 +01:00
1b05dfd1e2 replace var/www/laravel with var/www 2016-10-31 21:45:50 -04:00
03bba8d2de Merge pull request #400 from LaraDock/appleboy-patch-1
fix phpunit path for multiple project.
2016-10-31 21:32:33 -04:00
b6c7746a0d fix workdir path.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-11-01 09:23:40 +08:00
e7baf3cfc3 fix phpunit path 2016-11-01 09:00:19 +08:00
f630970151 remove ./databases:/docker-entrypoint-initdb.d until it works 2016-10-31 20:46:02 -04:00
3070eac7b7 Merge pull request #399 from LaraDock/multiple-projects
Multiple projects
2016-10-31 20:32:44 -04:00
66723c0278 update the doc to support multiple projects 2016-10-31 20:30:34 -04:00
dbee864d44 rename laravel.conf to default and add sample conf 2016-10-31 19:50:30 -04:00
739cc31f4c change app mapping directory from www/laravel to www
also add sample to show facilitate setup for multiple sites
2016-10-31 19:49:48 -04:00
28130c5907 delete site_a and site_b nginx config samples 2016-10-31 19:31:15 -04:00
658d4e7532 add root access section to mysql docs 2016-10-31 19:30:12 -04:00
5da4058613 delete the drupal sample nginx config file 2016-10-31 19:28:47 -04:00
2ed09f42ca change workspace and php-fpm work directories
making them compatible with multiple projects
2016-10-31 19:28:25 -04:00
53 changed files with 582 additions and 202 deletions

View File

@ -7,9 +7,7 @@
LaraDock能够帮你在**Docker**上快速搭建**Laravel**应用。 LaraDock能够帮你在**Docker**上快速搭建**Laravel**应用。
<br> <br>
就像Laravel Homestead一样但是Docker替换了Vagrant。 就像Laravel Homestead一样但是Docker替换了Vagrant。
>先在Docker上使用LaraDock然后再学习它们。 > 先在使用 LaraDock然后再学习它们。
![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg)
<br> <br>
## 目录 ## 目录
@ -471,13 +469,13 @@ composer create-project laravel/laravel my-cool-app "5.2.*"
系统默认LaraDock假定Laravel应用在LaraDock的父级目录中 系统默认LaraDock假定Laravel应用在LaraDock的父级目录中
By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. 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/laravel`替换 `../:/var/www/laravel` , 如下: 自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www`替换 `../:/var/www` , 如下:
```yaml ```yaml
application: application:
build: ./application build: ./application
volumes: volumes:
- ../my-cool-app/:/var/www/laravel - ../my-cool-app/:/var/www
``` ```
4 - 进入目录下继续工作.. 4 - 进入目录下继续工作..

139
README.md
View File

@ -60,6 +60,8 @@ Laradock is configured to run Laravel Apps by default, and it can be modifyed to
- [Cron jobs](#CronJobs) - [Cron jobs](#CronJobs)
- [Access workspace via ssh](#Workspace-ssh) - [Access workspace via ssh](#Workspace-ssh)
- [MySQL access from host](#MySQL-access-from-host) - [MySQL access from host](#MySQL-access-from-host)
- [MySQL root access](#MySQL-root-access)
- [Change MySQL port](#Change-MySQL-port)
- [Use custom Domain](#Use-custom-Domain) - [Use custom Domain](#Use-custom-Domain)
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
- [Install Prestissimo](#Install-Prestissimo) - [Install Prestissimo](#Install-Prestissimo)
@ -206,17 +208,22 @@ What's better than a **Demo Video**:
<a name="Installation"></a> <a name="Installation"></a>
## Installation ## Installation
Choose the setup the best suits your needs.
Clone the `LaraDock` repository: #### A) Setup for Single Project:
*(In case you want a Docker environment for each project)*
**A)** If you already have a Laravel project, clone this repository on your `Laravel` root directory: ##### A.1) Setup environment in existing Project:
*(In case you already have a project, and you want to setup an environment to run it)*
1 - Clone this repository on your project root directory:
```bash ```bash
git submodule add https://github.com/LaraDock/laradock.git git submodule add https://github.com/LaraDock/laradock.git
``` ```
>If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`. >If you are not already using Git for your PHP project, you can use `git clone` instead of `git submodule`.
Note: In this case the folder structure will be like this (recommended): Note: In this case the folder structure will be like this:
``` ```
- project1 - project1
@ -225,9 +232,10 @@ Note: In this case the folder structure will be like this (recommended):
- laradock - laradock
``` ```
<br> ##### A.2) Setup environment first then create project:
*(In case you don't have a project, and you want to create your project inside the Docker environment)*
**B)** If you don't have a Laravel project, and you want to install Laravel from Docker, clone this repo anywhere on your machine: 1 - Clone this repository anywhere on your machine:
```bash ```bash
git clone https://github.com/LaraDock/laradock.git git clone https://github.com/LaraDock/laradock.git
@ -237,11 +245,60 @@ Note: In this case the folder structure will be like this:
``` ```
- projects - projects
- laradock - laradock
- project1 - myProject
- project2
``` ```
**Note:** if you are using this folder structure don't forget to edit the `docker-compose.yml` file to map to your Laravel directory once you have it (example: `- ../project1/:/var/www/laravel`). "You will need to stop and re-run your docker-compose command for the changes to take place". 2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`).
3 - Stop and re-run your docker-compose command for the changes to take place.
```
docker-compose stop && docker-compose up -d XXXX YYYY ZZZZ ....
```
#### B) Setup for Multiple Projects:
1 - Clone this repository anywhere on your machine:
```bash
git clone https://github.com/LaraDock/laradock.git
```
2 - Edit the `docker-compose.yml` file to map to your projects directories:
```
applications:
image: tianon/true
volumes:
- ../project1/:/var/www/project1
- ../project2/:/var/www/project2
```
3 - You can access all sites by visiting `http://localhost/project1/public` and `http://localhost/project2/public` but of course that's not very useful so let's setup nginx quickly.
4 - Go to `nginx/sites` and copy `sample.conf.example` to `project1.conf` then to `project2.conf`
5 - Open the `project1.conf` file and edit the `server_name` and the `root` as follow:
```
server_name project1.dev;
root /var/www/project1/public;
```
Do the same for each project `project2.conf`, `project3.conf`,...
6 - Add the domains to the **hosts** files.
```
127.0.0.1 project1.dev
```
7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.
<a name="Usage"></a> <a name="Usage"></a>
## Usage ## Usage
@ -267,7 +324,7 @@ If you are using **Docker Toolbox** (VM), do one of the following:
**Example:** Running NGINX and MySQL: **Example:** Running NGINX and MySQL:
```bash ```bash
docker-compose up -d nginx mysql docker-compose up -d nginx mysql
``` ```
**Note**: The `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. If you couldn't find them running then you need specify them as follow: `docker-compose up -d nginx php-fpm mysql workspace`. **Note**: The `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. If you couldn't find them running then you need specify them as follow: `docker-compose up -d nginx php-fpm mysql workspace`.
@ -305,7 +362,7 @@ Open your `.env` file and set the `DB_HOST` to `mysql`:
DB_HOST=mysql DB_HOST=mysql
``` ```
*If you are using Laravel and you don't have it installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel).* *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).*
@ -371,8 +428,6 @@ docker-compose stop {container-name}
docker-compose down docker-compose down
``` ```
*Note: Careful with this command as it will delete your Data Volume Container as well. (if you want to keep your Database data than you should stop each container by itself as follow):*
@ -744,13 +799,13 @@ For more about the Laravel installation click [here](https://laravel.com/docs/ma
By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder.
Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www` with `../my-cool-app/:/var/www`, as follow:
```yaml ```yaml
application: application:
build: ./application image: tianon/true
volumes: volumes:
- ../my-cool-app/:/var/www/laravel - ../my-cool-app/:/var/www
... ...
``` ```
4 - Go to that folder and start working.. 4 - Go to that folder and start working..
@ -1064,7 +1119,7 @@ We also recommend [setting the timezone in Laravel](http://www.camroncade.com/ma
You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line. You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line.
``` ```
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1 * * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1
# Custom cron # Custom cron
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1 * * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
@ -1096,6 +1151,32 @@ ports:
- "3306:3306" - "3306:3306"
``` ```
<a name="MySQL-root-access"></a>
### 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.....`.
<a name="Change-MySQL-port"></a>
### 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 <a href="#MySQL-access-from-host">MySQL access from your host</a>, do not forget to change the internal port number (`"3306:3306"` -> `"3306:1234"`) in the docker-compose config file.
<a name="Use-custom-Domain"></a> <a name="Use-custom-Domain"></a>
### Use custom Domain (instead of the Docker IP) ### Use custom Domain (instead of the Docker IP)
@ -1250,7 +1331,18 @@ It should be like this:
<br> <br>
<a name="debugging"></a> <a name="debugging"></a>
### Debugging
### PHPStorm
Remote debug Laravel web and phpunit tests.
####[Full Guide Here](https://github.com/LaraDock/laradock/blob/master/_guides/phpstorm.md)
<br>
<a name="Misc"></a>
### Miscellaneous
*Here's a list of the common problems you might face, and the possible solutions.* *Here's a list of the common problems you might face, and the possible solutions.*
@ -1271,9 +1363,9 @@ Use `http://127.0.0.1` instead of `http://localhost` in your browser.
#### I see an error message containing `address already in use` #### 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 (80, 3306, etc.) are not being used already by other programs, such as a built in `apache`/`httpd` service or other development tools you have installed. 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.
@ -1288,8 +1380,11 @@ Make sure the ports for the services that you are trying to run (80, 3306, etc.)
This error is sometimes happens because your Laravel application isn't running on the container localhost IP (Which is 127.0.0.1). Steps to fix it: This error is sometimes happens because your Laravel application isn't running on the container localhost IP (Which is 127.0.0.1). Steps to fix it:
1. Check your running Laravel application IP by dumping `Request::ip()` variable using `dd(Request::ip())` anywhere on your application. The result is the IP of your Laravel container. * Option A
2. Change the `DB_HOST` variable on env with the IP that you received from previous step. 1. Check your running Laravel application IP by dumping `Request::ip()` variable using `dd(Request::ip())` anywhere on your application. The result is the IP of your Laravel container.
2. Change the `DB_HOST` variable on env with the IP that you received from previous step.
* Option B
1. Change the `DB_HOST` value to the same name as the mysql docker container. The Laradock docker-compose file currently has this as `mysql`

View File

@ -58,10 +58,10 @@ docker-compose exec workspace bash
#### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder #### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder
``` ```
$ root@0e77851d27d3:/var/www/laravel# composer install $ root@0e77851d27d3:/var/www# composer install
$ root@0e77851d27d3:/var/www/laravel# cp .env.example .env $ root@0e77851d27d3:/var/www# cp .env.example .env
$ root@0e77851d27d3:/var/www/laravel# php artisan key:generate $ root@0e77851d27d3:/var/www# php artisan key:generate
$ root@0e77851d27d3:/var/www/laravel# exit $ root@0e77851d27d3:/var/www# exit
$root@midascode:~/laravel/laradock# cd .. $root@midascode:~/laravel/laradock# cd ..
$root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache $root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache
``` ```
@ -141,13 +141,13 @@ Remove 0.0.0.0:80
``` ```
0.0.0.0:80 0.0.0.0:80
root /var/www/laravel/public root /var/www/public
``` ```
and replace with your https://yourdomain.com and replace with your https://yourdomain.com
``` ```
https://yourdomain.com https://yourdomain.com
root /var/www/laravel/public root /var/www/public
``` ```
uncomment tls uncomment tls

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

302
_guides/phpstorm.md Normal file
View File

@ -0,0 +1,302 @@
# PHPStorm Debugging Guide
- [Intro](#Intro)
- [Installation](#Installation)
- [Customize laradock/docker-compose.yml](#CustomizeDockerCompose)
- [Clean House](#InstallCleanHouse)
- [LaraDock Dial Tone](#InstallLaraDockDialTone)
- [hosts](#AddToHosts)
- [Firewall](#FireWall)
- [Enable xDebug on php-fpm](#enablePhpXdebug)
- [PHPStorm Settings](#InstallPHPStorm)
- [Configs](#InstallPHPStormConfigs)
- [Usage](#Usage)
- [Laravel](#UsageLaravel)
- [Run ExampleTest](#UsagePHPStormRunExampleTest)
- [Debug ExampleTest](#UsagePHPStormDebugExampleTest)
- [Debug Web Site](#UsagePHPStormDebugSite)
- [SSH into workspace](#SSHintoWorkspace)
- [KiTTY](#InstallKiTTY)
<a name="Intro"></a>
## Intro
Wiring up [Laravel](https://laravel.com/), [LaraDock](https://github.com/LaraDock/laradock) [Laravel+Docker] and [PHPStorm](https://www.jetbrains.com/phpstorm/) to play nice together complete with remote xdebug'ing as icing on top! Although this guide is based on `PHPStorm Windows`,
you should be able to adjust accordingly. This guide was written based on Docker for Windows Native.
<a name="Installation"></a>
## Installation
- This guide assumes the following:
- you have already installed and are familiar with Laravel, LaraDock and PHPStorm.
- you have installed Laravel as a parent of `laradock`. This guide assumes `/c/_dk/laravel`.
<a name="AddToHosts"></a>
## hosts
- Add `laravel` to your hosts file located on Windows 10 at `C:\Windows\System32\drivers\etc\hosts`. It should be set to the IP of your running container. Mine is: `10.0.75.2`
On Windows you can find it by opening Windows `Hyper-V Manager`.
- ![Windows Hyper-V Manager](photos/PHPStorm/Settings/WindowsHyperVManager.png)
- [Hosts File Editor](https://github.com/scottlerch/HostsFileEditor) makes it easy to change your hosts file.
- Set `laravel` to your docker host IP. See [Example](photos/SimpleHostsEditor/AddHost_laravel.png).
<a name="FireWall"></a>
## Firewall
Your PHPStorm will need to be able to receive a connection from PHP xdebug either your running workspace or php-fpm containers on port 9000. This means that your Windows Firewall should either enable connections from the Application PHPStorm OR the port.
- It is important to note that if the Application PHPStorm is NOT enabled in the firewall, you will not be able to recreate a rule to override that.
- Also be aware that if you are installing/upgrade different versions of PHPStorm, you MAY have orphaned references to PHPStorm in your Firewall! You may decide to remove orphaned references however in either case, make sure that they are set to receive public TCP traffic.
### Edit laradock/docker-compose.yml
Set the following variables:
```
### Workspace Utilities Container ###########################
workspace:
build:
context: ./workspace
args:
- INSTALL_XDEBUG=true
- INSTALL_WORKSPACE_SSH=true
...
### PHP-FPM Container #######################################
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_XDEBUG=true
...
```
### Edit xdebug.ini files
- `laradock/workspace/xdebug.ini`
- `laradock/php-fpm/xdebug.ini`
Set the following variables:
```
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.cli_color=1
```
<a name="InstallCleanHouse"></a>
### Need to clean house first?
Make sure you are starting with a clean state. For example, do you have other LaraDock containers and images?
Here are a few things I use to clean things up.
- Delete all containers using `grep laradock_` on the names, see: [Remove all containers based on docker image name](https://linuxconfig.org/remove-all-containners-based-on-docker-image-name).
`docker ps -a | awk '{ print $1,$2 }' | grep laradock_ | awk '{print $1}' | xargs -I {} docker rm {}`
- Delete all images containing `laradock`.
`docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}`
**Note:** This will only delete images that were built with `LaraDock`, **NOT** `laradock/*` which are pulled down by `LaraDock` such as `laradock/workspace`, etc.
**Note:** Some may fail with:
`Error response from daemon: conflict: unable to delete 3f38eaed93df (cannot be forced) - image has dependent child images`
- I added this to my `.bashrc` to remove orphaned images.
```
dclean() {
processes=`docker ps -q -f status=exited`
if [ -n "$processes" ]; thend
docker rm $processes
fi
images=`docker images -q -f dangling=true`
if [ -n "$images" ]; then
docker rmi $images
fi
}
```
- If you frequently switch configurations for LaraDock, you may find that adding the following and added to your `.bashrc` or equivalent useful:
```
# remove laravel* containers
# remove laravel_* images
dcleanlaradockfunction()
{
echo 'Removing ALL containers associated with laradock'
docker ps -a | awk '{ print $1,$2 }' | grep laradock | awk '{print $1}' | xargs -I {} docker rm {}
# remove ALL images associated with laradock_
# does NOT delete laradock/* which are hub images
echo 'Removing ALL images associated with laradock_'
docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}
echo 'Listing all laradock docker hub images...'
docker images | grep laradock
echo 'dcleanlaradock completed'
}
# associate the above function with an alias
# so can recall/lookup by typing 'alias'
alias dcleanlaradock=dcleanlaradockfunction
```
<a name="InstallLaraDockDialTone"></a>
#### Let's get a dial-tone with Laravel
```
# barebones at this point
docker-compose up -d nginx mysql
# run
docker-compose ps
# Should see:
Name Command State Ports
-----------------------------------------------------------------------------------------------------------
laradock_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
laradock_nginx_1 nginx Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
laradock_php-fpm_1 php-fpm Up 9000/tcp
laradock_volumes_data_1 true Exit 0
laradock_volumes_source_1 true Exit 0
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
```
<a name="enablePhpXdebug"></a>
#### Enable xDebug on php-fpm
In a host terminal sitting in the laradock folder, run: `./xdebugPhpFpm status`
You should see something like the following:
```
xDebug status
laradock_php-fpm_1
PHP 7.0.9 (cli) (built: Aug 10 2016 19:45:48) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
```
Other commands include `./xdebugPhpFpm start | stop`.
If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will already be running when
`php-fpm` is started and listening for debug info on port 9000.
<a name="InstallPHPStormConfigs"></a>
#### PHPStorm Settings
- Here are some settings that are known to work:
- `Settings/BuildDeploymentConnection`
- ![Settings/BuildDeploymentConnection](photos/PHPStorm/Settings/BuildDeploymentConnection.png)
- `Settings/BuildDeploymentConnectionMappings`
- ![Settings/BuildDeploymentConnectionMappings](photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png)
- `Settings/BuildDeploymentDebugger`
- ![Settings/BuildDeploymentDebugger](photos/PHPStorm/Settings/BuildDeploymentDebugger.png)
- `Settings/EditRunConfigurationRemoteWebDebug`
- ![Settings/EditRunConfigurationRemoteWebDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
- `Settings/EditRunConfigurationRemoteExampleTestDebug`
- ![Settings/EditRunConfigurationRemoteExampleTestDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
- `Settings/LangsPHPDebug`
- ![Settings/LangsPHPDebug](photos/PHPStorm/Settings/LangsPHPDebug.png)
- `Settings/LangsPHPInterpreters`
- ![Settings/LangsPHPInterpreters](photos/PHPStorm/Settings/LangsPHPInterpreters.png)
- `Settings/LangsPHPPHPUnit`
- ![Settings/LangsPHPPHPUnit](photos/PHPStorm/Settings/LangsPHPPHPUnit.png)
- `Settings/LangsPHPServers`
- ![Settings/LangsPHPServers](photos/PHPStorm/Settings/LangsPHPServers.png)
- `RemoteHost`
To switch on this view, go to: `Menu/Tools/Deployment/Browse Remote Host`.
- ![RemoteHost](photos/PHPStorm/RemoteHost.png)
- `RemoteWebDebug`
- ![DebugRemoteOn](photos/PHPStorm/DebugRemoteOn.png)
- `EditRunConfigurationRemoteWebDebug`
Go to: `Menu/Run/Edit Configurations`.
- ![EditRunConfigurationRemoteWebDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
- `EditRunConfigurationRemoteExampleTestDebug`
Go to: `Menu/Run/Edit Configurations`.
- ![EditRunConfigurationRemoteExampleTestDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
- `WindowsFirewallAllowedApps`
Go to: `Control Panel\All Control Panel Items\Windows Firewall\Allowed apps`.
- ![WindowsFirewallAllowedApps.png](photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png)
- `hosts`
Edit: `C:\Windows\System32\drivers\etc\hosts`.
- ![WindowsFirewallAllowedApps.png](photos/PHPStorm/Settings/hosts.png)
- [Enable xDebug on php-fpm](#enablePhpXdebug)
<a name="Usage"></a>
## Usage
<a name="UsagePHPStormRunExampleTest"></a>
### Run ExampleTest
- right-click on `tests/ExampleTest.php`
- Select: `Run 'ExampleTest.php'` or `Ctrl+Shift+F10`.
- Should pass!! You just ran a remote test via SSH!
<a name="UsagePHPStormDebugExampleTest"></a>
### Debug ExampleTest
- Open to edit: `tests/ExampleTest.php`
- Add a BreakPoint on line 16: `$this->visit('/')`
- right-click on `tests/ExampleTest.php`
- Select: `Debug 'ExampleTest.php'`.
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
- ![Remote Test Debugging Success](photos/PHPStorm/RemoteTestDebuggingSuccess.png)
<a name="UsagePHPStormDebugSite"></a>
### Debug WebSite
- In case xDebug is disabled, from the `laradock` folder run:
`./xdebugPhpFpm start`.
- To switch xdebug off, run:
`./xdebugPhpFpm stop`
- Start Remote Debugging
- ![DebugRemoteOn](photos/PHPStorm/DebugRemoteOn.png)
- Open to edit: `bootstrap/app.php`
- Add a BreakPoint on line 14: `$app = new Illuminate\Foundation\Application(`
- Reload [Laravel Site](http://laravel/)
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
- ![Remote Debugging Success](photos/PHPStorm/RemoteDebuggingSuccess.png)
<a name="SSHintoWorkspace"></a>
#### Let's shell into workspace
Assuming that you are in laradock folder, type:
`ssh -i workspace/insecure_id_rsa -p2222 root@laravel`
**Cha Ching!!!!**
- `workspace/insecure_id_rsa.ppk` may become corrupted. In which case:
- fire up `puttygen`
- import `workspace/insecure_id_rsa`
- save private key to `workspace/insecure_id_rsa.ppk`
<a name="InstallKiTTY"></a>
##### KiTTY
[Kitty](http://www.9bis.net/kitty/) KiTTY is a fork from version 0.67 of PuTTY.
- Here are some settings that are working for me:
- ![Session](photos/KiTTY/Session.png)
- ![Terminal](photos/KiTTY/Terminal.png)
- ![Window](photos/KiTTY/Window.png)
- ![WindowAppearance](photos/KiTTY/WindowAppearance.png)
- ![Connection](photos/KiTTY/Connection.png)
- ![ConnectionData](photos/KiTTY/ConnectionData.png)
- ![ConnectionSSH](photos/KiTTY/ConnectionSSH.png)
- ![ConnectionSSHAuth](photos/KiTTY/ConnectionSSHAuth.png)
- ![TerminalShell](photos/KiTTY/TerminalShell.png)

View File

@ -6,11 +6,11 @@ ARG PHP_SOCKET=php-fpm:9000
ENV WEB_PHP_SOCKET=$PHP_SOCKET ENV WEB_PHP_SOCKET=$PHP_SOCKET
ENV WEB_DOCUMENT_ROOT=/var/www/laravel/public ENV WEB_DOCUMENT_ROOT=/var/www/public
EXPOSE 80 443 EXPOSE 80 443
WORKDIR /var/www/laravel/public WORKDIR /var/www/public
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"] ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]

View File

@ -1,6 +1,6 @@
# Docs: https://caddyserver.com/docs/caddyfile # Docs: https://caddyserver.com/docs/caddyfile
0.0.0.0:80 0.0.0.0:80
root /var/www/laravel/public root /var/www/public
fastcgi / php-fpm:9000 php { fastcgi / php-fpm:9000 php {
index index.php index index.php
} }

View File

@ -19,6 +19,6 @@ RUN curl --silent --show-error --fail --location \
EXPOSE 80 443 2015 EXPOSE 80 443 2015
WORKDIR /var/www/laravel/public WORKDIR /var/www/public
CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"] CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]

View File

@ -2,6 +2,14 @@ version: '2'
services: services:
### Applications Code Container #############################
applications:
image: tianon/true
volumes:
- ../:/var/www
# - ../sample/:/var/www/sample
### Workspace Utilities Container ########################### ### Workspace Utilities Container ###########################
workspace: workspace:
@ -21,7 +29,7 @@ services:
- NODE_VERSION=stable - NODE_VERSION=stable
- TZ=UTC - TZ=UTC
volumes_from: volumes_from:
- volumes_source - applications
extra_hosts: extra_hosts:
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
- "dockerhost:10.0.75.1" - "dockerhost:10.0.75.1"
@ -44,7 +52,7 @@ services:
- CODEIGNITER=false - CODEIGNITER=false
dockerfile: Dockerfile-70 dockerfile: Dockerfile-70
volumes_from: volumes_from:
- volumes_source - applications
expose: expose:
- "9000" - "9000"
links: links:
@ -64,16 +72,17 @@ services:
args: args:
- PHP_UPSTREAM=php-fpm - PHP_UPSTREAM=php-fpm
volumes_from: volumes_from:
- volumes_source - applications
volumes: volumes:
- ./logs/nginx/:/var/log/nginx - ./logs/nginx/:/var/log/nginx
- ./nginx/sites/:/etc/nginx/sites-available
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
links: links:
- php-fpm - php-fpm
### Apache Server Container ################################## ### Apache Server Container #################################
apache2: apache2:
build: build:
@ -81,7 +90,7 @@ services:
args: args:
- PHP_SOCKET=php-fpm:9000 - PHP_SOCKET=php-fpm:9000
volumes_from: volumes_from:
- volumes_source - applications
volumes: volumes:
- ./logs/apache2:/var/log/apache2 - ./logs/apache2:/var/log/apache2
ports: ports:
@ -95,7 +104,7 @@ services:
hhvm: hhvm:
build: ./hhvm build: ./hhvm
volumes_from: volumes_from:
- volumes_source - applications
expose: expose:
- "9000" - "9000"
links: links:
@ -104,23 +113,24 @@ services:
### MySQL Container ######################################### ### MySQL Container #########################################
mysql: mysql:
build: ./mysql build:
volumes_from: context: ./mysql
- volumes_data args:
- MYSQL_DATABASE=homestead
- MYSQL_USER=homestead
- MYSQL_PASSWORD=secret
- MYSQL_ROOT_PASSWORD=root
volumes:
- mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
environment:
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
### MariaDB Container ####################################### ### MariaDB Container #######################################
mariadb: mariadb:
build: ./mariadb build: ./mariadb
volumes_from: volumes:
- volumes_data - mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
environment: environment:
@ -133,8 +143,21 @@ services:
postgres: postgres:
build: ./postgres build: ./postgres
volumes_from: volumes:
- volumes_data - postgres:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
POSTGRES_DB: homestead
POSTGRES_USER: homestead
POSTGRES_PASSWORD: secret
### PostgreSQL PostGis Container ############################
postgres-postgis:
build: ./postgres-postgis
volumes:
- postgres:/var/lib/postgresql/data
ports: ports:
- "5432:5432" - "5432:5432"
environment: environment:
@ -151,8 +174,8 @@ services:
- "1337:1337" - "1337:1337"
environment: environment:
- NEO4J_AUTH=homestead:secret - NEO4J_AUTH=homestead:secret
volumes_from: volumes:
- volumes_data - neo4j:/var/lib/neo4j/data
### MongoDB Container ####################################### ### MongoDB Container #######################################
@ -160,25 +183,26 @@ services:
build: ./mongo build: ./mongo
ports: ports:
- "27017:27017" - "27017:27017"
volumes_from: volumes:
- volumes_data - mongo:/data/db
### Redis Container ######################################### ### Redis Container #########################################
redis: redis:
build: ./redis build: ./redis
volumes_from: volumes:
- volumes_data - redis:/data
ports: ports:
- "6379:6379" - "6379:6379"
### Aerospike c Container ######################################### ### Aerospike c Container ###################################
aerospike: aerospike:
build: ./aerospike build: ./aerospike
volumes_from: volumes_from:
- workspace - workspace
- volumes_data volumes:
- aerospike:/opt/aerospike/data
ports: ports:
- "3000:3000" - "3000:3000"
- "3001:3001" - "3001:3001"
@ -190,8 +214,8 @@ services:
memcached: memcached:
build: ./memcached build: ./memcached
volumes_from: volumes:
- volumes_data - memcached:/var/lib/memcached
ports: ports:
- "11211:11211" - "11211:11211"
links: links:
@ -207,7 +231,7 @@ services:
links: links:
- php-fpm - php-fpm
### RabbitMQ Container #################################### ### RabbitMQ Container ######################################
rabbitmq: rabbitmq:
build: ./rabbitmq build: ./rabbitmq
@ -236,8 +260,9 @@ services:
caddy: caddy:
build: ./caddy build: ./caddy
volumes_from: volumes_from:
- volumes_source - applications
- volumes_data volumes:
- caddy:/root/.caddy
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
@ -248,7 +273,7 @@ services:
links: links:
- php-fpm - php-fpm
### phpMyAdmin Container ################################## ### phpMyAdmin Container ####################################
phpmyadmin: phpmyadmin:
build: ./phpmyadmin build: ./phpmyadmin
@ -257,8 +282,6 @@ services:
MYSQL_USER: homestead MYSQL_USER: homestead
MYSQL_PASSWORD: secret MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root MYSQL_ROOT_PASSWORD: root
volumes_from:
- volumes_data
ports: ports:
- "8080:80" - "8080:80"
links: links:
@ -267,7 +290,7 @@ services:
# for mariadb container # for mariadb container
# - "mariadb:db" # - "mariadb:db"
### pgAdmin Container ################################## ### pgAdmin Container #######################################
pgadmin: pgadmin:
build: ./pgadmin build: ./pgadmin
@ -276,40 +299,45 @@ services:
links: links:
- postgres - postgres
### ElasticSearch Container ################################## ### ElasticSearch Container #################################
elasticsearch: elasticsearch:
build: ./elasticsearch build: ./elasticsearch
volumes_from: volumes:
- volumes_data - elasticsearch-data:/usr/share/elasticsearch/data
- elasticsearch-pkugins:/usr/share/elasticsearch/data
ports: ports:
- "9200:9200" - "9200:9200"
- "9300:9300" - "9300:9300"
links: links:
- php-fpm - php-fpm
### Laravel Application Code Container ###################### ### Volumes Setup ###########################################
volumes_source: volumes:
image: tianon/true mysql:
volumes: driver: "local"
- ../:/var/www/laravel postgres:
driver: "local"
### Databases Data Container ################################ memcached:
driver: "local"
volumes_data: redis:
image: tianon/true driver: "local"
volumes: neo4j:
- ./data/mysql:/var/lib/mysql driver: "local"
- ./data/postgres:/var/lib/postgresql/data mariadb:
- ./data/memcached:/var/lib/memcached driver: "local"
- ./data/redis:/data mongo:
- ./data/neo4j:/var/lib/neo4j/data driver: "local"
- ./data/mongo:/data/db phpmyadmin:
- ./data/aerospike:/opt/aerospike/data driver: "local"
- ./data/sessions:/sessions aerospike:
- ./data/caddy:/root/.caddy driver: "local"
- ./data/elasticsearch/data:/usr/share/elasticsearch/data caddy:
- ./data/elasticsearch/pkugins:/usr/share/elasticsearch/pkugins driver: "local"
elasticsearch-data:
### Add more Containers below ############################### driver: "local"
elasticsearch-pkugins:
driver: "local"
sessions: ## nothing is connected to this (- ./data/sessions:/sessions)
driver: "local"

View File

@ -10,13 +10,13 @@ RUN apt-get update -y \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/www/laravel RUN mkdir -p /var/www
ADD server.ini /etc/hhvm/server.ini ADD server.ini /etc/hhvm/server.ini
RUN usermod -u 1000 www-data RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel WORKDIR /var/www
CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"] CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"]

View File

@ -12,7 +12,7 @@ hhvm.log.level = Error
hhvm.log.header = true hhvm.log.header = true
hhvm.log.access[default][file] = /var/log/hhvm/access.log hhvm.log.access[default][file] = /var/log/hhvm/access.log
hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b" hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b"
hhvm.server.source_root=/var/www/laravel/public hhvm.server.source_root=/var/www/public
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
; Uncomment to log to files instead of STDOUT ; Uncomment to log to files instead of STDOUT

View File

@ -1,9 +1,27 @@
FROM mysql:5.6 FROM mysql:5.7
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
ADD startup /etc/mysql/startup
RUN chown -R mysql:root /var/lib/mysql/
ARG MYSQL_DATABASE=homestead
ARG MYSQL_USER=homestead
ARG MYSQL_PASSWORD=secret
ARG MYSQL_ROOT_PASSWORD=root
ENV MYSQL_DATABASE=$MYSQL_DATABASE
ENV MYSQL_USER=$MYSQL_USER
ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
ENV MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
RUN sed -i 's/MYSQL_DATABASE/'$MYSQL_DATABASE'/g' /etc/mysql/startup && \
sed -i 's/MYSQL_USER/'$MYSQL_USER'/g' /etc/mysql/startup && \
sed -i 's/MYSQL_PASSWORD/'$MYSQL_PASSWORD'/g' /etc/mysql/startup
ADD my.cnf /etc/mysql/conf.d/my.cnf ADD my.cnf /etc/mysql/conf.d/my.cnf
CMD ["mysqld"] CMD ["mysqld", "--init-file=/etc/mysql/startup"]
EXPOSE 3306 EXPOSE 3306

View File

@ -4,3 +4,6 @@
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql] [mysql]
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

4
mysql/startup Normal file
View File

@ -0,0 +1,4 @@
DROP USER IF EXISTS 'MYSQL_USER';
CREATE USER 'MYSQL_USER'@'%';
CREATE DATABASE IF NOT EXISTS MYSQL_DATABASE;
GRANT ALL ON MYSQL_DATABASE.* TO 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD';

View File

@ -3,7 +3,6 @@ FROM nginx:alpine
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
ADD nginx.conf /etc/nginx/ ADD nginx.conf /etc/nginx/
COPY sites/*.conf /etc/nginx/sites-available/
ARG PHP_UPSTREAM=php-fpm ARG PHP_UPSTREAM=php-fpm

2
nginx/sites/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.conf
!default.conf

View File

@ -3,8 +3,8 @@ server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server ipv6only=on; listen [::]:80 default_server ipv6only=on;
server_name laravel; server_name laradock;
root /var/www/laravel/public; root /var/www/public;
index index.php index.html index.htm; index index.php index.html index.htm;
location / { location / {

View File

@ -1,57 +0,0 @@
server {
listen 80;
listen [::]:80;
#domain name
server_name drupal8.dev;
#file document root. This has to match one of the volumes in docer-composer.yml
root /var/www/drupal8;
# This is the full path to your index file
index index.php index.html index.htm;
## serve imagecache files directly or redirect to drupal if they do not exist.
location ~* files/styles {
access_log off;
expires 30d;
try_files $uri @drupal;
}
## serve imagecache files directly or redirect to drupal if they do not exist.
location ~* ^.+.(xsl|xml)$ {
access_log off;
expires 1d;
try_files $uri @drupal;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
}
location / {
index index.php;
# This is cool because no php is touched for static content
try_files $uri $uri/ @rewrite;
expires max;
}
location @drupal {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn&#39;t be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ .php$ {
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

View File

@ -3,8 +3,8 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name site_a; server_name sample.dev;
root /var/www/site_a/public; root /var/www/sample/public;
index index.php index.html index.htm; index index.php index.html index.htm;
location / { location / {

View File

@ -1,28 +0,0 @@
server {
listen 80;
listen [::]:80;
server_name site_b;
root /var/www/site_b/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}

View File

@ -142,7 +142,7 @@ RUN rm -r /var/lib/apt/lists/*
RUN usermod -u 1000 www-data RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel WORKDIR /var/www
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@ -153,7 +153,7 @@ RUN rm -r /var/lib/apt/lists/*
RUN usermod -u 1000 www-data RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel WORKDIR /var/www
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@ -0,0 +1,5 @@
FROM mdillon/postgis:latest
CMD ["postgres"]
EXPOSE 5432

View File

@ -45,12 +45,12 @@ services:
links: links:
- workspace - workspace
### Laravel Application Code Container ###################### ### Application Code Container ######################
volumes_source: volumes_source:
image: tianon/true image: tianon/true
volumes: volumes:
- ../:/var/www/laravel - ../:/var/www
### Databases Data Container ################################ ### Databases Data Container ################################

View File

@ -10,7 +10,7 @@
# https://hub.docker.com/r/laradock/workspace/tags/ # https://hub.docker.com/r/laradock/workspace/tags/
# #
FROM laradock/workspace:1.1 FROM laradock/workspace:1.2
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
@ -91,7 +91,7 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
apt-get update && \ apt-get update && \
apt-get install -y --force-yes php7.0-xdebug && \ apt-get install -y --force-yes php7.0-xdebug && \
sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc \
;fi ;fi
# ADD for REMOTE debugging # ADD for REMOTE debugging
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
@ -191,6 +191,7 @@ ARG INSTALL_YARN=false
ENV INSTALL_YARN ${INSTALL_YARN} ENV INSTALL_YARN ${INSTALL_YARN}
RUN if [ ${INSTALL_YARN} = true ]; then \ RUN if [ ${INSTALL_YARN} = true ]; then \
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
curl -o- -L https://yarnpkg.com/install.sh | bash && \ curl -o- -L https://yarnpkg.com/install.sh | bash && \
echo "" >> ~/.bashrc && \ echo "" >> ~/.bashrc && \
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \ echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \
@ -234,6 +235,16 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \
rm /etc/php/7.0/cli/conf.d/aerospike.ini \ rm /etc/php/7.0/cli/conf.d/aerospike.ini \
;fi ;fi
#####################################
# Non-root user : PHPUnit path
#####################################
# add ./vendor/bin to non-root user's bashrc (needed for phpunit)
USER laradock
RUN echo "" >> ~/.bashrc && \
echo 'export PATH="/var/www/vendor/bin:$PATH"' >> ~/.bashrc
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Final Touch # Final Touch
@ -246,4 +257,4 @@ RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set default work directory # Set default work directory
WORKDIR /var/www/laravel WORKDIR /var/www

View File

@ -1 +1 @@
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1 * * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1