index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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.18.1" />
  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 name="apple-mobile-web-app-title" content="Laradock">
  15. <meta name="apple-mobile-web-app-capable" content="yes">
  16. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  17. <link rel="shortcut icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
  18. <link rel="icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
  19. <style>
  20. @font-face {
  21. font-family: 'Icon';
  22. src: url('http://laradock.io/fonts/icon.eot');
  23. src: url('http://laradock.io/fonts/icon.eot')
  24. format('embedded-opentype'),
  25. url('http://laradock.io/fonts/icon.woff')
  26. format('woff'),
  27. url('http://laradock.io/fonts/icon.ttf')
  28. format('truetype'),
  29. url('http://laradock.io/fonts/icon.svg')
  30. format('svg');
  31. font-weight: normal;
  32. font-style: normal;
  33. }
  34. </style>
  35. <link rel="stylesheet" href="http://laradock.io/stylesheets/application.css">
  36. <link rel="stylesheet" href="http://laradock.io/stylesheets/temporary.css">
  37. <link rel="stylesheet" href="http://laradock.io/stylesheets/palettes.css">
  38. <link rel="stylesheet" href="http://laradock.io/stylesheets/highlight/highlight.css">
  39. <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Doctarine:400,700|Source&#43;Code&#43;Pro">
  40. <style>
  41. body, input {
  42. font-family: 'Doctarine', Helvetica, Arial, sans-serif;
  43. }
  44. pre, code {
  45. font-family: 'Source Code Pro', 'Courier New', 'Courier', monospace;
  46. }
  47. </style>
  48. <script src="http://laradock.io/javascripts/modernizr.js"></script>
  49. </head>
  50. <body class="palette-primary-deep-purple palette-accent-purple">
  51. <div class="backdrop">
  52. <div class="backdrop-paper"></div>
  53. </div>
  54. <input class="toggle" type="checkbox" id="toggle-drawer">
  55. <input class="toggle" type="checkbox" id="toggle-search">
  56. <label class="toggle-button overlay" for="toggle-drawer"></label>
  57. <header class="header">
  58. <nav aria-label="Header">
  59. <div class="bar default">
  60. <div class="button button-menu" role="button" aria-label="Menu">
  61. <label class="toggle-button icon icon-menu" for="toggle-drawer">
  62. <span></span>
  63. </label>
  64. </div>
  65. <div class="stretch">
  66. <div class="title">
  67. <b>Laradock</b> <span style="color: rgba(249, 245, 255, 0.63);"> / Getting Started</span>
  68. </div>
  69. </div>
  70. <div class="button button-github" role="button" aria-label="GitHub">
  71. <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>
  72. </div>
  73. <p style="font-size: 18px; padding: 8px">Github</p>
  74. </div>
  75. <div class="bar search">
  76. <div class="button button-close" role="button" aria-label="Close">
  77. <label class="toggle-button icon icon-back" for="toggle-search"></label>
  78. </div>
  79. <div class="stretch">
  80. <div class="field">
  81. <input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
  82. </div>
  83. </div>
  84. <div class="button button-reset" role="button" aria-label="Search">
  85. <button class="toggle-button icon icon-close" id="reset-search"></button>
  86. </div>
  87. </div>
  88. </nav>
  89. </header>
  90. <main class="main">
  91. <div class="drawer">
  92. <nav aria-label="Navigation">
  93. <div class="scrollable">
  94. <div class="wrapper">
  95. <div class="toc">
  96. <ul>
  97. <li>
  98. <a title="Introduction" href="http://laradock.io/introduction/">
  99. Introduction
  100. </a>
  101. </li>
  102. <li>
  103. <a class="current" title="Getting Started" href="http://laradock.io/getting-started/">
  104. Getting Started
  105. </a>
  106. <ul id="scrollspy">
  107. </ul>
  108. </li>
  109. <li>
  110. <a title="Documentation" href="http://laradock.io/documentation/">
  111. Documentation
  112. </a>
  113. </li>
  114. <li>
  115. <a title="Related Projects" href="http://laradock.io/related-projects/">
  116. Related Projects
  117. </a>
  118. </li>
  119. <li>
  120. <a title="Help &amp; Questions" href="http://laradock.io/help/">
  121. Help &amp; Questions
  122. </a>
  123. </li>
  124. <li>
  125. <a title="Contributing" href="http://laradock.io/contributing/">
  126. Contributing
  127. </a>
  128. </li>
  129. <li>
  130. <a title="License" href="http://laradock.io/license/">
  131. License
  132. </a>
  133. </li>
  134. </ul>
  135. <ul>
  136. </ul>
  137. </div>
  138. </div>
  139. </div>
  140. </nav>
  141. </div>
  142. <article class="article">
  143. <div class="wrapper">
  144. <h1>Getting Started </h1>
  145. <h2 id="requirements">Requirements</h2>
  146. <ul>
  147. <li><a href="https://git-scm.com/downloads">Git</a></li>
  148. <li><a href="https://www.docker.com/products/docker/">Docker</a> <code>&gt;= 1.12</code></li>
  149. </ul>
  150. <h2 id="installation">Installation</h2>
  151. <p>Choose the setup the best suits your needs.</p>
  152. <h4 id="a-setup-for-single-project">A) Setup for Single Project:</h4>
  153. <p><em>(In case you want a Docker environment for each project)</em></p>
  154. <h5 id="a-1-setup-environment-in-existing-project">A.1) Setup environment in existing Project:</h5>
  155. <p><em>(In case you already have a project, and you want to setup an environment to run it)</em></p>
  156. <p>1 - Clone this repository on your project root directory:</p>
  157. <pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
  158. </code></pre>
  159. <p><em>Note 1: If you are not yet using Git for your PHP project, you can use <code>git clone https://github.com/Laradock/laradock.git</code> instead.</em></p>
  160. <p><em>Note 2: To keep track of your LaraDock changes, between your projects and also keep LaraDock updated. <a href="#keep-tracking-LaraDock">Check this</a></em></p>
  161. <p><em>Note 3: In this case the folder structure will be like this:</em></p>
  162. <pre><code>- project1
  163. - laradock
  164. - project2
  165. - laradock
  166. </code></pre>
  167. <h5 id="a-2-setup-environment-first-then-create-project">A.2) Setup environment first then create project:</h5>
  168. <p><em>(In case you don&rsquo;t have a project, and you want to create your project inside the Docker environment)</em></p>
  169. <p>1 - Clone this repository anywhere on your machine:</p>
  170. <pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
  171. </code></pre>
  172. <p>Note: In this case the folder structure will be like this:</p>
  173. <pre><code>- projects
  174. - laradock
  175. - myProject
  176. </code></pre>
  177. <p>2 - Edit the <code>docker-compose.yml</code> file to map to your project directory once you have it (example: <code>- ../myProject:/var/www</code>).</p>
  178. <p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
  179. <pre><code>docker-compose stop &amp;&amp; docker-compose up -d XXXX YYYY ZZZZ ....
  180. </code></pre>
  181. <h4 id="b-setup-for-multiple-projects">B) Setup for Multiple Projects:</h4>
  182. <p>1 - Clone this repository anywhere on your machine:</p>
  183. <pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
  184. </code></pre>
  185. <p>2 - Edit the <code>docker-compose.yml</code> file to map to your projects directories:</p>
  186. <pre><code> applications:
  187. image: tianon/true
  188. volumes:
  189. - ../project1/:/var/www/project1
  190. - ../project2/:/var/www/project2
  191. </code></pre>
  192. <p>3 - You can access all sites by visiting <code>http://localhost/project1/public</code> and <code>http://localhost/project2/public</code> but of course that&rsquo;s not very useful so let&rsquo;s setup NGINX quickly.</p>
  193. <p>4 - Go to <code>nginx/sites</code> and copy <code>sample.conf.example</code> to <code>project1.conf</code> then to <code>project2.conf</code></p>
  194. <p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
  195. <pre><code> server_name project1.dev;
  196. root /var/www/project1/public;
  197. </code></pre>
  198. <p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,&hellip;</p>
  199. <p>6 - Add the domains to the <strong>hosts</strong> files.</p>
  200. <pre><code>127.0.0.1 project1.dev
  201. </code></pre>
  202. <p>7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.</p>
  203. <h2 id="usage">Usage</h2>
  204. <p><strong>Read Before starting:</strong></p>
  205. <p>If you are using <strong>Docker Toolbox</strong> (VM), do one of the following:</p>
  206. <ul>
  207. <li>Upgrade to Docker <a href="https://www.docker.com/products/docker">Native</a> for Mac/Windows (Recommended). Check out <a href="#upgrading-laradock">Upgrading LaraDock</a></li>
  208. <li>Use LaraDock v3.* (Visit the <code>LaraDock-ToolBox</code> <a href="https://github.com/laradock/laradock/tree/LaraDock-ToolBox">Branch</a>).</li>
  209. </ul>
  210. <p><br></p>
  211. <blockquote>
  212. <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 errors as much as possible.</p>
  213. </blockquote>
  214. <p><br></p>
  215. <p>1 - Run Containers: <em>(Make sure you are in the <code>laradock</code> folder before running the <code>docker-compose</code> commands).</em></p>
  216. <p><strong>Example:</strong> Running NGINX and MySQL:</p>
  217. <pre><code class="language-bash">docker-compose up -d nginx mysql
  218. </code></pre>
  219. <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>
  220. <p>You can select your own combination of Containers form the list below:</p>
  221. <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>workspace</code>, <code>phpmyadmin</code>, <code>aerospike</code>, <code>pgadmin</code>, <code>elasticsearch</code>, <code>rethinkdb</code>.</p>
  222. <p><br>
  223. 2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &hellip;).</p>
  224. <pre><code class="language-bash">docker-compose exec workspace bash
  225. </code></pre>
  226. <p>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</p>
  227. <pre><code class="language-bash">docker exec -it {workspace-container-id} bash
  228. </code></pre>
  229. <p><strong>Note:</strong> You can 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. (you can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code>).</p>
  230. <p><br>
  231. 3 - Edit your project configurations.</p>
  232. <p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
  233. <pre><code class="language-env">DB_HOST=mysql
  234. </code></pre>
  235. <p><em>If you want to use Laravel and you don&rsquo;t have it installed yet, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
  236. <p><br>
  237. 4 - Open your browser and visit your localhost address (<code>http://localhost/</code>).</p>
  238. <p><br>
  239. <strong>Debugging</strong>: if you are facing any problem here check the <a href="#debugging">Debugging</a> section.</p>
  240. <p>If you need a special support. Contact me, more details in the <a href="#Help">Help &amp; Questions</a> section.</p>
  241. <aside class="copyright" role="note">
  242. Documentation built with
  243. <a href="https://www.gohugo.io" target="_blank">Hugo</a>
  244. using the
  245. <a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
  246. </aside>
  247. <footer class="footer">
  248. <nav class="pagination" aria-label="Footer">
  249. <div class="previous">
  250. <a href="http://laradock.io/introduction/" title="Introduction">
  251. <span class="direction">
  252. Previous
  253. </span>
  254. <div class="page">
  255. <div class="button button-previous" role="button" aria-label="Previous">
  256. <i class="icon icon-back"></i>
  257. </div>
  258. <div class="stretch">
  259. <div class="title">
  260. Introduction
  261. </div>
  262. </div>
  263. </div>
  264. </a>
  265. </div>
  266. <div class="next">
  267. <a href="http://laradock.io/documentation/" title="Documentation">
  268. <span class="direction">
  269. Next
  270. </span>
  271. <div class="page">
  272. <div class="stretch">
  273. <div class="title">
  274. Documentation
  275. </div>
  276. </div>
  277. <div class="button button-next" role="button" aria-label="Next">
  278. <i class="icon icon-forward"></i>
  279. </div>
  280. </div>
  281. </a>
  282. </div>
  283. </nav>
  284. </footer>
  285. </div>
  286. </article>
  287. <div class="results" role="status" aria-live="polite">
  288. <div class="scrollable">
  289. <div class="wrapper">
  290. <div class="meta"></div>
  291. <div class="list"></div>
  292. </div>
  293. </div>
  294. </div>
  295. </main>
  296. <script>
  297. var base_url = '';
  298. var repo_id = '';
  299. </script>
  300. <script src="http://laradock.io/javascripts/application.js"></script>
  301. <script>
  302. /* Add headers to scrollspy */
  303. var headers = document.getElementsByTagName("h2");
  304. var scrollspy = document.getElementById('scrollspy');
  305. if(scrollspy) {
  306. if(headers.length > 0) {
  307. for(var i = 0; i < headers.length; i++) {
  308. var li = document.createElement("li");
  309. li.setAttribute("class", "anchor");
  310. var a = document.createElement("a");
  311. a.setAttribute("href", "#" + headers[i].id);
  312. a.setAttribute("title", headers[i].innerHTML);
  313. a.innerHTML = headers[i].innerHTML;
  314. li.appendChild(a)
  315. scrollspy.appendChild(li);
  316. }
  317. } else {
  318. scrollspy.parentElement.removeChild(scrollspy)
  319. }
  320. /* Add permanent link next to the headers */
  321. var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
  322. for(var i = 0; i < headers.length; i++) {
  323. var a = document.createElement("a");
  324. a.setAttribute("class", "headerlink");
  325. a.setAttribute("href", "#" + headers[i].id);
  326. a.setAttribute("title", "Permanent link")
  327. a.innerHTML = "#";
  328. headers[i].appendChild(a);
  329. }
  330. }
  331. </script>
  332. <script>
  333. (function(i,s,o,g,r,a,m){
  334. i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
  335. []).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  336. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
  337. m.parentNode.insertBefore(a,m)
  338. })(window, document,
  339. 'script', '//www.google-analytics.com/analytics.js', 'ga');
  340. ga('create', 'UA-37514928-9', 'auto');
  341. ga('set', 'anonymizeIp', true);
  342. ga('send', 'pageview');
  343. var buttons = document.querySelectorAll('a');
  344. Array.prototype.map.call(buttons, function(item) {
  345. if (item.host != document.location.host) {
  346. item.addEventListener('click', function() {
  347. var action = item.getAttribute('data-action') || 'follow';
  348. ga('send', 'event', 'outbound', action, item.href);
  349. });
  350. }
  351. });
  352. var query = document.querySelector('.query');
  353. query.addEventListener('blur', function() {
  354. if (this.value) {
  355. var path = document.location.pathname;
  356. ga('send', 'pageview', path + '?q=' + this.value);
  357. }
  358. });
  359. </script>
  360. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
  361. <script>hljs.initHighlightingOnLoad();</script>
  362. </body>
  363. </html>