* Fix:Issue #2038 Install mongodb php extension
- Make sure `INSTALL_MONGO` flag is `true`
- Run pecl install mongodb and enable the extentions in `laravel-horizon`
and `php-worker` images
- Remember to rebuild images
* INSTALL flag default set false
zend_extension=xdebug.so is already in /etc/php/7.2/cli/conf.d/20-xdebug.ini
rediefing the alias causes the was already loaded notice.
also /var/www/vendor/bin/phpunit instead of ./vendor/bin/phpunit breaks the alias when vendor directory is not directly under the root app directory
the first time, I ran apache2 container with other things such as MariaDB & PHPMyAdmin
the second time, I decided to run nginx instead of apache2 and I faced an error that said "adduser: group 'www-data' in use", so I solved and shared it to others.
* Update env-example
Added variables to install 'ping' and 'sshpass'
* Update docker-compose.yml
Import variable from '.env' to set 'INSTALL_MYSQL_CLIENT' and 'INSTALL_PING'
* Update Dockerfile
Add code to import variables from 'docker-compose.yml' to install 'ping' and/or 'sshpass'
* Support PHP 7.3
* travics-ci build test by pass:
* SSH2 extension does not yet support PHP 7.3
* V8JS extension does not yet support PHP 7.3.
* xdebug extension does not yet support PHP 7.3.
* memcached extension does not yet support PHP 7.3.
Because Container cannot volume when use APP_CODE_PATH_CONTAINER (with flag) concat with path name, e.g. /var/www:nocache/letencrypt
This will fix 1540.
* feature(nginx): add OpenSSL
* feature(nginx): add volume to store the certificates
* feature(nginx): add option installation OpenSSL
* feature(nginx): autogenerate certificates
* chore(nginx): add new line at end of file
* fix(nginx): fix run nginx on Windows
* fix(gitignore): end of file
* Revert "default user for workspace is laradock, so that owner of log file when running php artisan command doesn't change (#1875)"
This reverts commit 156d124db0.
* update document to inform user should add --user=laradock when exec into workspace, update sync.sh bash to exec into workspace with user laradock
It is bundled and enabled by default in the PHP language already, and adding this step raises a warning:
warning: tokenizer (tokenizer.so) is already loaded!
Also if this option disabled, it's still installed as part of the language anyway!
* Added documentation for installing libfaketime in the php-fpm container
* Enabled installing and using libfaketime system-wide inside the php-fpm container
This fix the following errors:
/bin/sh: 13: /root/.bashrc: shopt: not found
/bin/sh: 21: /root/.bashrc: shopt: not found
/bin/sh: 103: /root/.bashrc: source: not found
This fixes the following warnings when installing "zip" php extension:
configure: WARNING: ========================================================
configure: WARNING: Use of bundled libzip is deprecated and will be removed.
configure: WARNING: Some features such as encryption and bzip2 are not available.
configure: WARNING: Use system library and --with-libzip is recommended.
configure: WARNING: ========================================================
fix pip v10 error
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
Should only use `ADD` for URLs (and even then, `curl` or `wget` are preferred, for numerous reasons, even within this repo) and when extracting archive contents as part of the `ADD` operation; otherwise `COPY` is clearer and (slightly) more efficient.
This pull request references the of `BEANSTALKD_CONSOLE_HOST_PORT` from the `.env` file in the `docker-compose.yml`. Prior to this PR, the environment variable was defined in the `.env` file but was not used.
Enabling supervisorctl allow us to do, start/stop one service without having to stop the entire container for example. Usefull when we have many php process running.
supervisorctl stop laravel-worker
Google Chrome is releasing v63 which now forces all .dev domains to use HTTPS. Me and my co-workers had problems with this, so I do not want this to happen to others.
This will allow us to upgrade chrome driver easily. Set the default chrome driver to 2.32.
Also remove the comment and empty line to avoid getting below warning:
```
[WARNING]: Empty continuation lines will become errors in a future release.
```
**Why we need this change?**
Currently we are unable to run Dusk (Browser) tests in workspace container. This change,
is to allow us to install all dependencies needed to run Dust test which consists of
1. Linux packages such as xvfb (x-virtual frame buffer to run browser in headless container) and etc.
2. Chrome browser.
3. Chrome driver.
To install the Dusk dependencies.
1. Update `WORKSPACE_INSTALL_DUSK_DEPS` to true.
2. Run `docker-compose build workspace`.
I've also added couple of aliases to facilitate the preparation of test environment.
1. xvfb = `Xvfb -ac :0 -screen 0 1024x768x16 &` (run x-virtual frame buffer in the background)
2. serve = `php artisan serve --quiet &` (run laravel app in the background)
Once those are installed, we will need to update the default chrome driver argument in Laravel 5.5
from `--headless` to `sandbox`. Below are the steps to run Dusk in workspace.
1. `docker-compose run workspace bash` (get into workspace).
2. `laravel new dusk-test` (generate new lavarel app for testing purpose).
3. `cd dusk-test` (change directory to newly generate app folder).
4. `composer install --dev laravel/dusk` (install dusk via composer).
5. `php artisan dusk:install` (generate dusk files).
6. `sed -i '/APP_URL/d' .env` (remove APP_URL entry in .env)
7. `echo 'APP_URL=localhost:8000' >> .env` (add new APP_URL entry in .env)
8. `sed -i--'s/headless/no-sandbox/g' tests/DuskTestCase.php` (replace the default chrome driver argument).
9. `xvfb` (alias to run Xvfb instance in the background).
10. `serve` (alias to run laravel app in the background).
11. `dusk` (alias to run Dusk test).
It looks like the
219: user: "1000:50"
statement was added a while back to fix a file permissions issue, but on a completely fresh up it keeps mysql from starting, generating the following. Removing the line allowed everything to work properly.:
mysql_1 | Initializing database
mysql_1 | mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied)
mysql_1 | 2017-09-14T23:55:30.989254Z 0 [Note] Basedir set to /usr/
mysql_1 | 2017-09-14T23:55:30.989559Z 0 [Warning] The syntax '--symbolic-links/-s' is deprecated and will be removed in a future release
mysql_1 | 2017-09-14T23:55:30.989602Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
mysql_1 | 2017-09-14T23:55:30.990877Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting.
mysql_1 | 2017-09-14T23:55:30.990886Z 0 [ERROR] Aborting
ERROR INFO:
Step 4/5 : RUN rm -r /var/lib/apt/lists/*
---> Running in 4a3aa49e0e6e
rm: can't remove '/var/lib/apt/lists/*': No such file or directory
ERROR: Service 'php-worker' failed to build: The command '/bin/sh -c rm -r /var/lib/apt/lists/*' returned a non-zero code: 1
* 'master' of github.com:laradock/laradock:
format the readme.md file
fix travis ci hugo job get "cannot create directory" error.
fixed#1068
update some `guide` format in the documentation
* 'change-mysql-version' of https://github.com/hackel/laradock:
Add documentation on the MYSQL_VERSION variable.
Allow specifying the version of MySQL to install in .env file.
Added images and explanations for setting up remote debugging for PhpStorm on Linux
Also modified slightly Install Xdebug section to keep reading consistent
- fixes failing connection to host "mailhog" when sending mail via smtp
- mailhog needs to be available for the backend at Port 1025
- i.e. in a Laravel app .env should contain "MAIL_HOST=mailhog
although most much of use case developer should modify laradock to suit their project. we can use *.conf.example to take effect.
but we also need a dummy nginx conf to info other newer to know how to config their nginx conf. the *.conf.example should be.
so i think we should only take *.conf to take effect. not *
Elastic.co announced they will pull out their official images from the Docker Registry and user their own. There will be no updates starting 6/20/2017.
Pulling needs explicit version. Currently 5.4.1
Elastic.co announced they will pull out their official images from the Docker Registry and user their own. There will be no updates starting 6/20/2017.
Pulling needs explicit version. Currently 5.4.1
The dir for the conf seems to be missing from the base image, so the copy fails
Also if the server does not start with the conf as parameter it will not pick it up. Which leaves Redis wide open to attack by default:
Example try to telnet to your ip on the redis port for this container:
telnet 192.168.1.11 6379
echo "Hey no AUTH required!"
* 'master' of github.com:markhilton/laradock:
Added support for MS SQL server driver for PHP 7.0 - requested changes: - removed cd / && \ - added INSTALL_MSSQL to docker-compose.yml and env-example
Added support for MS SQL server driver for PHP 7.0
The guides page was showing broken images as the url for those was not taking into consideration the url rewrite. I just added a slash in front of all those urls to serve them from root images folder instead.
Caddy, NGINX and Apache2 should have the same default application paths. The `public/` path suffix is now added in the dotenv file to be able to use Laradock for non-laravel projects as well. Also, updated the documentation.
* 'master' of https://github.com/dtunes/laradock:
Upgrade hugo to 0.20.2 and added uglyurls = true to fix issues we when upgrading from 0.19 to 0.20 recently, also fixed 404 photos*
1. Repair git can not synchronize the BUG.
2. Increase the CDN query real IP, cross-domain request plugin.
you can use git xxx.com to sync code in caddy.
These duplicated Dockerfiles will be merged onto single Dockerfile
later. The same Dockerfile will check for the PHP version variable
and install the necessary softwar's accordingly.
These duplicated Dockerfiles will be merged onto single Dockerfile
later. The same Dockerfile will check for the PHP version variable
and install the necessary softwar's accordingly.
* 'master' of https://github.com/Laradock/laradock:
Fixed path variable for windows users
fixes up so Yarn is installable again
align file format
for file format
use '`' to quote identifier
use CREATE USER to define account authentication characteristics
use CREATE USER to define account authentication characteristics
Updated project example confs to fit nameing convention used in apache example
Updated project example confs to not have gitignore issues
docker-71 file now also works with new env-example setup
Adding Arg to docker-compose
Adding MSSQL Support
- add `project-1.conf` and `project-1.conf` to match the docs.
- keep default to work with both multiple and single projects.
- delete the .gitignore.
- update docker-compose and example-env file to match the new settings
- update the docs
- delete `laravel-https.conf` to replace it with documentation instead
* multiple-projects-improvement:
updated env-example and removed .env.example
complete missings
Seperated mysqli and tokenizer as seperate options without putting them under code igniter
Apache should just go to /var/www not /var/www/public when supporting multiple projects
fixed example and docker-compose.yml
Fixed php-fpm variables and example
Split up mysqli and tokenizer
Removed homestead entirely this time
Removed homestead entirely this time
Removed Homestead reference in all DB containers
Removed reference to homestead
Fixed timezone issue in docker-compose.yml
Added NGINX from env file and updated env-example
Updated PHP-FPM container to accept .env variables
Added workspace from env file and updated env-example
Removed .env file
Added env-example and adjusted docker-compose yml to support new env file
Updated gitignore
Changed to `docker ps` because this one word wraps. `docker-compose ps` will create a newline if text is too long in a small terminal window. Also `awk` represents tokens better than ones created with a " " delimiter.
* Mvzundert-multiple_frameworks:
complete missings
Seperated mysqli and tokenizer as seperate options without putting them under code igniter
Apache should just go to /var/www not /var/www/public when supporting multiple projects
fixed example and docker-compose.yml
Fixed php-fpm variables and example
Split up mysqli and tokenizer
Removed homestead entirely this time
Removed homestead entirely this time
Removed Homestead reference in all DB containers
Removed reference to homestead
Fixed timezone issue in docker-compose.yml
Added NGINX from env file and updated env-example
Updated PHP-FPM container to accept .env variables
Added workspace from env file and updated env-example
Removed .env file
Added env-example and adjusted docker-compose yml to support new env file
Updated gitignore
* 'multiple_frameworks' of https://github.com/Mvzundert/laradock:
Seperated mysqli and tokenizer as seperate options without putting them under code igniter
Apache should just go to /var/www not /var/www/public when supporting multiple projects
fixed example and docker-compose.yml
Fixed php-fpm variables and example
Split up mysqli and tokenizer
Removed homestead entirely this time
Removed homestead entirely this time
Removed Homestead reference in all DB containers
Removed reference to homestead
Fixed timezone issue in docker-compose.yml
Added NGINX from env file and updated env-example
Updated PHP-FPM container to accept .env variables
Added workspace from env file and updated env-example
Removed .env file
Added env-example and adjusted docker-compose yml to support new env file
Updated gitignore
This updates the download URL to include the DNS provider plugins so that we can use letsencrypt on our local environment. One thing to note, the version is not currently available as part of the dynamic download URL so this may need looking at in the future.
```
Step 15/32 : RUN if [ ${INSTALL_MEMCACHED} = true ]; then pecl install memcached && docker-php-ext-enable memcached ;fi
---> Running in b43e2e6b07f6
pecl/memcached requires PHP (version >= 7.0.0), installed version is 5.6.24
pecl/memcached can optionally use PHP extension "igbinary" (version >= 2.0)
pecl/memcached can optionally use PHP extension "msgpack" (version >= 2.0)
No valid packages found
install failed
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c if [ ${INSTALL_MEMCACHED} = true ]; then pecl install memcached && docker-php-ext-enable memcached ;fi' returned a non-zero code: 1
```
* xdebugPhpFpm permission denied fix
* xdebugPhpFpm might not have execution access when cloned. This
addition to readme helps tell the user why he got Permission Denied and
what can be done to fix it.
* Fix doesn't spelling, remove newline
* This is fixup for `38e26c3`.
Increasing buffer sizes for applications like react/babel.
Working on default images was throwing intermitten NGing errors and
requried multiple refreshes
When I submitted #538 it looks like I overlooked the crontab file
permissions for the Laradock user. This change ensure that all
crons added during build are set to the correct permission level.
Bug on Docker for Mac when we change the database from mysql to mariadb.
Maybe It is not a perfect fix. This fix will not share the same mysql volume, means we could not change database directly. We have to import the database to both database. But it will fix the Bug . Wish for better solution
- modified: README.md
- new file: _guides/photos/KiTTY/Connection.png
- new file: _guides/photos/KiTTY/ConnectionData.png
- new file: _guides/photos/KiTTY/ConnectionSSH.png
- new file: _guides/photos/KiTTY/ConnectionSSHAuth.png
- new file: _guides/photos/KiTTY/Session.png
- new file: _guides/photos/KiTTY/Terminal.png
- new file: _guides/photos/KiTTY/TerminalKeyboard.png
- new file: _guides/photos/KiTTY/TerminalShell.png
- new file: _guides/photos/KiTTY/Window.png
- new file: _guides/photos/KiTTY/WindowAppearance.png
- new file: _guides/photos/PHPStorm/DebugRemoteOn.png
- new file: _guides/photos/PHPStorm/RemoteDebuggingSuccess.png
- new file: _guides/photos/PHPStorm/RemoteHost.png
- new file: _guides/photos/PHPStorm/RemoteTestDebuggingSuccess.png
- new file: _guides/photos/PHPStorm/RemoteWebDebuggingSuccess.png
- new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnection.png
- new file: _guides/photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png
- new file: _guides/photos/PHPStorm/Settings/BuildDeploymentDebugger.png
- new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png
- new file: _guides/photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png
- new file: _guides/photos/PHPStorm/Settings/LangsPHPDebug.png
- new file: _guides/photos/PHPStorm/Settings/LangsPHPInterpreters.png
- new file: _guides/photos/PHPStorm/Settings/LangsPHPPHPUnit.png
- new file: _guides/photos/PHPStorm/Settings/LangsPHPServers.png
- new file: _guides/photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png
- new file: _guides/photos/PHPStorm/Settings/WindowsHyperVManager.png
- new file: _guides/photos/PHPStorm/Settings/hosts.png
- new file: _guides/photos/SimpleHostsEditor/AddHost_laravel.png
- new file: _guides/phpstorm.md
When running docker-compose with mariadb the following message will appear:
ERROR: for mariadb Cannot create container for service mariadb: Invalid volume spec "mariadb": Invalid volume destination path: 'mariadb' mount path must be absolute.
ERROR: Encountered errors while bringing up the project.
This commit fixes the issue.
* 'master' of https://github.com/LaraDock/laradock:
Fix typo in README: Giude -> Guide
Added laravel cronjob
Added cron files copying to workspace crontab
Remove port fowarding for MySQL and MariaDB
Added NVM binaries in root bashrc
Allows a Windows Powershell user to enter a running container to avoid the following error message.
Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose exec`.
* 'master' of https://github.com/LaraDock/laradock:
Fixes#305
add mysql custom configuration file.
fix php warning "Unable to load dynamic library '/usr/lib/php/20151012/aerospike.so'" when aerospike set not install at workspace
add build options MAX_ALLOWED_PACKET to mysql
update readme for ElasticSearch.
Support ElasticSearch Container.
Add vue-cli on workspace npm global installers
modify words in Chinese
Add aerospike extension installation on phpfpm-56 as well
These environment variables are not needed since they are only being used at build time and we are already specifying them using the ARG command, no need to specify it twice since it increases build time and size.
* 'master' of https://github.com/LaraDock/laradock:
fix caddy Dockerfile from previous commit.
caddy log to file. enable gzip compression.
update caddy to v0.9.1
Laravel 5.3 is published officially
Create README-zh.md
Since 5.5 and 5.6 dockerfiles are identical execept the base image php version.
Will let the users switch the php 5.6 and 5.5 version from the Dockerfile-5 by changing one char
in the first line. Removing this duplication will make contribution and maintance easier and faster.
I've placed the `application` and `data` directories into a `volumes`
subdirectory. The top level `data` directory is now used for storing the
data used by the database (and other, if any) containers. The `data`
directory has also been added to the `.gitignore` file to prevent
accidental pushing of user data.
All of the database data volume mapping have been changed from the host's
`/var/lib` directory to locally alongside the laradock installation. This
should hopefully prevent issues where data disappears after containers are
restarted or data on the host machine is overwritten by accident (scary!)
Additionally this should make data easier to backup between installations
- especially on Windows where `/var` does not exist and is created
transparently by Docker Machine/Windows beta.
This change will most likely cause data to disappear from existing
installations, however it may reappear if moved to it's new home.
References #137, #138
Added an untracked `.env` file to the root directory to prevent the
`WARNING: The INSTALL_PRESTISSIMO variable is not set` message from being
displayed when `docker-compose` is run.
Added section in README for optional features.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mahmoud@zalt.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[Docker](https://www.docker.com) 是一个开源项目,自动化部署应用程序软件的容器,在 Linux, Mac OS and Windows 提供一个额外的抽象层和自动化的[操作系统级的虚拟化](https://en.wikipedia.org/wiki/Operating-system-level_virtualization)
<ahref="https://github.com/laradock/laradock/stargazers"><ahref="#backers"alt="sponsors on Open Collective"><imgsrc="https://opencollective.com/laradock/backers/badge.svg"/></a><ahref="#sponsors"alt="Sponsors on Open Collective"><imgsrc="https://opencollective.com/laradock/sponsors/badge.svg"/></a><imgsrc="https://img.shields.io/github/stars/laradock/laradock.svg"alt="GitHub stars"></a>
<imgsrc="https://raw.githubusercontent.com/laradock/laradock/master/.github/home-page-images/sponsor-1.png?raw=true"width="300px"alt="Writing essays service Edubirdie"/>
For basic sponsorships go to [Open Collective](https://opencollective.com/laradock#sponsor), for golden sponsorships contact <ahref ="mailto: support@laradock.io">support@laradock.io</a>.
*Your logo will show up on the [github repository](https://github.com/laradock/laradock/) index page and the [documentation](http://laradock.io/) main page.*
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`) And you can still seek help on Gitter for it.
## Found an Issue
If you have an issue or you found a typo in the documentation, you can help us by
opening an [Issue](https://github.com/laradock/laradock/issues).
**Steps to do before opening an Issue:**
1. Before you submit your issue search the archive, maybe your question was already answered couple hours ago (search in the closed Issues as well).
2. Decide if the Issue belongs to this project or to [Docker](https://github.com/docker) itself! or even the tool you are using such as Nginx or MongoDB...
If your issue appears to be a bug, and hasn't been reported, then open a new issue.
*This helps us maximize the effort we can spend fixing issues and adding new
features, by not reporting duplicate issues.*
## Want a Feature
You can request a new feature by submitting an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as `Feature Suggestion`). If you would like to implement a new feature then consider submitting a Pull Request yourself.
## Update the Documentation (Site)
Laradock uses [Hugo](https://gohugo.io/) as website generator tool, with the [Material Docs theme](http://themes.gohugo.io/theme/material-docs/). You might need to check their docs quickly.
Go the `DOCUMENTATION/content` and search for the markdown file you want to edit
Note: Every folder represents a section in the sidebar "Menu". And every page and sidebar has a `weight` number to show it's position in the site.
To update the sidebar or add a new section to it, you can edit this `DOCUMENTATION/config.toml` toml file.
> The site will be auto-generated in the `docs/` folder by [Travis CI](https://travis-ci.org/laradock/laradock/).
### Host the documentation locally
1. Install [Hugo](https://gohugo.io/) on your machine.
2. Edit the `DOCUMENTATION/content`.
3. Delete the `/docs` folder from the root.
4. After you finish the editing, go to `DOCUMENTATION/` and run the `hugo` command to generate the HTML docs (inside a new `/docs` folder).
## Support new Software (Add new Container)
* Fork the repo and clone the code.
* Create folder as the software name (example: `mysql` - `nginx`).
* Add your `Dockerfile` in the folder "you may add additional files as well".
* Add the software to the `docker-compose.yml` file.
* Make sure you follow the same code/comments style.
* Add the environment variables to the `env-example` if you have any.
* **MOST IMPORTANTLY** update the `Documentation`, add as much information.
* Submit a Pull Request, to the `master` branch.
## Edit supported Software (Edit a Container)
* Fork the repo and clone the code.
* Open the software (container) folder (example: `mysql` - `nginx`).
* Edit the files.
* Make sure to update the `Documentation` in case you made any changes.
* Submit a Pull Request, to the `master` branch.
## Edit Base Image
* Open any dockerfile, copy the base image name (example: `FROM phusion/baseimage:latest`).
* Search for the image in the [Docker Hub](https://hub.docker.com/search/) and find the source..
*Most of the image in Laradock are offical images, these projects live in other repositories and maintainer by other organizations.*
**Note:** Laradock has two base images for (`Workspace` and `php-fpm`, mainly made to speed up the build time on your machine.
* Find the dockerfiles, edit them and submit a Pull Request.
* When updating a Laradock base image (`Workspace` or `php-fpm`), ask a project maintainer "Admin" to build a new image after your PR is merged.
**Note:** after the base image is updated, every dockerfile that uses that image, needs to update his base image tag to get the updated code.
<br>
## Submit Pull Request Instructions
### 1. Before Submitting a Pull Request (PR)
Always Test everything and make sure its working:
- Pull the latest updates (or fork of you don’t have permission)
- Before editing anything:
- Test building the container (docker-compose build --no-cache container-name) build with no cache first.
- Test running the container with some other containers in real app and see of everything is working fine.
- Now edit the container (edit section by section and test rebuilding the container after every edited section)
- Testing building the container (docker-compose build container-name) with no errors.
- Test it in a real App if possible.
### 2. Submitting a PR
Consider the following guidelines:
* Search [GitHub](https://github.com/laradock/laradock/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate efforts.
* Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
* Commit your changes using a descriptive commit message.
* Push your branch to GitHub:
```shell
git push origin my-fix-branch
```
* In GitHub, send a pull request to `laradock:master`.
* If we suggest changes then:
* Make the required updates.
* Commit your changes to your branch (e.g. `my-fix-branch`).
* Push the changes to your GitHub repository (this will update your Pull Request).
> If the PR gets too outdated we may ask you to rebase and force push to update the PR:
```shell
git rebase master -i
git push origin my-fix-branch -f
```
*WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments on code that were previously made by you and others in your commits.*
### 3. After your PR is merged
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```shell
git push origin --delete my-fix-branch
```
* Check out the master branch:
```shell
git checkout master -f
```
* Delete the local branch:
```shell
git branch -D my-fix-branch
```
* Update your master with the latest upstream version:
Note: If you are not using Git yet for your project, you can use `git clone` instead of `git submodule `.
*To keep track of your Laradock changes, between your projects and also keep Laradock updated [check these docs](/documentation/#keep-track-of-your-laradock-changes)*
2 - Make sure your folder structure should look like this:
```
+ project-a
+ laradock-a
+ project-b
+ laradock-b
```
*(It's important to rename the laradock folders to unique name in each project, if you want to run laradock per project).*
3 - Go to the [Usage](#Usage) section.
<aname="A2"></a>
### A.2) Don't have a PHP project yet:
1 - Clone this repository anywhere on your machine:
2 - Go to your web server and create config files to point to different project directory when visiting different domains:
For **Nginx** go to `nginx/sites`, for **Apache2**`apache2/sites`.
Laradock by default includes some sample files for you to copy `app.conf.example`, `laravel.conf.example` and `symfony.conf.example`.
3 - change the default names `*.conf`:
You can rename the config files, project folders and domains as you like, just make sure the `root` in the config files, is pointing to the correct project folder name.
4 - Add the domains to the **hosts** files.
```
127.0.0.1 project-1.test
127.0.0.1 project-2.test
...
```
If you use Chrome 63 or above for development, don't use `.dev`. [Why?](https://laravel-news.com/chrome-63-now-forces-dev-domains-https). Instead use `.localhost`, `.invalid`, `.test`, or `.example`.
4 - Go to the [Usage](#Usage) section.
<aname="Usage"></a>
## 2.3 Usage
**Read Before starting:**
If you are using **Docker Toolbox** (VM), do one of the following:
- Upgrade to Docker [Native](https://www.docker.com/products/docker) for Mac/Windows (Recommended). Check out [Upgrading Laradock](/documentation/#upgrading-laradock)
- Use Laradock v3.\*. Visit the [Laradock-ToolBox](https://github.com/laradock/laradock/tree/LaraDock-ToolBox) branch. *(outdated)*
<br>
We recommend using a Docker version which is newer than 1.13.
<br>
>**Warning:** If you used an older version of Laradock it's highly recommended to rebuild the containers you need to use [see how you rebuild a container](#Build-Re-build-Containers) in order to prevent as much errors as possible.
<br>
1 - Enter the laradock folder and copy `env-example` to `.env`
```shell
cp env-example .env
```
You can edit the `.env` file to choose which software's you want to be installed in your environment. You can always refer to the `docker-compose.yml` file to see how those variables are being used.
Depending on the host's operating system you may need to change the value given to `COMPOSE_FILE`. When you are running Laradock on Mac OS the correct file separator to use is `:`. When running Laradock from a Windows environment multiple files must be separated with `;`.
By default the containers that will be created have the current directory name as suffix (e.g. `laradock_workspace_1`). This can cause mixture of data inside the container volumes if you use laradock in multiple projects. In this case, either read the guide for [multiple projects](#B) or change the variable `COMPOSE_PROJECT_NAME` to something unique like your project name.
2 - Build the environment and run it using `docker-compose`
In this example we'll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:
```bash
docker-compose up -d nginx mysql
```
**Note**: All the web server containers `nginx`, `apache` ..etc depends on `php-fpm`, which means if you run any of them, they will automatically launch the `php-fpm` container for you, so no need to explicitly specify it in the `up` command. If you have to do so, you may need to run them as follows: `docker-compose up -d nginx php-fpm mysql`.
You can select your own combination of containers from [this list](http://laradock.io/introduction/#supported-software-images).
*(Please note that sometimes we forget to update the docs, so check the `docker-compose.yml` file to see an updated list of all available containers).*
<br>
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...)
```bash
docker-compose exec workspace bash
```
*Alternatively, for Windows PowerShell users: execute the following command to enter any running container:*
```bash
docker exec -it {workspace-container-id} bash
```
**Note:** You can add `--user=laradock` to have files created as your host's user. Example:
$root@server:~/laravel/laradock# docker-compose up -d nginx mysql
```
Note that more containers are available, find them in the [docs](http://laradock.io/introduction/#supported-software-containers) or the `docker-compose.yml` file.
### Go to Your Workspace
```
docker-compose exec workspace bash
```
### Execute commands
If you want to only execute some command and don't want to enter bash, you can execute `docker-compose run workspace <command>`.
```
docker-compose run workspace php artisan migrate
```
### Install and configure Laravel
Let's install Laravel's dependencies, add the `.env` file, generate the key and give proper permissions to the cache folder.
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.
### 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`.
### 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](images/photos/SimpleHostsEditor/AddHost_laravel.png).
### 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
```
#### 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).
**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" ]; then
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'
- Create a server with name `laradock` (matches **PHP_IDE_CONFIG** key in environment file) and make sure to map project root path with server correctly.
Join the chat room on [Gitter](https://gitter.im/Laradock/laradock) and get help and support from the community.
You can as well can open an [issue](https://github.com/laradock/laradock/issues) on Github (will be labeled as Question) and discuss it with people on [Gitter](https://gitter.im/Laradock/laradock).
<br>
<aname="Common-Problems"></a>
# Common Problems
*Here's a list of the common problems you might face, and the possible solutions.*
<br>
## I see a blank (white) page instead of the Laravel 'Welcome' page!
Run the following command from the Laravel root directory:
```bash
sudo chmod -R 777 storage bootstrap/cache
```
<br>
## I see "Welcome to nginx" instead of the Laravel App!
Use `http://127.0.0.1` instead of `http://localhost` in your browser.
<br>
## 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 (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.
<br>
## I get NGINX error 404 Not Found on Windows.
1. Go to docker Settings on your Windows machine.
2. Click on the `Shared Drives` tab and check the drive that contains your project files.
3. Enter your windows username and password.
4. Go to the `reset` tab and click restart docker.
<br>
## The time in my services does not match the current time
1. Make sure you've [changed the timezone](#Change-the-timezone).
2. Stop and rebuild the containers (`docker-compose up -d --build <services>`)
<br>
## 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`
## I get stuck when building nginx on `fetch http://mirrors.aliyun.com/alpine/v3.5/main/x86_64/APKINDEX.tar.gz`
As stated on [#749](https://github.com/laradock/laradock/issues/749#issuecomment-419652646), Already fixed,just set `CHANGE_SOURCE` to false.
## Custom composer repo packagist url and npm registry url
In China, the origin source of composer and npm is very slow. You can add `WORKSPACE_NPM_REGISTRY` and `WORKSPACE_COMPOSER_REPO_PACKAGIST` config in `.env` to use your custom source.
## I get `Module build failed: Error: write EPIPE` while compiling react application
When you run `npm build` or `yarn dev` building a react application using webpack with elixir you may receive a `Error: write EPIPE` while processing .jpg images.
This is caused of an outdated library for processing **.jpg files** in ubuntu 16.04.
To fix the problem you can follow those steps
1 - Open the `.env`.
2 - Search for `WORKSPACE_INSTALL_LIBPNG` or add the key if missing.
<imgsrc="https://raw.githubusercontent.com/laradock/laradock/master/.github/home-page-images/sponsor-1.png?raw=true"width="300px"alt="Writing essays service Edubirdie"/>
For basic sponsorships go to [Open Collective](https://opencollective.com/laradock#sponsor), for golden sponsorships contact <ahref ="mailto: support@laradock.io">support@laradock.io</a>.
<br>
*Your logo will show up on the [github repository](https://github.com/laradock/laradock/) index page and the [documentation](http://laradock.io/) main page.*
## Quick Overview
Let's see how easy it is to setup our demo stack `PHP`, `NGINX`, `MySQL`, `Redis` and `Composer`:
2 - Enter the laradock folder and rename `env-example` to `.env`.
```shell
cp env-example .env
```
3 - Run your containers:
```shell
docker-compose up -d nginx mysql phpmyadmin redis workspace
```
4 - Open your project's `.env` file and set the following:
```shell
DB_HOST=mysql
REDIS_HOST=redis
QUEUE_HOST=beanstalkd
```
5 - Open your browser and visit localhost: `http://localhost`.
```shell
That's it! enjoy :)
```
<aname="features"></a>
## Features
- Easy switch between PHP versions: 7.3, 7.2, 7.1, 5.6...
- Choose your favorite database engine: MySQL, Postgres, MariaDB...
- Run your own stack: Memcached, HHVM, RabbitMQ...
- Each software runs on its own container: PHP-FPM, NGINX, PHP-CLI...
- Easy to customize any container, with simple edit to the `Dockerfile`.
- All Images extends from an official base Image. (Trusted base Images).
- Pre-configured NGINX to host any code at your root directory.
- Can use Laradock per project, or single Laradock for all projects.
- Easy to install/remove software's in Containers using environment variables.
- Clean and well structured Dockerfiles (`Dockerfile`).
- Latest version of the Docker Compose file (`docker-compose`).
- Everything is visible and editable.
- Fast Images Builds.
<aname="Supported-Containers"></a>
## Supported Software (Docker Images)
> Laradock, adheres to the 'separation of concerns' principle, thus it runs each software on its own Docker Container.
> You can turn On/Off as many instances as you want without worrying about the configurations.
> To run a chosen container from the list below, run `docker-compose up -d {container-name}`.
> The container name `{container-name}` is the same as its folder name. Example to run the "PHP FPM" container use the name "php-fpm".
- **Web Servers:**
- NGINX
- Apache2
- Caddy
- **Load Balancers:**
- HAProxy
- Traefik
- **PHP Compilers:**
- PHP FPM
- HHVM
- **Database Management Systems:**
- MySQL
- PostgreSQL
- PostGIS
- MariaDB
- Percona
- MSSQL
- MongoDB
- MongoDB Web UI
- Neo4j
- CouchDB
- RethinkDB
- Cassandra
- **Database Management Apps:**
- PhpMyAdmin
- Adminer
- PgAdmin
- **Cache Engines:**
- Redis
- Redis Web UI
- Redis Cluster
- Memcached
- Aerospike
- Varnish
- **Message Brokers:**
- RabbitMQ
- RabbitMQ Admin Console
- Beanstalkd
- Beanstalkd Admin Console
- Eclipse Mosquitto
- PHP Worker
- Laravel Horizon
- **Mail Servers:**
- Mailu
- Mailhog
- MailDev
- **Log Management:**
- GrayLog
- **Testing:**
- Selenium
- **Monitoring:**
- Grafana
- NetData
- **Search Engines:**
- ElasticSearch
- Apache Solr
- Manticore Search
- **IDE's**
- ICE Coder
- Theia
- Web IDE
- **Miscellaneous:**
- Workspace *(Laradock container that includes a rich set of pre-configured useful tools)*
-`PHP CLI`
-`Composer`
-`Git`
-`Vim`
-`xDebug`
-`Linuxbrew`
-`Node`
-`V8JS`
-`Gulp`
-`SQLite`
-`Laravel Envoy`
-`Deployer`
-`Yarn`
-`SOAP`
-`Drush`
-`Wordpress CLI`
- Apache ZooKeeper *(Centralized service for distributed systems to a hierarchical key-value store)*
- Kibana *(Visualize your Elasticsearch data and navigate the Elastic Stack)*
- LogStash *(Server-side data processing pipeline that ingests data from a multitude of sources simultaneously)*
- Jenkins *(automation server, that provides plugins to support building, deploying and automating any project)*
- Certbot *(Automatically enable HTTPS on your website)*
- Swoole *(Production-Grade Async programming Framework for PHP)*
- SonarQube *(continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs and more)*
- Gitlab *(A single application for the entire software development lifecycle)*
- PostGIS *(Database extender for PostgreSQL. It adds support for geographic objects allowing location queries to be run in SQL)*
- Blackfire *(Empowers all PHP developers and IT/Ops to continuously verify and improve their app's performance)*
- Laravel Echo *(Bring the power of WebSockets to your Laravel applications)*
- Phalcon *(A PHP web framework based on the model–view–controller pattern)*
- Minio *(Cloud storage server released under Apache License v2, compatible with Amazon S3)*
- AWS EB CLI *(CLI that helps you deploy and manage your AWS Elastic Beanstalk applications and environments)*
- Thumbor *(Photo thumbnail service)*
- IPython *(Provides a rich architecture for interactive computing)*
- Jupyter Hub *(Jupyter notebook for multiple users)*
- Portainer *(Build and manage your Docker environments with ease)*
- Docker Registry *(The Docker Registry implementation for storing and distributing Docker images)*
- Docker Web UI *(A browser-based solution for browsing and modifying a private Docker registry)*
You can choose, which tools to install in your workspace container and other containers, from the `.env` file.
> If you modify `docker-compose.yml`, `.env` or any `dockerfile` file, you must re-build your containers, to see those effects in the running instance.
*If you can't find your Software in the list, build it yourself and submit it. Contributions are welcomed :)*
<aname="what-is-docker"></a>
## What is Docker?
[Docker](https://www.docker.com) is an open platform for developing, shipping, and running applications.
Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
With Docker, you can manage your infrastructure in the same ways you manage your applications.
By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
<aname="why-docker-not-vagrant"></a>
## Why Docker not Vagrant!?
[Vagrant](https://www.vagrantup.com) creates Virtual Machines in minutes while Docker creates Virtual Containers in seconds.
Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you **lightweight** Virtual Containers, that share the same kernel and allow to safely execute independent processes.
In addition to the speed, Docker gives tons of features that cannot be achieved with Vagrant.
Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time).
Sections such as www.example.com/foo/ will now be rendered with a list of all pages that are part of this section. The list shows the pages' title and a summary of their content.
[Show me the diff](https://github.com/digitalcraftsman/hugo-material-docs/commit/1f8393a8d4ce1b8ee3fc7d87be05895c12810494)
### 22nd March 2016
#### Changing setup for Google Analytics
Formerly, the tracking id for Google Analytics was set like below:
```toml
[params]
google_analytics=["UA-XXXXXXXX-X","auto"]
```
Now the theme uses Hugo's own Google Analytics config option. The variable moved outside the scope of `params` and the setup requires only the tracking id as a string:
```toml
googleAnalytics="UA-XXXXXXXX-X"
```
[Show me the diff](https://github.com/digitalcraftsman/hugo-material-docs/commit/fa10c8eef935932426d46b662a51f29a5e0d48e2)
Next, take a look in the `exampleSite` folder at. This directory contains an example config file and the content for the demo. It serves as an example setup for your documentation.
Copy at least the `config.toml` in the root directory of your website. Overwrite the existing config file if necessary.
Hugo includes a development server, so you can view your changes as you go -
very handy. Spin it up with the following command:
``` sh
hugo server
```
Now you can go to [localhost:1313](http://localhost:1313) and the Material
theme should be visible. For detailed installation instructions visit the [demo](http://themes.gohugo.io/theme/material-docs/).
Noteworthy changes of this theme are listed in the [changelog](https://github.com/digitalcraftsman/hugo-material-docs/blob/master/CHANGELOG.md).
## Acknowledgements
A big thank you to [Martin Donath](https://github.com/squidfunk). He created the original [Material theme](https://github.com/squidfunk/mkdocs-material) for Hugo's companion [MkDocs](http://www.mkdocs.org/). This port wouldn't be possible without him.
Furthermore, thanks to [Steve Francia](https://gihub.com/spf13) for creating Hugo and the [awesome community](https://github.com/spf13/hugo/graphs/contributors) around the project.
## License
The theme is released under the MIT license. Read the [license](https://github.com/digitalcraftsman/hugo-material-docs/blob/master/LICENSE.md) for more information.
<bodyclass="{{ with .Site.Params.palette.primary }}palette-primary-{{ . }}{{end }} {{ with .Site.Params.palette.accent }}palette-accent-{{ . }}{{ end }}">
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
- [Misc](#Misc)
- [Run a Docker Virtual Host](#Run-Docker-Virtual-Host)
- [Find your Docker IP Address](#Find-Docker-IP-Address)
- [Use custom Domain](#Use-custom-Domain)
- [Debugging](#debugging)
- [Help & Questions](#Help)
<aname="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.
**Usage Overview:** Run `NGINX`, `MySQL` and `Redis`.
>If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :)
<aname="what-is-docker"></a>
### What is Docker?
[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.
<aname="what-is-laravel"></a>
### What is Laravel?
Seriously!!!
<aname="why-docker-not-vagrant"></a>
### Why Docker not Vagrant!?
[Vagrant](https://www.vagrantup.com) creates Virtual Machines in minutes while Docker creates Virtual Containers in seconds.
Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you **lightweight** Virtual Containers, that share the same kernel and allow to safely execute independent processes.
In addition to the speed, Docker gives tens of features that cannot be achieved with Vagrant.
Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time).
<aname="laradock-vs-homestead"></a>
### LaraDock VS Homestead
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).
- Homestead is a tool that controls Vagrant for you (using Homestead special commands). And Vagrant manages your Virtual Machine.
- LaraDock is a tool that controls Docker for you (using Docker Compose official commands). And Docker manages you Virtual Containers.
Running a virtual Container is much faster than running a full virtual Machine.
<br>Thus **LaraDock is much faster than Homestead**.
1 - For **Windows & MAC** users only: If you are not using the native Docker-Engine `Beta`, make sure you have a running Docker Virtual Host on your machine.
[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
(**Linux** users don't need a Virtual Host, so skip this step).
<br>
2 - Run some Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).*
**Example:** Running NGINX and MySQL:
```bash
docker-compose up -d nginx mysql
```
You can select your own combination of container form this list:
**Note**: `workspace`, `data`, `php-fpm` and `application` will run automatically in most of the cases.
<br>
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...).
```bash
docker-compose run workspace bash
```
Replace `{Workspace-Container-Name}` with your Workspace container name.
<br>
To find the containers names type `docker-compose ps`.
<br>
4 - Edit the Laravel 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 `{Docker-IP}`:
```env
DB_HOST=xxx.xxx.xxx.xxx
```
[How to find my Docker IP Address?](#Find-Docker-IP-Address)
<br>
5 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
<br>
**Debugging**: if you are facing any problem here check the [Debugging](#debugging) section.
If you need a special support. Contact me, more details in the [Help & Questions](#Help) section.
<br>
<aname="Documentation"></a>
## Documentation
<aname="Docker"></a>
### [Docker]
<aname="List-current-running-Containers"></a>
### List current running Containers
```bash
docker ps
```
You can also use the this command if you want to see only this project containers:
```bash
docker-compose ps
```
<br>
<aname="Close-all-running-Containers"></a>
### Close all running Containers
```bash
docker-compose stop
```
To stop single container do:
```bash
docker-compose stop {container-name}
```
<br>
<aname="Delete-all-existing-Containers"></a>
### Delete all existing Containers
```bash
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):*
<br>
<aname="Enter-Container"></a>
### Enter a Container (SSH into a running Container)
1 - first list the current running containers with `docker ps`
2 - enter any container using:
```bash
docker-compose run {container-name} bash
```
3 - to exit a container, type `exit`.
<br>
<aname="Edit-Container"></a>
### Edit default container configuration
Open the `docker-compose.yml` and change anything you want.
Examples:
Change MySQL Database Name:
```yml
environment:
MYSQL_DATABASE:laradock
```
Change Redis defaut port to 1111:
```yml
ports:
- "1111:6379"
```
<br>
<aname="Edit-a-Docker-Image"></a>
### Edit a Docker Image
1 - Find the `dockerfile` of the image you want to edit,
<br>
example for `mysql` it will be `mysql/Dockerfile`.
2 - Edit the file the way you want.
3 - Re-build the container:
```bash
docker-compose build mysql
```
*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.*
<br>
<aname="Build-Re-build-Containers"></a>
### Build/Re-build Containers
If you do any change to any `dockerfile` make sure you run this command, for the changes to take effect:
```bash
docker-compose build
```
Optionally you can specify which container to rebuild (instead of rebuilding all the containers):
```bash
docker-compose build {container-name}
```
<br>
<aname="Add-Docker-Images"></a>
### Add more Software's (Docker Images)
To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/).
<br>
<aname="View-the-Log-files"></a>
### View the Log files
The Nginx Log file is stored in the `logs/nginx` directory.
However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this:
```bash
docker logs {container-name}
```
<br>
<aname="Laravel"></a>
### [Laravel]
<aname="Install-Laravel"></a>
### Install Laravel from a Docker Container
1 - First you need to enter the Workspace Container.
> We recommand using `composer create-project` instead of the Laravel installer, to install Laravel.
For more about the Laravel installation click [here](https://laravel.com/docs/master#installing-laravel).
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.
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:
```yaml
application:
build:./application
volumes:
- ../my-cool-app/:/var/www/laravel
```
4 - Go to that folder and start working..
```bash
cd my-cool-app
```
<br>
<aname="Run-Artisan-Commands"></a>
### Run Artisan Commands
You can run artisan commands and many other Terminal commands from the Workspace container.
1 - Make sure you have the workspace container running.
```bash
docker-compose up -d workspace // ..and all your other containers
```
2 - Enter the Workspace container:
```bash
docker-compose run workspace /bin/bash
```
3 - Run anything you want :)
```bash
php artisan
```
```bash
Composer update
```
```bash
phpunit
```
<br>
<aname="Use-Redis"></a>
### Use Redis
1 - First make sure you run the Redis Container (`redis`) with the `docker-compose up` command.
```bash
docker-compose up -d redis
```
2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1` IP.
```env
REDIS_HOST=xxx.xxx.xxx.xxx
```
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 your `Docker-IP` for Redis like this:
```php
'redis'=>[
'cluster'=>false,
'default'=>[
'host'=>'xxx.xxx.xxx.xxx',
'port'=>6379,
'database'=>0,
],
],
```
3 - To enable Redis Caching and/or for Sessions Management. Also from the `.env` file set `CACHE_DRIVER` and `SESSION_DRIVER` to `redis` instead of the default `file`.
```env
CACHE_DRIVER=redis
SESSION_DRIVER=redis
```
4 - Finally make sure you have the `predis/predis` package `(~1.0)` installed via Composer:
```bash
composer require predis/predis:^1.0
```
5 - You can manually test it from Laravel with this code:
1 - First make sure you run the MongoDB Container (`mongo`) with the `docker-compose up` command.
```bash
docker-compose up -d mongo
```
2 - Add the MongoDB configurations to the `config/database.php` config file:
```php
'connections'=>[
'mongodb'=>[
'driver'=>'mongodb',
'host'=>env('DB_HOST','localhost'),
'port'=>env('DB_PORT',27017),
'database'=>env('DB_DATABASE','database'),
'username'=>'',
'password'=>'',
'options'=>[
'database'=>'',
]
],
// ...
],
```
3 - Open your Laravel's `.env` file and update the following variables:
- set the `DB_HOST` to your `Docker-IP`.
- set the `DB_PORT` to `27017`.
- set the `DB_DATABASE` to `database`.
4 - Finally make sure you have the `jenssegers/mongodb` package installed via Composer and its Service Provider is added.
```bash
composer require jenssegers/mongodb
```
More details about this [here](https://github.com/jenssegers/laravel-mongodb#installation).
5 - Test it:
- First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent).
- Enter the Workspace Continer `docker-compose run workspace bash`.
- Migrate the Database `php artisan migrate`.
<br>
<aname="PHP"></a>
### [PHP]
<aname="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>
<aname="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.
1 - Open the `docker-compose.yml`.
2 - Search for `Dockerfile-70` in the PHP container section.
3 - Change the version number.
<br>
Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`.
Sample:
```txt
php-fpm:
build:
context: ./php-fpm
dockerfile: Dockerfile-70
```
Supported Versions:
- For (PHP 7.0.*) use `Dockerfile-70`
- For (PHP 5.6.*) use `Dockerfile-56`
- For (PHP 5.5.*) use `Dockerfile-55`
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/).
<br>
<aname="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>
<aname="Misc"></a>
### [Misc]
<aname="Run-Docker-Virtual-Host"></a>
### Run a Docker Virtual Host
These steps are only for **Windows & MAC** users *(Linux users don't need a virtual host)*:
1 - Run the default Host:
```bash
docker-machine start default
```
* If the host "default" does not exist, create one using the command below, else skip it:
* ```bash
docker-machine create -d virtualbox default
```
2 - Run this command to configure your shell:
```bash
eval $(docker-machine env)
```
<br>
<a name="Find-Docker-IP-Address"></a>
### Find your Docker IP Address
**On Windows & MAC:**
Run this command in your terminal:
```bash
docker-machine ip default
```
If your Host name is different then `default`, you have to specify it (`docker-machine ip my-host`).
*(The default IP is 192.168.99.100)*
<br>
> **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*.
Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`.
1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following:
```bash
xxx.xxx.xxx.xxx laravel.dev
```
2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`.
<br>
Example:
```env
DB_HOST=xxx.xxx.xxx.xxx
```
3 - Open your browser and visit `{http://laravel.dev}`
Optionally you can define the server name in the nginx config file, like this:
```conf
server_name laravel.dev;
```
<br>
<a name="debugging"></a>
### Debugging
*Here's a list of the common problems you might face, and the possible solutions.*
#### + I see a blank (white) page instead of the Laravel 'Welcome' page!
run this command from the Laravel root directory:
```bash
sudo chmod -R 777 storage bootstrap/cache
```
#### + I see "Welcome to nginx" instead of the Laravel App!
use `http://127.0.0.1` instead of `http://localhost` in your browser.
<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 :)
<a name="Help"></a>
## Help & Questions
If you need any help with Docker and Laravel, you can schedule a live call with the creator of this project at [Codementor.io](https://www.codementor.io/mahmoudz), He would love to help.
For general questions you can open [Issues](https://github.com/laradock/laradock/issues) here on Github (We will label them as questions).
Additionally, you can contact Mahmoud Zalt (the creator of this project) via a direct message on LaraChat, (his username is `mahmoud_zalt`). Or send him an email (`mahmoud@zalt.me`).
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
VOLUME /var/lib/beanstalkd/data
RUN apk add --no-cache beanstalkd
EXPOSE 11300
CMD["/usr/bin/beanstalkd"]
ENTRYPOINT["/usr/bin/beanstalkd"]
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.