move _guides to the documentation
|
@ -62,8 +62,8 @@ googleAnalytics = "UA-37514928-9"
|
|||
weight = 3
|
||||
|
||||
[[menu.main]]
|
||||
name = "Related Projects"
|
||||
url = "related-projects/"
|
||||
name = "Giudes"
|
||||
url = "guides/"
|
||||
weight = 4
|
||||
|
||||
[[menu.main]]
|
||||
|
@ -71,15 +71,20 @@ googleAnalytics = "UA-37514928-9"
|
|||
url = "help/"
|
||||
weight = 5
|
||||
|
||||
[[menu.main]]
|
||||
name = "Related Projects"
|
||||
url = "related-projects/"
|
||||
weight = 6
|
||||
|
||||
[[menu.main]]
|
||||
name = "Contributing"
|
||||
url = "contributing/"
|
||||
weight = 6
|
||||
weight = 7
|
||||
|
||||
[[menu.main]]
|
||||
name = "License"
|
||||
url = "license/"
|
||||
weight = 7
|
||||
weight = 8
|
||||
|
||||
# ------- MENU END -----------------------------------------
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Contributing
|
||||
type: index
|
||||
weight: 6
|
||||
weight: 7
|
||||
---
|
||||
|
||||
|
||||
|
|
|
@ -1,49 +1,293 @@
|
|||
# PHPStorm Debugging Guide
|
||||
---
|
||||
title: Guides
|
||||
type: index
|
||||
weight: 4
|
||||
---
|
||||
|
||||
|
||||
|
||||
* [Production Setup on Digital Ocean](#Digital-Ocean)
|
||||
* [PHPStorm XDebug Setup](#PHPStorm-Debugging)
|
||||
|
||||
|
||||
|
||||
<a name="Digital-Ocean"></a>
|
||||
# Production Setup on Digital Ocean
|
||||
|
||||
## Install Docker
|
||||
|
||||
- Visit [DigitalOcean](https://cloud.digitalocean.com/login) and login.
|
||||
- Click the `Create Droplet` button.
|
||||
- Open the `One-click apps` tab.
|
||||
- Select Docker with your preferred version.
|
||||
- Continue creating the droplet as you normally would.
|
||||
- If needed, check your e-mail for the droplet root password.
|
||||
|
||||
## SSH to your Server
|
||||
|
||||
Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.
|
||||
|
||||
```
|
||||
ssh root@ipaddress
|
||||
```
|
||||
|
||||
You may be prompted for a password. Type the one you found within your e-mailbox. It'll then ask you to change the password.
|
||||
|
||||
You can now check if Docker is available:
|
||||
|
||||
```
|
||||
$root@server:~# docker
|
||||
```
|
||||
|
||||
## Set Up Your Laravel Project
|
||||
|
||||
```
|
||||
$root@server:~# apt-get install git
|
||||
$root@server:~# git clone https://github.com/laravel/laravel
|
||||
$root@server:~# cd laravel
|
||||
$root@server:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
||||
$root@server:~/laravel/ cd laradock
|
||||
```
|
||||
|
||||
## Install docker-compose command
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
|
||||
$root@server:~/chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
## Create Your LaraDock Containers
|
||||
|
||||
```
|
||||
$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.
|
||||
|
||||
## Go to Your Workspace
|
||||
|
||||
```
|
||||
docker-compose exec workspace bash
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
```
|
||||
$ root@workspace:/var/www# composer install
|
||||
$ root@workspace:/var/www# cp .env.example .env
|
||||
$ root@workspace:/var/www# php artisan key:generate
|
||||
$ root@workspace:/var/www# exit
|
||||
$root@server:~/laravel/laradock# cd ..
|
||||
$root@server:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||
```
|
||||
|
||||
You can then view your Laravel site by visiting the IP address of your server in your browser. For example:
|
||||
|
||||
```
|
||||
http://192.168.1.1
|
||||
```
|
||||
|
||||
It should show you the Laravel default welcome page.
|
||||
|
||||
However, we want it to show up using your custom domain name, as well.
|
||||
|
||||
## Using Your Own Domain Name
|
||||
|
||||
Login to your DNS provider, such as Godaddy, Namecheap.
|
||||
|
||||
Point the Custom Domain Name Server to:
|
||||
|
||||
```
|
||||
ns1.digitalocean.com
|
||||
ns2.digitalocean.com
|
||||
ns3.digitalocean.com
|
||||
```
|
||||
|
||||
Within DigitalOcean, you'll need to change some settings, too.
|
||||
|
||||
Visit: https://cloud.digitalocean.com/networking/domains
|
||||
|
||||
Add your domain name and choose the server IP you'd provision earlier.
|
||||
|
||||
## Serving Site With NGINX (HTTP ONLY)
|
||||
|
||||
Go back to command line.
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock# cd nginx
|
||||
$root@server:~/laravel/laradock/nginx# vim laravel.conf
|
||||
```
|
||||
|
||||
Remove `default_server`
|
||||
|
||||
```
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
```
|
||||
|
||||
And add `server_name` (your custom domain)
|
||||
|
||||
```
|
||||
listen 80;
|
||||
listen [::]:80 ipv6only=on;
|
||||
server_name yourdomain.com;
|
||||
```
|
||||
|
||||
## Rebuild Your Nginx
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose down
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose build nginx
|
||||
```
|
||||
|
||||
## Re Run Your Containers MYSQL and NGINX
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||
```
|
||||
|
||||
**View Your Site with HTTP ONLY (http://yourdomain.com)**
|
||||
|
||||
## Run Site on SSL with Let's Encrypt Certificate
|
||||
|
||||
**Note: You need to Use Caddy here Instead of Nginx**
|
||||
|
||||
To go Caddy Folders and Edit CaddyFile
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock# cd caddy
|
||||
$root@server:~/laravel/laradock/caddy# vim Caddyfile
|
||||
```
|
||||
|
||||
Remove 0.0.0.0:80
|
||||
|
||||
```
|
||||
0.0.0.0:80
|
||||
root /var/www/public
|
||||
```
|
||||
|
||||
and replace with your https://yourdomain.com
|
||||
|
||||
```
|
||||
https://yourdomain.com
|
||||
root /var/www/public
|
||||
```
|
||||
|
||||
uncomment tls
|
||||
|
||||
```
|
||||
#tls self-signed
|
||||
```
|
||||
|
||||
and replace self-signed with your email address
|
||||
|
||||
```
|
||||
tls serverbreaker@gmai.com
|
||||
```
|
||||
|
||||
This is needed Prior to Creating Let's Encypt
|
||||
|
||||
## Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose up caddy
|
||||
```
|
||||
|
||||
You'll be prompt here to enter your email... you may enter it or not
|
||||
|
||||
```
|
||||
Attaching to laradock_mysql_1, laradock_caddy_1
|
||||
caddy_1 | Activating privacy features...
|
||||
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
|
||||
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
|
||||
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
|
||||
caddy_1 | Activating privacy features... done.
|
||||
caddy_1 | https://yourdomain.com
|
||||
caddy_1 | http://yourdomain.com
|
||||
```
|
||||
|
||||
After it finishes, press `Ctrl` + `C` to exit.
|
||||
|
||||
## Stop All Containers and ReRun Caddy and Other Containers on Background
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose down
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
||||
```
|
||||
|
||||
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
||||
|
||||
**Note that Certificate will be Automatically Renew By Caddy**
|
||||
|
||||
>References:
|
||||
>
|
||||
- [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04)
|
||||
- [https://www.digitalocean.com/products/one-click-apps/docker/](https://www.digitalocean.com/products/one-click-apps/docker/)
|
||||
- [https://docs.docker.com/engine/installation/linux/ubuntulinux/](https://docs.docker.com/engine/installation/linux/ubuntulinux/)
|
||||
- [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
|
||||
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
|
||||
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
||||
- [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)
|
||||
- [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)
|
||||
|
||||
- [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`,
|
||||
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`.
|
||||
- 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.
|
||||
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.
|
||||
|
@ -51,7 +295,7 @@ Your PHPStorm will need to be able to receive a connection from PHP xdebug eithe
|
|||
### Edit laradock/docker-compose.yml
|
||||
Set the following variables:
|
||||
```
|
||||
### Workspace Utilities Container ###########################
|
||||
### Workspace Utilities Container ###############
|
||||
|
||||
workspace:
|
||||
build:
|
||||
|
@ -60,9 +304,9 @@ Set the following variables:
|
|||
- INSTALL_XDEBUG=true
|
||||
- INSTALL_WORKSPACE_SSH=true
|
||||
...
|
||||
|
||||
|
||||
### PHP-FPM Container #######################################
|
||||
|
||||
|
||||
### PHP-FPM Container #####################
|
||||
|
||||
php-fpm:
|
||||
build:
|
||||
|
@ -70,7 +314,7 @@ Set the following variables:
|
|||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
|
||||
|
||||
```
|
||||
|
||||
### Edit xdebug.ini files
|
||||
|
@ -91,13 +335,13 @@ xdebug.cli_color=1
|
|||
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).
|
||||
- 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:
|
||||
**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.
|
||||
|
@ -107,7 +351,7 @@ Here are a few things I use to clean things up.
|
|||
if [ -n "$processes" ]; thend
|
||||
docker rm $processes
|
||||
fi
|
||||
|
||||
|
||||
images=`docker images -q -f dangling=true`
|
||||
if [ -n "$images" ]; then
|
||||
docker rmi $images
|
||||
|
@ -140,13 +384,13 @@ alias dcleanlaradock=dcleanlaradockfunction
|
|||
```
|
||||
|
||||
<a name="InstallLaraDockDialTone"></a>
|
||||
#### Let's get a dial-tone with Laravel
|
||||
## Let's get a dial-tone with Laravel
|
||||
|
||||
```
|
||||
# barebones at this point
|
||||
docker-compose up -d nginx mysql
|
||||
|
||||
# run
|
||||
# run
|
||||
docker-compose ps
|
||||
|
||||
# Should see:
|
||||
|
@ -163,7 +407,7 @@ laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222-
|
|||
```
|
||||
|
||||
<a name="enablePhpXdebug"></a>
|
||||
#### Enable xDebug on php-fpm
|
||||
## Enable xDebug on php-fpm
|
||||
In a host terminal sitting in the laradock folder, run: `./xdebugPhpFpm status`
|
||||
You should see something like the following:
|
||||
```
|
||||
|
@ -181,39 +425,39 @@ If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will
|
|||
|
||||
|
||||
<a name="InstallPHPStormConfigs"></a>
|
||||
#### PHPStorm Settings
|
||||
## 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)
|
||||
|
||||
|
@ -258,14 +502,14 @@ If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will
|
|||
|
||||
<a name="UsagePHPStormDebugSite"></a>
|
||||
### Debug WebSite
|
||||
- In case xDebug is disabled, from the `laradock` folder run:
|
||||
- In case xDebug is disabled, from the `laradock` folder run:
|
||||
`./xdebugPhpFpm start`.
|
||||
- To switch xdebug off, run:
|
||||
- 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/)
|
||||
|
@ -274,7 +518,7 @@ If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will
|
|||
|
||||
|
||||
<a name="SSHintoWorkspace"></a>
|
||||
#### Let's shell into workspace
|
||||
## Let's shell into workspace
|
||||
Assuming that you are in laradock folder, type:
|
||||
`ssh -i workspace/insecure_id_rsa -p2222 root@laravel`
|
||||
**Cha Ching!!!!**
|
||||
|
@ -285,7 +529,7 @@ Assuming that you are in laradock folder, type:
|
|||
|
||||
<a name="InstallKiTTY"></a>
|
||||
|
||||
##### KiTTY
|
||||
### 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:
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: License
|
||||
type: index
|
||||
weight: 7
|
||||
weight: 8
|
||||
---
|
||||
|
||||
[MIT License](https://github.com/laradock/laradock/blob/master/LICENSE) (MIT)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Related Projects
|
||||
type: index
|
||||
weight: 4
|
||||
weight: 6
|
||||
---
|
||||
|
||||
Laradock related projects:
|
||||
|
|
Before Width: | Height: | Size: 246 KiB |
Before Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
@ -1,216 +0,0 @@
|
|||
#### Install Docker
|
||||
|
||||
- Visit [DigitalOcean](https://cloud.digitalocean.com/login) and login.
|
||||
- Click the `Create Droplet` button.
|
||||
- Open the `One-click apps` tab.
|
||||
- Select Docker with your preferred version.
|
||||
- Continue creating the droplet as you normally would.
|
||||
- If needed, check your e-mail for the droplet root password.
|
||||
|
||||
#### SSH to your Server
|
||||
|
||||
Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.
|
||||
|
||||
```
|
||||
ssh root@ipaddress
|
||||
```
|
||||
|
||||
You may be prompted for a password. Type the one you found within your e-mailbox. It'll then ask you to change the password.
|
||||
|
||||
You can now check if Docker is available:
|
||||
|
||||
```
|
||||
$root@server:~# docker
|
||||
```
|
||||
|
||||
#### Set Up Your Laravel Project
|
||||
|
||||
```
|
||||
$root@server:~# apt-get install git
|
||||
$root@server:~# git clone https://github.com/laravel/laravel
|
||||
$root@server:~# cd laravel
|
||||
$root@server:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
||||
$root@server:~/laravel/ cd laradock
|
||||
```
|
||||
|
||||
#### Install docker-compose command
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
|
||||
$root@server:~/chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
#### Create Your LaraDock Containers
|
||||
|
||||
```
|
||||
$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.
|
||||
|
||||
#### Go to Your Workspace
|
||||
|
||||
```
|
||||
docker-compose exec workspace bash
|
||||
```
|
||||
|
||||
#### 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.
|
||||
|
||||
```
|
||||
$ root@workspace:/var/www# composer install
|
||||
$ root@workspace:/var/www# cp .env.example .env
|
||||
$ root@workspace:/var/www# php artisan key:generate
|
||||
$ root@workspace:/var/www# exit
|
||||
$root@server:~/laravel/laradock# cd ..
|
||||
$root@server:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||
```
|
||||
|
||||
You can then view your Laravel site by visiting the IP address of your server in your browser. For example:
|
||||
|
||||
```
|
||||
http://192.168.1.1
|
||||
```
|
||||
|
||||
It should show you the Laravel default welcome page.
|
||||
|
||||
However, we want it to show up using your custom domain name, as well.
|
||||
|
||||
#### Using Your Own Domain Name
|
||||
|
||||
Login to your DNS provider, such as Godaddy, Namecheap.
|
||||
|
||||
Point the Custom Domain Name Server to:
|
||||
|
||||
```
|
||||
ns1.digitalocean.com
|
||||
ns2.digitalocean.com
|
||||
ns3.digitalocean.com
|
||||
```
|
||||
|
||||
Within DigitalOcean, you'll need to change some settings, too.
|
||||
|
||||
Visit: https://cloud.digitalocean.com/networking/domains
|
||||
|
||||
Add your domain name and choose the server IP you'd provision earlier.
|
||||
|
||||
#### Serving Site With NGINX (HTTP ONLY)
|
||||
|
||||
Go back to command line.
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock# cd nginx
|
||||
$root@server:~/laravel/laradock/nginx# vim laravel.conf
|
||||
```
|
||||
|
||||
Remove `default_server`
|
||||
|
||||
```
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
```
|
||||
|
||||
And add `server_name` (your custom domain)
|
||||
|
||||
```
|
||||
listen 80;
|
||||
listen [::]:80 ipv6only=on;
|
||||
server_name yourdomain.com;
|
||||
```
|
||||
|
||||
#### Rebuild Your Nginx
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose down
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose build nginx
|
||||
```
|
||||
|
||||
#### Re Run Your Containers MYSQL and NGINX
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||
```
|
||||
|
||||
**View Your Site with HTTP ONLY (http://yourdomain.com)**
|
||||
|
||||
#### Run Site on SSL with Let's Encrypt Certificate
|
||||
|
||||
**Note: You need to Use Caddy here Instead of Nginx**
|
||||
|
||||
To go Caddy Folders and Edit CaddyFile
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock# cd caddy
|
||||
$root@server:~/laravel/laradock/caddy# vim Caddyfile
|
||||
```
|
||||
|
||||
Remove 0.0.0.0:80
|
||||
|
||||
```
|
||||
0.0.0.0:80
|
||||
root /var/www/public
|
||||
```
|
||||
|
||||
and replace with your https://yourdomain.com
|
||||
|
||||
```
|
||||
https://yourdomain.com
|
||||
root /var/www/public
|
||||
```
|
||||
|
||||
uncomment tls
|
||||
|
||||
```
|
||||
#tls self-signed
|
||||
```
|
||||
|
||||
and replace self-signed with your email address
|
||||
|
||||
```
|
||||
tls serverbreaker@gmai.com
|
||||
```
|
||||
|
||||
This is needed Prior to Creating Let's Encypt
|
||||
|
||||
#### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose up caddy
|
||||
```
|
||||
|
||||
You'll be prompt here to enter your email... you may enter it or not
|
||||
|
||||
```
|
||||
Attaching to laradock_mysql_1, laradock_caddy_1
|
||||
caddy_1 | Activating privacy features...
|
||||
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
|
||||
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
|
||||
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
|
||||
caddy_1 | Activating privacy features... done.
|
||||
caddy_1 | https://yourdomain.com
|
||||
caddy_1 | http://yourdomain.com
|
||||
```
|
||||
|
||||
After it finishes, press `Ctrl` + `C` to exit.
|
||||
|
||||
#### Stop All Containers and ReRun Caddy and Other Containers on Background
|
||||
|
||||
```
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose down
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
||||
```
|
||||
|
||||
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
|
||||
|
||||
**Note that Certificate will be Automatically Renew By Caddy**
|
||||
|
||||
>References:
|
||||
>
|
||||
- [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04)
|
||||
- [https://www.digitalocean.com/products/one-click-apps/docker/](https://www.digitalocean.com/products/one-click-apps/docker/)
|
||||
- [https://docs.docker.com/engine/installation/linux/ubuntulinux/](https://docs.docker.com/engine/installation/linux/ubuntulinux/)
|
||||
- [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
|
||||
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
|
||||
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
|
||||
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
|
|
@ -211,6 +211,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
@ -345,20 +363,20 @@ features, by not reporting duplicate issues.</em></p>
|
|||
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
<p>Go the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</p>
|
||||
|
||||
<p>To edit the sidebar or add a new section, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code> as well.</p>
|
||||
|
||||
<p><em>The site will be autogenerated in the <code>docs/</code> folder by <a href="https://travis-ci.com/">Travis</a>.</em></p>
|
||||
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Edit the <code>DOCUMENTATION/_settings/content</code>.</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="how-to-support-new-software-add-new-container">How to support new Software (Add new Container)</h2>
|
||||
|
||||
|
|
|
@ -48,20 +48,20 @@ features, by not reporting duplicate issues.</em></p>
|
|||
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
<p>Go the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</p>
|
||||
|
||||
<p>To edit the sidebar or add a new section, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code> as well.</p>
|
||||
|
||||
<p><em>The site will be autogenerated in the <code>docs/</code> folder by <a href="https://travis-ci.com/">Travis</a>.</em></p>
|
||||
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Edit the <code>DOCUMENTATION/_settings/content</code>.</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="how-to-support-new-software-add-new-container">How to support new Software (Add new Container)</h2>
|
||||
|
||||
|
|
|
@ -214,6 +214,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
|
|
@ -214,6 +214,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
|
|
@ -211,6 +211,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
|
703
docs/index.html
|
@ -214,6 +214,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
@ -310,6 +328,665 @@
|
|||
<article class="article">
|
||||
<div class="wrapper">
|
||||
|
||||
<h1>Guides </h1>
|
||||
|
||||
|
||||
|
||||
<h1 id="production-setup-on-digital-ocean">Production Setup on Digital Ocean</h1>
|
||||
|
||||
<h4 id="install-docker">Install Docker</h4>
|
||||
|
||||
<ul>
|
||||
<li>Visit <a href="https://cloud.digitalocean.com/login">DigitalOcean</a> and login.</li>
|
||||
<li>Click the <code>Create Droplet</code> button.</li>
|
||||
<li>Open the <code>One-click apps</code> tab.</li>
|
||||
<li>Select Docker with your preferred version.</li>
|
||||
<li>Continue creating the droplet as you normally would.</li>
|
||||
<li>If needed, check your e-mail for the droplet root password.</li>
|
||||
</ul>
|
||||
|
||||
<h4 id="ssh-to-your-server">SSH to your Server</h4>
|
||||
|
||||
<p>Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.</p>
|
||||
|
||||
<pre><code>ssh root@ipaddress
|
||||
</code></pre>
|
||||
|
||||
<p>You may be prompted for a password. Type the one you found within your e-mailbox. It’ll then ask you to change the password.</p>
|
||||
|
||||
<p>You can now check if Docker is available:</p>
|
||||
|
||||
<pre><code>$root@server:~# docker
|
||||
</code></pre>
|
||||
|
||||
<h4 id="set-up-your-laravel-project">Set Up Your Laravel Project</h4>
|
||||
|
||||
<pre><code>$root@server:~# apt-get install git
|
||||
$root@server:~# git clone https://github.com/laravel/laravel
|
||||
$root@server:~# cd laravel
|
||||
$root@server:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
||||
$root@server:~/laravel/ cd laradock
|
||||
</code></pre>
|
||||
|
||||
<h4 id="install-docker-compose-command">Install docker-compose command</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
|
||||
$root@server:~/chmod +x /usr/local/bin/docker-compose
|
||||
</code></pre>
|
||||
|
||||
<h4 id="create-your-laradock-containers">Create Your LaraDock Containers</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p>Note that more containers are available, find them in the <a href="http://laradock.io/introduction/#supported-software-containers">docs</a> or the <code>docker-compose.yml</code> file.</p>
|
||||
|
||||
<h4 id="go-to-your-workspace">Go to Your Workspace</h4>
|
||||
|
||||
<pre><code>docker-compose exec workspace bash
|
||||
</code></pre>
|
||||
|
||||
<h4 id="install-and-configure-laravel">Install and configure Laravel</h4>
|
||||
|
||||
<p>Let’s install Laravel’s dependencies, add the <code>.env</code> file, generate the key and give proper permissions to the cache folder.</p>
|
||||
|
||||
<pre><code>$ root@workspace:/var/www# composer install
|
||||
$ root@workspace:/var/www# cp .env.example .env
|
||||
$ root@workspace:/var/www# php artisan key:generate
|
||||
$ root@workspace:/var/www# exit
|
||||
$root@server:~/laravel/laradock# cd ..
|
||||
$root@server:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||
</code></pre>
|
||||
|
||||
<p>You can then view your Laravel site by visiting the IP address of your server in your browser. For example:</p>
|
||||
|
||||
<pre><code>http://192.168.1.1
|
||||
</code></pre>
|
||||
|
||||
<p>It should show you the Laravel default welcome page.</p>
|
||||
|
||||
<p>However, we want it to show up using your custom domain name, as well.</p>
|
||||
|
||||
<h4 id="using-your-own-domain-name">Using Your Own Domain Name</h4>
|
||||
|
||||
<p>Login to your DNS provider, such as Godaddy, Namecheap.</p>
|
||||
|
||||
<p>Point the Custom Domain Name Server to:</p>
|
||||
|
||||
<pre><code>ns1.digitalocean.com
|
||||
ns2.digitalocean.com
|
||||
ns3.digitalocean.com
|
||||
</code></pre>
|
||||
|
||||
<p>Within DigitalOcean, you’ll need to change some settings, too.</p>
|
||||
|
||||
<p>Visit: <a href="https://cloud.digitalocean.com/networking/domains">https://cloud.digitalocean.com/networking/domains</a></p>
|
||||
|
||||
<p>Add your domain name and choose the server IP you’d provision earlier.</p>
|
||||
|
||||
<h4 id="serving-site-with-nginx-http-only">Serving Site With NGINX (HTTP ONLY)</h4>
|
||||
|
||||
<p>Go back to command line.</p>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# cd nginx
|
||||
$root@server:~/laravel/laradock/nginx# vim laravel.conf
|
||||
</code></pre>
|
||||
|
||||
<p>Remove <code>default_server</code></p>
|
||||
|
||||
<pre><code> listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
</code></pre>
|
||||
|
||||
<p>And add <code>server_name</code> (your custom domain)</p>
|
||||
|
||||
<pre><code> listen 80;
|
||||
listen [::]:80 ipv6only=on;
|
||||
server_name yourdomain.com;
|
||||
</code></pre>
|
||||
|
||||
<h4 id="rebuild-your-nginx">Rebuild Your Nginx</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/nginx# docker-compose down
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose build nginx
|
||||
</code></pre>
|
||||
|
||||
<h4 id="re-run-your-containers-mysql-and-nginx">Re Run Your Containers MYSQL and NGINX</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p><strong>View Your Site with HTTP ONLY (<a href="http://yourdomain.com">http://yourdomain.com</a>)</strong></p>
|
||||
|
||||
<h4 id="run-site-on-ssl-with-let-s-encrypt-certificate">Run Site on SSL with Let’s Encrypt Certificate</h4>
|
||||
|
||||
<p><strong>Note: You need to Use Caddy here Instead of Nginx</strong></p>
|
||||
|
||||
<p>To go Caddy Folders and Edit CaddyFile</p>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# cd caddy
|
||||
$root@server:~/laravel/laradock/caddy# vim Caddyfile
|
||||
</code></pre>
|
||||
|
||||
<p>Remove 0.0.0.0:80</p>
|
||||
|
||||
<pre><code>0.0.0.0:80
|
||||
root /var/www/public
|
||||
</code></pre>
|
||||
|
||||
<p>and replace with your <a href="https://yourdomain.com">https://yourdomain.com</a></p>
|
||||
|
||||
<pre><code>https://yourdomain.com
|
||||
root /var/www/public
|
||||
</code></pre>
|
||||
|
||||
<p>uncomment tls</p>
|
||||
|
||||
<pre><code>#tls self-signed
|
||||
</code></pre>
|
||||
|
||||
<p>and replace self-signed with your email address</p>
|
||||
|
||||
<pre><code>tls serverbreaker@gmai.com
|
||||
</code></pre>
|
||||
|
||||
<p>This is needed Prior to Creating Let’s Encypt</p>
|
||||
|
||||
<h4 id="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</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/caddy# docker-compose up caddy
|
||||
</code></pre>
|
||||
|
||||
<p>You’ll be prompt here to enter your email… you may enter it or not</p>
|
||||
|
||||
<pre><code>Attaching to laradock_mysql_1, laradock_caddy_1
|
||||
caddy_1 | Activating privacy features...
|
||||
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
|
||||
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
|
||||
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
|
||||
caddy_1 | Activating privacy features... done.
|
||||
caddy_1 | https://yourdomain.com
|
||||
caddy_1 | http://yourdomain.com
|
||||
</code></pre>
|
||||
|
||||
<p>After it finishes, press <code>Ctrl</code> + <code>C</code> to exit.</p>
|
||||
|
||||
<h4 id="stop-all-containers-and-rerun-caddy-and-other-containers-on-background">Stop All Containers and ReRun Caddy and Other Containers on Background</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/caddy# docker-compose down
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
||||
</code></pre>
|
||||
|
||||
<p>View your Site in the Browser Securely Using HTTPS (<a href="https://yourdomain.com">https://yourdomain.com</a>)</p>
|
||||
|
||||
<p><strong>Note that Certificate will be Automatically Renew By Caddy</strong></p>
|
||||
|
||||
<blockquote>
|
||||
<p>References:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04">https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04</a></li>
|
||||
<li><a href="https://www.digitalocean.com/products/one-click-apps/docker/">https://www.digitalocean.com/products/one-click-apps/docker/</a></li>
|
||||
<li><a href="https://docs.docker.com/engine/installation/linux/ubuntulinux/">https://docs.docker.com/engine/installation/linux/ubuntulinux/</a></li>
|
||||
<li><a href="https://docs.docker.com/compose/install/">https://docs.docker.com/compose/install/</a></li>
|
||||
<li><a href="https://caddyserver.com/docs/automatic-https">https://caddyserver.com/docs/automatic-https</a></li>
|
||||
<li><a href="https://caddyserver.com/docs/tls">https://caddyserver.com/docs/tls</a></li>
|
||||
<li><a href="https://caddyserver.com/docs/caddyfile">https://caddyserver.com/docs/caddyfile</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<p><br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br></p>
|
||||
|
||||
<h1 id="phpstorm-debugging-guide">PHPStorm Debugging Guide</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="#Intro">Intro</a></li>
|
||||
<li><a href="#Installation">Installation</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#CustomizeDockerCompose">Customize laradock/docker-compose.yml</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#InstallCleanHouse">Clean House</a></li>
|
||||
<li><a href="#InstallLaraDockDialTone">LaraDock Dial Tone</a></li>
|
||||
<li><a href="#AddToHosts">hosts</a></li>
|
||||
<li><a href="#FireWall">Firewall</a></li>
|
||||
<li><a href="#enablePhpXdebug">Enable xDebug on php-fpm</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#InstallPHPStorm">PHPStorm Settings</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#InstallPHPStormConfigs">Configs</a></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
<li><a href="#Usage">Usage</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#UsageLaravel">Laravel</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#UsagePHPStormRunExampleTest">Run ExampleTest</a></li>
|
||||
<li><a href="#UsagePHPStormDebugExampleTest">Debug ExampleTest</a></li>
|
||||
<li><a href="#UsagePHPStormDebugSite">Debug Web Site</a></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
<li><a href="#SSHintoWorkspace">SSH into workspace</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#InstallKiTTY">KiTTY</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="Intro"></a></p>
|
||||
|
||||
<h2 id="intro">Intro</h2>
|
||||
|
||||
<p>Wiring up <a href="https://laravel.com/">Laravel</a>, <a href="https://github.com/LaraDock/laradock">LaraDock</a> [Laravel+Docker] and <a href="https://www.jetbrains.com/phpstorm/">PHPStorm</a> to play nice together complete with remote xdebug’ing as icing on top! Although this guide is based on <code>PHPStorm Windows</code>,
|
||||
you should be able to adjust accordingly. This guide was written based on Docker for Windows Native.</p>
|
||||
|
||||
<p><a name="Installation"></a></p>
|
||||
|
||||
<h2 id="installation">Installation</h2>
|
||||
|
||||
<ul>
|
||||
<li>This guide assumes the following:
|
||||
|
||||
<ul>
|
||||
<li>you have already installed and are familiar with Laravel, LaraDock and PHPStorm.</li>
|
||||
<li>you have installed Laravel as a parent of <code>laradock</code>. This guide assumes <code>/c/_dk/laravel</code>.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="AddToHosts"></a></p>
|
||||
|
||||
<h2 id="hosts">hosts</h2>
|
||||
|
||||
<ul>
|
||||
<li><p>Add <code>laravel</code> to your hosts file located on Windows 10 at <code>C:\Windows\System32\drivers\etc\hosts</code>. It should be set to the IP of your running container. Mine is: <code>10.0.75.2</code>
|
||||
On Windows you can find it by opening Windows <code>Hyper-V Manager</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/WindowsHyperVManager.png" alt="Windows Hyper-V Manager" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><a href="https://github.com/scottlerch/HostsFileEditor">Hosts File Editor</a> makes it easy to change your hosts file.</p>
|
||||
|
||||
<ul>
|
||||
<li>Set <code>laravel</code> to your docker host IP. See <a href="photos/SimpleHostsEditor/AddHost_laravel.png">Example</a>.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="FireWall"></a></p>
|
||||
|
||||
<h2 id="firewall">Firewall</h2>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<ul>
|
||||
<li>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.</li>
|
||||
<li>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.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="edit-laradock-docker-compose-yml">Edit laradock/docker-compose.yml</h3>
|
||||
|
||||
<p>Set the following variables:</p>
|
||||
|
||||
<pre><code>### 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
|
||||
...
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h3 id="edit-xdebug-ini-files">Edit xdebug.ini files</h3>
|
||||
|
||||
<ul>
|
||||
<li><code>laradock/workspace/xdebug.ini</code></li>
|
||||
<li><code>laradock/php-fpm/xdebug.ini</code></li>
|
||||
</ul>
|
||||
|
||||
<p>Set the following variables:</p>
|
||||
|
||||
<pre><code>xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.cli_color=1
|
||||
</code></pre>
|
||||
|
||||
<p><a name="InstallCleanHouse"></a></p>
|
||||
|
||||
<h3 id="need-to-clean-house-first">Need to clean house first?</h3>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<ul>
|
||||
<li><p>Delete all containers using <code>grep laradock_</code> on the names, see: <a href="https://linuxconfig.org/remove-all-containners-based-on-docker-image-name">Remove all containers based on docker image name</a>.
|
||||
<code>docker ps -a | awk '{ print $1,$2 }' | grep laradock_ | awk '{print $1}' | xargs -I {} docker rm {}</code></p></li>
|
||||
|
||||
<li><p>Delete all images containing <code>laradock</code>.
|
||||
<code>docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}</code>
|
||||
<strong>Note:</strong> This will only delete images that were built with <code>LaraDock</code>, <strong>NOT</strong> <code>laradock/*</code> which are pulled down by <code>LaraDock</code> such as <code>laradock/workspace</code>, etc.
|
||||
<strong>Note:</strong> Some may fail with:
|
||||
<code>Error response from daemon: conflict: unable to delete 3f38eaed93df (cannot be forced) - image has dependent child images</code></p></li>
|
||||
|
||||
<li><p>I added this to my <code>.bashrc</code> to remove orphaned images.</p>
|
||||
|
||||
<pre><code>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
|
||||
}
|
||||
</code></pre></li>
|
||||
|
||||
<li><p>If you frequently switch configurations for LaraDock, you may find that adding the following and added to your <code>.bashrc</code> or equivalent useful:
|
||||
```</p>
|
||||
|
||||
<h1 id="remove-laravel-containers">remove laravel* containers</h1>
|
||||
|
||||
<h1 id="remove-laravel-images">remove laravel_* images</h1>
|
||||
|
||||
<p>dcleanlaradockfunction()
|
||||
{
|
||||
echo ‘Removing ALL containers associated with laradock’
|
||||
docker ps -a | awk ‘{ print $1,$2 }’ | grep laradock | awk ‘{print $1}’ | xargs -I {} docker rm {}</p></li>
|
||||
</ul>
|
||||
|
||||
<p> # remove ALL images associated with laradock_
|
||||
# does NOT delete laradock/* which are hub images
|
||||
echo ‘Removing ALL images associated with laradock<em>‘
|
||||
docker images | awk ‘{print $1,$2,$3}’ | grep laradock</em> | awk ‘{print $3}’ | xargs -I {} docker rmi {}</p>
|
||||
|
||||
<p> echo ‘Listing all laradock docker hub images…’
|
||||
docker images | grep laradock</p>
|
||||
|
||||
<p> echo ‘dcleanlaradock completed’
|
||||
}</p>
|
||||
|
||||
<h1 id="associate-the-above-function-with-an-alias">associate the above function with an alias</h1>
|
||||
|
||||
<h1 id="so-can-recall-lookup-by-typing-alias">so can recall/lookup by typing ‘alias’</h1>
|
||||
|
||||
<p>alias dcleanlaradock=dcleanlaradockfunction</p>
|
||||
|
||||
<pre><code>
|
||||
<a name="InstallLaraDockDialTone"></a>
|
||||
#### Let's get a dial-tone with Laravel
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h1 id="barebones-at-this-point">barebones at this point</h1>
|
||||
|
||||
<p>docker-compose up -d nginx mysql</p>
|
||||
|
||||
<h1 id="run">run</h1>
|
||||
|
||||
<p>docker-compose ps</p>
|
||||
|
||||
<h1 id="should-see">Should see:</h1>
|
||||
|
||||
<pre><code> Name Command State Ports
|
||||
</code></pre>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>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</p>
|
||||
|
||||
<pre><code>
|
||||
<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:
|
||||
</code></pre>
|
||||
|
||||
<p>xDebug status
|
||||
laradock_php-fpm_1
|
||||
PHP 7.0.9 (cli) (built: Aug 10 2016 19:45:48) ( NTS )
|
||||
Copyright © 1997-2016 The PHP Group
|
||||
Zend Engine v3.0.0, Copyright © 1998-2016 Zend Technologies
|
||||
with Xdebug v2.4.1, Copyright © 2002-2016, by Derick Rethans
|
||||
``<code>
|
||||
Other commands include</code>./xdebugPhpFpm start | stop`.</p>
|
||||
|
||||
<p>If you have enabled <code>xdebug=true</code> in <code>docker-compose.yml/php-fpm</code>, <code>xdebug</code> will already be running when
|
||||
<code>php-fpm</code> is started and listening for debug info on port 9000.</p>
|
||||
|
||||
<p><a name="InstallPHPStormConfigs"></a></p>
|
||||
|
||||
<h4 id="phpstorm-settings">PHPStorm Settings</h4>
|
||||
|
||||
<ul>
|
||||
<li><p>Here are some settings that are known to work:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><code>Settings/BuildDeploymentConnection</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/BuildDeploymentConnection.png" alt="Settings/BuildDeploymentConnection" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/BuildDeploymentConnectionMappings</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png" alt="Settings/BuildDeploymentConnectionMappings" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/BuildDeploymentDebugger</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/BuildDeploymentDebugger.png" alt="Settings/BuildDeploymentDebugger" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/EditRunConfigurationRemoteWebDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png" alt="Settings/EditRunConfigurationRemoteWebDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/EditRunConfigurationRemoteExampleTestDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png" alt="Settings/EditRunConfigurationRemoteExampleTestDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPDebug.png" alt="Settings/LangsPHPDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPInterpreters</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPInterpreters.png" alt="Settings/LangsPHPInterpreters" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPPHPUnit</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPPHPUnit.png" alt="Settings/LangsPHPPHPUnit" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPServers</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPServers.png" alt="Settings/LangsPHPServers" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>RemoteHost</code>
|
||||
To switch on this view, go to: <code>Menu/Tools/Deployment/Browse Remote Host</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/RemoteHost.png" alt="RemoteHost" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>RemoteWebDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/DebugRemoteOn.png" alt="DebugRemoteOn" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>EditRunConfigurationRemoteWebDebug</code>
|
||||
Go to: <code>Menu/Run/Edit Configurations</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png" alt="EditRunConfigurationRemoteWebDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>EditRunConfigurationRemoteExampleTestDebug</code>
|
||||
Go to: <code>Menu/Run/Edit Configurations</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png" alt="EditRunConfigurationRemoteExampleTestDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>WindowsFirewallAllowedApps</code>
|
||||
Go to: <code>Control Panel\All Control Panel Items\Windows Firewall\Allowed apps</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png" alt="WindowsFirewallAllowedApps.png" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>hosts</code>
|
||||
Edit: <code>C:\Windows\System32\drivers\etc\hosts</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><p><img src="photos/PHPStorm/Settings/hosts.png" alt="WindowsFirewallAllowedApps.png" /></p></li>
|
||||
|
||||
<li><p><a href="#enablePhpXdebug">Enable xDebug on php-fpm</a></p></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="Usage"></a></p>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
<p><a name="UsagePHPStormRunExampleTest"></a></p>
|
||||
|
||||
<h3 id="run-exampletest">Run ExampleTest</h3>
|
||||
|
||||
<ul>
|
||||
<li>right-click on <code>tests/ExampleTest.php</code>
|
||||
|
||||
<ul>
|
||||
<li>Select: <code>Run 'ExampleTest.php'</code> or <code>Ctrl+Shift+F10</code>.</li>
|
||||
<li>Should pass!! You just ran a remote test via SSH!</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="UsagePHPStormDebugExampleTest"></a></p>
|
||||
|
||||
<h3 id="debug-exampletest">Debug ExampleTest</h3>
|
||||
|
||||
<ul>
|
||||
<li>Open to edit: <code>tests/ExampleTest.php</code></li>
|
||||
<li>Add a BreakPoint on line 16: <code>$this->visit('/')</code></li>
|
||||
<li>right-click on <code>tests/ExampleTest.php</code>
|
||||
|
||||
<ul>
|
||||
<li>Select: <code>Debug 'ExampleTest.php'</code>.</li>
|
||||
<li>Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!</li>
|
||||
<li><img src="photos/PHPStorm/RemoteTestDebuggingSuccess.png" alt="Remote Test Debugging Success" /></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="UsagePHPStormDebugSite"></a></p>
|
||||
|
||||
<h3 id="debug-website">Debug WebSite</h3>
|
||||
|
||||
<ul>
|
||||
<li><p>In case xDebug is disabled, from the <code>laradock</code> folder run:
|
||||
<code>./xdebugPhpFpm start</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li>To switch xdebug off, run:
|
||||
<code>./xdebugPhpFpm stop</code></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p>Start Remote Debugging</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/DebugRemoteOn.png" alt="DebugRemoteOn" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p>Open to edit: <code>bootstrap/app.php</code></p></li>
|
||||
|
||||
<li><p>Add a BreakPoint on line 14: <code>$app = new Illuminate\Foundation\Application(</code></p></li>
|
||||
|
||||
<li><p>Reload <a href="http://laravel/">Laravel Site</a></p>
|
||||
|
||||
<ul>
|
||||
<li>Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!</li>
|
||||
<li><img src="photos/PHPStorm/RemoteDebuggingSuccess.png" alt="Remote Debugging Success" /></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="SSHintoWorkspace"></a></p>
|
||||
|
||||
<h4 id="let-s-shell-into-workspace">Let’s shell into workspace</h4>
|
||||
|
||||
<p>Assuming that you are in laradock folder, type:
|
||||
<code>ssh -i workspace/insecure_id_rsa -p2222 root@laravel</code>
|
||||
<strong>Cha Ching!!!!</strong>
|
||||
- <code>workspace/insecure_id_rsa.ppk</code> may become corrupted. In which case:
|
||||
- fire up <code>puttygen</code>
|
||||
- import <code>workspace/insecure_id_rsa</code>
|
||||
- save private key to <code>workspace/insecure_id_rsa.ppk</code></p>
|
||||
|
||||
<p><a name="InstallKiTTY"></a></p>
|
||||
|
||||
<h5 id="kitty">KiTTY</h5>
|
||||
|
||||
<p><a href="http://www.9bis.net/kitty/">Kitty</a> KiTTY is a fork from version 0.67 of PuTTY.</p>
|
||||
|
||||
<ul>
|
||||
<li>Here are some settings that are working for me:
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/KiTTY/Session.png" alt="Session" /></li>
|
||||
<li><img src="photos/KiTTY/Terminal.png" alt="Terminal" /></li>
|
||||
<li><img src="photos/KiTTY/Window.png" alt="Window" /></li>
|
||||
<li><img src="photos/KiTTY/WindowAppearance.png" alt="WindowAppearance" /></li>
|
||||
<li><img src="photos/KiTTY/Connection.png" alt="Connection" /></li>
|
||||
<li><img src="photos/KiTTY/ConnectionData.png" alt="ConnectionData" /></li>
|
||||
<li><img src="photos/KiTTY/ConnectionSSH.png" alt="ConnectionSSH" /></li>
|
||||
<li><img src="photos/KiTTY/ConnectionSSHAuth.png" alt="ConnectionSSHAuth" /></li>
|
||||
<li><img src="photos/KiTTY/TerminalShell.png" alt="TerminalShell" /></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h1>Introduction </h1>
|
||||
|
||||
|
||||
|
@ -2011,20 +2688,20 @@ features, by not reporting duplicate issues.</em></p>
|
|||
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
<p>Go the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</p>
|
||||
|
||||
<p>To edit the sidebar or add a new section, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code> as well.</p>
|
||||
|
||||
<p><em>The site will be autogenerated in the <code>docs/</code> folder by <a href="https://travis-ci.com/">Travis</a>.</em></p>
|
||||
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Edit the <code>DOCUMENTATION/_settings/content</code>.</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="how-to-support-new-software-add-new-container">How to support new Software (Add new Container)</h2>
|
||||
|
||||
|
@ -2180,14 +2857,14 @@ git push origin my-fix-branch -f
|
|||
|
||||
|
||||
<div class="next">
|
||||
<a href="http://laradock.io/getting-started/" title="Getting Started">
|
||||
<a href="http://laradock.io/introduction/" title="Introduction">
|
||||
<span class="direction">
|
||||
Next
|
||||
</span>
|
||||
<div class="page">
|
||||
<div class="stretch">
|
||||
<div class="title">
|
||||
Getting Started
|
||||
Introduction
|
||||
</div>
|
||||
</div>
|
||||
<div class="button button-next" role="button" aria-label="Next">
|
||||
|
|
686
docs/index.xml
|
@ -8,6 +8,670 @@
|
|||
<language>en-us</language>
|
||||
<atom:link href="http://laradock.io/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
<item>
|
||||
<title>Guides</title>
|
||||
<link>http://laradock.io/guides/</link>
|
||||
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
|
||||
|
||||
<guid>http://laradock.io/guides/</guid>
|
||||
<description>
|
||||
|
||||
<h1 id="production-setup-on-digital-ocean">Production Setup on Digital Ocean</h1>
|
||||
|
||||
<h4 id="install-docker">Install Docker</h4>
|
||||
|
||||
<ul>
|
||||
<li>Visit <a href="https://cloud.digitalocean.com/login">DigitalOcean</a> and login.</li>
|
||||
<li>Click the <code>Create Droplet</code> button.</li>
|
||||
<li>Open the <code>One-click apps</code> tab.</li>
|
||||
<li>Select Docker with your preferred version.</li>
|
||||
<li>Continue creating the droplet as you normally would.</li>
|
||||
<li>If needed, check your e-mail for the droplet root password.</li>
|
||||
</ul>
|
||||
|
||||
<h4 id="ssh-to-your-server">SSH to your Server</h4>
|
||||
|
||||
<p>Find the IP address of the droplet in the DigitalOcean interface. Use it to connect to the server.</p>
|
||||
|
||||
<pre><code>ssh root@ipaddress
|
||||
</code></pre>
|
||||
|
||||
<p>You may be prompted for a password. Type the one you found within your e-mailbox. It&rsquo;ll then ask you to change the password.</p>
|
||||
|
||||
<p>You can now check if Docker is available:</p>
|
||||
|
||||
<pre><code>$root@server:~# docker
|
||||
</code></pre>
|
||||
|
||||
<h4 id="set-up-your-laravel-project">Set Up Your Laravel Project</h4>
|
||||
|
||||
<pre><code>$root@server:~# apt-get install git
|
||||
$root@server:~# git clone https://github.com/laravel/laravel
|
||||
$root@server:~# cd laravel
|
||||
$root@server:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
|
||||
$root@server:~/laravel/ cd laradock
|
||||
</code></pre>
|
||||
|
||||
<h4 id="install-docker-compose-command">Install docker-compose command</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh &gt; /usr/local/bin/docker-compose
|
||||
$root@server:~/chmod +x /usr/local/bin/docker-compose
|
||||
</code></pre>
|
||||
|
||||
<h4 id="create-your-laradock-containers">Create Your LaraDock Containers</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p>Note that more containers are available, find them in the <a href="http://laradock.io/introduction/#supported-software-containers">docs</a> or the <code>docker-compose.yml</code> file.</p>
|
||||
|
||||
<h4 id="go-to-your-workspace">Go to Your Workspace</h4>
|
||||
|
||||
<pre><code>docker-compose exec workspace bash
|
||||
</code></pre>
|
||||
|
||||
<h4 id="install-and-configure-laravel">Install and configure Laravel</h4>
|
||||
|
||||
<p>Let&rsquo;s install Laravel&rsquo;s dependencies, add the <code>.env</code> file, generate the key and give proper permissions to the cache folder.</p>
|
||||
|
||||
<pre><code>$ root@workspace:/var/www# composer install
|
||||
$ root@workspace:/var/www# cp .env.example .env
|
||||
$ root@workspace:/var/www# php artisan key:generate
|
||||
$ root@workspace:/var/www# exit
|
||||
$root@server:~/laravel/laradock# cd ..
|
||||
$root@server:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||
</code></pre>
|
||||
|
||||
<p>You can then view your Laravel site by visiting the IP address of your server in your browser. For example:</p>
|
||||
|
||||
<pre><code>http://192.168.1.1
|
||||
</code></pre>
|
||||
|
||||
<p>It should show you the Laravel default welcome page.</p>
|
||||
|
||||
<p>However, we want it to show up using your custom domain name, as well.</p>
|
||||
|
||||
<h4 id="using-your-own-domain-name">Using Your Own Domain Name</h4>
|
||||
|
||||
<p>Login to your DNS provider, such as Godaddy, Namecheap.</p>
|
||||
|
||||
<p>Point the Custom Domain Name Server to:</p>
|
||||
|
||||
<pre><code>ns1.digitalocean.com
|
||||
ns2.digitalocean.com
|
||||
ns3.digitalocean.com
|
||||
</code></pre>
|
||||
|
||||
<p>Within DigitalOcean, you&rsquo;ll need to change some settings, too.</p>
|
||||
|
||||
<p>Visit: <a href="https://cloud.digitalocean.com/networking/domains">https://cloud.digitalocean.com/networking/domains</a></p>
|
||||
|
||||
<p>Add your domain name and choose the server IP you&rsquo;d provision earlier.</p>
|
||||
|
||||
<h4 id="serving-site-with-nginx-http-only">Serving Site With NGINX (HTTP ONLY)</h4>
|
||||
|
||||
<p>Go back to command line.</p>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# cd nginx
|
||||
$root@server:~/laravel/laradock/nginx# vim laravel.conf
|
||||
</code></pre>
|
||||
|
||||
<p>Remove <code>default_server</code></p>
|
||||
|
||||
<pre><code> listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
</code></pre>
|
||||
|
||||
<p>And add <code>server_name</code> (your custom domain)</p>
|
||||
|
||||
<pre><code> listen 80;
|
||||
listen [::]:80 ipv6only=on;
|
||||
server_name yourdomain.com;
|
||||
</code></pre>
|
||||
|
||||
<h4 id="rebuild-your-nginx">Rebuild Your Nginx</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/nginx# docker-compose down
|
||||
$root@server:~/laravel/laradock/nginx# docker-compose build nginx
|
||||
</code></pre>
|
||||
|
||||
<h4 id="re-run-your-containers-mysql-and-nginx">Re Run Your Containers MYSQL and NGINX</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p><strong>View Your Site with HTTP ONLY (<a href="http://yourdomain.com">http://yourdomain.com</a>)</strong></p>
|
||||
|
||||
<h4 id="run-site-on-ssl-with-let-s-encrypt-certificate">Run Site on SSL with Let&rsquo;s Encrypt Certificate</h4>
|
||||
|
||||
<p><strong>Note: You need to Use Caddy here Instead of Nginx</strong></p>
|
||||
|
||||
<p>To go Caddy Folders and Edit CaddyFile</p>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock# cd caddy
|
||||
$root@server:~/laravel/laradock/caddy# vim Caddyfile
|
||||
</code></pre>
|
||||
|
||||
<p>Remove 0.0.0.0:80</p>
|
||||
|
||||
<pre><code>0.0.0.0:80
|
||||
root /var/www/public
|
||||
</code></pre>
|
||||
|
||||
<p>and replace with your <a href="https://yourdomain.com">https://yourdomain.com</a></p>
|
||||
|
||||
<pre><code>https://yourdomain.com
|
||||
root /var/www/public
|
||||
</code></pre>
|
||||
|
||||
<p>uncomment tls</p>
|
||||
|
||||
<pre><code>#tls self-signed
|
||||
</code></pre>
|
||||
|
||||
<p>and replace self-signed with your email address</p>
|
||||
|
||||
<pre><code>tls serverbreaker@gmai.com
|
||||
</code></pre>
|
||||
|
||||
<p>This is needed Prior to Creating Let&rsquo;s Encypt</p>
|
||||
|
||||
<h4 id="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&rsquo;s Encrypt</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/caddy# docker-compose up caddy
|
||||
</code></pre>
|
||||
|
||||
<p>You&rsquo;ll be prompt here to enter your email&hellip; you may enter it or not</p>
|
||||
|
||||
<pre><code>Attaching to laradock_mysql_1, laradock_caddy_1
|
||||
caddy_1 | Activating privacy features...
|
||||
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
|
||||
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
|
||||
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
|
||||
caddy_1 | Activating privacy features... done.
|
||||
caddy_1 | https://yourdomain.com
|
||||
caddy_1 | http://yourdomain.com
|
||||
</code></pre>
|
||||
|
||||
<p>After it finishes, press <code>Ctrl</code> + <code>C</code> to exit.</p>
|
||||
|
||||
<h4 id="stop-all-containers-and-rerun-caddy-and-other-containers-on-background">Stop All Containers and ReRun Caddy and Other Containers on Background</h4>
|
||||
|
||||
<pre><code>$root@server:~/laravel/laradock/caddy# docker-compose down
|
||||
$root@server:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
|
||||
</code></pre>
|
||||
|
||||
<p>View your Site in the Browser Securely Using HTTPS (<a href="https://yourdomain.com">https://yourdomain.com</a>)</p>
|
||||
|
||||
<p><strong>Note that Certificate will be Automatically Renew By Caddy</strong></p>
|
||||
|
||||
<blockquote>
|
||||
<p>References:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04">https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04</a></li>
|
||||
<li><a href="https://www.digitalocean.com/products/one-click-apps/docker/">https://www.digitalocean.com/products/one-click-apps/docker/</a></li>
|
||||
<li><a href="https://docs.docker.com/engine/installation/linux/ubuntulinux/">https://docs.docker.com/engine/installation/linux/ubuntulinux/</a></li>
|
||||
<li><a href="https://docs.docker.com/compose/install/">https://docs.docker.com/compose/install/</a></li>
|
||||
<li><a href="https://caddyserver.com/docs/automatic-https">https://caddyserver.com/docs/automatic-https</a></li>
|
||||
<li><a href="https://caddyserver.com/docs/tls">https://caddyserver.com/docs/tls</a></li>
|
||||
<li><a href="https://caddyserver.com/docs/caddyfile">https://caddyserver.com/docs/caddyfile</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<p><br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br></p>
|
||||
|
||||
<h1 id="phpstorm-debugging-guide">PHPStorm Debugging Guide</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="#Intro">Intro</a></li>
|
||||
<li><a href="#Installation">Installation</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#CustomizeDockerCompose">Customize laradock/docker-compose.yml</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#InstallCleanHouse">Clean House</a></li>
|
||||
<li><a href="#InstallLaraDockDialTone">LaraDock Dial Tone</a></li>
|
||||
<li><a href="#AddToHosts">hosts</a></li>
|
||||
<li><a href="#FireWall">Firewall</a></li>
|
||||
<li><a href="#enablePhpXdebug">Enable xDebug on php-fpm</a></li>
|
||||
</ul></li>
|
||||
<li><a href="#InstallPHPStorm">PHPStorm Settings</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#InstallPHPStormConfigs">Configs</a></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
<li><a href="#Usage">Usage</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#UsageLaravel">Laravel</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#UsagePHPStormRunExampleTest">Run ExampleTest</a></li>
|
||||
<li><a href="#UsagePHPStormDebugExampleTest">Debug ExampleTest</a></li>
|
||||
<li><a href="#UsagePHPStormDebugSite">Debug Web Site</a></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
<li><a href="#SSHintoWorkspace">SSH into workspace</a>
|
||||
|
||||
<ul>
|
||||
<li><a href="#InstallKiTTY">KiTTY</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="Intro"></a></p>
|
||||
|
||||
<h2 id="intro">Intro</h2>
|
||||
|
||||
<p>Wiring up <a href="https://laravel.com/">Laravel</a>, <a href="https://github.com/LaraDock/laradock">LaraDock</a> [Laravel+Docker] and <a href="https://www.jetbrains.com/phpstorm/">PHPStorm</a> to play nice together complete with remote xdebug&rsquo;ing as icing on top! Although this guide is based on <code>PHPStorm Windows</code>,
|
||||
you should be able to adjust accordingly. This guide was written based on Docker for Windows Native.</p>
|
||||
|
||||
<p><a name="Installation"></a></p>
|
||||
|
||||
<h2 id="installation">Installation</h2>
|
||||
|
||||
<ul>
|
||||
<li>This guide assumes the following:
|
||||
|
||||
<ul>
|
||||
<li>you have already installed and are familiar with Laravel, LaraDock and PHPStorm.</li>
|
||||
<li>you have installed Laravel as a parent of <code>laradock</code>. This guide assumes <code>/c/_dk/laravel</code>.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="AddToHosts"></a></p>
|
||||
|
||||
<h2 id="hosts">hosts</h2>
|
||||
|
||||
<ul>
|
||||
<li><p>Add <code>laravel</code> to your hosts file located on Windows 10 at <code>C:\Windows\System32\drivers\etc\hosts</code>. It should be set to the IP of your running container. Mine is: <code>10.0.75.2</code>
|
||||
On Windows you can find it by opening Windows <code>Hyper-V Manager</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/WindowsHyperVManager.png" alt="Windows Hyper-V Manager" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><a href="https://github.com/scottlerch/HostsFileEditor">Hosts File Editor</a> makes it easy to change your hosts file.</p>
|
||||
|
||||
<ul>
|
||||
<li>Set <code>laravel</code> to your docker host IP. See <a href="photos/SimpleHostsEditor/AddHost_laravel.png">Example</a>.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="FireWall"></a></p>
|
||||
|
||||
<h2 id="firewall">Firewall</h2>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<ul>
|
||||
<li>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.</li>
|
||||
<li>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.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="edit-laradock-docker-compose-yml">Edit laradock/docker-compose.yml</h3>
|
||||
|
||||
<p>Set the following variables:</p>
|
||||
|
||||
<pre><code>### 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
|
||||
...
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h3 id="edit-xdebug-ini-files">Edit xdebug.ini files</h3>
|
||||
|
||||
<ul>
|
||||
<li><code>laradock/workspace/xdebug.ini</code></li>
|
||||
<li><code>laradock/php-fpm/xdebug.ini</code></li>
|
||||
</ul>
|
||||
|
||||
<p>Set the following variables:</p>
|
||||
|
||||
<pre><code>xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.cli_color=1
|
||||
</code></pre>
|
||||
|
||||
<p><a name="InstallCleanHouse"></a></p>
|
||||
|
||||
<h3 id="need-to-clean-house-first">Need to clean house first?</h3>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<ul>
|
||||
<li><p>Delete all containers using <code>grep laradock_</code> on the names, see: <a href="https://linuxconfig.org/remove-all-containners-based-on-docker-image-name">Remove all containers based on docker image name</a>.
|
||||
<code>docker ps -a | awk '{ print $1,$2 }' | grep laradock_ | awk '{print $1}' | xargs -I {} docker rm {}</code></p></li>
|
||||
|
||||
<li><p>Delete all images containing <code>laradock</code>.
|
||||
<code>docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}</code>
|
||||
<strong>Note:</strong> This will only delete images that were built with <code>LaraDock</code>, <strong>NOT</strong> <code>laradock/*</code> which are pulled down by <code>LaraDock</code> such as <code>laradock/workspace</code>, etc.
|
||||
<strong>Note:</strong> Some may fail with:
|
||||
<code>Error response from daemon: conflict: unable to delete 3f38eaed93df (cannot be forced) - image has dependent child images</code></p></li>
|
||||
|
||||
<li><p>I added this to my <code>.bashrc</code> to remove orphaned images.</p>
|
||||
|
||||
<pre><code>dclean() {
|
||||
processes=`docker ps -q -f status=exited`
|
||||
if [ -n &quot;$processes&quot; ]; thend
|
||||
docker rm $processes
|
||||
fi
|
||||
|
||||
images=`docker images -q -f dangling=true`
|
||||
if [ -n &quot;$images&quot; ]; then
|
||||
docker rmi $images
|
||||
fi
|
||||
}
|
||||
</code></pre></li>
|
||||
|
||||
<li><p>If you frequently switch configurations for LaraDock, you may find that adding the following and added to your <code>.bashrc</code> or equivalent useful:
|
||||
```</p>
|
||||
|
||||
<h1 id="remove-laravel-containers">remove laravel* containers</h1>
|
||||
|
||||
<h1 id="remove-laravel-images">remove laravel_* images</h1>
|
||||
|
||||
<p>dcleanlaradockfunction()
|
||||
{
|
||||
echo &lsquo;Removing ALL containers associated with laradock&rsquo;
|
||||
docker ps -a | awk &lsquo;{ print $1,$2 }&rsquo; | grep laradock | awk &lsquo;{print $1}&rsquo; | xargs -I {} docker rm {}</p></li>
|
||||
</ul>
|
||||
|
||||
<p> # remove ALL images associated with laradock_
|
||||
# does NOT delete laradock/* which are hub images
|
||||
echo &lsquo;Removing ALL images associated with laradock<em>&lsquo;
|
||||
docker images | awk &lsquo;{print $1,$2,$3}&rsquo; | grep laradock</em> | awk &lsquo;{print $3}&rsquo; | xargs -I {} docker rmi {}</p>
|
||||
|
||||
<p> echo &lsquo;Listing all laradock docker hub images&hellip;&rsquo;
|
||||
docker images | grep laradock</p>
|
||||
|
||||
<p> echo &lsquo;dcleanlaradock completed&rsquo;
|
||||
}</p>
|
||||
|
||||
<h1 id="associate-the-above-function-with-an-alias">associate the above function with an alias</h1>
|
||||
|
||||
<h1 id="so-can-recall-lookup-by-typing-alias">so can recall/lookup by typing &lsquo;alias&rsquo;</h1>
|
||||
|
||||
<p>alias dcleanlaradock=dcleanlaradockfunction</p>
|
||||
|
||||
<pre><code>
|
||||
&lt;a name=&quot;InstallLaraDockDialTone&quot;&gt;&lt;/a&gt;
|
||||
#### Let's get a dial-tone with Laravel
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h1 id="barebones-at-this-point">barebones at this point</h1>
|
||||
|
||||
<p>docker-compose up -d nginx mysql</p>
|
||||
|
||||
<h1 id="run">run</h1>
|
||||
|
||||
<p>docker-compose ps</p>
|
||||
|
||||
<h1 id="should-see">Should see:</h1>
|
||||
|
||||
<pre><code> Name Command State Ports
|
||||
</code></pre>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>laradock_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306-&gt;3306/tcp
|
||||
laradock_nginx_1 nginx Up 0.0.0.0:443-&gt;443/tcp, 0.0.0.0:80-&gt;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-&gt;22/tcp</p>
|
||||
|
||||
<pre><code>
|
||||
&lt;a name=&quot;enablePhpXdebug&quot;&gt;&lt;/a&gt;
|
||||
#### Enable xDebug on php-fpm
|
||||
In a host terminal sitting in the laradock folder, run: `./xdebugPhpFpm status`
|
||||
You should see something like the following:
|
||||
</code></pre>
|
||||
|
||||
<p>xDebug status
|
||||
laradock_php-fpm_1
|
||||
PHP 7.0.9 (cli) (built: Aug 10 2016 19:45:48) ( NTS )
|
||||
Copyright &copy; 1997-2016 The PHP Group
|
||||
Zend Engine v3.0.0, Copyright &copy; 1998-2016 Zend Technologies
|
||||
with Xdebug v2.4.1, Copyright &copy; 2002-2016, by Derick Rethans
|
||||
``<code>
|
||||
Other commands include</code>./xdebugPhpFpm start | stop`.</p>
|
||||
|
||||
<p>If you have enabled <code>xdebug=true</code> in <code>docker-compose.yml/php-fpm</code>, <code>xdebug</code> will already be running when
|
||||
<code>php-fpm</code> is started and listening for debug info on port 9000.</p>
|
||||
|
||||
<p><a name="InstallPHPStormConfigs"></a></p>
|
||||
|
||||
<h4 id="phpstorm-settings">PHPStorm Settings</h4>
|
||||
|
||||
<ul>
|
||||
<li><p>Here are some settings that are known to work:</p>
|
||||
|
||||
<ul>
|
||||
<li><p><code>Settings/BuildDeploymentConnection</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/BuildDeploymentConnection.png" alt="Settings/BuildDeploymentConnection" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/BuildDeploymentConnectionMappings</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png" alt="Settings/BuildDeploymentConnectionMappings" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/BuildDeploymentDebugger</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/BuildDeploymentDebugger.png" alt="Settings/BuildDeploymentDebugger" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/EditRunConfigurationRemoteWebDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png" alt="Settings/EditRunConfigurationRemoteWebDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/EditRunConfigurationRemoteExampleTestDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png" alt="Settings/EditRunConfigurationRemoteExampleTestDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPDebug.png" alt="Settings/LangsPHPDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPInterpreters</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPInterpreters.png" alt="Settings/LangsPHPInterpreters" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPPHPUnit</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPPHPUnit.png" alt="Settings/LangsPHPPHPUnit" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>Settings/LangsPHPServers</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/LangsPHPServers.png" alt="Settings/LangsPHPServers" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>RemoteHost</code>
|
||||
To switch on this view, go to: <code>Menu/Tools/Deployment/Browse Remote Host</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/RemoteHost.png" alt="RemoteHost" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>RemoteWebDebug</code></p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/DebugRemoteOn.png" alt="DebugRemoteOn" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>EditRunConfigurationRemoteWebDebug</code>
|
||||
Go to: <code>Menu/Run/Edit Configurations</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png" alt="EditRunConfigurationRemoteWebDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>EditRunConfigurationRemoteExampleTestDebug</code>
|
||||
Go to: <code>Menu/Run/Edit Configurations</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png" alt="EditRunConfigurationRemoteExampleTestDebug" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>WindowsFirewallAllowedApps</code>
|
||||
Go to: <code>Control Panel\All Control Panel Items\Windows Firewall\Allowed apps</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png" alt="WindowsFirewallAllowedApps.png" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p><code>hosts</code>
|
||||
Edit: <code>C:\Windows\System32\drivers\etc\hosts</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><p><img src="photos/PHPStorm/Settings/hosts.png" alt="WindowsFirewallAllowedApps.png" /></p></li>
|
||||
|
||||
<li><p><a href="#enablePhpXdebug">Enable xDebug on php-fpm</a></p></li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="Usage"></a></p>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
<p><a name="UsagePHPStormRunExampleTest"></a></p>
|
||||
|
||||
<h3 id="run-exampletest">Run ExampleTest</h3>
|
||||
|
||||
<ul>
|
||||
<li>right-click on <code>tests/ExampleTest.php</code>
|
||||
|
||||
<ul>
|
||||
<li>Select: <code>Run 'ExampleTest.php'</code> or <code>Ctrl+Shift+F10</code>.</li>
|
||||
<li>Should pass!! You just ran a remote test via SSH!</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="UsagePHPStormDebugExampleTest"></a></p>
|
||||
|
||||
<h3 id="debug-exampletest">Debug ExampleTest</h3>
|
||||
|
||||
<ul>
|
||||
<li>Open to edit: <code>tests/ExampleTest.php</code></li>
|
||||
<li>Add a BreakPoint on line 16: <code>$this-&gt;visit('/')</code></li>
|
||||
<li>right-click on <code>tests/ExampleTest.php</code>
|
||||
|
||||
<ul>
|
||||
<li>Select: <code>Debug 'ExampleTest.php'</code>.</li>
|
||||
<li>Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!</li>
|
||||
<li><img src="photos/PHPStorm/RemoteTestDebuggingSuccess.png" alt="Remote Test Debugging Success" /></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="UsagePHPStormDebugSite"></a></p>
|
||||
|
||||
<h3 id="debug-website">Debug WebSite</h3>
|
||||
|
||||
<ul>
|
||||
<li><p>In case xDebug is disabled, from the <code>laradock</code> folder run:
|
||||
<code>./xdebugPhpFpm start</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li>To switch xdebug off, run:
|
||||
<code>./xdebugPhpFpm stop</code></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p>Start Remote Debugging</p>
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/PHPStorm/DebugRemoteOn.png" alt="DebugRemoteOn" /></li>
|
||||
</ul></li>
|
||||
|
||||
<li><p>Open to edit: <code>bootstrap/app.php</code></p></li>
|
||||
|
||||
<li><p>Add a BreakPoint on line 14: <code>$app = new Illuminate\Foundation\Application(</code></p></li>
|
||||
|
||||
<li><p>Reload <a href="http://laravel/">Laravel Site</a></p>
|
||||
|
||||
<ul>
|
||||
<li>Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!</li>
|
||||
<li><img src="photos/PHPStorm/RemoteDebuggingSuccess.png" alt="Remote Debugging Success" /></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
<p><a name="SSHintoWorkspace"></a></p>
|
||||
|
||||
<h4 id="let-s-shell-into-workspace">Let&rsquo;s shell into workspace</h4>
|
||||
|
||||
<p>Assuming that you are in laradock folder, type:
|
||||
<code>ssh -i workspace/insecure_id_rsa -p2222 root@laravel</code>
|
||||
<strong>Cha Ching!!!!</strong>
|
||||
- <code>workspace/insecure_id_rsa.ppk</code> may become corrupted. In which case:
|
||||
- fire up <code>puttygen</code>
|
||||
- import <code>workspace/insecure_id_rsa</code>
|
||||
- save private key to <code>workspace/insecure_id_rsa.ppk</code></p>
|
||||
|
||||
<p><a name="InstallKiTTY"></a></p>
|
||||
|
||||
<h5 id="kitty">KiTTY</h5>
|
||||
|
||||
<p><a href="http://www.9bis.net/kitty/">Kitty</a> KiTTY is a fork from version 0.67 of PuTTY.</p>
|
||||
|
||||
<ul>
|
||||
<li>Here are some settings that are working for me:
|
||||
|
||||
<ul>
|
||||
<li><img src="photos/KiTTY/Session.png" alt="Session" /></li>
|
||||
<li><img src="photos/KiTTY/Terminal.png" alt="Terminal" /></li>
|
||||
<li><img src="photos/KiTTY/Window.png" alt="Window" /></li>
|
||||
<li><img src="photos/KiTTY/WindowAppearance.png" alt="WindowAppearance" /></li>
|
||||
<li><img src="photos/KiTTY/Connection.png" alt="Connection" /></li>
|
||||
<li><img src="photos/KiTTY/ConnectionData.png" alt="ConnectionData" /></li>
|
||||
<li><img src="photos/KiTTY/ConnectionSSH.png" alt="ConnectionSSH" /></li>
|
||||
<li><img src="photos/KiTTY/ConnectionSSHAuth.png" alt="ConnectionSSHAuth" /></li>
|
||||
<li><img src="photos/KiTTY/TerminalShell.png" alt="TerminalShell" /></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Introduction</title>
|
||||
<link>http://laradock.io/introduction/</link>
|
||||
|
@ -1738,20 +2402,20 @@ features, by not reporting duplicate issues.</em></p>
|
|||
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
<p>Go the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</p>
|
||||
|
||||
<p>To edit the sidebar or add a new section, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code> as well.</p>
|
||||
|
||||
<p><em>The site will be autogenerated in the <code>docs/</code> folder by <a href="https://travis-ci.com/">Travis</a>.</em></p>
|
||||
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Edit the <code>DOCUMENTATION/_settings/content</code>.</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, go to <code>DOCUMENTATION/_settings/</code> and run the <code>hugo</code> command to generate the HTML docs (inside new <code>/docs</code> folder).</li>
|
||||
</ol>
|
||||
|
||||
<h2 id="how-to-support-new-software-add-new-container">How to support new Software (Add new Container)</h2>
|
||||
|
||||
|
|
|
@ -214,6 +214,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
@ -521,6 +539,22 @@ QUEUE_HOST=beanstalkd
|
|||
<nav class="pagination" aria-label="Footer">
|
||||
<div class="previous">
|
||||
|
||||
<a href="http://laradock.io/guides/" title="Guides">
|
||||
<span class="direction">
|
||||
Previous
|
||||
</span>
|
||||
<div class="page">
|
||||
<div class="button button-previous" role="button" aria-label="Previous">
|
||||
<i class="icon icon-back"></i>
|
||||
</div>
|
||||
<div class="stretch">
|
||||
<div class="title">
|
||||
Guides
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="next">
|
||||
|
|
|
@ -211,6 +211,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
|
|
@ -211,6 +211,24 @@
|
|||
|
||||
|
||||
|
||||
<a title="Giudes" href="http://laradock.io/guides/">
|
||||
|
||||
Giudes
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="current" title="Related Projects" href="http://laradock.io/related-projects/">
|
||||
|
||||
Related Projects
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
||||
<url>
|
||||
<loc>http://laradock.io/guides/</loc>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://laradock.io/introduction/</loc>
|
||||
</url>
|
||||
|
@ -44,6 +48,11 @@
|
|||
<priority>0</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://laradock.io/guides/</loc>
|
||||
<priority>0</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>http://laradock.io/help/</loc>
|
||||
<priority>0</priority>
|
||||
|
|