Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
99fb1b4169 | |||
6c9d5866b4 | |||
e8ef7ab8c9 | |||
5da5d5e29c | |||
19a2110b06 | |||
2fab33d4e4 | |||
4f819c238c | |||
d8875cb588 | |||
bb9f65eb2a | |||
d6508f3bb3 | |||
a3288462a8 | |||
225fb8cf4f | |||
f67edee5e5 | |||
e5a8fb9c95 | |||
4ef5db3713 | |||
6bbd1fbe19 | |||
d703c82c46 | |||
ecc4e06740 | |||
8b09149b15 | |||
380178e6fa | |||
be64b54606 | |||
cbeeb48aa1 | |||
7e2814168a | |||
5e9ae56a7f | |||
5d98e78dba | |||
c5d1116333 | |||
5594c53e03 | |||
44045f85e6 | |||
fc31a2415c | |||
a42f62c626 | |||
3e4a5edc64 | |||
9289c1b6c0 | |||
3f157a3277 | |||
f732bb283b | |||
ca4aeada08 | |||
3d54d68aa1 | |||
a0153810c6 | |||
4fe15ad5cf | |||
146f8ea6f4 | |||
9ab6d8fa15 | |||
f6d9ac6853 | |||
470994fc23 | |||
1b05dfd1e2 | |||
03bba8d2de | |||
b6c7746a0d | |||
e7baf3cfc3 | |||
f630970151 | |||
3070eac7b7 | |||
66723c0278 | |||
dbee864d44 | |||
739cc31f4c | |||
28130c5907 | |||
658d4e7532 | |||
5da4058613 | |||
2ed09f42ca | |||
6ee790c26d | |||
a1ade52cd6 | |||
05f4f371fe | |||
33e99ca9cf | |||
e913fd941e | |||
5286fd654a | |||
499342ea39 | |||
17442db357 | |||
4f7b0ec0c3 | |||
a0981aa836 | |||
6a3137fc27 | |||
4d5e3e5e4a | |||
aa7c52c42e | |||
6eed8199df | |||
c02f17417f | |||
91bae76527 | |||
891911ddc3 | |||
89fac4bdbe | |||
22a3bbc0b0 | |||
89a21ccf1b | |||
15892dba51 | |||
1fa1dc9a1c | |||
c4cd3ed2ac | |||
ffe45fed50 | |||
bd1f6ebd8a | |||
f35e5501db |
@ -5,7 +5,7 @@ Your contribution is more than welcome. Let's keep LaraDock amazing.
|
||||
|
||||
### Got a Question or Problem?
|
||||
|
||||
If you have questions about how to use LaraDock, please direct your questions to the discussion on [Gitter](https://gitter.im/LaraDock/laradock). If you beleave your question could help others, then consider opening an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as Question).
|
||||
If you have questions about how to use LaraDock, please direct your questions to the discussion on [Gitter](https://gitter.im/LaraDock/laradock). If you believe your question could help others, then consider opening an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as Question).
|
||||
|
||||
### Found an Issue?
|
||||
If you find a bug in the source code or a mistake in the documentation, you can help us by
|
||||
|
@ -7,9 +7,7 @@
|
||||
LaraDock能够帮你在**Docker**上快速搭建**Laravel**应用。
|
||||
<br>
|
||||
就像Laravel Homestead一样,但是Docker替换了Vagrant。
|
||||
>先在Docker上使用LaraDock,然后再学习它们。
|
||||
|
||||

|
||||
> 先在使用 LaraDock,然后再学习它们。
|
||||
|
||||
<br>
|
||||
## 目录
|
||||
@ -471,13 +469,13 @@ composer create-project laravel/laravel my-cool-app "5.2.*"
|
||||
系统默认LaraDock假定Laravel应用在LaraDock的父级目录中
|
||||
By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder.
|
||||
|
||||
自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www/laravel`替换 `../:/var/www/laravel` , 如下:
|
||||
自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www`替换 `../:/var/www` , 如下:
|
||||
|
||||
```yaml
|
||||
application:
|
||||
build: ./application
|
||||
volumes:
|
||||
- ../my-cool-app/:/var/www/laravel
|
||||
- ../my-cool-app/:/var/www
|
||||
```
|
||||
4 - 进入目录下继续工作..
|
||||
|
||||
|
658
README.md
@ -1,21 +1,15 @@
|
||||
# LaraDock
|
||||
# Laradock
|
||||
|
||||
[](http://zalt.me)
|
||||
|
||||
[](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
LaraDock helps you run your **Laravel** App on **Docker** real quick.
|
||||
<br>
|
||||
It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
Laradock is a Docker PHP development environment. It facilitate running **PHP** Apps on **Docker**.
|
||||
|
||||
>With LaraDock, use Docker first and learn about it later.
|
||||
Laradock is configured to run Laravel Apps by default, and it can be modified to run all kinds of PHP Apps (Symfony, CodeIgniter, Wordpress, Drupal...).
|
||||
|
||||
>Use Docker first and learn about it later.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
<br>
|
||||
## Contents
|
||||
|
||||
- [Readme Languages](#)
|
||||
@ -25,9 +19,8 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
- [Features](#features)
|
||||
- [Supported Software](#Supported-Containers)
|
||||
- [What is Docker](#what-is-docker)
|
||||
- [What is Laravel](#what-is-laravel)
|
||||
- [Why Docker not Vagrant](#why-docker-not-vagrant)
|
||||
- [LaraDock VS Homestead](#laradock-vs-homestead)
|
||||
- [Laradock VS Homestead](#laradock-vs-homestead)
|
||||
- [Demo Video](#Demo)
|
||||
- [Requirements](#Requirements)
|
||||
- [Installation](#Installation)
|
||||
@ -37,12 +30,21 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
- [List current running Containers](#List-current-running-Containers)
|
||||
- [Close all running Containers](#Close-all-running-Containers)
|
||||
- [Delete all existing Containers](#Delete-all-existing-Containers)
|
||||
- [Enter a Container (SSH into a running Container)](#Enter-Container)
|
||||
- [Enter a Container (run commands in a running Container)](#Enter-Container)
|
||||
- [Edit default container configuration](#Edit-Container)
|
||||
- [Edit a Docker Image](#Edit-a-Docker-Image)
|
||||
- [Build/Re-build Containers](#Build-Re-build-Containers)
|
||||
- [Add more Software (Docker Images)](#Add-Docker-Images)
|
||||
- [View the Log files](#View-the-Log-files)
|
||||
- [PHP](#PHP)
|
||||
- [Install PHP Extensions](#Install-PHP-Extensions)
|
||||
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
|
||||
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
|
||||
- [Install xDebug](#Install-xDebug)
|
||||
- [Start/Stop xDebug](#Control-xDebug)
|
||||
- [Production](#Production)
|
||||
- [Prepare LaraDock for Production](#LaraDock-for-Production)
|
||||
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
|
||||
- [Laravel](#Laravel):
|
||||
- [Install Laravel from a Docker Container](#Install-Laravel)
|
||||
- [Run Artisan Commands](#Run-Artisan-Commands)
|
||||
@ -51,19 +53,15 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
- [Use phpMyAdmin](#Use-phpMyAdmin)
|
||||
- [Use pgAdmin](#Use-pgAdmin)
|
||||
- [Use ElasticSearch](#Use-ElasticSearch)
|
||||
- [PHP](#PHP)
|
||||
- [Install PHP Extensions](#Install-PHP-Extensions)
|
||||
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
|
||||
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
|
||||
- [Install xDebug](#Install-xDebug)
|
||||
- [Start/Stop xDebug](#Controll-xDebug)
|
||||
- [Production](#Production)
|
||||
- [Prepare LaraDock for Production](#LaraDock-for-Production)
|
||||
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
|
||||
- [CodeIgniter](#CodeIgniter):
|
||||
- [Install CodeIgniter](#Install-CodeIgniter)
|
||||
- [Misc](#Misc)
|
||||
- [Change the timezone](#Change-the-timezone)
|
||||
- [Cron jobs](#CronJobs)
|
||||
- [Access workspace via ssh](#Workspace-ssh)
|
||||
- [MySQL access from host](#MySQL-access-from-host)
|
||||
- [MySQL root access](#MySQL-root-access)
|
||||
- [Change MySQL port](#Change-MySQL-port)
|
||||
- [Use custom Domain](#Use-custom-Domain)
|
||||
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
|
||||
- [Install Prestissimo](#Install-Prestissimo)
|
||||
@ -78,8 +76,9 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
<a name="Intro"></a>
|
||||
## Intro
|
||||
|
||||
LaraDock strives to make the development experience easier.
|
||||
It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine.
|
||||
Laradock strives to make the PHP development experience easier and faster.
|
||||
|
||||
It contains pre-packaged Docker Images that provides you a wonderful *development* environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your machines.
|
||||
|
||||
|
||||
**Usage Overview:**
|
||||
@ -139,7 +138,7 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red
|
||||
- Beanstalkd (+ Beanstalkd Console)
|
||||
- RabbitMQ (+ RabbitMQ Console)
|
||||
- **Tools:**
|
||||
- Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...)
|
||||
- Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, xDebug, Vim...)
|
||||
- PhpMyAdmin
|
||||
- PgAdmin
|
||||
- ElasticSearch
|
||||
@ -156,11 +155,6 @@ Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Red
|
||||
|
||||
[Docker](https://www.docker.com) is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of [operating-system-level virtualization](https://en.wikipedia.org/wiki/Operating-system-level_virtualization) on Linux, Mac OS and Windows.
|
||||
|
||||
<a name="what-is-laravel"></a>
|
||||
### What is Laravel?
|
||||
|
||||
Seriously!!!
|
||||
|
||||
|
||||
<a name="why-docker-not-vagrant"></a>
|
||||
### Why Docker not Vagrant!?
|
||||
@ -175,9 +169,11 @@ Most importantly Docker can run on Development and on Production (same environme
|
||||
|
||||
|
||||
<a name="laradock-vs-homestead"></a>
|
||||
### LaraDock VS Homestead
|
||||
### Laradock VS Homestead (For Laravel Developers)
|
||||
|
||||
LaraDock and [Homestead](https://laravel.com/docs/master/homestead) both gives you a complete virtual development environments. (Without the need to install and configure every single software on your own Operating System).
|
||||
> Laradock It's like Laravel Homestead but for Docker instead of Vagrant.
|
||||
|
||||
Laradock and [Homestead](https://laravel.com/docs/master/homestead) both give you complete virtual development environments. (Without the need to install and configure every single software on your own Operating System).
|
||||
|
||||
- Homestead is a tool that controls Vagrant for you (using Homestead special commands). And Vagrant manages your Virtual Machine.
|
||||
|
||||
@ -212,17 +208,22 @@ What's better than a **Demo Video**:
|
||||
<a name="Installation"></a>
|
||||
## Installation
|
||||
|
||||
Choose the setup the best suits your needs.
|
||||
|
||||
Clone the `LaraDock` repository:
|
||||
#### A) Setup for Single Project:
|
||||
*(In case you want a Docker environment for each project)*
|
||||
|
||||
**A)** If you already have a Laravel project, clone this repository on your `Laravel` root directory:
|
||||
##### A.1) Setup environment in existing Project:
|
||||
*(In case you already have a project, and you want to setup an environment to run it)*
|
||||
|
||||
1 - Clone this repository on your project root directory:
|
||||
|
||||
```bash
|
||||
git submodule add https://github.com/LaraDock/laradock.git
|
||||
```
|
||||
>If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.
|
||||
>If you are not already using Git for your PHP project, you can use `git clone` instead of `git submodule`.
|
||||
|
||||
Note: In this case the folder structure will be like this (recommended):
|
||||
Note: In this case the folder structure will be like this:
|
||||
|
||||
```
|
||||
- project1
|
||||
@ -231,9 +232,10 @@ Note: In this case the folder structure will be like this (recommended):
|
||||
- laradock
|
||||
```
|
||||
|
||||
<br>
|
||||
##### A.2) Setup environment first then create project:
|
||||
*(In case you don't have a project, and you want to create your project inside the Docker environment)*
|
||||
|
||||
**B)** If you don't have a Laravel project, and you want to install Laravel from Docker, clone this repo anywhere on your machine:
|
||||
1 - Clone this repository anywhere on your machine:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/LaraDock/laradock.git
|
||||
@ -243,11 +245,60 @@ Note: In this case the folder structure will be like this:
|
||||
```
|
||||
- projects
|
||||
- laradock
|
||||
- project1
|
||||
- project2
|
||||
- myProject
|
||||
```
|
||||
|
||||
**Note:** if you are using this folder structure don't forget to edit the `docker-compose.yml` file to map to your Laravel directory once you have it (example: `- ../project1/:/var/www/laravel`). "You will need to stop and re-run your docker-compose command for the changes to take place".
|
||||
2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`).
|
||||
|
||||
3 - Stop and re-run your docker-compose command for the changes to take place.
|
||||
|
||||
```
|
||||
docker-compose stop && docker-compose up -d XXXX YYYY ZZZZ ....
|
||||
```
|
||||
|
||||
|
||||
#### B) Setup for Multiple Projects:
|
||||
|
||||
1 - Clone this repository anywhere on your machine:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/LaraDock/laradock.git
|
||||
```
|
||||
|
||||
2 - Edit the `docker-compose.yml` file to map to your projects directories:
|
||||
|
||||
```
|
||||
applications:
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ../project1/:/var/www/project1
|
||||
- ../project2/:/var/www/project2
|
||||
```
|
||||
|
||||
3 - You can access all sites by visiting `http://localhost/project1/public` and `http://localhost/project2/public` but of course that's not very useful so let's setup nginx quickly.
|
||||
|
||||
|
||||
4 - Go to `nginx/sites` and copy `sample.conf.example` to `project1.conf` then to `project2.conf`
|
||||
|
||||
5 - Open the `project1.conf` file and edit the `server_name` and the `root` as follow:
|
||||
|
||||
```
|
||||
server_name project1.dev;
|
||||
root /var/www/project1/public;
|
||||
```
|
||||
Do the same for each project `project2.conf`, `project3.conf`,...
|
||||
|
||||
6 - Add the domains to the **hosts** files.
|
||||
|
||||
```
|
||||
127.0.0.1 project1.dev
|
||||
```
|
||||
|
||||
7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Usage"></a>
|
||||
## Usage
|
||||
@ -273,7 +324,7 @@ If you are using **Docker Toolbox** (VM), do one of the following:
|
||||
**Example:** Running NGINX and MySQL:
|
||||
|
||||
```bash
|
||||
docker-compose up -d nginx mysql
|
||||
docker-compose up -d nginx mysql
|
||||
```
|
||||
|
||||
**Note**: The `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. If you couldn't find them running then you need specify them as follow: `docker-compose up -d nginx php-fpm mysql workspace`.
|
||||
@ -303,16 +354,15 @@ docker exec -it {workspace-container-id} bash
|
||||
|
||||
|
||||
<br>
|
||||
3 - Edit the Laravel configurations.
|
||||
3 - Edit your project configurations.
|
||||
|
||||
If you don't have a Laravel project installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel).
|
||||
|
||||
Open your Laravel's `.env` file and set the `DB_HOST` to your `mysql`:
|
||||
Open your `.env` file and set the `DB_HOST` to `mysql`:
|
||||
|
||||
```env
|
||||
DB_HOST=mysql
|
||||
```
|
||||
|
||||
*If you want to use Laravel and you don't have it installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel).*
|
||||
|
||||
|
||||
|
||||
@ -343,7 +393,7 @@ If you need a special support. Contact me, more details in the [Help & Questions
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
You can also use the this command if you want to see only this project containers:
|
||||
You can also use the following command if you want to see only this project containers:
|
||||
|
||||
```bash
|
||||
docker-compose ps
|
||||
@ -378,8 +428,6 @@ docker-compose stop {container-name}
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
*Note: Careful with this command as it will delete your Data Volume Container as well. (if you want to keep your Database data than you should stop each container by itself as follow):*
|
||||
|
||||
|
||||
|
||||
|
||||
@ -388,11 +436,11 @@ docker-compose down
|
||||
|
||||
<br>
|
||||
<a name="Enter-Container"></a>
|
||||
### Enter a Container (SSH into a running Container)
|
||||
### Enter a Container (run commands in a running Container)
|
||||
|
||||
1 - first list the current running containers with `docker ps`
|
||||
1 - First list the current running containers with `docker ps`
|
||||
|
||||
2 - enter any container using:
|
||||
2 - Enter any container using:
|
||||
|
||||
```bash
|
||||
docker-compose exec {container-name} bash
|
||||
@ -404,7 +452,7 @@ docker-compose exec {container-name} bash
|
||||
docker-compose exec mysql bash
|
||||
```
|
||||
|
||||
3 - to exit a container, type `exit`.
|
||||
3 - To exit a container, type `exit`.
|
||||
|
||||
|
||||
|
||||
@ -516,6 +564,213 @@ docker logs {container-name}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="PHP"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Install-PHP-Extensions"></a>
|
||||
### Install PHP Extensions
|
||||
|
||||
Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers.
|
||||
|
||||
The PHP-FPM extensions should be installed in `php-fpm/Dockerfile-XX`. *(replace XX with your default PHP version number)*.
|
||||
<br>
|
||||
The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Change-the-PHP-FPM-Version"></a>
|
||||
### Change the (PHP-FPM) Version
|
||||
By default **PHP-FPM 7.0** is running.
|
||||
|
||||
>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.
|
||||
|
||||
#### A) Switch from PHP `7.0` to PHP `5.6`
|
||||
|
||||
1 - Open the `docker-compose.yml`.
|
||||
|
||||
2 - Search for `Dockerfile-70` in the PHP container section.
|
||||
|
||||
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this:
|
||||
|
||||
```yml
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
dockerfile: Dockerfile-70
|
||||
...
|
||||
```
|
||||
|
||||
4 - Finally rebuild the container
|
||||
|
||||
```bash
|
||||
docker-compose build php
|
||||
```
|
||||
|
||||
> For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
|
||||
|
||||
|
||||
#### B) Switch from PHP `7.0` or `5.6` to PHP `5.5`
|
||||
|
||||
We do not natively support PHP 5.5 anymore, but you can get it in few steps:
|
||||
|
||||
1 - Clone `https://github.com/LaraDock/php-fpm`.
|
||||
|
||||
3 - Rename `Dockerfile-56` to `Dockerfile-55`.
|
||||
|
||||
3 - Edit the file `FROM php:5.6-fpm` to `FROM php:5.5-fpm`.
|
||||
|
||||
4 - Build an image from `Dockerfile-55`.
|
||||
|
||||
5 - Open the `docker-compose.yml` file.
|
||||
|
||||
6 - Point `php-fpm` to your `Dockerfile-55` file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Change-the-PHP-CLI-Version"></a>
|
||||
### Change the PHP-CLI Version
|
||||
By default **PHP-CLI 7.0** is running.
|
||||
|
||||
>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.
|
||||
|
||||
The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`.
|
||||
|
||||
Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing).
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Install-xDebug"></a>
|
||||
### Install xDebug
|
||||
|
||||
1 - First install `xDebug` in the Workspace and the PHP-FPM Containers:
|
||||
<br>
|
||||
a) open the `docker-compose.yml` file
|
||||
<br>
|
||||
b) search for the `INSTALL_XDEBUG` argument under the Workspace Container
|
||||
<br>
|
||||
c) set it to `true`
|
||||
<br>
|
||||
d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container
|
||||
<br>
|
||||
e) set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
```
|
||||
|
||||
2 - Re-build the containers `docker-compose build workspace php-fpm`
|
||||
|
||||
3 - Open `laradock/workspace/xdebug.ini` and/or `laradock/php-fpm/xdebug.ini` and enable at least the following configs:
|
||||
|
||||
```
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
```
|
||||
|
||||
For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm).
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Control-xDebug"></a>
|
||||
### Start/Stop xDebug:
|
||||
|
||||
By installing xDebug, you are enabling it to run on startup by default.
|
||||
|
||||
To control the behavior of xDebug (in the `php-fpm` Container), you can run the following commands from the LaraDock root folder, (at the same prompt where you run docker-compose):
|
||||
|
||||
- Stop xDebug from running by default: `./xdebugPhpFpm stop`.
|
||||
- Start xDebug by default: `./xdebugPhpFpm start`.
|
||||
- See the status: `./xdebugPhpFpm status`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Production"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="LaraDock-for-Production"></a>
|
||||
### Prepare LaraDock for Production
|
||||
|
||||
It's recommended for production to create a custom `docker-compose.yml` file. For that reason, LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`).
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
ports:
|
||||
- "3306:3306"
|
||||
```
|
||||
|
||||
To learn more about how Docker publishes ports, please read [this excellent post on the subject](https://fralef.me/docker-and-iptables.html).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Digital-Ocean"></a>
|
||||
### Setup Laravel and Docker on Digital Ocean
|
||||
|
||||
####[Full Guide Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Laravel"></a>
|
||||
|
||||
@ -542,15 +797,15 @@ For more about the Laravel installation click [here](https://laravel.com/docs/ma
|
||||
|
||||
3 - Edit `docker-compose.yml` to Map the new application path:
|
||||
|
||||
By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder.
|
||||
By default, LaraDock assumes the Laravel application is living in the parent directory of the laradock folder.
|
||||
|
||||
Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow:
|
||||
Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www` with `../my-cool-app/:/var/www`, as follow:
|
||||
|
||||
```yaml
|
||||
application:
|
||||
build: ./application
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ../my-cool-app/:/var/www/laravel
|
||||
- ../my-cool-app/:/var/www
|
||||
...
|
||||
```
|
||||
4 - Go to that folder and start working..
|
||||
@ -559,7 +814,7 @@ Since the new Laravel application is in the `my-cool-app` folder, we need to rep
|
||||
cd my-cool-app
|
||||
```
|
||||
|
||||
5 - Go back to the laraDock installation steps to see how to edit the `.env` file.
|
||||
5 - Go back to the LaraDock installation steps to see how to edit the `.env` file.
|
||||
|
||||
|
||||
|
||||
@ -618,7 +873,7 @@ docker-compose up -d redis
|
||||
REDIS_HOST=redis
|
||||
```
|
||||
|
||||
If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the default `127.0.0.1` IP with `redis` for Redis like this:
|
||||
If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database configuration file `config/database.php` and replace the default `127.0.0.1` IP with `redis` for Redis like this:
|
||||
|
||||
```php
|
||||
'redis' => [
|
||||
@ -698,7 +953,7 @@ docker-compose up -d mongo
|
||||
```
|
||||
|
||||
|
||||
4 - Add the MongoDB configurations to the `config/database.php` config file:
|
||||
4 - Add the MongoDB configurations to the `config/database.php` configuration file:
|
||||
|
||||
```php
|
||||
'connections' => [
|
||||
@ -787,187 +1042,22 @@ docker-compose up -d elasticsearch
|
||||
|
||||
2 - Open your browser and visit the localhost on port **9200**: `http://localhost:9200`
|
||||
|
||||
### Install ElasticSearch Plugin
|
||||
|
||||
<br>
|
||||
<a name="PHP"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="Install-PHP-Extensions"></a>
|
||||
### Install PHP Extensions
|
||||
|
||||
Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers.
|
||||
|
||||
The PHP-FPM extensions should be installed in `php-fpm/Dockerfile-XX`. *(replace XX with your default PHP version number)*.
|
||||
<br>
|
||||
The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Change-the-PHP-FPM-Version"></a>
|
||||
### Change the (PHP-FPM) Version
|
||||
By default **PHP-FPM 7.0** is running.
|
||||
|
||||
>The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version.
|
||||
|
||||
#### A) Switch from PHP `7.0` to PHP `5.6`
|
||||
|
||||
1 - Open the `docker-compose.yml`.
|
||||
|
||||
2 - Search for `Dockerfile-70` in the PHP container section.
|
||||
|
||||
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this:
|
||||
|
||||
```yml
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
dockerfile: Dockerfile-70
|
||||
...
|
||||
```
|
||||
|
||||
4 - Finally rebuild the container
|
||||
1 - Install the ElasticSearch plugin like [delete-by-query](https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugins-delete-by-query.html).
|
||||
|
||||
```bash
|
||||
docker-compose build php
|
||||
docker exec {container-name} /usr/share/elasticsearch/bin/plugin install delete-by-query
|
||||
```
|
||||
|
||||
> For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
|
||||
2 - Restart elasticsearch container
|
||||
|
||||
|
||||
#### B) Switch from PHP `7.0` or `5.6` to PHP `5.5`
|
||||
|
||||
We do not natively support PHP 5.5 anymore, but you can get it in few steps:
|
||||
|
||||
1 - Clone `https://github.com/LaraDock/php-fpm`.
|
||||
|
||||
3 - Rename `Dockerfile-56` to `Dockerfile-55`.
|
||||
|
||||
3 - Edit the file `FROM php:5.6-fpm` to `FROM php:5.5-fpm`.
|
||||
|
||||
4 - Build an image from `Dockerfile-55`.
|
||||
|
||||
5 - Open the `docker-compose.yml` file.
|
||||
|
||||
6 - Point `php-fpm` to your `Dockerfile-55` file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Change-the-PHP-CLI-Version"></a>
|
||||
### Change the PHP-CLI Version
|
||||
By default **PHP-CLI 7.0** is running.
|
||||
|
||||
>Note: it's not very essential to edit the PHP-CLI verion. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job.
|
||||
|
||||
The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`.
|
||||
|
||||
Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing).
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Install-xDebug"></a>
|
||||
### Install xDebug
|
||||
|
||||
1 - First install `xDebug` in the Workspace and the PHP-FPM Containers:
|
||||
<br>
|
||||
a) open the `docker-compose.yml` file
|
||||
<br>
|
||||
b) search for the `INSTALL_XDEBUG` argument under the Workspace Container
|
||||
<br>
|
||||
c) set it to `true`
|
||||
<br>
|
||||
d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container
|
||||
<br>
|
||||
e) set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
```bash
|
||||
docker restart {container-name}
|
||||
```
|
||||
|
||||
2 - Re-build the containers `docker-compose build workspace php-fpm`
|
||||
|
||||
3 - Open `laradock/workspace/xdebug.ini` and/or `laradock/php-fpm/xdebug.ini` and enable at least the following configs:
|
||||
|
||||
```
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
```
|
||||
|
||||
For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm).
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Controll-xDebug"></a>
|
||||
### Start/Stop xDebug:
|
||||
|
||||
By installing xDebug, you are enabling it to run on startup by default.
|
||||
|
||||
To controll the behavior of xDebug (in the `php-fpm` Container), you can run the following commands from the LaraDock root folder:
|
||||
|
||||
- Stop xDebug from running by default: `./xdebugPhpFpm stop`.
|
||||
- Start xDebug by default: `./xdebugPhpFpm start`.
|
||||
- See the status: `./xdebugPhpFpm status`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Production"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="LaraDock-for-Production"></a>
|
||||
### Prepare LaraDock for Production
|
||||
|
||||
It's recommended for production to create a custom `docker-compose.yml` file. For that reason LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`).
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
ports:
|
||||
- "3306:3306"
|
||||
```
|
||||
|
||||
To learn more about how Docker publishes ports, please read [this excellent post on the subject](https://fralef.me/docker-and-iptables.html).
|
||||
|
||||
|
||||
|
||||
@ -975,10 +1065,24 @@ To learn more about how Docker publishes ports, please read [this excellent post
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Digital-Ocean"></a>
|
||||
### Setup Laravel and Docker on Digital Ocean
|
||||
<a name="CodeIgniter"></a>
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
<a name="Install-CodeIgniter"></a>
|
||||
### Install CodeIgniter
|
||||
|
||||
To install CodeIgniter 3 on Laradock all you have to do is the following simple steps:
|
||||
|
||||
1 - Open the `docker-compose.yml` file.
|
||||
|
||||
2 - Change `CODEIGNITER=false` to `CODEIGNITER=true`.
|
||||
|
||||
3 - Re-build your PHP-FPM Container `docker-compose build php-fpm`.
|
||||
|
||||
|
||||
|
||||
####[Full Guide Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
|
||||
|
||||
|
||||
|
||||
@ -1015,7 +1119,7 @@ We also recommend [setting the timezone in Laravel](http://www.camroncade.com/ma
|
||||
You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line.
|
||||
|
||||
```
|
||||
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1
|
||||
* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1
|
||||
|
||||
# Custom cron
|
||||
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
|
||||
@ -1023,6 +1127,20 @@ You can add your cron jobs to `workspace/crontab/root` after the `php artisan` l
|
||||
|
||||
Make sure you [change the timezone](#Change-the-timezone) if you don't want to use the default (UTC).
|
||||
|
||||
<a name="Workspace-ssh"></a>
|
||||
### Access workspace via ssh
|
||||
|
||||
You can access the `workspace` container through `localhost:2222` by setting the `INSTALL_WORKSPACE_SSH` build argument to `true`.
|
||||
|
||||
To change the default forwarded port for ssh:
|
||||
|
||||
```yml
|
||||
workspace:
|
||||
ports:
|
||||
- "2222:22" # Edit this line
|
||||
...
|
||||
```
|
||||
|
||||
<a name="MySQL-access-from-host"></a>
|
||||
### MySQL access from host
|
||||
|
||||
@ -1033,6 +1151,32 @@ ports:
|
||||
- "3306:3306"
|
||||
```
|
||||
|
||||
<a name="MySQL-root-access"></a>
|
||||
### MySQL root access
|
||||
|
||||
The default username and password for the root mysql user are `root` and `root `.
|
||||
|
||||
1 - Enter the mysql contaier: `docker-compose exec mysql bash`.
|
||||
|
||||
2 - Enter mysql: `mysql -uroot -proot` for non root access use `mysql -uhomestead -psecret`.
|
||||
|
||||
3 - See all users: `SELECT User FROM mysql.user;`
|
||||
|
||||
4 - Run any commands `show databases`, `show tables`, `select * from.....`.
|
||||
|
||||
|
||||
<a name="Change-MySQL-port"></a>
|
||||
### Change MySQL port
|
||||
|
||||
Modify the `mysql/my.cnf` file to set your port number, `1234` is used as an example.
|
||||
|
||||
```
|
||||
[mysqld]
|
||||
port=1234
|
||||
```
|
||||
|
||||
If you need <a href="#MySQL-access-from-host">MySQL access from your host</a>, do not forget to change the internal port number (`"3306:3306"` -> `"3306:1234"`) in the docker-compose configuration file.
|
||||
|
||||
<a name="Use-custom-Domain"></a>
|
||||
### Use custom Domain (instead of the Docker IP)
|
||||
|
||||
@ -1047,7 +1191,7 @@ Assuming your custom domain is `laravel.dev`
|
||||
2 - Open your browser and visit `{http://laravel.dev}`
|
||||
|
||||
|
||||
Optionally you can define the server name in the nginx config file, like this:
|
||||
Optionally you can define the server name in the nginx configuration file, like this:
|
||||
|
||||
```conf
|
||||
server_name laravel.dev;
|
||||
@ -1061,9 +1205,9 @@ server_name laravel.dev;
|
||||
|
||||
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.
|
||||
|
||||
1 - open the `docker-compose.yml` file
|
||||
1 - Open the `docker-compose.yml` file
|
||||
|
||||
2 - search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true`
|
||||
2 - Search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true`
|
||||
|
||||
It should be like this:
|
||||
|
||||
@ -1075,9 +1219,9 @@ It should be like this:
|
||||
- COMPOSER_GLOBAL_INSTALL=true
|
||||
...
|
||||
```
|
||||
3 - now add your dependencies to `workspace/composer.json`
|
||||
3 - Now add your dependencies to `workspace/composer.json`
|
||||
|
||||
4 - rebuild the Workspace Container `docker-compose build workspace`
|
||||
4 - Re-build the Workspace Container `docker-compose build workspace`
|
||||
|
||||
|
||||
|
||||
@ -1094,11 +1238,11 @@ Click on this [Enable Global Composer Build Install](#Enable-Global-Composer-Bui
|
||||
|
||||
2 - Add prestissimo as requirement in Composer:
|
||||
|
||||
a - now open the `workspace/composer.json` file
|
||||
a - Now open the `workspace/composer.json` file
|
||||
|
||||
b - add `"hirak/prestissimo": "^0.3"` as requirement
|
||||
b - Add `"hirak/prestissimo": "^0.3"` as requirement
|
||||
|
||||
c - rebuild the Workspace Container `docker-compose build workspace`
|
||||
c - Re-build the Workspace Container `docker-compose build workspace`
|
||||
|
||||
|
||||
|
||||
@ -1187,7 +1331,18 @@ It should be like this:
|
||||
|
||||
<br>
|
||||
<a name="debugging"></a>
|
||||
### Debugging
|
||||
|
||||
### PHPStorm
|
||||
Remote debug Laravel web and phpunit tests.
|
||||
|
||||
####[Full Guide Here](https://github.com/LaraDock/laradock/blob/master/_guides/phpstorm.md)
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Misc"></a>
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
|
||||
*Here's a list of the common problems you might face, and the possible solutions.*
|
||||
|
||||
@ -1208,9 +1363,9 @@ Use `http://127.0.0.1` instead of `http://localhost` in your browser.
|
||||
|
||||
|
||||
|
||||
#### I see an error message containing `address already in use`
|
||||
#### I see an error message containing `address already in use` or `port is already allocated`
|
||||
|
||||
Make sure the ports for the services that you are trying to run (80, 3306, etc.) are not being used already by other programs, such as a built in `apache`/`httpd` service or other development tools you have installed.
|
||||
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 `apache`/`httpd` service or other development tools you have installed.
|
||||
|
||||
|
||||
|
||||
@ -1221,6 +1376,15 @@ Make sure the ports for the services that you are trying to run (80, 3306, etc.)
|
||||
3. Enter your windows username and password.
|
||||
4. Go to the `reset` tab and click restart docker.
|
||||
|
||||
#### I get Mysql connection refused
|
||||
|
||||
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:
|
||||
|
||||
* Option A
|
||||
1. Check your running Laravel application IP by dumping `Request::ip()` variable using `dd(Request::ip())` anywhere on your application. The result is the IP of your Laravel container.
|
||||
2. Change the `DB_HOST` variable on env with the IP that you received from previous step.
|
||||
* Option B
|
||||
1. Change the `DB_HOST` value to the same name as the mysql docker container. The Laradock docker-compose file currently has this as `mysql`
|
||||
|
||||
|
||||
|
||||
@ -1250,7 +1414,7 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ
|
||||
<br>
|
||||
## Contributing
|
||||
|
||||
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 :)
|
||||
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 :)
|
||||
|
||||
#### Read the [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md).
|
||||
|
||||
|
@ -58,10 +58,10 @@ docker-compose exec workspace bash
|
||||
#### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder
|
||||
|
||||
```
|
||||
$ root@0e77851d27d3:/var/www/laravel# composer install
|
||||
$ root@0e77851d27d3:/var/www/laravel# cp .env.example .env
|
||||
$ root@0e77851d27d3:/var/www/laravel# php artisan key:generate
|
||||
$ root@0e77851d27d3:/var/www/laravel# exit
|
||||
$ root@0e77851d27d3:/var/www# composer install
|
||||
$ root@0e77851d27d3:/var/www# cp .env.example .env
|
||||
$ root@0e77851d27d3:/var/www# php artisan key:generate
|
||||
$ root@0e77851d27d3:/var/www# exit
|
||||
$root@midascode:~/laravel/laradock# cd ..
|
||||
$root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache
|
||||
```
|
||||
@ -141,13 +141,13 @@ Remove 0.0.0.0:80
|
||||
|
||||
```
|
||||
0.0.0.0:80
|
||||
root /var/www/laravel/public
|
||||
root /var/www/public
|
||||
```
|
||||
and replace with your https://yourdomain.com
|
||||
|
||||
```
|
||||
https://yourdomain.com
|
||||
root /var/www/laravel/public
|
||||
root /var/www/public
|
||||
```
|
||||
uncomment tls
|
||||
|
||||
|
BIN
_guides/photos/KiTTY/Connection.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
_guides/photos/KiTTY/ConnectionData.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
_guides/photos/KiTTY/ConnectionSSH.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
_guides/photos/KiTTY/ConnectionSSHAuth.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
_guides/photos/KiTTY/Session.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
_guides/photos/KiTTY/Terminal.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
_guides/photos/KiTTY/TerminalKeyboard.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
_guides/photos/KiTTY/TerminalShell.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
_guides/photos/KiTTY/Window.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
_guides/photos/KiTTY/WindowAppearance.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
_guides/photos/PHPStorm/DebugRemoteOn.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
_guides/photos/PHPStorm/RemoteDebuggingSuccess.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
_guides/photos/PHPStorm/RemoteHost.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
_guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
_guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
_guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png
Normal file
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 23 KiB |
BIN
_guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png
Normal file
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 11 KiB |
BIN
_guides/photos/PHPStorm/Settings/LangsPHPDebug.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
_guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
_guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
_guides/photos/PHPStorm/Settings/LangsPHPServers.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
_guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
_guides/photos/PHPStorm/Settings/WindowsHyperVManager.png
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
_guides/photos/PHPStorm/Settings/hosts.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
_guides/photos/SimpleHostsEditor/AddHost_laravel.png
Normal file
After Width: | Height: | Size: 18 KiB |
302
_guides/phpstorm.md
Normal file
@ -0,0 +1,302 @@
|
||||
# PHPStorm Debugging Guide
|
||||
|
||||
- [Intro](#Intro)
|
||||
- [Installation](#Installation)
|
||||
- [Customize laradock/docker-compose.yml](#CustomizeDockerCompose)
|
||||
- [Clean House](#InstallCleanHouse)
|
||||
- [LaraDock Dial Tone](#InstallLaraDockDialTone)
|
||||
- [hosts](#AddToHosts)
|
||||
- [Firewall](#FireWall)
|
||||
- [Enable xDebug on php-fpm](#enablePhpXdebug)
|
||||
- [PHPStorm Settings](#InstallPHPStorm)
|
||||
- [Configs](#InstallPHPStormConfigs)
|
||||
- [Usage](#Usage)
|
||||
- [Laravel](#UsageLaravel)
|
||||
- [Run ExampleTest](#UsagePHPStormRunExampleTest)
|
||||
- [Debug ExampleTest](#UsagePHPStormDebugExampleTest)
|
||||
- [Debug Web Site](#UsagePHPStormDebugSite)
|
||||
- [SSH into workspace](#SSHintoWorkspace)
|
||||
- [KiTTY](#InstallKiTTY)
|
||||
|
||||
<a name="Intro"></a>
|
||||
## Intro
|
||||
|
||||
Wiring up [Laravel](https://laravel.com/), [LaraDock](https://github.com/LaraDock/laradock) [Laravel+Docker] and [PHPStorm](https://www.jetbrains.com/phpstorm/) to play nice together complete with remote xdebug'ing as icing on top! Although this guide is based on `PHPStorm Windows`,
|
||||
you should be able to adjust accordingly. This guide was written based on Docker for Windows Native.
|
||||
|
||||
<a name="Installation"></a>
|
||||
## Installation
|
||||
|
||||
- This guide assumes the following:
|
||||
- you have already installed and are familiar with Laravel, LaraDock and PHPStorm.
|
||||
- you have installed Laravel as a parent of `laradock`. This guide assumes `/c/_dk/laravel`.
|
||||
|
||||
<a name="AddToHosts"></a>
|
||||
## hosts
|
||||
- Add `laravel` to your hosts file located on Windows 10 at `C:\Windows\System32\drivers\etc\hosts`. It should be set to the IP of your running container. Mine is: `10.0.75.2`
|
||||
On Windows you can find it by opening Windows `Hyper-V Manager`.
|
||||
- 
|
||||
|
||||
- [Hosts File Editor](https://github.com/scottlerch/HostsFileEditor) makes it easy to change your hosts file.
|
||||
- Set `laravel` to your docker host IP. See [Example](photos/SimpleHostsEditor/AddHost_laravel.png).
|
||||
|
||||
|
||||
<a name="FireWall"></a>
|
||||
## Firewall
|
||||
Your PHPStorm will need to be able to receive a connection from PHP xdebug either your running workspace or php-fpm containers on port 9000. This means that your Windows Firewall should either enable connections from the Application PHPStorm OR the port.
|
||||
|
||||
- It is important to note that if the Application PHPStorm is NOT enabled in the firewall, you will not be able to recreate a rule to override that.
|
||||
- Also be aware that if you are installing/upgrade different versions of PHPStorm, you MAY have orphaned references to PHPStorm in your Firewall! You may decide to remove orphaned references however in either case, make sure that they are set to receive public TCP traffic.
|
||||
|
||||
### Edit laradock/docker-compose.yml
|
||||
Set the following variables:
|
||||
```
|
||||
### Workspace Utilities Container ###########################
|
||||
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
- INSTALL_WORKSPACE_SSH=true
|
||||
...
|
||||
|
||||
|
||||
### PHP-FPM Container #######################################
|
||||
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=true
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
### Edit xdebug.ini files
|
||||
- `laradock/workspace/xdebug.ini`
|
||||
- `laradock/php-fpm/xdebug.ini`
|
||||
|
||||
Set the following variables:
|
||||
```
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.cli_color=1
|
||||
```
|
||||
|
||||
|
||||
<a name="InstallCleanHouse"></a>
|
||||
### Need to clean house first?
|
||||
Make sure you are starting with a clean state. For example, do you have other LaraDock containers and images?
|
||||
Here are a few things I use to clean things up.
|
||||
|
||||
- Delete all containers using `grep laradock_` on the names, see: [Remove all containers based on docker image name](https://linuxconfig.org/remove-all-containners-based-on-docker-image-name).
|
||||
`docker ps -a | awk '{ print $1,$2 }' | grep laradock_ | awk '{print $1}' | xargs -I {} docker rm {}`
|
||||
|
||||
- Delete all images containing `laradock`.
|
||||
`docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}`
|
||||
**Note:** This will only delete images that were built with `LaraDock`, **NOT** `laradock/*` which are pulled down by `LaraDock` such as `laradock/workspace`, etc.
|
||||
**Note:** Some may fail with:
|
||||
`Error response from daemon: conflict: unable to delete 3f38eaed93df (cannot be forced) - image has dependent child images`
|
||||
|
||||
- I added this to my `.bashrc` to remove orphaned images.
|
||||
```
|
||||
dclean() {
|
||||
processes=`docker ps -q -f status=exited`
|
||||
if [ -n "$processes" ]; thend
|
||||
docker rm $processes
|
||||
fi
|
||||
|
||||
images=`docker images -q -f dangling=true`
|
||||
if [ -n "$images" ]; then
|
||||
docker rmi $images
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
- If you frequently switch configurations for LaraDock, you may find that adding the following and added to your `.bashrc` or equivalent useful:
|
||||
```
|
||||
# remove laravel* containers
|
||||
# remove laravel_* images
|
||||
dcleanlaradockfunction()
|
||||
{
|
||||
echo 'Removing ALL containers associated with laradock'
|
||||
docker ps -a | awk '{ print $1,$2 }' | grep laradock | awk '{print $1}' | xargs -I {} docker rm {}
|
||||
|
||||
# remove ALL images associated with laradock_
|
||||
# does NOT delete laradock/* which are hub images
|
||||
echo 'Removing ALL images associated with laradock_'
|
||||
docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}
|
||||
|
||||
echo 'Listing all laradock docker hub images...'
|
||||
docker images | grep laradock
|
||||
|
||||
echo 'dcleanlaradock completed'
|
||||
}
|
||||
# associate the above function with an alias
|
||||
# so can recall/lookup by typing 'alias'
|
||||
alias dcleanlaradock=dcleanlaradockfunction
|
||||
```
|
||||
|
||||
<a name="InstallLaraDockDialTone"></a>
|
||||
#### Let's get a dial-tone with Laravel
|
||||
|
||||
```
|
||||
# barebones at this point
|
||||
docker-compose up -d nginx mysql
|
||||
|
||||
# run
|
||||
docker-compose ps
|
||||
|
||||
# Should see:
|
||||
Name Command State Ports
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
laradock_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
|
||||
laradock_nginx_1 nginx Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
|
||||
laradock_php-fpm_1 php-fpm Up 9000/tcp
|
||||
laradock_volumes_data_1 true Exit 0
|
||||
laradock_volumes_source_1 true Exit 0
|
||||
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
|
||||
|
||||
|
||||
```
|
||||
|
||||
<a name="enablePhpXdebug"></a>
|
||||
#### Enable xDebug on php-fpm
|
||||
In a host terminal sitting in the laradock folder, run: `./xdebugPhpFpm status`
|
||||
You should see something like the following:
|
||||
```
|
||||
xDebug status
|
||||
laradock_php-fpm_1
|
||||
PHP 7.0.9 (cli) (built: Aug 10 2016 19:45:48) ( NTS )
|
||||
Copyright (c) 1997-2016 The PHP Group
|
||||
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
|
||||
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
|
||||
```
|
||||
Other commands include `./xdebugPhpFpm start | stop`.
|
||||
|
||||
If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will already be running when
|
||||
`php-fpm` is started and listening for debug info on port 9000.
|
||||
|
||||
|
||||
<a name="InstallPHPStormConfigs"></a>
|
||||
#### PHPStorm Settings
|
||||
- Here are some settings that are known to work:
|
||||
- `Settings/BuildDeploymentConnection`
|
||||
- 
|
||||
|
||||
- `Settings/BuildDeploymentConnectionMappings`
|
||||
- 
|
||||
|
||||
- `Settings/BuildDeploymentDebugger`
|
||||
- 
|
||||
|
||||
- `Settings/EditRunConfigurationRemoteWebDebug`
|
||||
- 
|
||||
|
||||
- `Settings/EditRunConfigurationRemoteExampleTestDebug`
|
||||
- 
|
||||
|
||||
- `Settings/LangsPHPDebug`
|
||||
- 
|
||||
|
||||
- `Settings/LangsPHPInterpreters`
|
||||
- 
|
||||
|
||||
- `Settings/LangsPHPPHPUnit`
|
||||
- 
|
||||
|
||||
- `Settings/LangsPHPServers`
|
||||
- 
|
||||
|
||||
- `RemoteHost`
|
||||
To switch on this view, go to: `Menu/Tools/Deployment/Browse Remote Host`.
|
||||
- 
|
||||
|
||||
- `RemoteWebDebug`
|
||||
- 
|
||||
|
||||
- `EditRunConfigurationRemoteWebDebug`
|
||||
Go to: `Menu/Run/Edit Configurations`.
|
||||
- 
|
||||
|
||||
- `EditRunConfigurationRemoteExampleTestDebug`
|
||||
Go to: `Menu/Run/Edit Configurations`.
|
||||
- 
|
||||
|
||||
- `WindowsFirewallAllowedApps`
|
||||
Go to: `Control Panel\All Control Panel Items\Windows Firewall\Allowed apps`.
|
||||
- 
|
||||
|
||||
- `hosts`
|
||||
Edit: `C:\Windows\System32\drivers\etc\hosts`.
|
||||
- 
|
||||
|
||||
- [Enable xDebug on php-fpm](#enablePhpXdebug)
|
||||
|
||||
|
||||
|
||||
<a name="Usage"></a>
|
||||
## Usage
|
||||
|
||||
<a name="UsagePHPStormRunExampleTest"></a>
|
||||
### Run ExampleTest
|
||||
- right-click on `tests/ExampleTest.php`
|
||||
- Select: `Run 'ExampleTest.php'` or `Ctrl+Shift+F10`.
|
||||
- Should pass!! You just ran a remote test via SSH!
|
||||
|
||||
<a name="UsagePHPStormDebugExampleTest"></a>
|
||||
### Debug ExampleTest
|
||||
- Open to edit: `tests/ExampleTest.php`
|
||||
- Add a BreakPoint on line 16: `$this->visit('/')`
|
||||
- right-click on `tests/ExampleTest.php`
|
||||
- Select: `Debug 'ExampleTest.php'`.
|
||||
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
|
||||
- 
|
||||
|
||||
|
||||
<a name="UsagePHPStormDebugSite"></a>
|
||||
### Debug WebSite
|
||||
- In case xDebug is disabled, from the `laradock` folder run:
|
||||
`./xdebugPhpFpm start`.
|
||||
- To switch xdebug off, run:
|
||||
`./xdebugPhpFpm stop`
|
||||
|
||||
- Start Remote Debugging
|
||||
- 
|
||||
|
||||
- Open to edit: `bootstrap/app.php`
|
||||
- Add a BreakPoint on line 14: `$app = new Illuminate\Foundation\Application(`
|
||||
- Reload [Laravel Site](http://laravel/)
|
||||
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
|
||||
- 
|
||||
|
||||
|
||||
<a name="SSHintoWorkspace"></a>
|
||||
#### Let's shell into workspace
|
||||
Assuming that you are in laradock folder, type:
|
||||
`ssh -i workspace/insecure_id_rsa -p2222 root@laravel`
|
||||
**Cha Ching!!!!**
|
||||
- `workspace/insecure_id_rsa.ppk` may become corrupted. In which case:
|
||||
- fire up `puttygen`
|
||||
- import `workspace/insecure_id_rsa`
|
||||
- save private key to `workspace/insecure_id_rsa.ppk`
|
||||
|
||||
<a name="InstallKiTTY"></a>
|
||||
|
||||
##### KiTTY
|
||||
[Kitty](http://www.9bis.net/kitty/) KiTTY is a fork from version 0.67 of PuTTY.
|
||||
|
||||
- Here are some settings that are working for me:
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
- 
|
||||
|
||||
|
@ -2,15 +2,15 @@ FROM webdevops/apache:ubuntu-16.04
|
||||
|
||||
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
|
||||
|
||||
ARG PHP_SOCKET="php-fpm:9000"
|
||||
ARG PHP_SOCKET=php-fpm:9000
|
||||
|
||||
ENV WEB_PHP_SOCKET=$PHP_SOCKET
|
||||
|
||||
ENV WEB_DOCUMENT_ROOT=/var/www/laravel/public
|
||||
ENV WEB_DOCUMENT_ROOT=/var/www/public
|
||||
|
||||
EXPOSE 80 443
|
||||
|
||||
WORKDIR /var/www/laravel/public
|
||||
WORKDIR /var/www/public
|
||||
|
||||
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Docs: https://caddyserver.com/docs/caddyfile
|
||||
0.0.0.0:80
|
||||
root /var/www/laravel/public
|
||||
root /var/www/public
|
||||
fastcgi / php-fpm:9000 php {
|
||||
index index.php
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ FROM alpine:3.4
|
||||
|
||||
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
|
||||
|
||||
ENV caddy_version=0.9.1
|
||||
ENV caddy_version=0.9.3
|
||||
|
||||
LABEL caddy_version="$caddy_version" architecture="amd64"
|
||||
|
||||
@ -11,14 +11,14 @@ RUN apk update \
|
||||
&& apk add tar curl
|
||||
|
||||
RUN curl --silent --show-error --fail --location \
|
||||
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
|
||||
"https://github.com/mholt/caddy/releases/download/v$caddy_version/caddy_linux_amd64.tar.gz" \
|
||||
| tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \
|
||||
&& mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \
|
||||
&& chmod 0755 /usr/bin/caddy
|
||||
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
|
||||
"https://github.com/mholt/caddy/releases/download/v$caddy_version/caddy_linux_amd64.tar.gz" \
|
||||
| tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \
|
||||
&& mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \
|
||||
&& chmod 0755 /usr/bin/caddy
|
||||
|
||||
EXPOSE 80 443 2015
|
||||
|
||||
WORKDIR /var/www/laravel/public
|
||||
WORKDIR /var/www/public
|
||||
|
||||
CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]
|
||||
|
@ -2,6 +2,14 @@ version: '2'
|
||||
|
||||
services:
|
||||
|
||||
### Applications Code Container #############################
|
||||
|
||||
applications:
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ../:/var/www
|
||||
# - ../sample/:/var/www/sample
|
||||
|
||||
### Workspace Utilities Container ###########################
|
||||
|
||||
workspace:
|
||||
@ -21,12 +29,12 @@ services:
|
||||
- NODE_VERSION=stable
|
||||
- TZ=UTC
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
- applications
|
||||
extra_hosts:
|
||||
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
|
||||
- "dockerhost:10.0.75.1"
|
||||
ports:
|
||||
- "22:22"
|
||||
- "2222:22"
|
||||
tty: true
|
||||
|
||||
### PHP-FPM Container #######################################
|
||||
@ -41,9 +49,10 @@ services:
|
||||
- INSTALL_MEMCACHED=false
|
||||
- INSTALL_OPCACHE=false
|
||||
- INSTALL_AEROSPIKE_EXTENSION=false
|
||||
- CODEIGNITER=false
|
||||
dockerfile: Dockerfile-70
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
- applications
|
||||
expose:
|
||||
- "9000"
|
||||
links:
|
||||
@ -53,7 +62,7 @@ services:
|
||||
- "dockerhost:10.0.75.1"
|
||||
environment:
|
||||
# IMPORTANT: Set the Remote Interpreter entry matching name to `laravel`
|
||||
- PHP_IDE_CONFIG="serverName=laravel"
|
||||
- PHP_IDE_CONFIG=serverName=laravel
|
||||
|
||||
### Nginx Server Container ##################################
|
||||
|
||||
@ -63,24 +72,25 @@ services:
|
||||
args:
|
||||
- PHP_UPSTREAM=php-fpm
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
- applications
|
||||
volumes:
|
||||
- ./logs/nginx/:/var/log/nginx
|
||||
- ./nginx/sites/:/etc/nginx/sites-available
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
### Apache Server Container ##################################
|
||||
### Apache Server Container #################################
|
||||
|
||||
apache2:
|
||||
build:
|
||||
context: ./apache2
|
||||
args:
|
||||
- PHP_SOCKET="php-fpm:9000"
|
||||
- PHP_SOCKET=php-fpm:9000
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
- applications
|
||||
volumes:
|
||||
- ./logs/apache2:/var/log/apache2
|
||||
ports:
|
||||
@ -94,7 +104,7 @@ services:
|
||||
hhvm:
|
||||
build: ./hhvm
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
- applications
|
||||
expose:
|
||||
- "9000"
|
||||
links:
|
||||
@ -103,23 +113,24 @@ services:
|
||||
### MySQL Container #########################################
|
||||
|
||||
mysql:
|
||||
build: ./mysql
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
build:
|
||||
context: ./mysql
|
||||
args:
|
||||
- MYSQL_DATABASE=homestead
|
||||
- MYSQL_USER=homestead
|
||||
- MYSQL_PASSWORD=secret
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
MYSQL_DATABASE: homestead
|
||||
MYSQL_USER: homestead
|
||||
MYSQL_PASSWORD: secret
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
|
||||
### MariaDB Container #######################################
|
||||
|
||||
mariadb:
|
||||
build: ./mariadb
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
@ -132,8 +143,21 @@ services:
|
||||
|
||||
postgres:
|
||||
build: ./postgres
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_DB: homestead
|
||||
POSTGRES_USER: homestead
|
||||
POSTGRES_PASSWORD: secret
|
||||
|
||||
### PostgreSQL PostGis Container ############################
|
||||
|
||||
postgres-postgis:
|
||||
build: ./postgres-postgis
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
@ -150,8 +174,8 @@ services:
|
||||
- "1337:1337"
|
||||
environment:
|
||||
- NEO4J_AUTH=homestead:secret
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- neo4j:/var/lib/neo4j/data
|
||||
|
||||
### MongoDB Container #######################################
|
||||
|
||||
@ -159,25 +183,26 @@ services:
|
||||
build: ./mongo
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- mongo:/data/db
|
||||
|
||||
### Redis Container #########################################
|
||||
|
||||
redis:
|
||||
build: ./redis
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- redis:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
### Aerospike c Container #########################################
|
||||
### Aerospike c Container ###################################
|
||||
|
||||
aerospike:
|
||||
build: ./aerospike
|
||||
volumes_from:
|
||||
- workspace
|
||||
- volumes_data
|
||||
volumes:
|
||||
- aerospike:/opt/aerospike/data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
@ -189,8 +214,8 @@ services:
|
||||
|
||||
memcached:
|
||||
build: ./memcached
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- memcached:/var/lib/memcached
|
||||
ports:
|
||||
- "11211:11211"
|
||||
links:
|
||||
@ -206,7 +231,7 @@ services:
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
### RabbitMQ Container ####################################
|
||||
### RabbitMQ Container ######################################
|
||||
|
||||
rabbitmq:
|
||||
build: ./rabbitmq
|
||||
@ -235,8 +260,9 @@ services:
|
||||
caddy:
|
||||
build: ./caddy
|
||||
volumes_from:
|
||||
- volumes_source
|
||||
- volumes_data
|
||||
- applications
|
||||
volumes:
|
||||
- caddy:/root/.caddy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
@ -247,7 +273,7 @@ services:
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
### phpMyAdmin Container ##################################
|
||||
### phpMyAdmin Container ####################################
|
||||
|
||||
phpmyadmin:
|
||||
build: ./phpmyadmin
|
||||
@ -256,8 +282,6 @@ services:
|
||||
MYSQL_USER: homestead
|
||||
MYSQL_PASSWORD: secret
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
ports:
|
||||
- "8080:80"
|
||||
links:
|
||||
@ -266,7 +290,7 @@ services:
|
||||
# for mariadb container
|
||||
# - "mariadb:db"
|
||||
|
||||
### pgAdmin Container ##################################
|
||||
### pgAdmin Container #######################################
|
||||
|
||||
pgadmin:
|
||||
build: ./pgadmin
|
||||
@ -275,39 +299,45 @@ services:
|
||||
links:
|
||||
- postgres
|
||||
|
||||
### ElasticSearch Container ##################################
|
||||
### ElasticSearch Container #################################
|
||||
|
||||
elasticsearch:
|
||||
build: ./elasticsearch
|
||||
volumes_from:
|
||||
- volumes_data
|
||||
volumes:
|
||||
- elasticsearch-data:/usr/share/elasticsearch/data
|
||||
- elasticsearch-pkugins:/usr/share/elasticsearch/data
|
||||
ports:
|
||||
- "9200:9200"
|
||||
- "9300:9300"
|
||||
links:
|
||||
- php-fpm
|
||||
|
||||
### Laravel Application Code Container ######################
|
||||
### Volumes Setup ###########################################
|
||||
|
||||
volumes_source:
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ../:/var/www/laravel
|
||||
|
||||
### Databases Data Container ################################
|
||||
|
||||
volumes_data:
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql
|
||||
- ./data/postgres:/var/lib/postgresql/data
|
||||
- ./data/memcached:/var/lib/memcached
|
||||
- ./data/redis:/data
|
||||
- ./data/neo4j:/var/lib/neo4j/data
|
||||
- ./data/mongo:/data/db
|
||||
- ./data/aerospike:/opt/aerospike/data
|
||||
- ./data/sessions:/sessions
|
||||
- ./data/caddy:/root/.caddy
|
||||
- ./data/elasticsearch/data:/usr/share/elasticsearch/data
|
||||
|
||||
### Add more Containers below ###############################
|
||||
volumes:
|
||||
mysql:
|
||||
driver: "local"
|
||||
postgres:
|
||||
driver: "local"
|
||||
memcached:
|
||||
driver: "local"
|
||||
redis:
|
||||
driver: "local"
|
||||
neo4j:
|
||||
driver: "local"
|
||||
mariadb:
|
||||
driver: "local"
|
||||
mongo:
|
||||
driver: "local"
|
||||
phpmyadmin:
|
||||
driver: "local"
|
||||
aerospike:
|
||||
driver: "local"
|
||||
caddy:
|
||||
driver: "local"
|
||||
elasticsearch-data:
|
||||
driver: "local"
|
||||
elasticsearch-pkugins:
|
||||
driver: "local"
|
||||
sessions: ## nothing is connected to this (- ./data/sessions:/sessions)
|
||||
driver: "local"
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM ubuntu:14.04
|
||||
FROM ubuntu:14.04
|
||||
|
||||
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
|
||||
|
||||
@ -10,13 +10,13 @@ RUN apt-get update -y \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /var/www/laravel
|
||||
RUN mkdir -p /var/www
|
||||
|
||||
ADD server.ini /etc/hhvm/server.ini
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
WORKDIR /var/www/laravel
|
||||
WORKDIR /var/www
|
||||
|
||||
CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"]
|
||||
|
||||
|
@ -12,7 +12,7 @@ hhvm.log.level = Error
|
||||
hhvm.log.header = true
|
||||
hhvm.log.access[default][file] = /var/log/hhvm/access.log
|
||||
hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b"
|
||||
hhvm.server.source_root=/var/www/laravel/public
|
||||
hhvm.server.source_root=/var/www/public
|
||||
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
|
||||
|
||||
; Uncomment to log to files instead of STDOUT
|
||||
|
@ -1,9 +1,27 @@
|
||||
FROM mysql:latest
|
||||
FROM mysql:5.7
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
ADD startup /etc/mysql/startup
|
||||
|
||||
RUN chown -R mysql:root /var/lib/mysql/
|
||||
|
||||
ARG MYSQL_DATABASE=homestead
|
||||
ARG MYSQL_USER=homestead
|
||||
ARG MYSQL_PASSWORD=secret
|
||||
ARG MYSQL_ROOT_PASSWORD=root
|
||||
|
||||
ENV MYSQL_DATABASE=$MYSQL_DATABASE
|
||||
ENV MYSQL_USER=$MYSQL_USER
|
||||
ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
|
||||
ENV MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
|
||||
|
||||
RUN sed -i 's/MYSQL_DATABASE/'$MYSQL_DATABASE'/g' /etc/mysql/startup && \
|
||||
sed -i 's/MYSQL_USER/'$MYSQL_USER'/g' /etc/mysql/startup && \
|
||||
sed -i 's/MYSQL_PASSWORD/'$MYSQL_PASSWORD'/g' /etc/mysql/startup
|
||||
|
||||
ADD my.cnf /etc/mysql/conf.d/my.cnf
|
||||
|
||||
CMD ["mysqld"]
|
||||
CMD ["mysqld", "--init-file=/etc/mysql/startup"]
|
||||
|
||||
EXPOSE 3306
|
||||
|
@ -4,3 +4,6 @@
|
||||
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
|
||||
|
||||
[mysql]
|
||||
|
||||
[mysqld]
|
||||
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
|
||||
|
4
mysql/startup
Normal file
@ -0,0 +1,4 @@
|
||||
DROP USER IF EXISTS 'MYSQL_USER';
|
||||
CREATE USER 'MYSQL_USER'@'%';
|
||||
CREATE DATABASE IF NOT EXISTS MYSQL_DATABASE;
|
||||
GRANT ALL ON MYSQL_DATABASE.* TO 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD';
|
@ -3,7 +3,6 @@ FROM nginx:alpine
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
ADD nginx.conf /etc/nginx/
|
||||
COPY sites/*.conf /etc/nginx/sites-available/
|
||||
|
||||
ARG PHP_UPSTREAM=php-fpm
|
||||
|
||||
|
@ -26,4 +26,5 @@ http {
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-available/*;
|
||||
open_file_cache max=100;
|
||||
charset UTF-8;
|
||||
}
|
||||
|
2
nginx/sites/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.conf
|
||||
!default.conf
|
@ -3,8 +3,8 @@ server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
|
||||
server_name laravel;
|
||||
root /var/www/laravel/public;
|
||||
server_name laradock;
|
||||
root /var/www/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
@ -1,57 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
#domain name
|
||||
server_name drupal8.dev;
|
||||
|
||||
#file document root. This has to match one of the volumes in docer-composer.yml
|
||||
root /var/www/drupal8;
|
||||
|
||||
# This is the full path to your index file
|
||||
index index.php index.html index.htm;
|
||||
|
||||
## serve imagecache files directly or redirect to drupal if they do not exist.
|
||||
location ~* files/styles {
|
||||
access_log off;
|
||||
expires 30d;
|
||||
try_files $uri @drupal;
|
||||
}
|
||||
|
||||
## serve imagecache files directly or redirect to drupal if they do not exist.
|
||||
location ~* ^.+.(xsl|xml)$ {
|
||||
access_log off;
|
||||
expires 1d;
|
||||
try_files $uri @drupal;
|
||||
}
|
||||
|
||||
## Images and static content is treated different
|
||||
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
|
||||
access_log off;
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
location / {
|
||||
index index.php;
|
||||
# This is cool because no php is touched for static content
|
||||
try_files $uri $uri/ @rewrite;
|
||||
expires max;
|
||||
}
|
||||
|
||||
location @drupal {
|
||||
rewrite ^/(.*)$ /index.php?q=$1 last;
|
||||
}
|
||||
|
||||
location @rewrite {
|
||||
# Some modules enforce no slash (/) at the end of the URL
|
||||
# Else this rewrite block wouldn't be needed (GlobalRedirect)
|
||||
rewrite ^/(.*)$ /index.php?q=$1;
|
||||
}
|
||||
|
||||
location ~ .php$ {
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
@ -3,8 +3,8 @@ server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name site_a;
|
||||
root /var/www/site_a/public;
|
||||
server_name sample.dev;
|
||||
root /var/www/sample/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
@ -1,28 +0,0 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name site_b;
|
||||
root /var/www/site_b/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,6 +108,7 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
|
||||
#####################################
|
||||
# Opcache:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_OPCACHE=false
|
||||
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
|
||||
docker-php-ext-install opcache && \
|
||||
@ -117,6 +118,17 @@ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
|
||||
# Copy opcache configration
|
||||
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
|
||||
#####################################
|
||||
# Codeigniter Modifications:
|
||||
#####################################
|
||||
|
||||
ARG CODEIGNITER=false
|
||||
RUN if [ ${CODEIGNITER} = true ]; then \
|
||||
# Install Codeigniter PHP extentions requirements
|
||||
docker-php-ext-install mysqli && \
|
||||
docker-php-ext-install tokenizer \
|
||||
;fi
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
@ -130,7 +142,7 @@ RUN rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
WORKDIR /var/www/laravel
|
||||
WORKDIR /var/www
|
||||
|
||||
CMD ["php-fpm"]
|
||||
|
||||
|
@ -129,6 +129,16 @@ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
|
||||
# Copy opcache configration
|
||||
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
|
||||
#####################################
|
||||
# Codeigniter Modifications:
|
||||
#####################################
|
||||
|
||||
ARG CODEIGNITER=false
|
||||
RUN if [ ${CODEIGNITER} = true ]; then \
|
||||
# Install Codeigniter PHP extentions requirements
|
||||
docker-php-ext-install mysqli && \
|
||||
docker-php-ext-install tokenizer \
|
||||
;fi
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
@ -143,7 +153,7 @@ RUN rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
WORKDIR /var/www/laravel
|
||||
WORKDIR /var/www
|
||||
|
||||
CMD ["php-fpm"]
|
||||
|
||||
|
5
postgres-postgis/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM mdillon/postgis:latest
|
||||
|
||||
CMD ["postgres"]
|
||||
|
||||
EXPOSE 5432
|
@ -45,12 +45,12 @@ services:
|
||||
links:
|
||||
- workspace
|
||||
|
||||
### Laravel Application Code Container ######################
|
||||
### Application Code Container ######################
|
||||
|
||||
volumes_source:
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ../:/var/www/laravel
|
||||
- ../:/var/www
|
||||
|
||||
### Databases Data Container ################################
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# https://hub.docker.com/r/laradock/workspace/tags/
|
||||
#
|
||||
|
||||
FROM laradock/workspace:1.1
|
||||
FROM laradock/workspace:1.2
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
@ -91,7 +91,7 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
|
||||
apt-get update && \
|
||||
apt-get install -y --force-yes php7.0-xdebug && \
|
||||
sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \
|
||||
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \
|
||||
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc \
|
||||
;fi
|
||||
# ADD for REMOTE debugging
|
||||
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
|
||||
@ -125,7 +125,7 @@ ENV INSTALL_MONGO ${INSTALL_MONGO}
|
||||
RUN if [ ${INSTALL_MONGO} = true ]; then \
|
||||
# Install the mongodb extension
|
||||
pecl install mongodb && \
|
||||
echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \
|
||||
echo "extension=mongodb.so" >> /etc/php/7.0/cli/conf.d/30-mongodb.ini \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
@ -191,9 +191,10 @@ ARG INSTALL_YARN=false
|
||||
ENV INSTALL_YARN ${INSTALL_YARN}
|
||||
|
||||
RUN if [ ${INSTALL_YARN} = true ]; then \
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
|
||||
curl -o- -L https://yarnpkg.com/install.sh | bash && \
|
||||
echo "" >> ~/.bashrc && \
|
||||
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \
|
||||
echo "" >> ~/.bashrc && \
|
||||
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \
|
||||
;fi
|
||||
|
||||
# Add YARN binaries to root's .bashrc
|
||||
@ -234,6 +235,16 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \
|
||||
rm /etc/php/7.0/cli/conf.d/aerospike.ini \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# Non-root user : PHPUnit path
|
||||
#####################################
|
||||
|
||||
# add ./vendor/bin to non-root user's bashrc (needed for phpunit)
|
||||
USER laradock
|
||||
|
||||
RUN echo "" >> ~/.bashrc && \
|
||||
echo 'export PATH="/var/www/vendor/bin:$PATH"' >> ~/.bashrc
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
@ -246,4 +257,4 @@ RUN apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Set default work directory
|
||||
WORKDIR /var/www/laravel
|
||||
WORKDIR /var/www
|
||||
|
@ -1 +1 @@
|
||||
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1
|
||||
* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1
|
||||
|