enhance documentation readability
This commit is contained in:
parent
4e257c8e8f
commit
4814490e2a
14
.github/README.md
vendored
14
.github/README.md
vendored
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
For basic sponsorships go to [Open Collective](https://opencollective.com/laradock#sponsor), for golden sponsorships contact <a href = "mailto: support@laradock.io">support@laradock.io</a>.
|
For basic sponsorships go to [Open Collective](https://opencollective.com/laradock#sponsor), for golden sponsorships contact <a href = "mailto: support@laradock.io">support@laradock.io</a>.
|
||||||
|
|
||||||
Your logo will show up on the [github repository](https://github.com/laradock/laradock/) index page and the [documentation](http://laradock.io/) main page, with a link to your website.
|
*Your logo will show up on the [github repository](https://github.com/laradock/laradock/) index page and the [documentation](http://laradock.io/) main page, with a link to your website.*
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
@ -71,18 +71,18 @@ Your logo will show up on the [github repository](https://github.com/laradock/la
|
|||||||
> Help keeping the project development going, by [contributing](http://laradock.io/contributing) or donating a little.
|
> Help keeping the project development going, by [contributing](http://laradock.io/contributing) or donating a little.
|
||||||
> Thanks in advance.
|
> Thanks in advance.
|
||||||
|
|
||||||
Donate directly via [Paypal](https://www.paypal.me/mzalt)
|
Donate directly via [Paypal](https://paypal.me/mzmmzz)
|
||||||
|
|
||||||
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/mzalt)
|
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/mzmmzz)
|
||||||
|
|
||||||
or become a backer on [Open Collective](https://opencollective.com/laradock#backer)
|
|
||||||
|
|
||||||
<a href="https://opencollective.com/laradock#backers" target="_blank"><img src="https://opencollective.com/laradock/backers.svg?width=890"></a>
|
|
||||||
|
|
||||||
or show your support via [Beerpay](https://beerpay.io/laradock/laradock)
|
or show your support via [Beerpay](https://beerpay.io/laradock/laradock)
|
||||||
|
|
||||||
[![Beerpay](https://beerpay.io/laradock/laradock/badge.svg?style=flat)](https://beerpay.io/laradock/laradock)
|
[![Beerpay](https://beerpay.io/laradock/laradock/badge.svg?style=flat)](https://beerpay.io/laradock/laradock)
|
||||||
|
|
||||||
|
or become a backer on [Open Collective](https://opencollective.com/laradock#backer)
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/laradock#backers" target="_blank"><img src="https://opencollective.com/laradock/backers.svg?width=890"></a>
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -48,42 +48,42 @@ googleAnalytics = "UA-37514928-9"
|
|||||||
# ------- MENU START -----------------------------------------
|
# ------- MENU START -----------------------------------------
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Introduction"
|
name = "1. Introduction"
|
||||||
url = "introduction/"
|
url = "introduction/"
|
||||||
weight = 1
|
weight = 1
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Getting Started"
|
name = "2. Getting Started"
|
||||||
url = "getting-started/"
|
url = "getting-started/"
|
||||||
weight = 2
|
weight = 2
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Documentation"
|
name = "3. Documentation"
|
||||||
url = "documentation/"
|
url = "documentation/"
|
||||||
weight = 3
|
weight = 3
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Guides"
|
name = "4. Guides"
|
||||||
url = "guides/"
|
url = "guides/"
|
||||||
weight = 4
|
weight = 4
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Help & Questions"
|
name = "5. Help & Questions"
|
||||||
url = "help/"
|
url = "help/"
|
||||||
weight = 5
|
weight = 5
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Related Projects"
|
name = "6. Related Projects"
|
||||||
url = "related-projects/"
|
url = "related-projects/"
|
||||||
weight = 6
|
weight = 6
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Contributing"
|
name = "7. Contributing"
|
||||||
url = "contributing/"
|
url = "contributing/"
|
||||||
weight = 7
|
weight = 7
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "License"
|
name = "8. License"
|
||||||
url = "license/"
|
url = "license/"
|
||||||
weight = 8
|
weight = 8
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Contributing
|
title: 7. Contributing
|
||||||
type: index
|
type: index
|
||||||
weight: 7
|
weight: 7
|
||||||
---
|
---
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Documentation
|
title: 3. Documentation
|
||||||
type: index
|
type: index
|
||||||
weight: 3
|
weight: 3
|
||||||
---
|
---
|
||||||
@ -320,21 +320,6 @@ PHP_FPM_INSTALL_PHPDBG=true
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
<a name="Setup remote debugging for PhpStorm on Linux"></a>
|
|
||||||
## Setup remote debugging for PhpStorm on Linux
|
|
||||||
|
|
||||||
- Make sure you have followed the steps above in the [Install Xdebug section](#install-xdebug).
|
|
||||||
|
|
||||||
- Make sure Xdebug accepts connections and listens on port 9000. (Should be default configuration).
|
|
||||||
|
|
||||||
![Debug Configuration](/images/photos/PHPStorm/linux/configuration/debugConfiguration.png "Debug Configuration").
|
|
||||||
|
|
||||||
- Create a server with name `laradock` (matches **PHP_IDE_CONFIG** key in environment file) and make sure to map project root path with server correctly.
|
|
||||||
|
|
||||||
![Server Configuration](/images/photos/PHPStorm/linux/configuration/serverConfiguration.png "Server Configuration").
|
|
||||||
|
|
||||||
- Start listening for debug connections, place a breakpoint and you are good to go !
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Control-xDebug"></a>
|
<a name="Control-xDebug"></a>
|
||||||
@ -2029,22 +2014,6 @@ Remote debug Laravel web and phpunit tests.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<a name="upgrading-laradock"></a>
|
|
||||||
## 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}`
|
|
||||||
2. Install Docker for [Mac](https://docs.docker.com/docker-for-mac/) or [Windows](https://docs.docker.com/docker-for-windows/).
|
|
||||||
3. Upgrade Laradock to `v4.*.*` (`git pull origin master`)
|
|
||||||
4. Use Laradock as you used to do: `docker-compose up -d nginx mysql`.
|
|
||||||
|
|
||||||
**Note:** If you face any problem with the last step above: rebuild all your containers
|
|
||||||
`docker-compose build --no-cache`
|
|
||||||
"Warning Containers Data might be lost!"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2212,126 +2181,17 @@ docker-compose up ...
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Common-Problems"></a>
|
<a name="upgrade-laradock"></a>
|
||||||
## Common Problems
|
## Upgrade Laradock
|
||||||
|
|
||||||
*Here's a list of the common problems you might face, and the possible solutions.*
|
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}`
|
||||||
|
2. Install Docker for [Mac](https://docs.docker.com/docker-for-mac/) or [Windows](https://docs.docker.com/docker-for-windows/).
|
||||||
|
3. Upgrade Laradock to `v4.*.*` (`git pull origin master`)
|
||||||
|
4. Use Laradock as you used to do: `docker-compose up -d nginx mysql`.
|
||||||
|
|
||||||
|
**Note:** If you face any problem with the last step above: rebuild all your containers
|
||||||
|
`docker-compose build --no-cache`
|
||||||
|
"Warning Containers Data might be lost!"
|
||||||
|
|
||||||
<br>
|
|
||||||
## I see a blank (white) page instead of the Laravel 'Welcome' page!
|
|
||||||
|
|
||||||
Run the following command from the Laravel root directory:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo chmod -R 777 storage bootstrap/cache
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
## I see "Welcome to nginx" instead of the Laravel App!
|
|
||||||
|
|
||||||
Use `http://127.0.0.1` instead of `http://localhost` in your browser.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
## I get NGINX error 404 Not Found on Windows.
|
|
||||||
|
|
||||||
1. Go to docker Settings on your Windows machine.
|
|
||||||
2. Click on the `Shared Drives` tab and check the drive that contains your project files.
|
|
||||||
3. Enter your windows username and password.
|
|
||||||
4. Go to the `reset` tab and click restart docker.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
## The time in my services does not match the current time
|
|
||||||
|
|
||||||
1. Make sure you've [changed the timezone](#Change-the-timezone).
|
|
||||||
2. Stop and rebuild the containers (`docker-compose up -d --build <services>`)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
## 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:
|
|
||||||
|
|
||||||
* Option A
|
|
||||||
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`
|
|
||||||
|
|
||||||
## I get stuck when building nginx on `fetch http://mirrors.aliyun.com/alpine/v3.5/main/x86_64/APKINDEX.tar.gz`
|
|
||||||
|
|
||||||
As stated on [#749](https://github.com/laradock/laradock/issues/749#issuecomment-419652646), Already fixed,just set `CHANGE_SOURCE` to false.
|
|
||||||
|
|
||||||
## Custom composer repo packagist url and npm registry url
|
|
||||||
|
|
||||||
In China, the origin source of composer and npm is very slow. You can add `WORKSPACE_NPM_REGISTRY` and `WORKSPACE_COMPOSER_REPO_PACKAGIST` config in `.env` to use your custom source.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```bash
|
|
||||||
WORKSPACE_NPM_REGISTRY=https://registry.npm.taobao.org
|
|
||||||
WORKSPACE_COMPOSER_REPO_PACKAGIST=https://packagist.phpcomposer.com
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## I get `Module build failed: Error: write EPIPE` while compiling react application
|
|
||||||
|
|
||||||
When you run `npm build` or `yarn dev` building a react application using webpack with elixir you may receive a `Error: write EPIPE` while processing .jpg images.
|
|
||||||
|
|
||||||
This is caused of an outdated library for processing **.jpg files** in ubuntu 16.04.
|
|
||||||
|
|
||||||
To fix the problem you can follow those steps
|
|
||||||
|
|
||||||
1 - Open the `.env`.
|
|
||||||
|
|
||||||
2 - Search for `WORKSPACE_INSTALL_LIBPNG` or add the key if missing.
|
|
||||||
|
|
||||||
3 - Set the value to true:
|
|
||||||
|
|
||||||
```dotenv
|
|
||||||
WORKSPACE_INSTALL_LIBPNG=true
|
|
||||||
```
|
|
||||||
|
|
||||||
4 - Finally rebuild the workspace image
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose build workspace
|
|
||||||
```
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Getting Started
|
title: 2. Getting Started
|
||||||
type: index
|
type: index
|
||||||
weight: 2
|
weight: 2
|
||||||
---
|
---
|
||||||
|
|
||||||
## Requirements
|
## 2.1 Requirements
|
||||||
|
|
||||||
- [Git](https://git-scm.com/downloads)
|
- [Git](https://git-scm.com/downloads)
|
||||||
- [Docker](https://www.docker.com/products/docker/) `>= 17.12`
|
- [Docker](https://www.docker.com/products/docker/) `>= 17.12`
|
||||||
@ -12,10 +12,7 @@ weight: 2
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 2.2 Installation
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Choose the setup the best suits your needs.
|
Choose the setup the best suits your needs.
|
||||||
|
|
||||||
@ -110,9 +107,11 @@ Your folder structure should look like this:
|
|||||||
+ project-2
|
+ project-2
|
||||||
```
|
```
|
||||||
|
|
||||||
2 - Go to `nginx/sites` and create config files to point to different project directory when visiting different domains.
|
2 - Go to your web server and create config files to point to different project directory when visiting different domains:
|
||||||
|
|
||||||
Laradock by default includes `app.conf.example`, `laravel.conf.example` and `symfony.conf.example` as working samples.
|
For **Nginx** go to `nginx/sites`, for **Apache2** `apache2/sites`.
|
||||||
|
|
||||||
|
Laradock by default includes some sample files for you to copy `app.conf.example`, `laravel.conf.example` and `symfony.conf.example`.
|
||||||
|
|
||||||
3 - change the default names `*.conf`:
|
3 - change the default names `*.conf`:
|
||||||
|
|
||||||
@ -125,6 +124,7 @@ You can rename the config files, project folders and domains as you like, just m
|
|||||||
127.0.0.1 project-2.test
|
127.0.0.1 project-2.test
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
If you use Chrome 63 or above for development, don't use `.dev`. [Why?](https://laravel-news.com/chrome-63-now-forces-dev-domains-https). Instead use `.localhost`, `.invalid`, `.test`, or `.example`.
|
If you use Chrome 63 or above for development, don't use `.dev`. [Why?](https://laravel-news.com/chrome-63-now-forces-dev-domains-https). Instead use `.localhost`, `.invalid`, `.test`, or `.example`.
|
||||||
|
|
||||||
> **Now jump to the [Usage](#Usage) section.**
|
> **Now jump to the [Usage](#Usage) section.**
|
||||||
@ -136,7 +136,7 @@ If you use Chrome 63 or above for development, don't use `.dev`. [Why?](https://
|
|||||||
|
|
||||||
|
|
||||||
<a name="Usage"></a>
|
<a name="Usage"></a>
|
||||||
## Usage
|
## 2.3 Usage
|
||||||
|
|
||||||
**Read Before starting:**
|
**Read Before starting:**
|
||||||
|
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
---
|
---
|
||||||
title: Guides
|
title: 4. Guides
|
||||||
type: index
|
type: index
|
||||||
weight: 4
|
weight: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* [Production Setup on Digital Ocean](#Digital-Ocean)
|
|
||||||
* [PHPStorm XDebug Setup](#PHPStorm-Debugging)
|
|
||||||
* [Running Laravel Dusk Test](#Laravel-Dusk)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Digital-Ocean"></a>
|
<a name="Digital-Ocean"></a>
|
||||||
# Production Setup on Digital Ocean
|
## Production Setup on Digital Ocean
|
||||||
|
|
||||||
## Install Docker
|
### Install Docker
|
||||||
|
|
||||||
- Visit [DigitalOcean](https://cloud.digitalocean.com/login) and login.
|
- Visit [DigitalOcean](https://cloud.digitalocean.com/login) and login.
|
||||||
- Click the `Create Droplet` button.
|
- Click the `Create Droplet` button.
|
||||||
@ -24,7 +17,7 @@ weight: 4
|
|||||||
- Continue creating the droplet as you normally would.
|
- Continue creating the droplet as you normally would.
|
||||||
- If needed, check your e-mail for the droplet root password.
|
- If needed, check your e-mail for the droplet root password.
|
||||||
|
|
||||||
## SSH to your Server
|
### SSH to your Server
|
||||||
|
|
||||||
Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.
|
Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.
|
||||||
|
|
||||||
@ -40,7 +33,7 @@ You can now check if Docker is available:
|
|||||||
$root@server:~# docker
|
$root@server:~# docker
|
||||||
```
|
```
|
||||||
|
|
||||||
## Set Up Your Laravel Project
|
### Set Up Your Laravel Project
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@server:~# apt-get install git
|
$root@server:~# apt-get install git
|
||||||
@ -50,12 +43,12 @@ $root@server:~/laravel/ git submodule add https://github.com/Laradock/laradock.g
|
|||||||
$root@server:~/laravel/ cd laradock
|
$root@server:~/laravel/ cd laradock
|
||||||
```
|
```
|
||||||
|
|
||||||
## Enter the laradock folder and rename env-example to .env.
|
### Enter the laradock folder and rename env-example to .env.
|
||||||
```
|
```
|
||||||
$root@server:~/laravel/laradock# cp env-example .env
|
$root@server:~/laravel/laradock# cp env-example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
## Create Your Laradock Containers
|
### Create Your Laradock Containers
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
|
$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
|
||||||
@ -63,13 +56,13 @@ $root@server:~/laravel/laradock# docker-compose up -d nginx mysql
|
|||||||
|
|
||||||
Note that more containers are available, find them in the [docs](http://laradock.io/introduction/#supported-software-containers) or the `docker-compose.yml` file.
|
Note that more containers are available, find them in the [docs](http://laradock.io/introduction/#supported-software-containers) or the `docker-compose.yml` file.
|
||||||
|
|
||||||
## Go to Your Workspace
|
### Go to Your Workspace
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose exec workspace bash
|
docker-compose exec workspace bash
|
||||||
```
|
```
|
||||||
|
|
||||||
## Execute commands
|
### Execute commands
|
||||||
|
|
||||||
If you want to only execute some command and don't want to enter bash, you can execute `docker-compose run workspace <command>`.
|
If you want to only execute some command and don't want to enter bash, you can execute `docker-compose run workspace <command>`.
|
||||||
|
|
||||||
@ -77,7 +70,7 @@ If you want to only execute some command and don't want to enter bash, you can e
|
|||||||
docker-compose run workspace php artisan migrate
|
docker-compose run workspace php artisan migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install and configure Laravel
|
### Install and configure Laravel
|
||||||
|
|
||||||
Let's install Laravel's dependencies, add the `.env` file, generate the key and give proper permissions to the cache folder.
|
Let's install Laravel's dependencies, add the `.env` file, generate the key and give proper permissions to the cache folder.
|
||||||
|
|
||||||
@ -100,7 +93,7 @@ It should show you the Laravel default welcome page.
|
|||||||
|
|
||||||
However, we want it to show up using your custom domain name, as well.
|
However, we want it to show up using your custom domain name, as well.
|
||||||
|
|
||||||
## Using Your Own Domain Name
|
### Using Your Own Domain Name
|
||||||
|
|
||||||
Login to your DNS provider, such as Godaddy, Namecheap.
|
Login to your DNS provider, such as Godaddy, Namecheap.
|
||||||
|
|
||||||
@ -118,7 +111,7 @@ Visit: https://cloud.digitalocean.com/networking/domains
|
|||||||
|
|
||||||
Add your domain name and choose the server IP you'd provision earlier.
|
Add your domain name and choose the server IP you'd provision earlier.
|
||||||
|
|
||||||
## Serving Site With NGINX (HTTP ONLY)
|
### Serving Site With NGINX (HTTP ONLY)
|
||||||
|
|
||||||
Go back to command line.
|
Go back to command line.
|
||||||
|
|
||||||
@ -142,14 +135,14 @@ And add `server_name` (your custom domain)
|
|||||||
server_name yourdomain.com;
|
server_name yourdomain.com;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Rebuild Your Nginx
|
### Rebuild Your Nginx
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@server:~/laravel/laradock# docker-compose down
|
$root@server:~/laravel/laradock# docker-compose down
|
||||||
$root@server:~/laravel/laradock# docker-compose build nginx
|
$root@server:~/laravel/laradock# docker-compose build nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
## Re Run Your Containers MYSQL and NGINX
|
### Re Run Your Containers MYSQL and NGINX
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||||
@ -157,7 +150,7 @@ $root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
|||||||
|
|
||||||
**View Your Site with HTTP ONLY (http://yourdomain.com)**
|
**View Your Site with HTTP ONLY (http://yourdomain.com)**
|
||||||
|
|
||||||
## Run Site on SSL with Let's Encrypt Certificate
|
### Run Site on SSL with Let's Encrypt Certificate
|
||||||
|
|
||||||
**Note: You need to Use Caddy here Instead of Nginx**
|
**Note: You need to Use Caddy here Instead of Nginx**
|
||||||
|
|
||||||
@ -196,7 +189,7 @@ tls serverbreaker@gmai.com
|
|||||||
|
|
||||||
This is needed Prior to Creating Let's Encypt
|
This is needed Prior to Creating Let's Encypt
|
||||||
|
|
||||||
## Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@server:~/laravel/laradock# docker-compose up caddy
|
$root@server:~/laravel/laradock# docker-compose up caddy
|
||||||
@ -217,7 +210,7 @@ caddy_1 | http://yourdomain.com
|
|||||||
|
|
||||||
After it finishes, press `Ctrl` + `C` to exit.
|
After it finishes, press `Ctrl` + `C` to exit.
|
||||||
|
|
||||||
## Stop All Containers and ReRun Caddy and Other Containers on Background
|
### Stop All Containers and ReRun Caddy and Other Containers on Background
|
||||||
|
|
||||||
```
|
```
|
||||||
$root@server:~/laravel/laradock# docker-compose down
|
$root@server:~/laravel/laradock# docker-compose down
|
||||||
@ -238,326 +231,6 @@ View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
|||||||
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
||||||
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
|
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<a name="PHPStorm-Debugging"></a>
|
|
||||||
# PHPStorm XDebug Setup
|
|
||||||
|
|
||||||
- [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](images/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](images/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" ]; then
|
|
||||||
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: `./php-fpm/xdebug 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 `./php-fpm/xdebug 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](/images/photos/PHPStorm/Settings/BuildDeploymentConnection.png)
|
|
||||||
|
|
||||||
- `Settings/BuildDeploymentConnectionMappings`
|
|
||||||
- ![Settings/BuildDeploymentConnectionMappings](/images/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png)
|
|
||||||
|
|
||||||
- `Settings/BuildDeploymentDebugger`
|
|
||||||
- ![Settings/BuildDeploymentDebugger](/images/photos/PHPStorm/Settings/BuildDeploymentDebugger.png)
|
|
||||||
|
|
||||||
- `Settings/EditRunConfigurationRemoteWebDebug`
|
|
||||||
- ![Settings/EditRunConfigurationRemoteWebDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
|
|
||||||
|
|
||||||
- `Settings/EditRunConfigurationRemoteExampleTestDebug`
|
|
||||||
- ![Settings/EditRunConfigurationRemoteExampleTestDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
|
|
||||||
|
|
||||||
- `Settings/LangsPHPDebug`
|
|
||||||
- ![Settings/LangsPHPDebug](/images/photos/PHPStorm/Settings/LangsPHPDebug.png)
|
|
||||||
|
|
||||||
- `Settings/LangsPHPInterpreters`
|
|
||||||
- ![Settings/LangsPHPInterpreters](/images/photos/PHPStorm/Settings/LangsPHPInterpreters.png)
|
|
||||||
|
|
||||||
- `Settings/LangsPHPPHPUnit`
|
|
||||||
- ![Settings/LangsPHPPHPUnit](/images/photos/PHPStorm/Settings/LangsPHPPHPUnit.png)
|
|
||||||
|
|
||||||
- `Settings/LangsPHPServers`
|
|
||||||
- ![Settings/LangsPHPServers](/images/photos/PHPStorm/Settings/LangsPHPServers.png)
|
|
||||||
|
|
||||||
- `RemoteHost`
|
|
||||||
To switch on this view, go to: `Menu/Tools/Deployment/Browse Remote Host`.
|
|
||||||
- ![RemoteHost](/images/photos/PHPStorm/RemoteHost.png)
|
|
||||||
|
|
||||||
- `RemoteWebDebug`
|
|
||||||
- ![DebugRemoteOn](/images/photos/PHPStorm/DebugRemoteOn.png)
|
|
||||||
|
|
||||||
- `EditRunConfigurationRemoteWebDebug`
|
|
||||||
Go to: `Menu/Run/Edit Configurations`.
|
|
||||||
- ![EditRunConfigurationRemoteWebDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
|
|
||||||
|
|
||||||
- `EditRunConfigurationRemoteExampleTestDebug`
|
|
||||||
Go to: `Menu/Run/Edit Configurations`.
|
|
||||||
- ![EditRunConfigurationRemoteExampleTestDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
|
|
||||||
|
|
||||||
- `WindowsFirewallAllowedApps`
|
|
||||||
Go to: `Control Panel\All Control Panel Items\Windows Firewall\Allowed apps`.
|
|
||||||
- ![WindowsFirewallAllowedApps.png](/images/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png)
|
|
||||||
|
|
||||||
- `hosts`
|
|
||||||
Edit: `C:\Windows\System32\drivers\etc\hosts`.
|
|
||||||
- ![WindowsFirewallAllowedApps.png](/images/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](/images/photos/PHPStorm/RemoteTestDebuggingSuccess.png)
|
|
||||||
|
|
||||||
|
|
||||||
<a name="UsagePHPStormDebugSite"></a>
|
|
||||||
### Debug WebSite
|
|
||||||
- In case xDebug is disabled, from the `laradock` folder run:
|
|
||||||
`./php-fpm/xdebug start`.
|
|
||||||
- To switch xdebug off, run:
|
|
||||||
`./php-fpm/xdebug stop`
|
|
||||||
|
|
||||||
- Start Remote Debugging
|
|
||||||
- ![DebugRemoteOn](/images/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](/images/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](/images/photos/KiTTY/Session.png)
|
|
||||||
- ![Terminal](/images/photos/KiTTY/Terminal.png)
|
|
||||||
- ![Window](/images/photos/KiTTY/Window.png)
|
|
||||||
- ![WindowAppearance](/images/photos/KiTTY/WindowAppearance.png)
|
|
||||||
- ![Connection](/images/photos/KiTTY/Connection.png)
|
|
||||||
- ![ConnectionData](/images/photos/KiTTY/ConnectionData.png)
|
|
||||||
- ![ConnectionSSH](/images/photos/KiTTY/ConnectionSSH.png)
|
|
||||||
- ![ConnectionSSHAuth](/images/photos/KiTTY/ConnectionSSHAuth.png)
|
|
||||||
- ![TerminalShell](/images/photos/KiTTY/TerminalShell.png)
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
@ -565,13 +238,9 @@ Assuming that you are in laradock folder, type:
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<a name="Laravel-Dusk"></a>
|
<a name="Laravel-Dusk"></a>
|
||||||
# Running Laravel Dusk Tests
|
## Running Laravel Dusk Tests
|
||||||
|
|
||||||
- [Option 1: Without Selenium](#option1-dusk)
|
### Option 1: Without Selenium
|
||||||
- [Option 2: With Selenium](#option2-dusk)
|
|
||||||
|
|
||||||
<a name="option1-dusk"></a>
|
|
||||||
## Option 1: Without Selenium
|
|
||||||
|
|
||||||
- [Intro](#option1-dusk-intro)
|
- [Intro](#option1-dusk-intro)
|
||||||
- [Workspace Setup](#option1-workspace-setup)
|
- [Workspace Setup](#option1-workspace-setup)
|
||||||
@ -579,14 +248,12 @@ Assuming that you are in laradock folder, type:
|
|||||||
- [Choose Chrome Driver Version (Optional)](#option1-choose-chrome-driver-version)
|
- [Choose Chrome Driver Version (Optional)](#option1-choose-chrome-driver-version)
|
||||||
- [Run Dusk Tests](#option1-run-dusk-tests)
|
- [Run Dusk Tests](#option1-run-dusk-tests)
|
||||||
|
|
||||||
<a name="option1-dusk-intro"></a>
|
#### Intro
|
||||||
### Intro
|
|
||||||
|
|
||||||
This is a guide to run Dusk tests in your `workspace` container with headless
|
This is a guide to run Dusk tests in your `workspace` container with headless
|
||||||
google-chrome and chromedriver. It has been tested with Laravel 5.4 and 5.5.
|
google-chrome and chromedriver. It has been tested with Laravel 5.4 and 5.5.
|
||||||
|
|
||||||
<a name="option1-workspace-setup"></a>
|
#### Workspace Setup
|
||||||
### Workspace Setup
|
|
||||||
|
|
||||||
Update your .env with following entries:
|
Update your .env with following entries:
|
||||||
|
|
||||||
@ -606,8 +273,7 @@ Then run below to build your workspace.
|
|||||||
docker-compose build workspace
|
docker-compose build workspace
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="option1-application-setup"></a>
|
#### Application Setup
|
||||||
### Application Setup
|
|
||||||
|
|
||||||
Run a `workspace` container and you will be inside the container at `/var/www` directory.
|
Run a `workspace` container and you will be inside the container at `/var/www` directory.
|
||||||
|
|
||||||
@ -672,8 +338,7 @@ abstract class DuskTestCase extends BaseTestCase
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="option1-choose-chrome-driver-version"></a>
|
#### Choose Chrome Driver Version (Optional)
|
||||||
### Choose Chrome Driver Version (Optional)
|
|
||||||
|
|
||||||
You could choose to use either:
|
You could choose to use either:
|
||||||
|
|
||||||
@ -727,8 +392,7 @@ abstract class DuskTestCase extends BaseTestCase
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="option1-run-dusk-tests"></a>
|
#### Run Dusk Tests
|
||||||
### Run Dusk Tests
|
|
||||||
|
|
||||||
Run local server in `workspace` container and run Dusk tests.
|
Run local server in `workspace` container and run Dusk tests.
|
||||||
|
|
||||||
@ -745,8 +409,7 @@ PHPUnit 6.4.0 by Sebastian Bergmann and contributors.
|
|||||||
Time: 837 ms, Memory: 6.00MB
|
Time: 837 ms, Memory: 6.00MB
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="option2-dusk"></a>
|
### Option 2: With Selenium
|
||||||
## Option 2: With Selenium
|
|
||||||
|
|
||||||
- [Intro](#dusk-intro)
|
- [Intro](#dusk-intro)
|
||||||
- [DNS Setup](#dns-setup)
|
- [DNS Setup](#dns-setup)
|
||||||
@ -754,8 +417,7 @@ Time: 837 ms, Memory: 6.00MB
|
|||||||
- [Laravel Dusk Setup](#laravel-dusk-setup)
|
- [Laravel Dusk Setup](#laravel-dusk-setup)
|
||||||
- [Running Laravel Dusk Tests](#running-tests)
|
- [Running Laravel Dusk Tests](#running-tests)
|
||||||
|
|
||||||
<a name="dusk-intro"></a>
|
#### Intro
|
||||||
### Intro
|
|
||||||
Setting up Laravel Dusk tests to run with Laradock appears be something that
|
Setting up Laravel Dusk tests to run with Laradock appears be something that
|
||||||
eludes most Laradock users. This guide is designed to show you how to wire them
|
eludes most Laradock users. This guide is designed to show you how to wire them
|
||||||
up to work together. This guide is written with macOS and Linux in mind. As such,
|
up to work together. This guide is written with macOS and Linux in mind. As such,
|
||||||
@ -765,8 +427,7 @@ for Windows-specific instructions.
|
|||||||
This guide assumes you know how to use a DNS forwarder such as `dnsmasq` or are comfortable
|
This guide assumes you know how to use a DNS forwarder such as `dnsmasq` or are comfortable
|
||||||
with editing the `/etc/hosts` file for one-off DNS changes.
|
with editing the `/etc/hosts` file for one-off DNS changes.
|
||||||
|
|
||||||
<a name="dns-setup"></a>
|
#### DNS Setup
|
||||||
### DNS Setup
|
|
||||||
According to RFC-2606, only four TLDs are reserved for local testing[^1]:
|
According to RFC-2606, only four TLDs are reserved for local testing[^1]:
|
||||||
|
|
||||||
- `.test`
|
- `.test`
|
||||||
@ -799,8 +460,7 @@ For example, in your `/etc/hosts` file:
|
|||||||
This will ensure that when navigating to `myapp.test`, it will route the
|
This will ensure that when navigating to `myapp.test`, it will route the
|
||||||
request to `127.0.0.1` which will be handled by Nginx in Laradock.
|
request to `127.0.0.1` which will be handled by Nginx in Laradock.
|
||||||
|
|
||||||
<a name="docker-compose"></a>
|
#### Docker Compose setup
|
||||||
### Docker Compose setup
|
|
||||||
In order to make the Selenium container talk to the Nginx container appropriately,
|
In order to make the Selenium container talk to the Nginx container appropriately,
|
||||||
the `docker-compose.yml` needs to be edited to accommodate this. Make the following
|
the `docker-compose.yml` needs to be edited to accommodate this. Make the following
|
||||||
changes:
|
changes:
|
||||||
@ -822,8 +482,7 @@ the Selenium container to make requests to the Nginx container, which is
|
|||||||
necessary for running Dusk tests. These changes also link the `nginx` environment
|
necessary for running Dusk tests. These changes also link the `nginx` environment
|
||||||
variable to the domain you wired up in your hosts file.
|
variable to the domain you wired up in your hosts file.
|
||||||
|
|
||||||
<a name="laravel-dusk-setup"></a>
|
#### Laravel Dusk Setup
|
||||||
### Laravel Dusk Setup
|
|
||||||
|
|
||||||
In order to make Laravel Dusk make the proper request to the Selenium container,
|
In order to make Laravel Dusk make the proper request to the Selenium container,
|
||||||
you have to edit the `DuskTestCase.php` file that's provided on the initial
|
you have to edit the `DuskTestCase.php` file that's provided on the initial
|
||||||
@ -833,13 +492,13 @@ Remote Web Driver attempts to use to set up the Selenium session.
|
|||||||
One recommendation for this is to add a separate config option in your `.env.dusk.local`
|
One recommendation for this is to add a separate config option in your `.env.dusk.local`
|
||||||
so it's still possible to run your Dusk tests locally should you want to.
|
so it's still possible to run your Dusk tests locally should you want to.
|
||||||
|
|
||||||
#### .env.dusk.local
|
##### .env.dusk.local
|
||||||
```
|
```
|
||||||
...
|
...
|
||||||
USE_SELENIUM=true
|
USE_SELENIUM=true
|
||||||
```
|
```
|
||||||
|
|
||||||
#### DuskTestCase.php
|
##### DuskTestCase.php
|
||||||
```php
|
```php
|
||||||
abstract class DuskTestCase extends BaseTestCase
|
abstract class DuskTestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
@ -859,8 +518,7 @@ abstract class DuskTestCase extends BaseTestCase
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="running-tests"></a>
|
#### Running Laravel Dusk Tests
|
||||||
### Running Laravel Dusk Tests
|
|
||||||
|
|
||||||
Now that you have everything set up, to run your Dusk tests, you have to SSH
|
Now that you have everything set up, to run your Dusk tests, you have to SSH
|
||||||
into the workspace container as you normally would:
|
into the workspace container as you normally would:
|
||||||
@ -885,3 +543,326 @@ This invokes the Dusk command from inside the workspace container but when the s
|
|||||||
execution, it returns your session to your project directory.
|
execution, it returns your session to your project directory.
|
||||||
|
|
||||||
[^1]: [Don't Use .dev for Development](https://iyware.com/dont-use-dev-for-development/)
|
[^1]: [Don't Use .dev for Development](https://iyware.com/dont-use-dev-for-development/)
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="PHPStorm-Debugging"></a>
|
||||||
|
## PHPStorm XDebug Setup
|
||||||
|
|
||||||
|
- [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)
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
### 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`.
|
||||||
|
|
||||||
|
### 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](images/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](images/photos/SimpleHostsEditor/AddHost_laravel.png).
|
||||||
|
|
||||||
|
|
||||||
|
### 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
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### 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" ]; then
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 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
|
||||||
|
```
|
||||||
|
|
||||||
|
### Enable xDebug on php-fpm
|
||||||
|
|
||||||
|
In a host terminal sitting in the laradock folder, run: `./php-fpm/xdebug 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 `./php-fpm/xdebug 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.
|
||||||
|
|
||||||
|
|
||||||
|
### PHPStorm Settings
|
||||||
|
|
||||||
|
- Here are some settings that are known to work:
|
||||||
|
- `Settings/BuildDeploymentConnection`
|
||||||
|
- ![Settings/BuildDeploymentConnection](/images/photos/PHPStorm/Settings/BuildDeploymentConnection.png)
|
||||||
|
|
||||||
|
- `Settings/BuildDeploymentConnectionMappings`
|
||||||
|
- ![Settings/BuildDeploymentConnectionMappings](/images/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png)
|
||||||
|
|
||||||
|
- `Settings/BuildDeploymentDebugger`
|
||||||
|
- ![Settings/BuildDeploymentDebugger](/images/photos/PHPStorm/Settings/BuildDeploymentDebugger.png)
|
||||||
|
|
||||||
|
- `Settings/EditRunConfigurationRemoteWebDebug`
|
||||||
|
- ![Settings/EditRunConfigurationRemoteWebDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
|
||||||
|
|
||||||
|
- `Settings/EditRunConfigurationRemoteExampleTestDebug`
|
||||||
|
- ![Settings/EditRunConfigurationRemoteExampleTestDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
|
||||||
|
|
||||||
|
- `Settings/LangsPHPDebug`
|
||||||
|
- ![Settings/LangsPHPDebug](/images/photos/PHPStorm/Settings/LangsPHPDebug.png)
|
||||||
|
|
||||||
|
- `Settings/LangsPHPInterpreters`
|
||||||
|
- ![Settings/LangsPHPInterpreters](/images/photos/PHPStorm/Settings/LangsPHPInterpreters.png)
|
||||||
|
|
||||||
|
- `Settings/LangsPHPPHPUnit`
|
||||||
|
- ![Settings/LangsPHPPHPUnit](/images/photos/PHPStorm/Settings/LangsPHPPHPUnit.png)
|
||||||
|
|
||||||
|
- `Settings/LangsPHPServers`
|
||||||
|
- ![Settings/LangsPHPServers](/images/photos/PHPStorm/Settings/LangsPHPServers.png)
|
||||||
|
|
||||||
|
- `RemoteHost`
|
||||||
|
To switch on this view, go to: `Menu/Tools/Deployment/Browse Remote Host`.
|
||||||
|
- ![RemoteHost](/images/photos/PHPStorm/RemoteHost.png)
|
||||||
|
|
||||||
|
- `RemoteWebDebug`
|
||||||
|
- ![DebugRemoteOn](/images/photos/PHPStorm/DebugRemoteOn.png)
|
||||||
|
|
||||||
|
- `EditRunConfigurationRemoteWebDebug`
|
||||||
|
Go to: `Menu/Run/Edit Configurations`.
|
||||||
|
- ![EditRunConfigurationRemoteWebDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
|
||||||
|
|
||||||
|
- `EditRunConfigurationRemoteExampleTestDebug`
|
||||||
|
Go to: `Menu/Run/Edit Configurations`.
|
||||||
|
- ![EditRunConfigurationRemoteExampleTestDebug](/images/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
|
||||||
|
|
||||||
|
- `WindowsFirewallAllowedApps`
|
||||||
|
Go to: `Control Panel\All Control Panel Items\Windows Firewall\Allowed apps`.
|
||||||
|
- ![WindowsFirewallAllowedApps.png](/images/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png)
|
||||||
|
|
||||||
|
- `hosts`
|
||||||
|
Edit: `C:\Windows\System32\drivers\etc\hosts`.
|
||||||
|
- ![WindowsFirewallAllowedApps.png](/images/photos/PHPStorm/Settings/hosts.png)
|
||||||
|
|
||||||
|
- [Enable xDebug on php-fpm](#enablePhpXdebug)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
#### 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!
|
||||||
|
|
||||||
|
#### 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](/images/photos/PHPStorm/RemoteTestDebuggingSuccess.png)
|
||||||
|
|
||||||
|
#### Debug WebSite
|
||||||
|
- In case xDebug is disabled, from the `laradock` folder run:
|
||||||
|
`./php-fpm/xdebug start`.
|
||||||
|
- To switch xdebug off, run:
|
||||||
|
`./php-fpm/xdebug stop`
|
||||||
|
|
||||||
|
- Start Remote Debugging
|
||||||
|
- ![DebugRemoteOn](/images/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](/images/photos/PHPStorm/RemoteDebuggingSuccess.png)
|
||||||
|
|
||||||
|
|
||||||
|
### 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`
|
||||||
|
|
||||||
|
#### 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](/images/photos/KiTTY/Session.png)
|
||||||
|
- ![Terminal](/images/photos/KiTTY/Terminal.png)
|
||||||
|
- ![Window](/images/photos/KiTTY/Window.png)
|
||||||
|
- ![WindowAppearance](/images/photos/KiTTY/WindowAppearance.png)
|
||||||
|
- ![Connection](/images/photos/KiTTY/Connection.png)
|
||||||
|
- ![ConnectionData](/images/photos/KiTTY/ConnectionData.png)
|
||||||
|
- ![ConnectionSSH](/images/photos/KiTTY/ConnectionSSH.png)
|
||||||
|
- ![ConnectionSSHAuth](/images/photos/KiTTY/ConnectionSSHAuth.png)
|
||||||
|
- ![TerminalShell](/images/photos/KiTTY/TerminalShell.png)
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="Setup remote debugging (PhpStorm)"></a>
|
||||||
|
## Setup remote debugging for PhpStorm on Linux
|
||||||
|
|
||||||
|
- Make sure you have followed the steps above in the [Install Xdebug section](#install-xdebug).
|
||||||
|
|
||||||
|
- Make sure Xdebug accepts connections and listens on port 9000. (Should be default configuration).
|
||||||
|
|
||||||
|
![Debug Configuration](/images/photos/PHPStorm/linux/configuration/debugConfiguration.png "Debug Configuration").
|
||||||
|
|
||||||
|
- Create a server with name `laradock` (matches **PHP_IDE_CONFIG** key in environment file) and make sure to map project root path with server correctly.
|
||||||
|
|
||||||
|
![Server Configuration](/images/photos/PHPStorm/linux/configuration/serverConfiguration.png "Server Configuration").
|
||||||
|
|
||||||
|
- Start listening for debug connections, place a breakpoint and you are good to go !
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Help & Questions
|
title: 5. Help & Questions
|
||||||
type: index
|
type: index
|
||||||
weight: 5
|
weight: 5
|
||||||
---
|
---
|
||||||
@ -7,3 +7,121 @@ weight: 5
|
|||||||
Join the chat room on [Gitter](https://gitter.im/Laradock/laradock) and get help and support from the community.
|
Join the chat room on [Gitter](https://gitter.im/Laradock/laradock) and get help and support from the community.
|
||||||
|
|
||||||
You can as well can open an [issue](https://github.com/laradock/laradock/issues) on Github (will be labeled as Question) and discuss it with people on [Gitter](https://gitter.im/Laradock/laradock).
|
You can as well can open an [issue](https://github.com/laradock/laradock/issues) on Github (will be labeled as Question) and discuss it with people on [Gitter](https://gitter.im/Laradock/laradock).
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Common-Problems"></a>
|
||||||
|
# Common Problems
|
||||||
|
|
||||||
|
*Here's a list of the common problems you might face, and the possible solutions.*
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
## I see a blank (white) page instead of the Laravel 'Welcome' page!
|
||||||
|
|
||||||
|
Run the following command from the Laravel root directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chmod -R 777 storage bootstrap/cache
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
## I see "Welcome to nginx" instead of the Laravel App!
|
||||||
|
|
||||||
|
Use `http://127.0.0.1` instead of `http://localhost` in your browser.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
## I get NGINX error 404 Not Found on Windows.
|
||||||
|
|
||||||
|
1. Go to docker Settings on your Windows machine.
|
||||||
|
2. Click on the `Shared Drives` tab and check the drive that contains your project files.
|
||||||
|
3. Enter your windows username and password.
|
||||||
|
4. Go to the `reset` tab and click restart docker.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
## The time in my services does not match the current time
|
||||||
|
|
||||||
|
1. Make sure you've [changed the timezone](#Change-the-timezone).
|
||||||
|
2. Stop and rebuild the containers (`docker-compose up -d --build <services>`)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
## 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:
|
||||||
|
|
||||||
|
* Option A
|
||||||
|
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`
|
||||||
|
|
||||||
|
## I get stuck when building nginx on `fetch http://mirrors.aliyun.com/alpine/v3.5/main/x86_64/APKINDEX.tar.gz`
|
||||||
|
|
||||||
|
As stated on [#749](https://github.com/laradock/laradock/issues/749#issuecomment-419652646), Already fixed,just set `CHANGE_SOURCE` to false.
|
||||||
|
|
||||||
|
## Custom composer repo packagist url and npm registry url
|
||||||
|
|
||||||
|
In China, the origin source of composer and npm is very slow. You can add `WORKSPACE_NPM_REGISTRY` and `WORKSPACE_COMPOSER_REPO_PACKAGIST` config in `.env` to use your custom source.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```bash
|
||||||
|
WORKSPACE_NPM_REGISTRY=https://registry.npm.taobao.org
|
||||||
|
WORKSPACE_COMPOSER_REPO_PACKAGIST=https://packagist.phpcomposer.com
|
||||||
|
```
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
## I get `Module build failed: Error: write EPIPE` while compiling react application
|
||||||
|
|
||||||
|
When you run `npm build` or `yarn dev` building a react application using webpack with elixir you may receive a `Error: write EPIPE` while processing .jpg images.
|
||||||
|
|
||||||
|
This is caused of an outdated library for processing **.jpg files** in ubuntu 16.04.
|
||||||
|
|
||||||
|
To fix the problem you can follow those steps
|
||||||
|
|
||||||
|
1 - Open the `.env`.
|
||||||
|
|
||||||
|
2 - Search for `WORKSPACE_INSTALL_LIBPNG` or add the key if missing.
|
||||||
|
|
||||||
|
3 - Set the value to true:
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
WORKSPACE_INSTALL_LIBPNG=true
|
||||||
|
```
|
||||||
|
|
||||||
|
4 - Finally rebuild the workspace image
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose build workspace
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Introduction
|
title: 1. Introduction
|
||||||
type: index
|
type: index
|
||||||
weight: 1
|
weight: 1
|
||||||
---
|
---
|
||||||
@ -9,7 +9,7 @@ weight: 1
|
|||||||
|
|
||||||
A full PHP development environment for Docker.
|
A full PHP development environment for Docker.
|
||||||
|
|
||||||
Includes a lot of useful Docker Images, all pre-configured to provide a wonderful PHP development environment.
|
Supports a variety of useful Docker Images, pre-configured to provide a wonderful PHP development environment.
|
||||||
|
|
||||||
|
|
||||||
![](https://raw.githubusercontent.com/laradock/laradock/master/.github/home-page-images/laradock-logo.jpg)
|
![](https://raw.githubusercontent.com/laradock/laradock/master/.github/home-page-images/laradock-logo.jpg)
|
||||||
@ -31,11 +31,11 @@ Includes a lot of useful Docker Images, all pre-configured to provide a wonderfu
|
|||||||
|
|
||||||
For basic sponsorships go to [Open Collective](https://opencollective.com/laradock#sponsor), for golden sponsorships contact <a href = "mailto: support@laradock.io">support@laradock.io</a>.
|
For basic sponsorships go to [Open Collective](https://opencollective.com/laradock#sponsor), for golden sponsorships contact <a href = "mailto: support@laradock.io">support@laradock.io</a>.
|
||||||
<br>
|
<br>
|
||||||
Your logo will show up on the [github repository](https://github.com/laradock/laradock/) index page and the [documentation](http://laradock.io/) main page, with a link to your website.
|
*Your logo will show up on the [github repository](https://github.com/laradock/laradock/) index page and the [documentation](http://laradock.io/) main page, with a link to your website.*
|
||||||
|
|
||||||
## Quick Overview
|
## Quick Overview
|
||||||
|
|
||||||
Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL`, `Redis` and `Beanstalkd`:
|
Let's see how easy it is to setup our demo stack `PHP`, `NGINX`, `MySQL`, `Redis` and `Composer`:
|
||||||
|
|
||||||
1 - Clone Laradock inside your PHP project:
|
1 - Clone Laradock inside your PHP project:
|
||||||
|
|
||||||
@ -77,8 +77,8 @@ That's it! enjoy :)
|
|||||||
|
|
||||||
- Easy switch between PHP versions: 7.3, 7.2, 7.1, 5.6...
|
- Easy switch between PHP versions: 7.3, 7.2, 7.1, 5.6...
|
||||||
- Choose your favorite database engine: MySQL, Postgres, MariaDB...
|
- Choose your favorite database engine: MySQL, Postgres, MariaDB...
|
||||||
- Run your own combination of software: Memcached, HHVM, Beanstalkd...
|
- Run your own stack: Memcached, HHVM, RabbitMQ...
|
||||||
- Every software runs on a separate container: PHP-FPM, NGINX, PHP-CLI...
|
- Each software runs on its own container: PHP-FPM, NGINX, PHP-CLI...
|
||||||
- Easy to customize any container, with simple edit to the `Dockerfile`.
|
- Easy to customize any container, with simple edit to the `Dockerfile`.
|
||||||
- All Images extends from an official base Image. (Trusted base Images).
|
- All Images extends from an official base Image. (Trusted base Images).
|
||||||
- Pre-configured NGINX to host any code at your root directory.
|
- Pre-configured NGINX to host any code at your root directory.
|
||||||
@ -88,39 +88,101 @@ That's it! enjoy :)
|
|||||||
- Latest version of the Docker Compose file (`docker-compose`).
|
- Latest version of the Docker Compose file (`docker-compose`).
|
||||||
- Everything is visible and editable.
|
- Everything is visible and editable.
|
||||||
- Fast Images Builds.
|
- Fast Images Builds.
|
||||||
- More to come every week..
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Supported-Containers"></a>
|
<a name="Supported-Containers"></a>
|
||||||
## Supported Software (Images)
|
## Supported Software (Images)
|
||||||
|
|
||||||
In adhering to the separation of concerns principle as promoted by Docker, Laradock runs each software on its own Container.
|
> Laradock, adheres to the 'separation of concerns' principle, thus it runs each software on its own Docker Container.
|
||||||
You can turn On/Off as many instances of as any container without worrying about the configurations, everything works like a charm.
|
> You can turn On/Off as many instances of as any container without worrying about the configurations.
|
||||||
|
|
||||||
|
> To run a chosen container from the list below, run `docker-compose up -d {container-name}`.
|
||||||
|
> The container name `{container-name}` is the same as its folder name. Example to run the "PHP FPM" container use the name "php-fpm".
|
||||||
|
|
||||||
|
- **Web Servers:**
|
||||||
|
* NGINX
|
||||||
|
* Apache2
|
||||||
|
* Caddy
|
||||||
|
* HAProxy
|
||||||
|
|
||||||
- **Database Engines:**
|
|
||||||
MySQL - MariaDB - Percona - MongoDB - Neo4j - RethinkDB - MSSQL - PostgreSQL - Postgres-PostGIS.
|
|
||||||
- **Database Management:**
|
|
||||||
PhpMyAdmin - Adminer - PgAdmin
|
|
||||||
- **Cache Engines:**
|
|
||||||
Redis - Memcached - Aerospike
|
|
||||||
- **PHP Servers:**
|
|
||||||
NGINX - Apache2 - Caddy
|
|
||||||
- **PHP Compilers:**
|
- **PHP Compilers:**
|
||||||
PHP FPM - HHVM
|
* PHP FPM
|
||||||
- **Message Queueing:**
|
* HHVM
|
||||||
Beanstalkd - RabbitMQ - PHP Worker
|
|
||||||
- **Queueing Management:**
|
|
||||||
Beanstalkd Console - RabbitMQ Console
|
|
||||||
- **Random Tools:**
|
|
||||||
Mailu - HAProxy - Certbot - Blackfire - Selenium - Jenkins - ElasticSearch - Kibana - Grafana - Gitlab - Mailhog - MailDev - Minio - Varnish - Swoole - NetData - Portainer - Laravel Echo - Phalcon...
|
|
||||||
|
|
||||||
Laradock introduces the **Workspace** Image, as a development environment.
|
- **Database Management Systems:**
|
||||||
It contains a rich set of helpful tools, all pre-configured to work and integrate with almost any combination of Containers and tools you may choose.
|
* MySQL
|
||||||
|
* MariaDB
|
||||||
|
* Percona
|
||||||
|
* MongoDB
|
||||||
|
* Neo4j
|
||||||
|
* RethinkDB
|
||||||
|
* MSSQL
|
||||||
|
* PostgreSQL
|
||||||
|
* Postgres-PostGIS
|
||||||
|
|
||||||
**Workspace Image Tools**
|
- **Database Management Apps:**
|
||||||
PHP CLI - Composer - Git - Linuxbrew - Node - V8JS - Gulp - SQLite - xDebug - Envoy - Deployer - Vim - Yarn - SOAP - Drush - WP-CLI...
|
* PhpMyAdmin
|
||||||
|
* Adminer
|
||||||
|
* PgAdmin
|
||||||
|
|
||||||
|
- **Cache Engines:**
|
||||||
|
* Redis
|
||||||
|
* Memcached
|
||||||
|
* Aerospike
|
||||||
|
* Varnish
|
||||||
|
|
||||||
|
- **Message Brokers:**
|
||||||
|
* RabbitMQ (+ Admin Console)
|
||||||
|
* Beanstalkd (+ Admin Console)
|
||||||
|
* PHP Worker
|
||||||
|
|
||||||
|
- **Mail Servers:**
|
||||||
|
* Mailu
|
||||||
|
* Mailhog
|
||||||
|
* MailDev
|
||||||
|
|
||||||
|
- **Testing:**
|
||||||
|
* Selenium
|
||||||
|
|
||||||
|
- **Monitoring:**
|
||||||
|
* Grafana
|
||||||
|
* NetData
|
||||||
|
|
||||||
|
- **More Tools:**
|
||||||
|
* Certbot *(Automatically enable HTTPS on your website)*
|
||||||
|
* Swoole *(Production-Grade Async programming Framework for PHP)*
|
||||||
|
* ElasticSearch *(Search engine based on the Lucene library)*
|
||||||
|
* Kibana *(Visualize your Elasticsearch data and navigate the Elastic Stack)*
|
||||||
|
* Portainer *(Build and manage your Docker environments with ease)*
|
||||||
|
* Jenkins (automation server)
|
||||||
|
* Gitlab *(A single application for the entire software development lifecycle)*
|
||||||
|
* Blackfire *(Empowers all PHP developers and IT/Ops to continuously verify and improve their app's performance)*
|
||||||
|
* Laravel Echo *(Bring the power of WebSockets to your Laravel applications)*
|
||||||
|
* Phalcon *(A PHP web framework based on the model–view–controller pattern)*
|
||||||
|
* Minio *(Cloud storage server released under Apache License v2, compatible with Amazon S3)*
|
||||||
|
|
||||||
|
- **Workspace Image Tools**
|
||||||
|
|
||||||
|
> Laradock introduces the **Workspace** Image, as a development environment.
|
||||||
|
> It contains a rich set of helpful tools, all pre-configured to work and integrate with almost any combination of tools you choose.
|
||||||
|
|
||||||
|
* PHP CLI
|
||||||
|
* Composer
|
||||||
|
* Git
|
||||||
|
* Vim
|
||||||
|
* xDebug
|
||||||
|
* Linuxbrew
|
||||||
|
* Node
|
||||||
|
* V8JS
|
||||||
|
* Gulp
|
||||||
|
* SQLite
|
||||||
|
* Envoy
|
||||||
|
* Deployer
|
||||||
|
* Yarn
|
||||||
|
* SOAP
|
||||||
|
* Drush
|
||||||
|
* Wordpress CLI
|
||||||
|
|
||||||
You can choose, which tools to install in your workspace container and other containers, from the `.env` file.
|
You can choose, which tools to install in your workspace container and other containers, from the `.env` file.
|
||||||
|
|
||||||
@ -166,7 +228,6 @@ Most importantly Docker can run on Development and on Production (same environme
|
|||||||
|
|
||||||
What's better than a **Demo Video**:
|
What's better than a **Demo Video**:
|
||||||
|
|
||||||
- Laradock v5.* (should be next!)
|
|
||||||
- Laradock [v4.*](https://www.youtube.com/watch?v=TQii1jDa96Y)
|
- Laradock [v4.*](https://www.youtube.com/watch?v=TQii1jDa96Y)
|
||||||
- Laradock [v2.*](https://www.youtube.com/watch?v=-DamFMczwDA)
|
- Laradock [v2.*](https://www.youtube.com/watch?v=-DamFMczwDA)
|
||||||
- Laradock [v0.3](https://www.youtube.com/watch?v=jGkyO6Is_aI)
|
- Laradock [v0.3](https://www.youtube.com/watch?v=jGkyO6Is_aI)
|
||||||
@ -195,14 +256,14 @@ You are welcome to join our chat room on Gitter.
|
|||||||
> Help keeping the project development going, by [contributing](http://laradock.io/contributing) or donating a little.
|
> Help keeping the project development going, by [contributing](http://laradock.io/contributing) or donating a little.
|
||||||
> Thanks in advance.
|
> Thanks in advance.
|
||||||
|
|
||||||
Donate directly via [Paypal](https://www.paypal.me/mzalt)
|
Donate directly via [Paypal](https://paypal.me/mzmmzz)
|
||||||
|
|
||||||
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/mzalt)
|
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/mzmmzz)
|
||||||
|
|
||||||
or become a backer on [Open Collective](https://opencollective.com/laradock#backer)
|
|
||||||
|
|
||||||
<a href="https://opencollective.com/laradock#backers" target="_blank"><img src="https://opencollective.com/laradock/backers.svg?width=890"></a>
|
|
||||||
|
|
||||||
or show your support via [Beerpay](https://beerpay.io/laradock/laradock)
|
or show your support via [Beerpay](https://beerpay.io/laradock/laradock)
|
||||||
|
|
||||||
[![Beerpay](https://beerpay.io/laradock/laradock/badge.svg?style=flat)](https://beerpay.io/laradock/laradock)
|
[![Beerpay](https://beerpay.io/laradock/laradock/badge.svg?style=flat)](https://beerpay.io/laradock/laradock)
|
||||||
|
|
||||||
|
or become a backer on [Open Collective](https://opencollective.com/laradock#backer)
|
||||||
|
|
||||||
|
<a href="https://opencollective.com/laradock#backers" target="_blank"><img src="https://opencollective.com/laradock/backers.svg?width=890"></a>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: License
|
title: 8. License
|
||||||
type: index
|
type: index
|
||||||
weight: 8
|
weight: 8
|
||||||
---
|
---
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Related Projects
|
title: 6. Related Projects
|
||||||
type: index
|
type: index
|
||||||
weight: 6
|
weight: 6
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user