1720 lines
59 KiB
HTML
1720 lines
59 KiB
HTML
|
<!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>Getting started - Laradock Docs</title>
|
||
|
<meta name="generator" content="Hugo 0.18.1" />
|
||
|
|
||
|
|
||
|
<meta name="description" content="Laradock documentations.">
|
||
|
|
||
|
<link rel="canonical" href="https://laradock.io/getting-started/">
|
||
|
|
||
|
<meta name="author" content="Mahmoud Zalt">
|
||
|
|
||
|
|
||
|
<meta property="og:url" content="https://laradock.io/getting-started/">
|
||
|
<meta property="og:title" content="Laradock Docs">
|
||
|
<meta property="og:image" content="https://laradock.io/images/logo.png">
|
||
|
<meta name="apple-mobile-web-app-title" content="Laradock Docs">
|
||
|
<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="https://laradock.io/images/favicon.ico">
|
||
|
<link rel="icon" type="image/x-icon" href="https://laradock.io/images/favicon.ico">
|
||
|
|
||
|
<style>
|
||
|
@font-face {
|
||
|
font-family: 'Icon';
|
||
|
src: url('https://laradock.io/fonts/icon.eot');
|
||
|
src: url('https://laradock.io/fonts/icon.eot')
|
||
|
format('embedded-opentype'),
|
||
|
url('https://laradock.io/fonts/icon.woff')
|
||
|
format('woff'),
|
||
|
url('https://laradock.io/fonts/icon.ttf')
|
||
|
format('truetype'),
|
||
|
url('https://laradock.io/fonts/icon.svg')
|
||
|
format('svg');
|
||
|
font-weight: normal;
|
||
|
font-style: normal;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<link rel="stylesheet" href="https://laradock.io/stylesheets/application.css">
|
||
|
<link rel="stylesheet" href="https://laradock.io/stylesheets/temporary.css">
|
||
|
<link rel="stylesheet" href="https://laradock.io/stylesheets/palettes.css">
|
||
|
<link rel="stylesheet" href="https://laradock.io/stylesheets/highlight/highlight.css">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:400,700|Ubuntu+Mono">
|
||
|
<style>
|
||
|
body, input {
|
||
|
font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
|
||
|
}
|
||
|
pre, code {
|
||
|
font-family: 'Ubuntu Mono', 'Courier New', 'Courier', monospace;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
|
||
|
<script src="https://laradock.io/javascripts/modernizr.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
<body class="palette-primary-red palette-accent-teal">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<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">
|
||
|
Getting started
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||
|
<a href="https://github.com/laradock" title="@laradock on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</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">
|
||
|
<a href="https://github.com/laradock/laradock" class="project">
|
||
|
<div class="banner">
|
||
|
|
||
|
<div class="logo">
|
||
|
<img src="https://laradock.io/images/logo.png">
|
||
|
</div>
|
||
|
|
||
|
<div class="name">
|
||
|
<strong>Laradock Docs <span class="version">4.18.*</span></strong>
|
||
|
|
||
|
<br>
|
||
|
laradock/laradock
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</a>
|
||
|
|
||
|
<div class="scrollable">
|
||
|
<div class="wrapper">
|
||
|
|
||
|
<ul class="repo">
|
||
|
<li class="repo-download">
|
||
|
<a href="https://github.com/laradock/laradock/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||
|
<i class="icon icon-download"></i> Download
|
||
|
</a>
|
||
|
</li>
|
||
|
<li class="repo-stars">
|
||
|
<a href="https://github.com/laradock/laradock/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||
|
<i class="icon icon-star"></i> Stars
|
||
|
<span class="count">–</span>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<hr>
|
||
|
|
||
|
|
||
|
<div class="toc">
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<li>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<a title="Introduction" href="https://laradock.io/">
|
||
|
|
||
|
Introduction
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
|
||
|
<li>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<a class="current" title="Getting started" href="https://laradock.io/getting-started/">
|
||
|
|
||
|
Getting started
|
||
|
</a>
|
||
|
|
||
|
|
||
|
<ul id="scrollspy">
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
|
||
|
<li>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<a title="License" href="https://laradock.io/license/">
|
||
|
|
||
|
License
|
||
|
</a>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
|
||
|
<hr>
|
||
|
<span class="section">The author</span>
|
||
|
|
||
|
<ul>
|
||
|
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="https://github.com/laradock" target="_blank" title="@laradock on GitHub">
|
||
|
@laradock on GitHub
|
||
|
</a>
|
||
|
</li>
|
||
|
|
||
|
|
||
|
|
||
|
<li>
|
||
|
<a href="mailto:mahmoud@zalt.me" title="Email of mahmoud@zalt.me">
|
||
|
Contact via email
|
||
|
</a>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</nav>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<article class="article">
|
||
|
<div class="wrapper">
|
||
|
<h1>Getting started </h1>
|
||
|
|
||
|
|
||
|
|
||
|
<p><a name="Requirements"></a></p>
|
||
|
|
||
|
<h2 id="requirements:d680e8a854a7cbad6d490c445cba2eba">Requirements</h2>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="https://git-scm.com/downloads">Git</a></li>
|
||
|
<li><a href="https://www.docker.com/products/docker/">Docker</a> <code>>= 1.12</code></li>
|
||
|
</ul>
|
||
|
|
||
|
<p><a name="Installation"></a></p>
|
||
|
|
||
|
<h2 id="installation:d680e8a854a7cbad6d490c445cba2eba">Installation</h2>
|
||
|
|
||
|
<p>Choose the setup the best suits your needs.</p>
|
||
|
|
||
|
<h4 id="a-setup-for-single-project:d680e8a854a7cbad6d490c445cba2eba">A) Setup for Single Project:</h4>
|
||
|
|
||
|
<p><em>(In case you want a Docker environment for each project)</em></p>
|
||
|
|
||
|
<h5 id="a-1-setup-environment-in-existing-project:d680e8a854a7cbad6d490c445cba2eba">A.1) Setup environment in existing Project:</h5>
|
||
|
|
||
|
<p><em>(In case you already have a project, and you want to setup an environment to run it)</em></p>
|
||
|
|
||
|
<p>1 - Clone this repository on your project root directory:</p>
|
||
|
|
||
|
<pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
|
||
|
</code></pre>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p><em>Note 3: In this case the folder structure will be like this:</em></p>
|
||
|
|
||
|
<pre><code>- project1
|
||
|
- laradock
|
||
|
- project2
|
||
|
- laradock
|
||
|
</code></pre>
|
||
|
|
||
|
<h5 id="a-2-setup-environment-first-then-create-project:d680e8a854a7cbad6d490c445cba2eba">A.2) Setup environment first then create project:</h5>
|
||
|
|
||
|
<p><em>(In case you don't have a project, and you want to create your project inside the Docker environment)</em></p>
|
||
|
|
||
|
<p>1 - Clone this repository anywhere on your machine:</p>
|
||
|
|
||
|
<pre><code class="language-bash">git clone https://github.com/LaraDock/laradock.git
|
||
|
</code></pre>
|
||
|
|
||
|
<p>Note: In this case the folder structure will be like this:</p>
|
||
|
|
||
|
<pre><code>- projects
|
||
|
- laradock
|
||
|
- myProject
|
||
|
</code></pre>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
|
||
|
|
||
|
<pre><code>docker-compose stop && docker-compose up -d XXXX YYYY ZZZZ ....
|
||
|
</code></pre>
|
||
|
|
||
|
<h4 id="b-setup-for-multiple-projects:d680e8a854a7cbad6d490c445cba2eba">B) Setup for Multiple Projects:</h4>
|
||
|
|
||
|
<p>1 - Clone this repository anywhere on your machine:</p>
|
||
|
|
||
|
<pre><code class="language-bash">git clone https://github.com/LaraDock/laradock.git
|
||
|
</code></pre>
|
||
|
|
||
|
<p>2 - Edit the <code>docker-compose.yml</code> file to map to your projects directories:</p>
|
||
|
|
||
|
<pre><code> applications:
|
||
|
image: tianon/true
|
||
|
volumes:
|
||
|
- ../project1/:/var/www/project1
|
||
|
- ../project2/:/var/www/project2
|
||
|
</code></pre>
|
||
|
|
||
|
<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's not very useful so let's setup nginx quickly.</p>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
|
||
|
|
||
|
<pre><code> server_name project1.dev;
|
||
|
root /var/www/project1/public;
|
||
|
</code></pre>
|
||
|
|
||
|
<p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,...</p>
|
||
|
|
||
|
<p>6 - Add the domains to the <strong>hosts</strong> files.</p>
|
||
|
|
||
|
<pre><code>127.0.0.1 project1.dev
|
||
|
</code></pre>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p><a name="Usage"></a></p>
|
||
|
|
||
|
<h2 id="usage:d680e8a854a7cbad6d490c445cba2eba">Usage</h2>
|
||
|
|
||
|
<p><strong>Read Before starting:</strong></p>
|
||
|
|
||
|
<p>If you are using <strong>Docker Toolbox</strong> (VM), do one of the following:</p>
|
||
|
|
||
|
<ul>
|
||
|
<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>
|
||
|
<li>Use LaraDock v3.* (Visit the <code>LaraDock-ToolBox</code> <a href="https://github.com/LaraDock/laradock/tree/LaraDock-ToolBox">Branch</a>).</li>
|
||
|
</ul>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<blockquote>
|
||
|
<p><strong>Warning:</strong> If you used an older version of LaraDock it'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>
|
||
|
</blockquote>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p><strong>Example:</strong> Running NGINX and MySQL:</p>
|
||
|
|
||
|
<pre><code class="language-bash">docker-compose up -d nginx mysql
|
||
|
</code></pre>
|
||
|
|
||
|
<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't find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
|
||
|
|
||
|
<p>You can select your own combination of Containers form the list below:</p>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p><br>
|
||
|
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...).</p>
|
||
|
|
||
|
<pre><code class="language-bash">docker-compose exec workspace bash
|
||
|
</code></pre>
|
||
|
|
||
|
<p>Alternativey, for Windows Powershell users: execute the following command to enter any running container:</p>
|
||
|
|
||
|
<pre><code class="language-bash">docker exec -it {workspace-container-id} bash
|
||
|
</code></pre>
|
||
|
|
||
|
<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's user. (you can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code>).</p>
|
||
|
|
||
|
<p><br>
|
||
|
3 - Edit your project configurations.</p>
|
||
|
|
||
|
<p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||
|
|
||
|
<pre><code class="language-env">DB_HOST=mysql
|
||
|
</code></pre>
|
||
|
|
||
|
<p><em>If you want to use Laravel and you don't have it installed yet, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
|
||
|
|
||
|
<p><br>
|
||
|
4 - Open your browser and visit your localhost address (<code>http://localhost/</code>).</p>
|
||
|
|
||
|
<p><br>
|
||
|
<strong>Debugging</strong>: if you are facing any problem here check the <a href="#debugging">Debugging</a> section.</p>
|
||
|
|
||
|
<p>If you need a special support. Contact me, more details in the <a href="#Help">Help & Questions</a> section.</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Documentation"></a></p>
|
||
|
|
||
|
<h2 id="documentation:d680e8a854a7cbad6d490c445cba2eba">Documentation</h2>
|
||
|
|
||
|
<p><a name="Docker"></a></p>
|
||
|
|
||
|
<p><a name="List-current-running-Containers"></a></p>
|
||
|
|
||
|
<h3 id="list-current-running-containers:d680e8a854a7cbad6d490c445cba2eba">List current running Containers</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="close-all-running-containers:d680e8a854a7cbad6d490c445cba2eba">Close all running Containers</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="delete-all-existing-containers:d680e8a854a7cbad6d490c445cba2eba">Delete all existing Containers</h3>
|
||
|
|
||
|
<pre><code class="language-bash">docker-compose down
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Enter-Container"></a></p>
|
||
|
|
||
|
<h3 id="enter-a-container-run-commands-in-a-running-container:d680e8a854a7cbad6d490c445cba2eba">Enter a Container (run commands in a running Container)</h3>
|
||
|
|
||
|
<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>3 - To exit a container, type <code>exit</code>.</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Edit-Container"></a></p>
|
||
|
|
||
|
<h3 id="edit-default-container-configuration:d680e8a854a7cbad6d490c445cba2eba">Edit default container configuration</h3>
|
||
|
|
||
|
<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 defaut port to 1111:</p>
|
||
|
|
||
|
<pre><code class="language-yml"> ports:
|
||
|
- "1111:6379"
|
||
|
...
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Edit-a-Docker-Image"></a></p>
|
||
|
|
||
|
<h3 id="edit-a-docker-image:d680e8a854a7cbad6d490c445cba2eba">Edit a Docker Image</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="build-re-build-containers:d680e8a854a7cbad6d490c445cba2eba">Build/Re-build Containers</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="add-more-software-docker-images:d680e8a854a7cbad6d490c445cba2eba">Add more Software (Docker Images)</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="view-the-log-files:d680e8a854a7cbad6d490c445cba2eba">View the Log files</h3>
|
||
|
|
||
|
<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,...) you can run this:</p>
|
||
|
|
||
|
<pre><code class="language-bash">docker logs {container-name}
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="PHP"></a></p>
|
||
|
|
||
|
<p><a name="Install-PHP-Extensions"></a></p>
|
||
|
|
||
|
<h3 id="install-php-extensions:d680e8a854a7cbad6d490c445cba2eba">Install PHP Extensions</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="change-the-php-fpm-version:d680e8a854a7cbad6d490c445cba2eba">Change the (PHP-FPM) Version</h3>
|
||
|
|
||
|
<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't have to change the PHP-CLI version if you are planning to run your application on different PHP-FPM version.</p>
|
||
|
</blockquote>
|
||
|
|
||
|
<h4 id="a-switch-from-php-7-0-to-php-5-6:d680e8a854a7cbad6d490c445cba2eba">A) Switch from PHP <code>7.0</code> to PHP <code>5.6</code></h4>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h4 id="b-switch-from-php-7-0-or-5-6-to-php-5-5:d680e8a854a7cbad6d490c445cba2eba">B) Switch from PHP <code>7.0</code> or <code>5.6</code> to PHP <code>5.5</code></h4>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="change-the-php-cli-version:d680e8a854a7cbad6d490c445cba2eba">Change the PHP-CLI Version</h3>
|
||
|
|
||
|
<p>By default <strong>PHP-CLI 7.0</strong> is running.</p>
|
||
|
|
||
|
<blockquote>
|
||
|
<p>Note: it's not very essential to edit the PHP-CLI version. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn'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's done for the PHP-FPM. (consider contributing).</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Install-xDebug"></a></p>
|
||
|
|
||
|
<h3 id="install-xdebug:d680e8a854a7cbad6d490c445cba2eba">Install xDebug</h3>
|
||
|
|
||
|
<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 configs:</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>
|
||
|
|
||
|
<h3 id="start-stop-xdebug:d680e8a854a7cbad6d490c445cba2eba">Start/Stop xDebug:</h3>
|
||
|
|
||
|
<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><br>
|
||
|
<a name="Install-Deployer"></a></p>
|
||
|
|
||
|
<h3 id="install-deployer-deployment-tool-for-php:d680e8a854a7cbad6d490c445cba2eba">Install Deployer (Deployment tool for PHP)</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h6 id="deployer-documentation-here-https-deployer-org-docs:d680e8a854a7cbad6d490c445cba2eba"><a href="https://deployer.org/docs">Deployer Documentation Here</a></h6>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Production"></a></p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="LaraDock-for-Production"></a></p>
|
||
|
|
||
|
<h3 id="prepare-laradock-for-production:d680e8a854a7cbad6d490c445cba2eba">Prepare LaraDock for Production</h3>
|
||
|
|
||
|
<p>It'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 exampe: <code>docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...</code>).</p>
|
||
|
|
||
|
<p>Note: The Database (MySQL/MariaDB/...) 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:
|
||
|
- "3306:3306"
|
||
|
</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>
|
||
|
|
||
|
<h3 id="setup-laravel-and-docker-on-digital-ocean:d680e8a854a7cbad6d490c445cba2eba">Setup Laravel and Docker on Digital Ocean</h3>
|
||
|
|
||
|
<h4 id="full-guide-here-https-github-com-laradock-laradock-blob-master-guides-digital-ocean-md:d680e8a854a7cbad6d490c445cba2eba"><a href="https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md">Full Guide Here</a></h4>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Laravel"></a></p>
|
||
|
|
||
|
<p><a name="Install-Laravel"></a></p>
|
||
|
|
||
|
<h3 id="install-laravel-from-a-docker-container:d680e8a854a7cbad6d490c445cba2eba">Install Laravel from a Docker Container</h3>
|
||
|
|
||
|
<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 "5.2.*"
|
||
|
</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>
|
||
|
|
||
|
<h3 id="run-artisan-commands:d680e8a854a7cbad6d490c445cba2eba">Run Artisan Commands</h3>
|
||
|
|
||
|
<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'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>
|
||
|
|
||
|
<h3 id="run-laravel-queue-worker:d680e8a854a7cbad6d490c445cba2eba">Run Laravel Queue Worker</h3>
|
||
|
|
||
|
<p>1 - First add <code>php-worker</code> container. It will be similar as like PHP-FPM Containter.
|
||
|
<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>
|
||
|
|
||
|
<h3 id="use-redis:d680e8a854a7cbad6d490c445cba2eba">Use Redis</h3>
|
||
|
|
||
|
<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'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'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' => [
|
||
|
'cluster' => false,
|
||
|
'default' => [
|
||
|
'host' => 'redis',
|
||
|
'port' => 6379,
|
||
|
'database' => 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')->put('LaraDock', 'Awesome', 10);
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Use-Mongo"></a></p>
|
||
|
|
||
|
<h3 id="use-mongo:d680e8a854a7cbad6d490c445cba2eba">Use Mongo</h3>
|
||
|
|
||
|
<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' => [
|
||
|
|
||
|
'mongodb' => [
|
||
|
'driver' => 'mongodb',
|
||
|
'host' => env('DB_HOST', 'localhost'),
|
||
|
'port' => env('DB_PORT', 27017),
|
||
|
'database' => env('DB_DATABASE', 'database'),
|
||
|
'username' => '',
|
||
|
'password' => '',
|
||
|
'options' => [
|
||
|
'database' => '',
|
||
|
]
|
||
|
],
|
||
|
|
||
|
// ...
|
||
|
|
||
|
],
|
||
|
</code></pre>
|
||
|
|
||
|
<p>5 - Open your Laravel'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>
|
||
|
|
||
|
<h3 id="use-phpmyadmin:d680e8a854a7cbad6d490c445cba2eba">Use PhpMyAdmin</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="use-pgadmin:d680e8a854a7cbad6d490c445cba2eba">Use PgAdmin</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="use-beanstalkd:d680e8a854a7cbad6d490c445cba2eba">Use Beanstalkd</h3>
|
||
|
|
||
|
<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 dependecy 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>
|
||
|
|
||
|
<h3 id="use-elasticsearch:d680e8a854a7cbad6d490c445cba2eba">Use ElasticSearch</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h4 id="install-elasticsearch-plugin:d680e8a854a7cbad6d490c445cba2eba">Install ElasticSearch Plugin</h4>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="use-selenium:d680e8a854a7cbad6d490c445cba2eba">Use Selenium</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="use-rethinkdb:d680e8a854a7cbad6d490c445cba2eba">Use RethinkDB</h3>
|
||
|
|
||
|
<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' => [
|
||
|
|
||
|
'rethinkdb' => [
|
||
|
'name' => 'rethinkdb',
|
||
|
'driver' => 'rethinkdb',
|
||
|
'host' => env('DB_HOST', 'rethinkdb'),
|
||
|
'port' => env('DB_PORT', 28015),
|
||
|
'database' => env('DB_DATABASE', 'test'),
|
||
|
]
|
||
|
|
||
|
// ...
|
||
|
|
||
|
],
|
||
|
</code></pre>
|
||
|
|
||
|
<p>4 - Open your Laravel'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="CodeIgniter"></a></p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Install-CodeIgniter"></a></p>
|
||
|
|
||
|
<h3 id="install-codeigniter:d680e8a854a7cbad6d490c445cba2eba">Install CodeIgniter</h3>
|
||
|
|
||
|
<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:d680e8a854a7cbad6d490c445cba2eba">Miscellaneous</h2>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Change-the-timezone"></a></p>
|
||
|
|
||
|
<h3 id="change-the-timezone:d680e8a854a7cbad6d490c445cba2eba">Change the timezone</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="adding-cron-jobs:d680e8a854a7cbad6d490c445cba2eba">Adding cron jobs</h3>
|
||
|
|
||
|
<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 >> /dev/null 2>&1
|
||
|
|
||
|
# Custom cron
|
||
|
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
|
||
|
</code></pre>
|
||
|
|
||
|
<p>Make sure you <a href="#Change-the-timezone">change the timezone</a> if you don't want to use the default (UTC).</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Workspace-ssh"></a></p>
|
||
|
|
||
|
<h3 id="access-workspace-via-ssh:d680e8a854a7cbad6d490c445cba2eba">Access workspace via ssh</h3>
|
||
|
|
||
|
<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:
|
||
|
- "2222:22" # Edit this line
|
||
|
...
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="MySQL-access-from-host"></a></p>
|
||
|
|
||
|
<h3 id="mysql-access-from-host:d680e8a854a7cbad6d490c445cba2eba">MySQL access from host</h3>
|
||
|
|
||
|
<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:
|
||
|
- "3306:3306"
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="MySQL-root-access"></a></p>
|
||
|
|
||
|
<h3 id="mysql-root-access:d680e8a854a7cbad6d490c445cba2eba">MySQL root access</h3>
|
||
|
|
||
|
<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 contaier: <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>
|
||
|
|
||
|
<h3 id="change-mysql-port:d680e8a854a7cbad6d490c445cba2eba">Change MySQL port</h3>
|
||
|
|
||
|
<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>"3306:3306"</code> -> <code>"3306:1234"</code>) in the docker-compose configuration file.</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Use-custom-Domain"></a></p>
|
||
|
|
||
|
<h3 id="use-custom-domain-instead-of-the-docker-ip:d680e8a854a7cbad6d490c445cba2eba">Use custom Domain (instead of the Docker IP)</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="enable-global-composer-build-install:d680e8a854a7cbad6d490c445cba2eba">Enable Global Composer Build Install</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="install-prestissimo:d680e8a854a7cbad6d490c445cba2eba">Install Prestissimo</h3>
|
||
|
|
||
|
<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>"hirak/prestissimo": "^0.3"</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>
|
||
|
|
||
|
<h3 id="install-node-nvm:d680e8a854a7cbad6d490c445cba2eba">Install Node + NVM</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="install-node-yarn:d680e8a854a7cbad6d490c445cba2eba">Install Node + YARN</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="install-linuxbrew:d680e8a854a7cbad6d490c445cba2eba">Install Linuxbrew</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<h3 id="common-terminal-aliases:d680e8a854a7cbad6d490c445cba2eba">Common Terminal Aliases</h3>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Install-Aerospike-Extension"></a></p>
|
||
|
|
||
|
<h3 id="install-aerospike-extension:d680e8a854a7cbad6d490c445cba2eba">Install Aerospike extension</h3>
|
||
|
|
||
|
<p>1 - First install <code>aerospike</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_AEROSPIKE_EXTENSION</code> argument under the Workspace Container
|
||
|
<br>
|
||
|
c) set it to <code>true</code>
|
||
|
<br>
|
||
|
d) search for the <code>INSTALL_AEROSPIKE_EXTENSION</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_AEROSPIKE_EXTENSION=true
|
||
|
...
|
||
|
php-fpm:
|
||
|
build:
|
||
|
context: ./php-fpm
|
||
|
args:
|
||
|
- INSTALL_AEROSPIKE_EXTENSION=true
|
||
|
...
|
||
|
</code></pre>
|
||
|
|
||
|
<p>2 - Re-build the containers <code>docker-compose build workspace php-fpm</code></p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Install-Laravel-Envoy"></a></p>
|
||
|
|
||
|
<h3 id="install-laravel-envoy-envoy-task-runner:d680e8a854a7cbad6d490c445cba2eba">Install Laravel Envoy (Envoy Task Runner)</h3>
|
||
|
|
||
|
<p>1 - Open the <code>docker-compose.yml</code> file
|
||
|
<br>
|
||
|
2 - Search for the <code>INSTALL_LARAVEL_ENVOY</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_LARAVEL_ENVOY=true
|
||
|
...
|
||
|
</code></pre>
|
||
|
|
||
|
<p>4 - Re-build the containers <code>docker-compose build workspace</code></p>
|
||
|
|
||
|
<p>######<a href="https://laravel.com/docs/5.3/envoy">Laravel Envoy Documentation Here</a></p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="phpstorm-debugging"></a></p>
|
||
|
|
||
|
<h3 id="phpstorm-debugging-guide:d680e8a854a7cbad6d490c445cba2eba">PHPStorm Debugging Guide</h3>
|
||
|
|
||
|
<p>Remote debug Laravel web and phpunit tests.</p>
|
||
|
|
||
|
<p>######<a href="https://github.com/LaraDock/laradock/blob/master/_guides/phpstorm.md">Debugging Guide Here</a></p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="keep-tracking-Laradock"></a></p>
|
||
|
|
||
|
<h3 id="keep-track-of-your-laradock-changes:d680e8a854a7cbad6d490c445cba2eba">Keep track of your Laradock changes</h3>
|
||
|
|
||
|
<ol>
|
||
|
<li>Fork the Lardock repository.</li>
|
||
|
<li>Use that fork as a submodule.</li>
|
||
|
<li>Commit all your changes to your fork.</li>
|
||
|
<li>Pull new stuff from the main repo from time to time.</li>
|
||
|
</ol>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="upgrading-laradock"></a></p>
|
||
|
|
||
|
<h3 id="upgrading-laradock:d680e8a854a7cbad6d490c445cba2eba">Upgrading LaraDock</h3>
|
||
|
|
||
|
<p>Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requires upgrading LaraDock from v3.* to v4.*:</p>
|
||
|
|
||
|
<ol>
|
||
|
<li>Stop the docker vm <code>docker-machine stop {default}</code></li>
|
||
|
<li>Install Docker for <a href="https://docs.docker.com/docker-for-mac/">Mac</a> or <a href="https://docs.docker.com/docker-for-windows/">Windows</a>.</li>
|
||
|
<li>Upgrade LaraDock to <code>v4.*.*</code> (<code>git pull origin master</code>)</li>
|
||
|
<li>Use LaraDock as you used to do: <code>docker-compose up -d nginx mysql</code>.</li>
|
||
|
</ol>
|
||
|
|
||
|
<p><strong>Note:</strong> If you face any problem with the last step above: rebuild all your containers
|
||
|
<code>docker-compose build --no-cache</code>
|
||
|
"Warnning Containers Data might be lost!"</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Common-Problems"></a></p>
|
||
|
|
||
|
<h2 id="common-problems:d680e8a854a7cbad6d490c445cba2eba">Common Problems</h2>
|
||
|
|
||
|
<p><em>Here's a list of the common problems you might face, and the possible solutions.</em></p>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h4 id="i-see-a-blank-white-page-instead-of-the-laravel-welcome-page:d680e8a854a7cbad6d490c445cba2eba">I see a blank (white) page instead of the Laravel 'Welcome' page!</h4>
|
||
|
|
||
|
<p>Run the following command from the Laravel root directory:</p>
|
||
|
|
||
|
<pre><code class="language-bash">sudo chmod -R 777 storage bootstrap/cache
|
||
|
</code></pre>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h4 id="i-see-welcome-to-nginx-instead-of-the-laravel-app:d680e8a854a7cbad6d490c445cba2eba">I see "Welcome to nginx" instead of the Laravel App!</h4>
|
||
|
|
||
|
<p>Use <code>http://127.0.0.1</code> instead of <code>http://localhost</code> in your browser.</p>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h4 id="i-see-an-error-message-containing-address-already-in-use-or-port-is-already-allocated:d680e8a854a7cbad6d490c445cba2eba">I see an error message containing <code>address already in use</code> or <code>port is already allocated</code></h4>
|
||
|
|
||
|
<p>Make sure the ports for the services that you are trying to run (22, 80, 443, 3306, etc.) are not being used already by other programs on the host, such as a built in <code>apache</code>/<code>httpd</code> service or other development tools you have installed.</p>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h4 id="i-get-nginx-error-404-not-found-on-windows:d680e8a854a7cbad6d490c445cba2eba">I get Nginx error 404 Not Found on Windows.</h4>
|
||
|
|
||
|
<ol>
|
||
|
<li>Go to docker Settings on your Windows machine.</li>
|
||
|
<li>Click on the <code>Shared Drives</code> tab and check the drive that contains your project files.</li>
|
||
|
<li>Enter your windows username and password.</li>
|
||
|
<li>Go to the <code>reset</code> tab and click restart docker.</li>
|
||
|
</ol>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h4 id="the-time-in-my-services-does-not-match-the-current-time:d680e8a854a7cbad6d490c445cba2eba">The time in my services does not match the current time</h4>
|
||
|
|
||
|
<ol>
|
||
|
<li>Make sure you've <a href="#Change-the-timezone">changed the timezone</a>.</li>
|
||
|
<li>Stop and rebuild the containers (<code>docker-compose up -d --build <services></code>)</li>
|
||
|
</ol>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h4 id="i-get-mysql-connection-refused:d680e8a854a7cbad6d490c445cba2eba">I get Mysql connection refused</h4>
|
||
|
|
||
|
<p>This error sometimes happens because your Laravel application isn't running on the container localhost IP (Which is 127.0.0.1). Steps to fix it:</p>
|
||
|
|
||
|
<ul>
|
||
|
<li>Option A
|
||
|
|
||
|
<ol>
|
||
|
<li>Check your running Laravel application IP by dumping <code>Request::ip()</code> variable using <code>dd(Request::ip())</code> anywhere on your application. The result is the IP of your Laravel container.</li>
|
||
|
<li>Change the <code>DB_HOST</code> variable on env with the IP that you received from previous step.</li>
|
||
|
</ol></li>
|
||
|
<li>Option B
|
||
|
|
||
|
<ol>
|
||
|
<li>Change the <code>DB_HOST</code> value to the same name as the mysql docker container. The Laradock docker-compose file currently has this as <code>mysql</code></li>
|
||
|
</ol></li>
|
||
|
</ul>
|
||
|
|
||
|
<p><br></p>
|
||
|
|
||
|
<h2 id="contributing:d680e8a854a7cbad6d490c445cba2eba">Contributing</h2>
|
||
|
|
||
|
<p>This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade any container, or anything else, do not hesitate to contribute, you are more than welcome :)</p>
|
||
|
|
||
|
<h4 id="read-the-contribution-guidelines-https-github-com-laradock-laradock-blob-master-contributing-md:d680e8a854a7cbad6d490c445cba2eba">Read the <a href="https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md">Contribution Guidelines</a>.</h4>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="related-projects"></a></p>
|
||
|
|
||
|
<h2 id="related-projects:d680e8a854a7cbad6d490c445cba2eba">Related Projects</h2>
|
||
|
|
||
|
<p>LaraDock related projects:
|
||
|
* <a href="https://github.com/lorinlee/laradock-cli">LaraDock CLI</a> by <a href="https://github.com/lorinlee">LorinLee</a>
|
||
|
* <a href="https://github.com/bagart/laradock_env">LaraDock Env</a> by <a href="https://github.com/bagart">BAGArt</a>
|
||
|
* <a href="https://github.com/poyhsiao/Klaradock">Klaradock</a> by <a href="https://github.com/poyhsiao">Kim Hsiao</a>
|
||
|
* <a href="https://github.com/sifat-rahim/ansible-laradock-kubernetes">Ansible Laradock Kubernetes</a> by <a href="https://github.com/sifat-rahim">Sifat Rahim</a></p>
|
||
|
|
||
|
<p>These Docker Compose projects have piqued our interest:
|
||
|
* <a href="https://github.com/ojhaujjwal/magedock">MageDock</a> by <a href="https://github.com/ojhaujjwal">Ujjwal Ojha</a>
|
||
|
* <a href="https://github.com/scudelletti/rubydev-dock">RubyDev-Dock</a> by <a href="https://github.com/scudelletti">Diogo Scudelletti</a>
|
||
|
* <a href="https://github.com/Osedea/nodock">NoDock</a> by <a href="https://github.com/Osedea">Osedea</a></p>
|
||
|
|
||
|
<p>If you want your project listed here, please open an issue.</p>
|
||
|
|
||
|
<p><br>
|
||
|
<a name="Help"></a></p>
|
||
|
|
||
|
<h2 id="help-questions:d680e8a854a7cbad6d490c445cba2eba">Help & Questions</h2>
|
||
|
|
||
|
<p>Join the chat room on <a href="https://gitter.im/LaraDock/laradock">Gitter</a> and get help and support from the community.</p>
|
||
|
|
||
|
<p>You can as well can open an <a href="https://github.com/laradock/laradock/issues">issue</a> on Github (will be labeled as Question) and discuss it with people on <a href="https://gitter.im/LaraDock/laradock">Gitter</a>.</p>
|
||
|
|
||
|
<p>For special help with Docker and/or Laravel, you can schedule a live call with the creator of this project at <a href="https://www.codementor.io/mahmoudz">Codementor.io</a>.</p>
|
||
|
|
||
|
<h2 id="credits:d680e8a854a7cbad6d490c445cba2eba">Credits</h2>
|
||
|
|
||
|
<p><strong>Super Admins:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="https://github.com/Mahmoudz">Mahmoud Zalt</a> (mahmoudz) [ <a href="https://twitter.com/Mahmoud_Zalt">Twitter</a> | <a href="http://zalt.me">Personal Site</a> | <a href="https://www.linkedin.com/in/mahmoudzalt">Linkedin</a> ]</li>
|
||
|
<li><a href="https://github.com/appleboy">Bo-Yi Wu</a> (appleboy)</li>
|
||
|
<li><a href="https://github.com/philtrep">Philippe Trépanier</a> (philtrep)</li>
|
||
|
<li><a href="https://github.com/mikeerickson">Mike Erickson</a> (mikeerickson)</li>
|
||
|
<li>Join Us!</li>
|
||
|
</ul>
|
||
|
|
||
|
<p><strong>Amazing Contributors:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="https://github.com/LaraDock/laradock/graphs/contributors">Contributors</a></li>
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
<aside class="copyright" role="note">
|
||
|
|
||
|
© 2017 Released under the MIT license –
|
||
|
|
||
|
Documentation built with
|
||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||
|
using the
|
||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||
|
</aside>
|
||
|
|
||
|
<footer class="footer">
|
||
|
|
||
|
|
||
|
<nav class="pagination" aria-label="Footer">
|
||
|
<div class="previous">
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="next">
|
||
|
|
||
|
<a href="https://laradock.io/license/" title="License">
|
||
|
<span class="direction">
|
||
|
Next
|
||
|
</span>
|
||
|
<div class="page">
|
||
|
<div class="stretch">
|
||
|
<div class="title">
|
||
|
License
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="button button-next" role="button" aria-label="Next">
|
||
|
<i class="icon icon-forward"></i>
|
||
|
</div>
|
||
|
</div>
|
||
|
</a>
|
||
|
|
||
|
</div>
|
||
|
</nav>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</footer>
|
||
|
</div>
|
||
|
</article>
|
||
|
|
||
|
<div class="results" role="status" aria-live="polite">
|
||
|
<div class="scrollable">
|
||
|
<div class="wrapper">
|
||
|
<div class="meta"></div>
|
||
|
<div class="list"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</main>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
var base_url = 'https:\/\/laradock.io\/';
|
||
|
var repo_id = 'laradock\/laradock';
|
||
|
|
||
|
</script>
|
||
|
|
||
|
<script src="https://laradock.io/javascripts/application.js"></script>
|
||
|
|
||
|
|
||
|
<script>
|
||
|
/* Add headers to scrollspy */
|
||
|
var headers = document.getElementsByTagName("h2");
|
||
|
var scrollspy = document.getElementById('scrollspy');
|
||
|
|
||
|
if(scrollspy) {
|
||
|
if(headers.length > 0) {
|
||
|
for(var i = 0; i < headers.length; i++) {
|
||
|
var li = document.createElement("li");
|
||
|
li.setAttribute("class", "anchor");
|
||
|
|
||
|
var a = document.createElement("a");
|
||
|
a.setAttribute("href", "#" + headers[i].id);
|
||
|
a.setAttribute("title", headers[i].innerHTML);
|
||
|
a.innerHTML = headers[i].innerHTML;
|
||
|
|
||
|
li.appendChild(a)
|
||
|
scrollspy.appendChild(li);
|
||
|
}
|
||
|
} else {
|
||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||
|
}
|
||
|
|
||
|
|
||
|
/* Add permanent link next to the headers */
|
||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||
|
|
||
|
for(var i = 0; i < headers.length; i++) {
|
||
|
var a = document.createElement("a");
|
||
|
a.setAttribute("class", "headerlink");
|
||
|
a.setAttribute("href", "#" + headers[i].id);
|
||
|
a.setAttribute("title", "Permanent link")
|
||
|
a.innerHTML = "#";
|
||
|
headers[i].appendChild(a);
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||
|
</body>
|
||
|
</html>
|
||
|
|