index.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  2. <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  3. <channel>
  4. <title>Getting-starteds on Laradock</title>
  5. <link>http://laradock.io/getting-started/index.xml</link>
  6. <description>Recent content in Getting-starteds on Laradock</description>
  7. <generator>Hugo -- gohugo.io</generator>
  8. <language>en-us</language>
  9. <atom:link href="http://laradock.io/getting-started/index.xml" rel="self" type="application/rss+xml" />
  10. <item>
  11. <title>Getting Started</title>
  12. <link>http://laradock.io/getting-started/</link>
  13. <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
  14. <guid>http://laradock.io/getting-started/</guid>
  15. <description>
  16. &lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
  17. &lt;ul&gt;
  18. &lt;li&gt;&lt;a href=&#34;https://git-scm.com/downloads&#34;&gt;Git&lt;/a&gt;&lt;/li&gt;
  19. &lt;li&gt;&lt;a href=&#34;https://www.docker.com/products/docker/&#34;&gt;Docker&lt;/a&gt; &lt;code&gt;&amp;gt;= 1.12&lt;/code&gt;&lt;/li&gt;
  20. &lt;/ul&gt;
  21. &lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
  22. &lt;p&gt;Choose the setup the best suits your needs.&lt;/p&gt;
  23. &lt;ul&gt;
  24. &lt;li&gt;&lt;a href=&#34;#A&#34;&gt;A) Setup for Single Project&lt;/a&gt;
  25. &lt;ul&gt;
  26. &lt;li&gt;&lt;a href=&#34;#A1&#34;&gt;A.1) Already have a PHP project&lt;/a&gt;&lt;/li&gt;
  27. &lt;li&gt;&lt;a href=&#34;#A2&#34;&gt;A.2) Don&amp;rsquo;t have a PHP project yet&lt;/a&gt;&lt;/li&gt;
  28. &lt;/ul&gt;&lt;/li&gt;
  29. &lt;li&gt;&lt;a href=&#34;#B&#34;&gt;B) Setup for Multiple Projects&lt;/a&gt;&lt;/li&gt;
  30. &lt;/ul&gt;
  31. &lt;p&gt;&lt;a name=&#34;A&#34;&gt;&lt;/a&gt;&lt;/p&gt;
  32. &lt;h3 id=&#34;a-setup-for-single-project&#34;&gt;A) Setup for Single Project&lt;/h3&gt;
  33. &lt;blockquote&gt;
  34. &lt;p&gt;(Follow these steps if you want a separate Docker environment for each project)&lt;/p&gt;
  35. &lt;/blockquote&gt;
  36. &lt;p&gt;&lt;a name=&#34;A1&#34;&gt;&lt;/a&gt;&lt;/p&gt;
  37. &lt;h3 id=&#34;a-1-already-have-a-php-project&#34;&gt;A.1) Already have a PHP project:&lt;/h3&gt;
  38. &lt;p&gt;1 - Clone laradock on your project root directory:&lt;/p&gt;
  39. &lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;git submodule add https://github.com/Laradock/laradock.git
  40. &lt;/code&gt;&lt;/pre&gt;
  41. &lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;
  42. &lt;ul&gt;
  43. &lt;li&gt;&lt;p&gt;If you are not using Git yet for your project, you can use &lt;code&gt;git clone&lt;/code&gt; instead of &lt;code&gt;git submodule&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
  44. &lt;li&gt;&lt;p&gt;Note 2: To keep track of your Laradock changes, between your projects and also keep Laradock updated. &lt;a href=&#34;http://laradock.io/documentation/#keep-track-of-your-laradock-changes&#34;&gt;Check this&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
  45. &lt;/ul&gt;
  46. &lt;p&gt;Your folder structure should look like this:&lt;/p&gt;
  47. &lt;pre&gt;&lt;code&gt;+ project-a
  48. + laradock-a
  49. + project-b
  50. + laradock-b
  51. &lt;/code&gt;&lt;/pre&gt;
  52. &lt;p&gt;(It&amp;rsquo;s important to rename the folders differently in each project.)&lt;/p&gt;
  53. &lt;blockquote&gt;
  54. &lt;p&gt;&lt;strong&gt;Now jump to the &lt;a href=&#34;#Usage&#34;&gt;Usage&lt;/a&gt; section.&lt;/strong&gt;&lt;/p&gt;
  55. &lt;/blockquote&gt;
  56. &lt;p&gt;&lt;a name=&#34;A2&#34;&gt;&lt;/a&gt;&lt;/p&gt;
  57. &lt;h3 id=&#34;a-2-don-t-have-a-php-project-yet&#34;&gt;A.2) Don&amp;rsquo;t have a PHP project yet:&lt;/h3&gt;
  58. &lt;p&gt;1 - Clone this repository anywhere on your machine:&lt;/p&gt;
  59. &lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;git clone https://github.com/laradock/laradock.git
  60. &lt;/code&gt;&lt;/pre&gt;
  61. &lt;p&gt;Your folder structure should look like this:&lt;/p&gt;
  62. &lt;pre&gt;&lt;code&gt;+ laradock
  63. + project-z
  64. &lt;/code&gt;&lt;/pre&gt;
  65. &lt;p&gt;2 - Edit your web server sites configuration.&lt;/p&gt;
  66. &lt;p&gt;&lt;strong&gt;In case of NGINX:&lt;/strong&gt; open &lt;code&gt;nginx/sites/default.conf&lt;/code&gt; and change the &lt;code&gt;root&lt;/code&gt; from &lt;code&gt;/var/www/public&lt;/code&gt; to &lt;code&gt;/var/www/{my-project-folder-name}/public&lt;/code&gt;.&lt;/p&gt;
  67. &lt;p&gt;&lt;em&gt;Or you can keep &lt;code&gt;default.conf&lt;/code&gt; as it is, and create a separate config &lt;code&gt;my-site.conf&lt;/code&gt; file for it.&lt;/em&gt;&lt;/p&gt;
  68. &lt;p&gt;&lt;strong&gt;In case of Apache:&lt;/strong&gt; :P&lt;/p&gt;
  69. &lt;p&gt;&lt;br&gt;&lt;/p&gt;
  70. &lt;blockquote&gt;
  71. &lt;p&gt;&lt;strong&gt;Now jump to the &lt;a href=&#34;#Usage&#34;&gt;Usage&lt;/a&gt; section.&lt;/strong&gt;&lt;/p&gt;
  72. &lt;/blockquote&gt;
  73. &lt;p&gt;&lt;a name=&#34;B&#34;&gt;&lt;/a&gt;&lt;/p&gt;
  74. &lt;h3 id=&#34;b-setup-for-multiple-projects&#34;&gt;B) Setup for Multiple Projects:&lt;/h3&gt;
  75. &lt;blockquote&gt;
  76. &lt;p&gt;(Follow these steps if you want a single Docker environment for all your project)&lt;/p&gt;
  77. &lt;/blockquote&gt;
  78. &lt;p&gt;1 - Clone this repository anywhere on your machine (similar to &lt;a href=&#34;#A2&#34;&gt;Steps A.2. from above&lt;/a&gt;):&lt;/p&gt;
  79. &lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;git clone https://github.com/laradock/laradock.git
  80. &lt;/code&gt;&lt;/pre&gt;
  81. &lt;p&gt;Your folder structure should look like this:&lt;/p&gt;
  82. &lt;pre&gt;&lt;code&gt;+ laradock
  83. + project-1
  84. + project-2
  85. &lt;/code&gt;&lt;/pre&gt;
  86. &lt;p&gt;2 - Go to &lt;code&gt;nginx/sites&lt;/code&gt; and create config files to point to different project directory when visiting different domains.&lt;/p&gt;
  87. &lt;p&gt;Laradock by default includes &lt;code&gt;project-1.conf&lt;/code&gt; and &lt;code&gt;project-2.conf&lt;/code&gt; as working samples.&lt;/p&gt;
  88. &lt;p&gt;3 - change the default names &lt;code&gt;project-n&lt;/code&gt;:&lt;/p&gt;
  89. &lt;p&gt;You can rename the config files, project folders and domains as you like, just make sure the &lt;code&gt;root&lt;/code&gt; in the config files, is pointing to the correct project folder name.&lt;/p&gt;
  90. &lt;p&gt;4 - Add the domains to the &lt;strong&gt;hosts&lt;/strong&gt; files.&lt;/p&gt;
  91. &lt;pre&gt;&lt;code&gt;127.0.0.1 project-1.dev
  92. 127.0.0.1 project-2.dev
  93. &lt;/code&gt;&lt;/pre&gt;
  94. &lt;blockquote&gt;
  95. &lt;p&gt;&lt;strong&gt;Now jump to the &lt;a href=&#34;#Usage&#34;&gt;Usage&lt;/a&gt; section.&lt;/strong&gt;&lt;/p&gt;
  96. &lt;/blockquote&gt;
  97. &lt;p&gt;&lt;a name=&#34;Usage&#34;&gt;&lt;/a&gt;&lt;/p&gt;
  98. &lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
  99. &lt;p&gt;&lt;strong&gt;Read Before starting:&lt;/strong&gt;&lt;/p&gt;
  100. &lt;p&gt;If you are using &lt;strong&gt;Docker Toolbox&lt;/strong&gt; (VM), do one of the following:&lt;/p&gt;
  101. &lt;ul&gt;
  102. &lt;li&gt;Upgrade to Docker &lt;a href=&#34;https://www.docker.com/products/docker&#34;&gt;Native&lt;/a&gt; for Mac/Windows (Recommended). Check out &lt;a href=&#34;http://laradock.io/documentation/#upgrading-laradock&#34;&gt;Upgrading Laradock&lt;/a&gt;&lt;/li&gt;
  103. &lt;li&gt;Use Laradock v3.*. Visit the &lt;a href=&#34;https://github.com/laradock/laradock/tree/LaraDock-ToolBox&#34;&gt;LaraDock-ToolBox&lt;/a&gt; branch. &lt;em&gt;(outdated)&lt;/em&gt;&lt;/li&gt;
  104. &lt;/ul&gt;
  105. &lt;p&gt;&lt;br&gt;&lt;/p&gt;
  106. &lt;blockquote&gt;
  107. &lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; If you used an older version of Laradock it&amp;rsquo;s highly recommended to rebuild the containers you need to use &lt;a href=&#34;#Build-Re-build-Containers&#34;&gt;see how you rebuild a container&lt;/a&gt; in order to prevent as much errors as possible.&lt;/p&gt;
  108. &lt;/blockquote&gt;
  109. &lt;p&gt;&lt;br&gt;&lt;/p&gt;
  110. &lt;p&gt;1 - Enter the laradock folder and rename &lt;code&gt;env-example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt;&lt;/p&gt;
  111. &lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;cp env-example .env
  112. &lt;/code&gt;&lt;/pre&gt;
  113. &lt;p&gt;You can edit the &lt;code&gt;.env&lt;/code&gt; file to chose which software&amp;rsquo;s you want to be installed in your environment. You can always refer to the &lt;code&gt;docker-compose.yml&lt;/code&gt; file to see how those variables are been used.&lt;/p&gt;
  114. &lt;p&gt;2 - Build the enviroment and run it using &lt;code&gt;docker-compose&lt;/code&gt;&lt;/p&gt;
  115. &lt;p&gt;In this example we&amp;rsquo;ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:&lt;/p&gt;
  116. &lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker-compose up -d nginx mysql
  117. &lt;/code&gt;&lt;/pre&gt;
  118. &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The &lt;code&gt;workspace&lt;/code&gt; and &lt;code&gt;php-fpm&lt;/code&gt; will run automatically in most of the cases, so no need to specify them in the &lt;code&gt;up&lt;/code&gt; command. If you couldn&amp;rsquo;t find them running then you need specify them as follow: &lt;code&gt;docker-compose up -d nginx php-fpm mysql workspace&lt;/code&gt;.&lt;/p&gt;
  119. &lt;p&gt;You can select your own combination of containers form the list below:&lt;/p&gt;
  120. &lt;blockquote&gt;
  121. &lt;p&gt;&lt;code&gt;nginx&lt;/code&gt;, &lt;code&gt;hhvm&lt;/code&gt;, &lt;code&gt;php-fpm&lt;/code&gt;, &lt;code&gt;mysql&lt;/code&gt;, &lt;code&gt;redis&lt;/code&gt;, &lt;code&gt;postgres&lt;/code&gt;, &lt;code&gt;mariadb&lt;/code&gt;, &lt;code&gt;neo4j&lt;/code&gt;, &lt;code&gt;mongo&lt;/code&gt;, &lt;code&gt;apache2&lt;/code&gt;, &lt;code&gt;caddy&lt;/code&gt;, &lt;code&gt;memcached&lt;/code&gt;, &lt;code&gt;beanstalkd&lt;/code&gt;, &lt;code&gt;beanstalkd-console&lt;/code&gt;, &lt;code&gt;rabbitmq&lt;/code&gt;, &lt;code&gt;beanstalkd-console&lt;/code&gt;, &lt;code&gt;workspace&lt;/code&gt;, &lt;code&gt;phpmyadmin&lt;/code&gt;, &lt;code&gt;adminer&lt;/code&gt;, &lt;code&gt;aerospike&lt;/code&gt;, &lt;code&gt;pgadmin&lt;/code&gt;, &lt;code&gt;elasticsearch&lt;/code&gt;, &lt;code&gt;rethinkdb&lt;/code&gt;, &lt;code&gt;postgres-postgis&lt;/code&gt;, &lt;code&gt;certbot&lt;/code&gt;, &lt;code&gt;mailhog&lt;/code&gt;, &lt;code&gt;minio&lt;/code&gt; and more&amp;hellip;!&lt;/p&gt;
  122. &lt;/blockquote&gt;
  123. &lt;p&gt;&lt;em&gt;(Please note that sometimes we forget to update the docs, so check the &lt;code&gt;docker-compose.yml&lt;/code&gt; file to see an updated list of all available containers).&lt;/em&gt;&lt;/p&gt;
  124. &lt;p&gt;&lt;br&gt;
  125. 3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &amp;hellip;)&lt;/p&gt;
  126. &lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker-compose exec workspace bash
  127. &lt;/code&gt;&lt;/pre&gt;
  128. &lt;p&gt;&lt;em&gt;Alternatively, for Windows PowerShell users: execute the following command to enter any running container:&lt;/em&gt;&lt;/p&gt;
  129. &lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker exec -it {workspace-container-id} bash
  130. &lt;/code&gt;&lt;/pre&gt;
  131. &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can add &lt;code&gt;--user=laradock&lt;/code&gt; to have files created as your host&amp;rsquo;s user. Example:&lt;/p&gt;
  132. &lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;docker-compose exec --user=laradock workspace bash
  133. &lt;/code&gt;&lt;/pre&gt;
  134. &lt;p&gt;&lt;em&gt;You can change the PUID (User id) and PGID (group id) variables from the &lt;code&gt;.env&lt;/code&gt; file)&lt;/em&gt;&lt;/p&gt;
  135. &lt;p&gt;&lt;br&gt;
  136. 4 - Update your project configurations to use the database host&lt;/p&gt;
  137. &lt;p&gt;Open your PHP project&amp;rsquo;s &lt;code&gt;.env&lt;/code&gt; file or whichever configuration file you are reading from, and set the database host &lt;code&gt;DB_HOST&lt;/code&gt; to &lt;code&gt;mysql&lt;/code&gt;:&lt;/p&gt;
  138. &lt;pre&gt;&lt;code class=&#34;language-env&#34;&gt;DB_HOST=mysql
  139. &lt;/code&gt;&lt;/pre&gt;
  140. &lt;p&gt;&lt;em&gt;If you want to install Laravel as PHP project, see &lt;a href=&#34;#Install-Laravel&#34;&gt;How to Install Laravel in a Docker Container&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
  141. &lt;p&gt;&lt;br&gt;
  142. 5 - Open your browser and visit your localhost address &lt;code&gt;http://localhost/&lt;/code&gt;. If you followed the multiple projects setup, you can visit &lt;code&gt;http://project-1.dev/&lt;/code&gt; and &lt;code&gt;http://project-2.dev/&lt;/code&gt;. But first don&amp;rsquo;t&lt;/p&gt;
  143. </description>
  144. </item>
  145. </channel>
  146. </rss>