forked from laradock/laradock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.xml
More file actions
1218 lines (799 loc) · 54.5 KB
/
Copy pathindex.xml
File metadata and controls
1218 lines (799 loc) · 54.5 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
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Documentations on Laradock</title>
<link>http://laradock.io/documentation/index.xml</link>
<description>Recent content in Documentations on Laradock</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="http://laradock.io/documentation/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Documentation</title>
<link>http://laradock.io/documentation/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://laradock.io/documentation/</guid>
<description>
<p><a name="List-current-running-Containers"></a></p>
<h2 id="list-current-running-containers">List current running Containers</h2>
<pre><code class="language-bash">docker ps
</code></pre>
<p>You can also use the following command if you want to see only this project containers:</p>
<pre><code class="language-bash">docker-compose ps
</code></pre>
<p><br>
<a name="Close-all-running-Containers"></a></p>
<h2 id="close-all-running-containers">Close all running Containers</h2>
<pre><code class="language-bash">docker-compose stop
</code></pre>
<p>To stop single container do:</p>
<pre><code class="language-bash">docker-compose stop {container-name}
</code></pre>
<p><br>
<a name="Delete-all-existing-Containers"></a></p>
<h2 id="delete-all-existing-containers">Delete all existing Containers</h2>
<pre><code class="language-bash">docker-compose down
</code></pre>
<p><br>
<a name="Enter-Container"></a></p>
<h2 id="enter-a-container-run-commands-in-a-running-container">Enter a Container (run commands in a running Container)</h2>
<p>1 - First list the current running containers with <code>docker ps</code></p>
<p>2 - Enter any container using:</p>
<pre><code class="language-bash">docker-compose exec {container-name} bash
</code></pre>
<p><em>Example: enter MySQL container</em></p>
<pre><code class="language-bash">docker-compose exec mysql bash
</code></pre>
<p><em>Example: enter to MySQL prompt within MySQL container</em></p>
<pre><code class="language-bash">docker-compose exec mysql mysql -u homestead -psecret
</code></pre>
<p>3 - To exit a container, type <code>exit</code>.</p>
<p><br>
<a name="Edit-Container"></a></p>
<h2 id="edit-default-container-configuration">Edit default container configuration</h2>
<p>Open the <code>docker-compose.yml</code> and change anything you want.</p>
<p>Examples:</p>
<p>Change MySQL Database Name:</p>
<pre><code class="language-yml"> environment:
MYSQL_DATABASE: laradock
...
</code></pre>
<p>Change Redis default port to 1111:</p>
<pre><code class="language-yml"> ports:
- &quot;1111:6379&quot;
...
</code></pre>
<p><br>
<a name="Edit-a-Docker-Image"></a></p>
<h2 id="edit-a-docker-image">Edit a Docker Image</h2>
<p>1 - Find the <code>Dockerfile</code> of the image you want to edit,
<br>
example for <code>mysql</code> it will be <code>mysql/Dockerfile</code>.</p>
<p>2 - Edit the file the way you want.</p>
<p>3 - Re-build the container:</p>
<pre><code class="language-bash">docker-compose build mysql
</code></pre>
<p>More info on Containers rebuilding <a href="#Build-Re-build-Containers">here</a>.</p>
<p><br>
<a name="Build-Re-build-Containers"></a></p>
<h2 id="build-re-build-containers">Build/Re-build Containers</h2>
<p>If you do any change to any <code>Dockerfile</code> make sure you run this command, for the changes to take effect:</p>
<pre><code class="language-bash">docker-compose build
</code></pre>
<p>Optionally you can specify which container to rebuild (instead of rebuilding all the containers):</p>
<pre><code class="language-bash">docker-compose build {container-name}
</code></pre>
<p>You might use the <code>--no-cache</code> option if you want full rebuilding (<code>docker-compose build --no-cache {container-name}</code>).</p>
<p><br>
<a name="Add-Docker-Images"></a></p>
<h2 id="add-more-software-docker-images">Add more Software (Docker Images)</h2>
<p>To add an image (software), just edit the <code>docker-compose.yml</code> and add your container details, to do so you need to be familiar with the <a href="https://docs.docker.com/compose/compose-file/">docker compose file syntax</a>.</p>
<p><br>
<a name="View-the-Log-files"></a></p>
<h2 id="view-the-log-files">View the Log files</h2>
<p>The NGINX Log file is stored in the <code>logs/nginx</code> directory.</p>
<p>However to view the logs of all the other containers (MySQL, PHP-FPM,&hellip;) you can run this:</p>
<pre><code class="language-bash">docker logs {container-name}
</code></pre>
<p>More <a href="https://docs.docker.com/compose/reference/logs/">options</a></p>
<pre><code class="language-bash">docker logs -f {container-name}
</code></pre>
<p><br>
<a name="PHP"></a></p>
<p><a name="Install-PHP-Extensions"></a></p>
<h2 id="install-php-extensions">Install PHP Extensions</h2>
<p>Before installing PHP extensions, you have to decide whether you need for the <code>FPM</code> or <code>CLI</code> because each lives on a different container, if you need it for both you have to edit both containers.</p>
<p>The PHP-FPM extensions should be installed in <code>php-fpm/Dockerfile-XX</code>. <em>(replace XX with your default PHP version number)</em>.
<br>
The PHP-CLI extensions should be installed in <code>workspace/Dockerfile</code>.</p>
<p><br>
<a name="Change-the-PHP-FPM-Version"></a></p>
<h2 id="change-the-php-fpm-version">Change the (PHP-FPM) Version</h2>
<p>By default <strong>PHP-FPM 7.0</strong> is running.</p>
<blockquote>
<p>The PHP-FPM is responsible of serving your application code, you don&rsquo;t have to change the PHP-CLI version if you are planning to run your application on different PHP-FPM version.</p>
</blockquote>
<h3 id="a-switch-from-php-7-0-to-php-5-6">A) Switch from PHP <code>7.0</code> to PHP <code>5.6</code></h3>
<p>1 - Open the <code>docker-compose.yml</code>.</p>
<p>2 - Search for <code>Dockerfile-70</code> in the PHP container section.</p>
<p>3 - Change the version number, by replacing <code>Dockerfile-70</code> with <code>Dockerfile-56</code>, like this:</p>
<pre><code class="language-yml"> php-fpm:
build:
context: ./php-fpm
dockerfile: Dockerfile-70
...
</code></pre>
<p>4 - Finally rebuild the container</p>
<pre><code class="language-bash">docker-compose build php-fpm
</code></pre>
<blockquote>
<p>For more details about the PHP base image, visit the <a href="https://hub.docker.com/_/php/">official PHP docker images</a>.</p>
</blockquote>
<h3 id="b-switch-from-php-7-0-or-5-6-to-php-5-5">B) Switch from PHP <code>7.0</code> or <code>5.6</code> to PHP <code>5.5</code></h3>
<p>We do not natively support PHP 5.5 anymore, but you can get it in few steps:</p>
<p>1 - Clone <code>https://github.com/laradock/php-fpm</code>.</p>
<p>3 - Rename <code>Dockerfile-56</code> to <code>Dockerfile-55</code>.</p>
<p>3 - Edit the file <code>FROM php:5.6-fpm</code> to <code>FROM php:5.5-fpm</code>.</p>
<p>4 - Build an image from <code>Dockerfile-55</code>.</p>
<p>5 - Open the <code>docker-compose.yml</code> file.</p>
<p>6 - Point <code>php-fpm</code> to your <code>Dockerfile-55</code> file.</p>
<p><br>
<a name="Change-the-PHP-CLI-Version"></a></p>
<h2 id="change-the-php-cli-version">Change the PHP-CLI Version</h2>
<p>By default <strong>PHP-CLI 7.0</strong> is running.</p>
<blockquote>
<p>Note: it&rsquo;s not very essential to edit the PHP-CLI version. The PHP-CLI is only used for the Artisan Commands &amp; Composer. It doesn&rsquo;t serve your Application code, this is the PHP-FPM job.</p>
</blockquote>
<p>The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the <code>workspace/Dockerfile</code>.</p>
<p>Right now you have to manually edit the <code>Dockerfile</code> or create a new one like it&rsquo;s done for the PHP-FPM. (consider contributing).</p>
<p><br>
<a name="Install-xDebug"></a></p>
<h2 id="install-xdebug">Install xDebug</h2>
<p>1 - First install <code>xDebug</code> in the Workspace and the PHP-FPM Containers:
<br>
a) open the <code>docker-compose.yml</code> file
<br>
b) search for the <code>INSTALL_XDEBUG</code> argument under the Workspace Container
<br>
c) set it to <code>true</code>
<br>
d) search for the <code>INSTALL_XDEBUG</code> argument under the PHP-FPM Container
<br>
e) set it to <code>true</code></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- INSTALL_XDEBUG=true
...
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_XDEBUG=true
...
</code></pre>
<p>2 - Re-build the containers <code>docker-compose build workspace php-fpm</code></p>
<p>3 - Open <code>laradock/workspace/xdebug.ini</code> and/or <code>laradock/php-fpm/xdebug.ini</code> and enable at least the following configurations:</p>
<pre><code>xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
</code></pre>
<p>For information on how to configure xDebug with your IDE and work it out, check this <a href="https://github.com/LarryEitel/laravel-laradock-phpstorm">Repository</a>.</p>
<p><br>
<a name="Control-xDebug"></a></p>
<h2 id="start-stop-xdebug">Start/Stop xDebug:</h2>
<p>By installing xDebug, you are enabling it to run on startup by default.</p>
<p>To control the behavior of xDebug (in the <code>php-fpm</code> Container), you can run the following commands from the Laradock root folder, (at the same prompt where you run docker-compose):</p>
<ul>
<li>Stop xDebug from running by default: <code>./xdebugPhpFpm stop</code>.</li>
<li>Start xDebug by default: <code>./xdebugPhpFpm start</code>.</li>
<li>See the status: <code>./xdebugPhpFpm status</code>.</li>
</ul>
<p>Note: If <code>./xdebugPhpFpm</code> doesn&rsquo;t execute and gives <code>Permission Denied</code> error the problem can be that file <code>xdebugPhpFpm</code> doesn&rsquo;t have execution access. This can be fixed by running <code>chmod</code> command with desired access permissions.</p>
<p><br>
<a name="Install-Deployer"></a></p>
<h2 id="install-deployer-deployment-tool-for-php">Install Deployer (Deployment tool for PHP)</h2>
<p>1 - Open the <code>docker-compose.yml</code> file
<br>
2 - Search for the <code>INSTALL_DEPLOYER</code> argument under the Workspace Container
<br>
3 - Set it to <code>true</code>
<br></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- INSTALL_DEPLOYER=true
...
</code></pre>
<p>4 - Re-build the containers <code>docker-compose build workspace</code></p>
<p><a href="https://deployer.org/docs"><strong>Deployer Documentation Here</strong></a></p>
<p><br>
<a name="Production"></a></p>
<p><br>
<a name="Laradock-for-Production"></a></p>
<h2 id="prepare-laradock-for-production">Prepare Laradock for Production</h2>
<p>It&rsquo;s recommended for production to create a custom <code>docker-compose.yml</code> file. For that reason, Laradock is shipped with <code>production-docker-compose.yml</code> which should contain only the containers you are planning to run on production (usage example: <code>docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...</code>).</p>
<p>Note: The Database (MySQL/MariaDB/&hellip;) ports should not be forwarded on production, because Docker will automatically publish the port on the host, which is quite insecure, unless specifically told not to. So make sure to remove these lines:</p>
<pre><code>ports:
- &quot;3306:3306&quot;
</code></pre>
<p>To learn more about how Docker publishes ports, please read <a href="https://fralef.me/docker-and-iptables.html">this excellent post on the subject</a>.</p>
<p><br>
<a name="Digital-Ocean"></a></p>
<h2 id="setup-laravel-and-docker-on-digital-ocean">Setup Laravel and Docker on Digital Ocean</h2>
<h3 id="full-guide-here-https-github-com-laradock-laradock-blob-master-guides-digital-ocean-md"><a href="https://github.com/laradock/laradock/blob/master/_guides/digital_ocean.md">Full Guide Here</a></h3>
<p><br>
<a name="Laravel"></a></p>
<p><a name="Install-Laravel"></a></p>
<h2 id="install-laravel-from-a-docker-container">Install Laravel from a Docker Container</h2>
<p>1 - First you need to enter the Workspace Container.</p>
<p>2 - Install Laravel.</p>
<p>Example using Composer</p>
<pre><code class="language-bash">composer create-project laravel/laravel my-cool-app &quot;5.2.*&quot;
</code></pre>
<blockquote>
<p>We recommend using <code>composer create-project</code> instead of the Laravel installer, to install Laravel.</p>
</blockquote>
<p>For more about the Laravel installation click <a href="https://laravel.com/docs/master#installing-laravel">here</a>.</p>
<p>3 - Edit <code>docker-compose.yml</code> to Map the new application path:</p>
<p>By default, Laradock assumes the Laravel application is living in the parent directory of the laradock folder.</p>
<p>Since the new Laravel application is in the <code>my-cool-app</code> folder, we need to replace <code>../:/var/www</code> with <code>../my-cool-app/:/var/www</code>, as follow:</p>
<pre><code class="language-yaml"> application:
image: tianon/true
volumes:
- ../my-cool-app/:/var/www
...
</code></pre>
<p>4 - Go to that folder and start working..</p>
<pre><code class="language-bash">cd my-cool-app
</code></pre>
<p>5 - Go back to the Laradock installation steps to see how to edit the <code>.env</code> file.</p>
<p><br>
<a name="Run-Artisan-Commands"></a></p>
<h2 id="run-artisan-commands">Run Artisan Commands</h2>
<p>You can run artisan commands and many other Terminal commands from the Workspace container.</p>
<p>1 - Make sure you have the workspace container running.</p>
<pre><code class="language-bash">docker-compose up -d workspace // ..and all your other containers
</code></pre>
<p>2 - Find the Workspace container name:</p>
<pre><code class="language-bash">docker-compose ps
</code></pre>
<p>3 - Enter the Workspace container:</p>
<pre><code class="language-bash">docker-compose exec workspace bash
</code></pre>
<p>Add <code>--user=laradock</code> (example <code>docker-compose exec --user=laradock workspace bash</code>) to have files created as your host&rsquo;s user.</p>
<p>4 - Run anything you want :)</p>
<pre><code class="language-bash">php artisan
</code></pre>
<pre><code class="language-bash">Composer update
</code></pre>
<pre><code class="language-bash">phpunit
</code></pre>
<p><br>
<a name="Run-Laravel-Queue-Worker"></a></p>
<h2 id="run-laravel-queue-worker">Run Laravel Queue Worker</h2>
<p>1 - First add <code>php-worker</code> container. It will be similar as like PHP-FPM Container.
<br>
a) open the <code>docker-compose.yml</code> file
<br>
b) add a new service container by simply copy-paste this section below PHP-FPM container</p>
<pre><code class="language-yaml"> php-worker:
build:
context: ./php-fpm
dockerfile: Dockerfile-70 # or Dockerfile-56, choose your PHP-FPM container setting
volumes_from:
- applications
command: php artisan queue:work
</code></pre>
<p>2 - Start everything up</p>
<pre><code class="language-bash">docker-compose up -d php-worker
</code></pre>
<p><br>
<a name="Use-Redis"></a></p>
<h2 id="use-redis">Use Redis</h2>
<p>1 - First make sure you run the Redis Container (<code>redis</code>) with the <code>docker-compose up</code> command.</p>
<pre><code class="language-bash">docker-compose up -d redis
</code></pre>
<p>2 - Open your Laravel&rsquo;s <code>.env</code> file and set the <code>REDIS_HOST</code> to <code>redis</code></p>
<pre><code class="language-env">REDIS_HOST=redis
</code></pre>
<p>If you don&rsquo;t find the <code>REDIS_HOST</code> variable in your <code>.env</code> file. Go to the database configuration file <code>config/database.php</code> and replace the default <code>127.0.0.1</code> IP with <code>redis</code> for Redis like this:</p>
<pre><code class="language-php">'redis' =&gt; [
'cluster' =&gt; false,
'default' =&gt; [
'host' =&gt; 'redis',
'port' =&gt; 6379,
'database' =&gt; 0,
],
],
</code></pre>
<p>3 - To enable Redis Caching and/or for Sessions Management. Also from the <code>.env</code> file set <code>CACHE_DRIVER</code> and <code>SESSION_DRIVER</code> to <code>redis</code> instead of the default <code>file</code>.</p>
<pre><code class="language-env">CACHE_DRIVER=redis
SESSION_DRIVER=redis
</code></pre>
<p>4 - Finally make sure you have the <code>predis/predis</code> package <code>(~1.0)</code> installed via Composer:</p>
<pre><code class="language-bash">composer require predis/predis:^1.0
</code></pre>
<p>5 - You can manually test it from Laravel with this code:</p>
<pre><code class="language-php">\Cache::store('redis')-&gt;put('Laradock', 'Awesome', 10);
</code></pre>
<p><br>
<a name="Use-Mongo"></a></p>
<h2 id="use-mongo">Use Mongo</h2>
<p>1 - First install <code>mongo</code> in the Workspace and the PHP-FPM Containers:
<br>
a) open the <code>docker-compose.yml</code> file
<br>
b) search for the <code>INSTALL_MONGO</code> argument under the Workspace Container
<br>
c) set it to <code>true</code>
<br>
d) search for the <code>INSTALL_MONGO</code> argument under the PHP-FPM Container
<br>
e) set it to <code>true</code></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- INSTALL_MONGO=true
...
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_MONGO=true
...
</code></pre>
<p>2 - Re-build the containers <code>docker-compose build workspace php-fpm</code></p>
<p>3 - Run the MongoDB Container (<code>mongo</code>) with the <code>docker-compose up</code> command.</p>
<pre><code class="language-bash">docker-compose up -d mongo
</code></pre>
<p>4 - Add the MongoDB configurations to the <code>config/database.php</code> configuration file:</p>
<pre><code class="language-php">'connections' =&gt; [
'mongodb' =&gt; [
'driver' =&gt; 'mongodb',
'host' =&gt; env('DB_HOST', 'localhost'),
'port' =&gt; env('DB_PORT', 27017),
'database' =&gt; env('DB_DATABASE', 'database'),
'username' =&gt; '',
'password' =&gt; '',
'options' =&gt; [
'database' =&gt; '',
]
],
// ...
],
</code></pre>
<p>5 - Open your Laravel&rsquo;s <code>.env</code> file and update the following variables:</p>
<ul>
<li>set the <code>DB_HOST</code> to your <code>mongo</code>.</li>
<li>set the <code>DB_PORT</code> to <code>27017</code>.</li>
<li>set the <code>DB_DATABASE</code> to <code>database</code>.</li>
</ul>
<p>6 - Finally make sure you have the <code>jenssegers/mongodb</code> package installed via Composer and its Service Provider is added.</p>
<pre><code class="language-bash">composer require jenssegers/mongodb
</code></pre>
<p>More details about this <a href="https://github.com/jenssegers/laravel-mongodb#installation">here</a>.</p>
<p>7 - Test it:</p>
<ul>
<li>First let your Models extend from the Mongo Eloquent Model. Check the <a href="https://github.com/jenssegers/laravel-mongodb#eloquent">documentation</a>.</li>
<li>Enter the Workspace Container.</li>
<li>Migrate the Database <code>php artisan migrate</code>.</li>
</ul>
<p><br>
<a name="Use-phpMyAdmin"></a></p>
<h2 id="use-phpmyadmin">Use PhpMyAdmin</h2>
<p>1 - Run the phpMyAdmin Container (<code>phpmyadmin</code>) with the <code>docker-compose up</code> command. Example:</p>
<pre><code class="language-bash"># use with mysql
docker-compose up -d mysql phpmyadmin
# use with mariadb
docker-compose up -d mariadb phpmyadmin
</code></pre>
<p>2 - Open your browser and visit the localhost on port <strong>8080</strong>: <code>http://localhost:8080</code></p>
<p><br>
<a name="Use-pgAdmin"></a></p>
<h2 id="use-pgadmin">Use PgAdmin</h2>
<p>1 - Run the pgAdmin Container (<code>pgadmin</code>) with the <code>docker-compose up</code> command. Example:</p>
<pre><code class="language-bash">docker-compose up -d postgres pgadmin
</code></pre>
<p>2 - Open your browser and visit the localhost on port <strong>5050</strong>: <code>http://localhost:5050</code></p>
<p><br>
<a name="Use-Beanstalkd"></a></p>
<h2 id="use-beanstalkd">Use Beanstalkd</h2>
<p>1 - Run the Beanstalkd Container:</p>
<pre><code class="language-bash">docker-compose up -d beanstalkd
</code></pre>
<p>2 - Configure Laravel to connect to that container by editing the <code>config/queue.php</code> config file.</p>
<p>a. first set <code>beanstalkd</code> as default queue driver
b. set the queue host to beanstalkd : <code>QUEUE_HOST=beanstalkd</code></p>
<p><em>beanstalkd is now available on default port <code>11300</code>.</em></p>
<p>3 - Require the dependency package <a href="https://github.com/pda/pheanstalk">pda/pheanstalk</a> using composer.</p>
<p>Optionally you can use the Beanstalkd Console Container to manage your Queues from a web interface.</p>
<p>1 - Run the Beanstalkd Console Container:</p>
<pre><code class="language-bash">docker-compose up -d beanstalkd-console
</code></pre>
<p>2 - Open your browser and visit <code>http://localhost:2080/</code></p>
<p>3 - Add the server</p>
<ul>
<li>Host: beanstalkd</li>
<li>Port: 11300</li>
</ul>
<p>4 - Done.</p>
<p><br>
<a name="Use-ElasticSearch"></a></p>
<h2 id="use-elasticsearch">Use ElasticSearch</h2>
<p>1 - Run the ElasticSearch Container (<code>elasticsearch</code>) with the <code>docker-compose up</code> command:</p>
<pre><code class="language-bash">docker-compose up -d elasticsearch
</code></pre>
<p>2 - Open your browser and visit the localhost on port <strong>9200</strong>: <code>http://localhost:9200</code></p>
<h3 id="install-elasticsearch-plugin">Install ElasticSearch Plugin</h3>
<p>1 - Install the ElasticSearch plugin like <a href="https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugins-delete-by-query.html">delete-by-query</a>.</p>
<pre><code class="language-bash">docker exec {container-name} /usr/share/elasticsearch/bin/plugin install delete-by-query
</code></pre>
<p>2 - Restart elasticsearch container</p>
<pre><code class="language-bash">docker restart {container-name}
</code></pre>
<p><br>
<a name="Use-Selenium"></a></p>
<h2 id="use-selenium">Use Selenium</h2>
<p>1 - Run the Selenium Container (<code>selenium</code>) with the <code>docker-compose up</code> command. Example:</p>
<pre><code class="language-bash">docker-compose up -d selenium
</code></pre>
<p>2 - Open your browser and visit the localhost on port <strong>4444</strong> at the following URL: <code>http://localhost:4444/wd/hub</code></p>
<p><br>
<a name="Use-RethinkDB"></a></p>
<h2 id="use-rethinkdb">Use RethinkDB</h2>
<p>The RethinkDB is an open-source Database for Real-time Web (<a href="https://rethinkdb.com/">RethinkDB</a>).
A package (<a href="https://github.com/duxet/laravel-rethinkdb">Laravel RethinkDB</a>) is being developed and was released a version for Laravel 5.2 (experimental).</p>
<p>1 - Run the RethinkDB Container (<code>rethinkdb</code>) with the <code>docker-compose up</code> command.</p>
<pre><code class="language-bash">docker-compose up -d rethinkdb
</code></pre>
<p>2 - Access the RethinkDB Administration Console <a href="http://localhost:8090/#tables">http://localhost:8090/#tables</a> for create a database called <code>database</code>.</p>
<p>3 - Add the RethinkDB configurations to the <code>config/database.php</code> configuration file:</p>
<pre><code class="language-php">'connections' =&gt; [
'rethinkdb' =&gt; [
'name' =&gt; 'rethinkdb',
'driver' =&gt; 'rethinkdb',
'host' =&gt; env('DB_HOST', 'rethinkdb'),
'port' =&gt; env('DB_PORT', 28015),
'database' =&gt; env('DB_DATABASE', 'test'),
]
// ...
],
</code></pre>
<p>4 - Open your Laravel&rsquo;s <code>.env</code> file and update the following variables:</p>
<ul>
<li>set the <code>DB_CONNECTION</code> to your <code>rethinkdb</code>.</li>
<li>set the <code>DB_HOST</code> to <code>rethinkdb</code>.</li>
<li>set the <code>DB_PORT</code> to <code>28015</code>.</li>
<li>set the <code>DB_DATABASE</code> to <code>database</code>.</li>
</ul>
<p><br>
<a name="Use-Minio"></a></p>
<h2 id="use-minio">Use Minio</h2>
<p>1 - Configure Minio:
- On the workspace container, change <code>INSTALL_MC</code> to true to get the client
- Set <code>MINIO_ACCESS_KEY</code> and <code>MINIO_ACCESS_SECRET</code> if you wish to set proper keys</p>
<p>2 - Run the Minio Container (<code>minio</code>) with the <code>docker-compose up</code> command. Example:</p>
<pre><code class="language-bash">docker-compose up -d minio
</code></pre>
<p>3 - Open your browser and visit the localhost on port <strong>9000</strong> at the following URL: <code>http://localhost:9000</code></p>
<p>4 - Create a bucket either through the webui or using the mc client:</p>
<pre><code class="language-bash"> mc mb minio/bucket
</code></pre>
<p>5 - When configuring your other clients use the following details:</p>
<pre><code> S3_HOST=http://minio
S3_KEY=access
S3_SECRET=secretkey
S3_REGION=us-east-1
S3_BUCKET=bucket
</code></pre>
<p><br>
<a name="CodeIgniter"></a></p>
<p><br>
<a name="Install-CodeIgniter"></a></p>
<h2 id="install-codeigniter">Install CodeIgniter</h2>
<p>To install CodeIgniter 3 on Laradock all you have to do is the following simple steps:</p>
<p>1 - Open the <code>docker-compose.yml</code> file.</p>
<p>2 - Change <code>CODEIGNITER=false</code> to <code>CODEIGNITER=true</code>.</p>
<p>3 - Re-build your PHP-FPM Container <code>docker-compose build php-fpm</code>.</p>
<p><br>
<a name="Misc"></a></p>
<h2 id="miscellaneous">Miscellaneous</h2>
<p><br>
<a name="Change-the-timezone"></a></p>
<h2 id="change-the-timezone">Change the timezone</h2>
<p>To change the timezone for the <code>workspace</code> container, modify the <code>TZ</code> build argument in the Docker Compose file to one in the <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ database</a>.</p>
<p>For example, if I want the timezone to be <code>New York</code>:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- TZ=America/New_York
...
</code></pre>
<p>We also recommend <a href="http://www.camroncade.com/managing-timezones-with-laravel/">setting the timezone in Laravel</a>.</p>
<p><br>
<a name="CronJobs"></a></p>
<h2 id="adding-cron-jobs">Adding cron jobs</h2>
<p>You can add your cron jobs to <code>workspace/crontab/root</code> after the <code>php artisan</code> line.</p>
<pre><code>* * * * * php /var/www/artisan schedule:run &gt;&gt; /dev/null 2&gt;&amp;1
# Custom cron
* * * * * root echo &quot;Every Minute&quot; &gt; /var/log/cron.log 2&gt;&amp;1
</code></pre>
<p>Make sure you <a href="#Change-the-timezone">change the timezone</a> if you don&rsquo;t want to use the default (UTC).</p>
<p><br>
<a name="Workspace-ssh"></a></p>
<h2 id="access-workspace-via-ssh">Access workspace via ssh</h2>
<p>You can access the <code>workspace</code> container through <code>localhost:2222</code> by setting the <code>INSTALL_WORKSPACE_SSH</code> build argument to <code>true</code>.</p>
<p>To change the default forwarded port for ssh:</p>
<pre><code class="language-yml"> workspace:
ports:
- &quot;2222:22&quot; # Edit this line
...
</code></pre>
<p><br>
<a name="MySQL-access-from-host"></a></p>
<h2 id="mysql-access-from-host">MySQL access from host</h2>
<p>You can forward the MySQL/MariaDB port to your host by making sure these lines are added to the <code>mysql</code> or <code>mariadb</code> section of the <code>docker-compose.yml</code> or in your <a href="https://docs.docker.com/compose/extends/">environment specific Compose</a> file.</p>
<pre><code>ports:
- &quot;3306:3306&quot;
</code></pre>
<p><br>
<a name="MySQL-root-access"></a></p>
<h2 id="mysql-root-access">MySQL root access</h2>
<p>The default username and password for the root MySQL user are <code>root</code> and <code>root</code>.</p>
<p>1 - Enter the MySQL container: <code>docker-compose exec mysql bash</code>.</p>
<p>2 - Enter mysql: <code>mysql -uroot -proot</code> for non root access use <code>mysql -uhomestead -psecret</code>.</p>
<p>3 - See all users: <code>SELECT User FROM mysql.user;</code></p>
<p>4 - Run any commands <code>show databases</code>, <code>show tables</code>, <code>select * from.....</code>.</p>
<p><br>
<a name="Change-MySQL-port"></a></p>
<h2 id="change-mysql-port">Change MySQL port</h2>
<p>Modify the <code>mysql/my.cnf</code> file to set your port number, <code>1234</code> is used as an example.</p>
<pre><code>[mysqld]
port=1234
</code></pre>
<p>If you need <a href="#MySQL-access-from-host">MySQL access from your host</a>, do not forget to change the internal port number (<code>&quot;3306:3306&quot;</code> -&gt; <code>&quot;3306:1234&quot;</code>) in the docker-compose configuration file.</p>
<p><br>
<a name="Use-custom-Domain"></a></p>
<h2 id="use-custom-domain-instead-of-the-docker-ip">Use custom Domain (instead of the Docker IP)</h2>
<p>Assuming your custom domain is <code>laravel.dev</code></p>
<p>1 - Open your <code>/etc/hosts</code> file and map your localhost address <code>127.0.0.1</code> to the <code>laravel.dev</code> domain, by adding the following:</p>
<pre><code class="language-bash">127.0.0.1 laravel.dev
</code></pre>
<p>2 - Open your browser and visit <code>{http://laravel.dev}</code></p>
<p>Optionally you can define the server name in the NGINX configuration file, like this:</p>
<pre><code class="language-conf">server_name laravel.dev;
</code></pre>
<p><br>
<a name="Enable-Global-Composer-Build-Install"></a></p>
<h2 id="enable-global-composer-build-install">Enable Global Composer Build Install</h2>
<p>Enabling Global Composer Install during the build for the container allows you to get your composer requirements installed and available in the container after the build is done.</p>
<p>1 - Open the <code>docker-compose.yml</code> file</p>
<p>2 - Search for the <code>COMPOSER_GLOBAL_INSTALL</code> argument under the Workspace Container and set it to <code>true</code></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- COMPOSER_GLOBAL_INSTALL=true
...
</code></pre>
<p>3 - Now add your dependencies to <code>workspace/composer.json</code></p>
<p>4 - Re-build the Workspace Container <code>docker-compose build workspace</code></p>
<p><br>
<a name="Install-Prestissimo"></a></p>
<h2 id="install-prestissimo">Install Prestissimo</h2>
<p><a href="https://github.com/hirak/prestissimo">Prestissimo</a> is a plugin for composer which enables parallel install functionality.</p>
<p>1 - Enable Running Global Composer Install during the Build:</p>
<p>Click on this <a href="#Enable-Global-Composer-Build-Install">Enable Global Composer Build Install</a> and do steps 1 and 2 only then continue here.</p>
<p>2 - Add prestissimo as requirement in Composer:</p>
<p>a - Now open the <code>workspace/composer.json</code> file</p>
<p>b - Add <code>&quot;hirak/prestissimo&quot;: &quot;^0.3&quot;</code> as requirement</p>
<p>c - Re-build the Workspace Container <code>docker-compose build workspace</code></p>
<p><br>
<a name="Install-Node"></a></p>
<h2 id="install-node-nvm">Install Node + NVM</h2>
<p>To install NVM and NodeJS in the Workspace container</p>
<p>1 - Open the <code>docker-compose.yml</code> file</p>
<p>2 - Search for the <code>INSTALL_NODE</code> argument under the Workspace Container and set it to <code>true</code></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- INSTALL_NODE=true
...
</code></pre>
<p>3 - Re-build the container <code>docker-compose build workspace</code></p>
<p><br>
<a name="Install-Yarn"></a></p>
<h2 id="install-node-yarn">Install Node + YARN</h2>
<p>Yarn is a new package manager for JavaScript. It is so faster than npm, which you can find <a href="http://yarnpkg.com/en/compare">here</a>.To install NodeJS and <a href="https://yarnpkg.com/">Yarn</a> in the Workspace container:</p>
<p>1 - Open the <code>docker-compose.yml</code> file</p>
<p>2 - Search for the <code>INSTALL_NODE</code> and <code>INSTALL_YARN</code> argument under the Workspace Container and set it to <code>true</code></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- INSTALL_NODE=true
- INSTALL_YARN=true
...
</code></pre>
<p>3 - Re-build the container <code>docker-compose build workspace</code></p>
<p><br>
<a name="Install-Linuxbrew"></a></p>
<h2 id="install-linuxbrew">Install Linuxbrew</h2>
<p>Linuxbrew is a package manager for Linux. It is the Linux version of MacOS Homebrew and can be found <a href="http://linuxbrew.sh">here</a>. To install Linuxbrew in the Workspace container:</p>
<p>1 - Open the <code>docker-compose.yml</code> file</p>
<p>2 - Search for the <code>INSTALL_LINUXBREW</code> argument under the Workspace Container and set it to <code>true</code></p>
<p>It should be like this:</p>
<pre><code class="language-yml"> workspace:
build:
context: ./workspace
args:
- INSTALL_LINUXBREW=true
...
</code></pre>
<p>3 - Re-build the container <code>docker-compose build workspace</code></p>
<p><br>
<a name="Common-Aliases"></a>
<br></p>
<h2 id="common-terminal-aliases">Common Terminal Aliases</h2>
<p>When you start your docker container, Laradock will copy the <code>aliases.sh</code> file located in the <code>laradock/workspace</code> directory and add sourcing to the container <code>~/.bashrc</code> file.</p>
<p>You are free to modify the <code>aliases.sh</code> as you see fit, adding your own aliases (or function macros) to suit your requirements.</p>