index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <!DOCTYPE html>
  2. <html class="no-js">
  3. <head lang="en-us">
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
  6. <meta http-equiv="X-UA-Compatible" content="IE=10" />
  7. <title>Getting Started - Laradock</title>
  8. <meta name="generator" content="Hugo 0.19" />
  9. <meta name="description" content="Laradock documentations.">
  10. <link rel="canonical" href="http://laradock.io/getting-started/">
  11. <meta name="author" content="Mahmoud Zalt">
  12. <meta property="og:url" content="http://laradock.io/getting-started/">
  13. <meta property="og:title" content="Laradock">
  14. <meta property="og:image" content="http://laradock.io/images/logo.png">
  15. <meta name="apple-mobile-web-app-title" content="Laradock">
  16. <meta name="apple-mobile-web-app-capable" content="yes">
  17. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  18. <link rel="shortcut icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
  19. <link rel="icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
  20. <style>
  21. @font-face {
  22. font-family: 'Icon';
  23. src: url('http://laradock.io/fonts/icon.eot');
  24. src: url('http://laradock.io/fonts/icon.eot')
  25. format('embedded-opentype'),
  26. url('http://laradock.io/fonts/icon.woff')
  27. format('woff'),
  28. url('http://laradock.io/fonts/icon.ttf')
  29. format('truetype'),
  30. url('http://laradock.io/fonts/icon.svg')
  31. format('svg');
  32. font-weight: normal;
  33. font-style: normal;
  34. }
  35. </style>
  36. <link rel="stylesheet" href="http://laradock.io/stylesheets/application.css">
  37. <link rel="stylesheet" href="http://laradock.io/stylesheets/temporary.css">
  38. <link rel="stylesheet" href="http://laradock.io/stylesheets/palettes.css">
  39. <link rel="stylesheet" href="http://laradock.io/stylesheets/highlight/highlight.css">
  40. <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Doctarine:400,700|Source&#43;Code&#43;Pro">
  41. <style>
  42. body, input {
  43. font-family: 'Doctarine', Helvetica, Arial, sans-serif;
  44. }
  45. pre, code {
  46. font-family: 'Source Code Pro', 'Courier New', 'Courier', monospace;
  47. }
  48. </style>
  49. <script src="http://laradock.io/javascripts/modernizr.js"></script>
  50. </head>
  51. <body class="palette-primary-deep-purple palette-accent-purple">
  52. <div class="backdrop">
  53. <div class="backdrop-paper"></div>
  54. </div>
  55. <input class="toggle" type="checkbox" id="toggle-drawer">
  56. <input class="toggle" type="checkbox" id="toggle-search">
  57. <label class="toggle-button overlay" for="toggle-drawer"></label>
  58. <header class="header">
  59. <nav aria-label="Header">
  60. <div class="bar default">
  61. <div class="button button-menu" role="button" aria-label="Menu">
  62. <label class="toggle-button icon icon-menu" for="toggle-drawer">
  63. <span></span>
  64. </label>
  65. </div>
  66. <div class="stretch">
  67. <div class="title">
  68. <b>Laradock</b> <span style="color: rgba(249, 245, 255, 0.63);"> / Getting Started</span>
  69. </div>
  70. </div>
  71. <div class="button button-github" role="button" aria-label="GitHub">
  72. <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>
  73. </div>
  74. <p style="font-size: 18px; padding: 8px">Github</p>
  75. </div>
  76. <div class="bar search">
  77. <div class="button button-close" role="button" aria-label="Close">
  78. <label class="toggle-button icon icon-back" for="toggle-search"></label>
  79. </div>
  80. <div class="stretch">
  81. <div class="field">
  82. <input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
  83. </div>
  84. </div>
  85. <div class="button button-reset" role="button" aria-label="Search">
  86. <button class="toggle-button icon icon-close" id="reset-search"></button>
  87. </div>
  88. </div>
  89. </nav>
  90. </header>
  91. <main class="main">
  92. <div class="drawer">
  93. <nav aria-label="Navigation">
  94. <a href="http://laradock.io/" class="project">
  95. <div class="banner">
  96. <div class="logo">
  97. <img src="http://laradock.io/images/logo.png">
  98. </div>
  99. </div>
  100. </a>
  101. <div class="scrollable">
  102. <div class="wrapper">
  103. <div class="toc">
  104. <ul>
  105. <li>
  106. <a title="Introduction" href="http://laradock.io/introduction/">
  107. Introduction
  108. </a>
  109. </li>
  110. <li>
  111. <a class="current" title="Getting Started" href="http://laradock.io/getting-started/">
  112. Getting Started
  113. </a>
  114. <ul id="scrollspy">
  115. </ul>
  116. </li>
  117. <li>
  118. <a title="Documentation" href="http://laradock.io/documentation/">
  119. Documentation
  120. </a>
  121. </li>
  122. <li>
  123. <a title="Giudes" href="http://laradock.io/guides/">
  124. Giudes
  125. </a>
  126. </li>
  127. <li>
  128. <a title="Help &amp; Questions" href="http://laradock.io/help/">
  129. Help &amp; Questions
  130. </a>
  131. </li>
  132. <li>
  133. <a title="Related Projects" href="http://laradock.io/related-projects/">
  134. Related Projects
  135. </a>
  136. </li>
  137. <li>
  138. <a title="Contributing" href="http://laradock.io/contributing/">
  139. Contributing
  140. </a>
  141. </li>
  142. <li>
  143. <a title="License" href="http://laradock.io/license/">
  144. License
  145. </a>
  146. </li>
  147. </ul>
  148. <ul>
  149. </ul>
  150. </div>
  151. </div>
  152. </div>
  153. </nav>
  154. </div>
  155. <article class="article">
  156. <div class="wrapper">
  157. <h1>Getting Started </h1>
  158. <h2 id="requirements">Requirements</h2>
  159. <ul>
  160. <li><a href="https://git-scm.com/downloads">Git</a></li>
  161. <li><a href="https://www.docker.com/products/docker/">Docker</a> <code>&gt;= 1.12</code></li>
  162. </ul>
  163. <h2 id="installation">Installation</h2>
  164. <p>Choose the setup the best suits your needs.</p>
  165. <ul>
  166. <li><a href="#A">A) Setup for Single Project</a>
  167. <ul>
  168. <li><a href="#A1">A.1) Already have a PHP project</a></li>
  169. <li><a href="#A2">A.2) Don&rsquo;t have a PHP project yet</a></li>
  170. </ul></li>
  171. <li><a href="#B">B) Setup for Multiple Projects</a></li>
  172. </ul>
  173. <p><a name="A"></a></p>
  174. <h3 id="a-setup-for-single-project">A) Setup for Single Project</h3>
  175. <blockquote>
  176. <p>(Follow these steps if you want a separate Docker environment for each project)</p>
  177. </blockquote>
  178. <p><a name="A1"></a></p>
  179. <h3 id="a-1-already-have-a-php-project">A.1) Already have a PHP project:</h3>
  180. <p>1 - Clone laradock on your project root directory:</p>
  181. <pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
  182. </code></pre>
  183. <p><strong>Notes:</strong></p>
  184. <ul>
  185. <li><p>If you are not using Git yet for your project, you can use <code>git clone</code> instead of <code>git submodule</code>.</p></li>
  186. <li><p>Note 2: To keep track of your Laradock changes, between your projects and also keep Laradock updated. <a href="http://laradock.io/documentation/#keep-track-of-your-laradock-changes">Check this</a></p></li>
  187. </ul>
  188. <p>Your folder structure should look like this:</p>
  189. <pre><code>+ project-a
  190. + laradock-a
  191. + project-b
  192. + laradock-b
  193. </code></pre>
  194. <p>(It&rsquo;s important to rename the folders differently in each project.)</p>
  195. <blockquote>
  196. <p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
  197. </blockquote>
  198. <p><a name="A2"></a></p>
  199. <h3 id="a-2-don-t-have-a-php-project-yet">A.2) Don&rsquo;t have a PHP project yet:</h3>
  200. <p>1 - Clone this repository anywhere on your machine:</p>
  201. <pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
  202. </code></pre>
  203. <p>Your folder structure should look like this:</p>
  204. <pre><code>+ laradock
  205. + project-z
  206. </code></pre>
  207. <p>2 - Edit your web server sites configuration.</p>
  208. <p><strong>In case of NGINX:</strong> open <code>nginx/sites/default.conf</code> and change the <code>root</code> from <code>/var/www/public</code> to <code>/var/www/{my-project-folder-name}/public</code>.</p>
  209. <p><em>Or you can keep <code>default.conf</code> as it is, and create a separate config <code>my-site.conf</code> file for it.</em></p>
  210. <p><strong>In case of Apache:</strong> :P</p>
  211. <p><br></p>
  212. <blockquote>
  213. <p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
  214. </blockquote>
  215. <p><a name="B"></a></p>
  216. <h3 id="b-setup-for-multiple-projects">B) Setup for Multiple Projects:</h3>
  217. <blockquote>
  218. <p>(Follow these steps if you want a single Docker environment for all your project)</p>
  219. </blockquote>
  220. <p>1 - Clone this repository anywhere on your machine (similar to <a href="#A2">Steps A.2. from above</a>):</p>
  221. <pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
  222. </code></pre>
  223. <p>Your folder structure should look like this:</p>
  224. <pre><code>+ laradock
  225. + project-1
  226. + project-2
  227. </code></pre>
  228. <p>2 - Go to <code>nginx/sites</code> and create config files to point to different project directory when visiting different domains.</p>
  229. <p>Laradock by default includes <code>project-1.conf</code> and <code>project-2.conf</code> as working samples.</p>
  230. <p>3 - change the default names <code>project-n</code>:</p>
  231. <p>You can rename the config files, project folders and domains as you like, just make sure the <code>root</code> in the config files, is pointing to the correct project folder name.</p>
  232. <p>4 - Add the domains to the <strong>hosts</strong> files.</p>
  233. <pre><code>127.0.0.1 project-1.dev
  234. 127.0.0.1 project-2.dev
  235. </code></pre>
  236. <blockquote>
  237. <p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
  238. </blockquote>
  239. <p><a name="Usage"></a></p>
  240. <h2 id="usage">Usage</h2>
  241. <p><strong>Read Before starting:</strong></p>
  242. <p>If you are using <strong>Docker Toolbox</strong> (VM), do one of the following:</p>
  243. <ul>
  244. <li>Upgrade to Docker <a href="https://www.docker.com/products/docker">Native</a> for Mac/Windows (Recommended). Check out <a href="http://laradock.io/documentation/#upgrading-laradock">Upgrading Laradock</a></li>
  245. <li>Use Laradock v3.*. Visit the <a href="https://github.com/laradock/laradock/tree/LaraDock-ToolBox">LaraDock-ToolBox</a> branch. <em>(outdated)</em></li>
  246. </ul>
  247. <p><br></p>
  248. <blockquote>
  249. <p><strong>Warning:</strong> If you used an older version of Laradock it&rsquo;s highly recommended to rebuild the containers you need to use <a href="#Build-Re-build-Containers">see how you rebuild a container</a> in order to prevent as much errors as possible.</p>
  250. </blockquote>
  251. <p><br></p>
  252. <p>1 - Enter the laradock folder and rename <code>env-example</code> to <code>.env</code></p>
  253. <pre><code class="language-shell">cp env-example .env
  254. </code></pre>
  255. <p>You can edit the <code>.env</code> file to chose which software&rsquo;s you want to be installed in your environment. You can always refer to the <code>docker-compose.yml</code> file to see how those variables are been used.</p>
  256. <p>2 - Build the enviroment and run it using <code>docker-compose</code></p>
  257. <p>In this example we&rsquo;ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:</p>
  258. <pre><code class="language-bash">docker-compose up -d nginx mysql
  259. </code></pre>
  260. <p><strong>Note</strong>: The <code>workspace</code> and <code>php-fpm</code> will run automatically in most of the cases, so no need to specify them in the <code>up</code> command. If you couldn&rsquo;t find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
  261. <p>You can select your own combination of containers form the list below:</p>
  262. <blockquote>
  263. <p><code>nginx</code>, <code>hhvm</code>, <code>php-fpm</code>, <code>mysql</code>, <code>redis</code>, <code>postgres</code>, <code>mariadb</code>, <code>neo4j</code>, <code>mongo</code>, <code>apache2</code>, <code>caddy</code>, <code>memcached</code>, <code>beanstalkd</code>, <code>beanstalkd-console</code>, <code>rabbitmq</code>, <code>beanstalkd-console</code>, <code>workspace</code>, <code>phpmyadmin</code>, <code>adminer</code>, <code>aerospike</code>, <code>pgadmin</code>, <code>elasticsearch</code>, <code>rethinkdb</code>, <code>postgres-postgis</code>, <code>certbot</code>, <code>mailhog</code>, <code>minio</code> and more&hellip;!</p>
  264. </blockquote>
  265. <p><em>(Please note that sometimes we forget to update the docs, so check the <code>docker-compose.yml</code> file to see an updated list of all available containers).</em></p>
  266. <p><br>
  267. 3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &hellip;)</p>
  268. <pre><code class="language-bash">docker-compose exec workspace bash
  269. </code></pre>
  270. <p><em>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</em></p>
  271. <pre><code class="language-bash">docker exec -it {workspace-container-id} bash
  272. </code></pre>
  273. <p><strong>Note:</strong> You can add <code>--user=laradock</code> to have files created as your host&rsquo;s user. Example:</p>
  274. <pre><code class="language-shell">docker-compose exec --user=laradock workspace bash
  275. </code></pre>
  276. <p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>.env</code> file)</em></p>
  277. <p><br>
  278. 4 - Update your project configurations to use the database host</p>
  279. <p>Open your PHP project&rsquo;s <code>.env</code> file or whichever configuration file you are reading from, and set the database host <code>DB_HOST</code> to <code>mysql</code>:</p>
  280. <pre><code class="language-env">DB_HOST=mysql
  281. </code></pre>
  282. <p><em>If you want to install Laravel as PHP project, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
  283. <p><br>
  284. 5 - Open your browser and visit your localhost address <code>http://localhost/</code>. If you followed the multiple projects setup, you can visit <code>http://project-1.dev/</code> and <code>http://project-2.dev/</code>. But first don&rsquo;t</p>
  285. <aside class="copyright" role="note">
  286. Documentation built with
  287. <a href="https://www.gohugo.io" target="_blank">Hugo</a>
  288. using the
  289. <a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
  290. </aside>
  291. <footer class="footer">
  292. <nav class="pagination" aria-label="Footer">
  293. <div class="previous">
  294. <a href="http://laradock.io/introduction/" title="Introduction">
  295. <span class="direction">
  296. Previous
  297. </span>
  298. <div class="page">
  299. <div class="button button-previous" role="button" aria-label="Previous">
  300. <i class="icon icon-back"></i>
  301. </div>
  302. <div class="stretch">
  303. <div class="title">
  304. Introduction
  305. </div>
  306. </div>
  307. </div>
  308. </a>
  309. </div>
  310. <div class="next">
  311. <a href="http://laradock.io/documentation/" title="Documentation">
  312. <span class="direction">
  313. Next
  314. </span>
  315. <div class="page">
  316. <div class="stretch">
  317. <div class="title">
  318. Documentation
  319. </div>
  320. </div>
  321. <div class="button button-next" role="button" aria-label="Next">
  322. <i class="icon icon-forward"></i>
  323. </div>
  324. </div>
  325. </a>
  326. </div>
  327. </nav>
  328. </footer>
  329. </div>
  330. </article>
  331. <div class="results" role="status" aria-live="polite">
  332. <div class="scrollable">
  333. <div class="wrapper">
  334. <div class="meta"></div>
  335. <div class="list"></div>
  336. </div>
  337. </div>
  338. </div>
  339. </main>
  340. <script>
  341. var base_url = '';
  342. var repo_id = '';
  343. </script>
  344. <script src="http://laradock.io/javascripts/application.js"></script>
  345. <script>
  346. /* Add headers to scrollspy */
  347. var headers = document.getElementsByTagName("h2");
  348. var scrollspy = document.getElementById('scrollspy');
  349. if(scrollspy) {
  350. if(headers.length > 0) {
  351. for(var i = 0; i < headers.length; i++) {
  352. var li = document.createElement("li");
  353. li.setAttribute("class", "anchor");
  354. var a = document.createElement("a");
  355. a.setAttribute("href", "#" + headers[i].id);
  356. a.setAttribute("title", headers[i].innerHTML);
  357. a.innerHTML = headers[i].innerHTML;
  358. li.appendChild(a)
  359. scrollspy.appendChild(li);
  360. }
  361. } else {
  362. scrollspy.parentElement.removeChild(scrollspy)
  363. }
  364. /* Add permanent link next to the headers */
  365. var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
  366. for(var i = 0; i < headers.length; i++) {
  367. var a = document.createElement("a");
  368. a.setAttribute("class", "headerlink");
  369. a.setAttribute("href", "#" + headers[i].id);
  370. a.setAttribute("title", "Permanent link")
  371. a.innerHTML = "#";
  372. headers[i].appendChild(a);
  373. }
  374. }
  375. </script>
  376. <script>
  377. (function(i,s,o,g,r,a,m){
  378. i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
  379. []).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  380. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
  381. m.parentNode.insertBefore(a,m)
  382. })(window, document,
  383. 'script', '//www.google-analytics.com/analytics.js', 'ga');
  384. ga('create', 'UA-37514928-9', 'auto');
  385. ga('set', 'anonymizeIp', true);
  386. ga('send', 'pageview');
  387. var buttons = document.querySelectorAll('a');
  388. Array.prototype.map.call(buttons, function(item) {
  389. if (item.host != document.location.host) {
  390. item.addEventListener('click', function() {
  391. var action = item.getAttribute('data-action') || 'follow';
  392. ga('send', 'event', 'outbound', action, item.href);
  393. });
  394. }
  395. });
  396. var query = document.querySelector('.query');
  397. query.addEventListener('blur', function() {
  398. if (this.value) {
  399. var path = document.location.pathname;
  400. ga('send', 'pageview', path + '?q=' + this.value);
  401. }
  402. });
  403. </script>
  404. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
  405. <script>hljs.initHighlightingOnLoad();</script>
  406. </body>
  407. </html>