forked from laradock/laradock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2980 lines (1906 loc) · 98.3 KB
/
Copy pathindex.html
File metadata and controls
2980 lines (1906 loc) · 98.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="no-js">
<head lang="en-us">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<title>Laradock</title>
<meta name="generator" content="Hugo 0.19" />
<meta name="description" content="Laradock documentations.">
<link rel="canonical" href="http://laradock.io/">
<meta name="author" content="Mahmoud Zalt">
<meta property="og:url" content="http://laradock.io/">
<meta property="og:title" content="Laradock">
<meta name="apple-mobile-web-app-title" content="Laradock">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="shortcut icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
<link rel="icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
<style>
@font-face {
font-family: 'Icon';
src: url('http://laradock.io/fonts/icon.eot');
src: url('http://laradock.io/fonts/icon.eot')
format('embedded-opentype'),
url('http://laradock.io/fonts/icon.woff')
format('woff'),
url('http://laradock.io/fonts/icon.ttf')
format('truetype'),
url('http://laradock.io/fonts/icon.svg')
format('svg');
font-weight: normal;
font-style: normal;
}
</style>
<link rel="stylesheet" href="http://laradock.io/stylesheets/application.css">
<link rel="stylesheet" href="http://laradock.io/stylesheets/temporary.css">
<link rel="stylesheet" href="http://laradock.io/stylesheets/palettes.css">
<link rel="stylesheet" href="http://laradock.io/stylesheets/highlight/highlight.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Doctarine:400,700|Source+Code+Pro">
<style>
body, input {
font-family: 'Doctarine', Helvetica, Arial, sans-serif;
}
pre, code {
font-family: 'Source Code Pro', 'Courier New', 'Courier', monospace;
}
</style>
<script src="http://laradock.io/javascripts/modernizr.js"></script>
<link href="http://laradock.io/index.xml" rel="alternate" type="application/rss+xml" title="Laradock" />
<link href="http://laradock.io/index.xml" rel="feed" type="application/rss+xml" title="Laradock" />
</head>
<body class="palette-primary-deep-purple palette-accent-purple">
<div class="backdrop">
<div class="backdrop-paper"></div>
</div>
<input class="toggle" type="checkbox" id="toggle-drawer">
<input class="toggle" type="checkbox" id="toggle-search">
<label class="toggle-button overlay" for="toggle-drawer"></label>
<header class="header">
<nav aria-label="Header">
<div class="bar default">
<div class="button button-menu" role="button" aria-label="Menu">
<label class="toggle-button icon icon-menu" for="toggle-drawer">
<span></span>
</label>
</div>
<div class="stretch">
<div class="title">
<b>Laradock</b> <span style="color: rgba(249, 245, 255, 0.63);"> / Laradock</span>
</div>
</div>
<div class="button button-github" role="button" aria-label="GitHub">
<a style="padding: 0px; font-size:40px" href="https://github.com/laradock/laradock" title="@laradock/laradock on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
</div>
<p style="font-size: 18px; padding: 8px">Github</p>
</div>
<div class="bar search">
<div class="button button-close" role="button" aria-label="Close">
<label class="toggle-button icon icon-back" for="toggle-search"></label>
</div>
<div class="stretch">
<div class="field">
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
</div>
</div>
<div class="button button-reset" role="button" aria-label="Search">
<button class="toggle-button icon icon-close" id="reset-search"></button>
</div>
</div>
</nav>
</header>
<main class="main">
<div class="drawer">
<nav aria-label="Navigation">
<div class="scrollable">
<div class="wrapper">
<div class="toc">
<ul>
<li>
<a title="Introduction" href="http://laradock.io/introduction/">
Introduction
</a>
</li>
<li>
<a title="Getting Started" href="http://laradock.io/getting-started/">
Getting Started
</a>
</li>
<li>
<a title="Documentation" href="http://laradock.io/documentation/">
Documentation
</a>
</li>
<li>
<a title="Giudes" href="http://laradock.io/guides/">
Giudes
</a>
</li>
<li>
<a title="Related Projects" href="http://laradock.io/related-projects/">
Related Projects
</a>
</li>
<li>
<a title="Help & Questions" href="http://laradock.io/help/">
Help & Questions
</a>
</li>
<li>
<a title="Contributing" href="http://laradock.io/contributing/">
Contributing
</a>
</li>
<li>
<a title="License" href="http://laradock.io/license/">
License
</a>
</li>
</ul>
<ul>
</ul>
</div>
</div>
</div>
</nav>
</div>
<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>
<p>Laradock strives to make the PHP development experience easier and faster.</p>
<p>It contains pre-packaged Docker Images that provides you a wonderful <em>development</em> environment without requiring you to install PHP, NGINX, MySQL, Redis, and any other software on your machines.</p>
<p>Laradock is configured to run Laravel Apps by default, and it can be modified to run all kinds of PHP Apps (Symfony, CodeIgniter, WordPress, Drupal…).</p>
<h2 id="quick-overview">Quick Overview</h2>