Merge branch 'master' into develop

This commit is contained in:
Shao Yu-Lung (Allen) 2021-03-23 20:33:45 +08:00 committed by GitHub
commit 55e2c6472e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
192 changed files with 23578 additions and 1995 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.sh text eol=lf

View File

@ -1,46 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
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]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,3 +0,0 @@
### First off, thanks for taking the time to contribute!
For the contribution guide [click here](http://laradock.io/contributing/).

6
.github/FUNDING.yml vendored
View File

@ -1,6 +1,6 @@
# DO NOT CHANGE THIS FILE PLEASE.
github: Mahmoudz
open_collective: laradock
ko_fi: laradock
issuehunt: laradock
custom: ['beerpay.io/laradock/laradock', 'paypal.me/mzmmzz']
custom: ['paypal.me/mzmmzz']
patreon: zalt

View File

@ -1,23 +0,0 @@
### Info:
- Docker version (`$ docker --version`):
- Laradock commit (`$ git rev-parse HEAD`):
- System info (Mac, PC, Linux):
- System info disto/version:
### Issue:
<!--- What seems to be wrong? -->
_____
### Expected behavior:
<!--- What should happen instead? -->
_____
### Reproduce:
<!--- How can we reproduce the error? -->
_____
### Relevant Code:
```
// place a code sample here
```

50
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,50 @@
---
name: "Bug report"
about: "Report a general issue, encountered while using Laradock."
labels: "Type: Bug"
---
### Description:
<!-- A clear and concise description of what the bug is. -->
### Expected Behavior:
<!-- A clear and concise description of what you expected to happen. -->
### Context information:
**Output of `git rev-parse HEAD`**
```
{paste here}
```
**Output of `docker version`**
```
{paste here}
```
**Output of `docker-compose version`**
```
{paste here}
```
**System info: Mac, Windows or Linux. Include which disto/version**
```
{paste here}
```
### Steps to reproduce the issue:
<!--- How can we reproduce the issue? -->
1.
2.
3.
### Stacktrace & Additional info:
```
{paste here}
```

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support question
url: https://gitter.im/LaraDock/laradock
about: 'This repository is only for reporting bugs. If you need help, get in touch with us via Gitter.'

View File

@ -0,0 +1,17 @@
---
name: "Feature request"
about: "Suggest an idea for this project."
labels: "Type: Feature Request"
---
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->

View File

@ -1,7 +1,18 @@
<!--- Thank you for contributing to Laradock -->
## Description
<!--- Describe your changes in detail -->
<!--- If it fixes an open issue, please link to the issue here. -->
##### I completed the 3 steps below:
## Motivation and Context
<!--- What problem does it solve, or what feature does it add? -->
- [ ] I've read the [Contribution Guide](http://laradock.io/contributing).
- [ ] I've updated the **documentation**. (refer to [this](http://laradock.io/contributing/#update-the-documentation-site) for how to do so).
- [ ] I enjoyed my time contributing and making developer's life easier :)
## Types of Changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [] Bug fix (non-breaking change which fixes an issue).
- [] New feature (non-breaking change which adds functionality).
- [] Breaking change (fix or feature that would cause existing functionality to not work as expected).
## Definition of Done Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
- [] I've read the [Contribution Guide](http://laradock.io/contributing).
- [] I've updated the **documentation**. (refer to [this](http://laradock.io/contributing/#update-the-documentation-site) for how to do so).
- [] I enjoyed my time contributing and making developer's life easier :)

3
.github/SUPPORT.md vendored Normal file
View File

@ -0,0 +1,3 @@
# Support Questions
For help, please visit our official chatting room on [Gitter](https://gitter.im/Laradock/laradock).

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

21
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,21 @@
# Configuration for Github probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 21
# Issues with these labels will never be considered stale
exemptLabels:
- 'Type: Feature Request'
# Label to use when marking an issue as stale
staleLabel: Stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Hi 👋 this issue has been automatically marked as `stale` 📌 because it has not had recent activity 😴.
It will be closed if no further activity occurs. Thank you for your contributions ❤️.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Hi again 👋 we would like to inform you that this issue has been automatically `closed` 🔒 because it had not recent activity during the `stale` period.
We really really appreciate your contributions, and looking forward for more in the future 🎈.
# Limit to only `issues` or `pulls`
only: issues

54
.github/workflows/main-ci.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: CI
on:
push:
branches: '**'
tags: '**'
pull_request:
schedule:
- cron: '0 0 * * 0'
jobs:
build-php:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php_version: ["5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0"]
service: [php-fpm, php-worker, workspace, laravel-horizon]
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
env:
PHP_VERSION: ${{ matrix.php_version }}
run: |
cp env-example .env
sed -i -- '99,274s/=false/=true/g' .env
sed -i -- 's/GNUPG=false/GNUPG=true/g' .env
sed -i -- 's/CHANGE_SOURCE=true/CHANGE_SOURCE=false/g' .env
sed -i -- 's/PHPDBG=true/PHPDBG=false/g' .env
sed -i -- 's/CASSANDRA=true/CASSANDRA=false/g' .env
sed -i -- 's/GEARMAN=true/GEARMAN=false/g' .env
sed -i -- 's/AEROSPIKE=true/AEROSPIKE=false/g' .env
sed -i -- 's/PHALCON=true/PHALCON=false/g' .env
sed -i -- 's/RDKAFKA=true/RDKAFKA=false/g' .env
sed -i -- 's/MAILPARSE=true/MAILPARSE=false/g' .env
sed -i -- 's/OCI8=true/OCI8=false/g' .env
sed -i -- 's/IONCUBE=true/IONCUBE=false/g' .env
sed -i -- 's/V8JS=true/V8JS=false/g' .env
docker-compose build ${{ matrix.service }}
build-other:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service: ['nginx', 'redis', 'mysql', 'mariadb', 'percona', 'minio', 'mongo']
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: |
cp env-example .env
sed -i -- 's/=false/=true/g' .env
sed -i -- 's/CHANGE_SOURCE=true/CHANGE_SOURCE=false/g' .env
docker-compose build ${{ matrix.service }}

2
.gitignore vendored
View File

@ -22,4 +22,6 @@
!/.devcontainer/devcontainer.example.json
!/.devcontainer/docker-compose.extend-example.yml
docker-compose.custom.yml
.DS_Store

View File

@ -1,62 +0,0 @@
# image: docker:latest
# services:
# - docker:dind
image: jonaskello/docker-and-compose:1.12.1-1.8.0
services:
- docker:1.12.1-dind
before_script:
- docker info
- docker-compose version
- cp env-example .env
- sed -i -- "s/=false/=true/g" .env
- cat .env
- env | sort
build:5.6:php-fpm:
variables:
PHP_VERSION: "5.6"
script:
- docker-compose build php-fpm
build:7.0:php-fpm:
variables:
PHP_VERSION: "7.0"
script:
- docker-compose build php-fpm
build:7.1:php-fpm:
variables:
PHP_VERSION: "7.1"
script:
- docker-compose build php-fpm
build:7.2:php-fpm:
variables:
PHP_VERSION: "7.2"
script:
- docker-compose build php-fpm
build:5.6:workspace:
variables:
PHP_VERSION: "5.6"
script:
- docker-compose build workspace
build:7.0:workspace:
variables:
PHP_VERSION: "7.0"
script:
- docker-compose build workspace
build:7.1:workspace:
variables:
PHP_VERSION: "7.1"
script:
- docker-compose build workspace
build:7.2:workspace:
variables:
PHP_VERSION: "7.2"
script:
- docker-compose build workspace

2
.gitpod.yml Normal file
View File

@ -0,0 +1,2 @@
image: gitpod/workspace-full

View File

@ -7,20 +7,6 @@ env:
matrix:
- HUGO_VERSION=0.20.2
- PHP_VERSION=5.6 BUILD_SERVICE=workspace
- PHP_VERSION=7.0 BUILD_SERVICE=workspace
- PHP_VERSION=7.1 BUILD_SERVICE=workspace
- PHP_VERSION=7.2 BUILD_SERVICE=workspace
- PHP_VERSION=7.3 BUILD_SERVICE=workspace
- PHP_VERSION=7.4 BUILD_SERVICE=workspace
- PHP_VERSION=5.6 BUILD_SERVICE=php-fpm
- PHP_VERSION=7.0 BUILD_SERVICE=php-fpm
- PHP_VERSION=7.1 BUILD_SERVICE=php-fpm
- PHP_VERSION=7.2 BUILD_SERVICE=php-fpm
- PHP_VERSION=7.3 BUILD_SERVICE=php-fpm
- PHP_VERSION=7.4 BUILD_SERVICE=php-fpm
- PHP_VERSION=hhvm BUILD_SERVICE=hhvm
# - PHP_VERSION=5.6 BUILD_SERVICE=php-worker
@ -29,12 +15,14 @@ env:
- PHP_VERSION=7.2 BUILD_SERVICE=php-worker
- PHP_VERSION=7.3 BUILD_SERVICE=php-worker
- PHP_VERSION=7.4 BUILD_SERVICE=php-worker
- PHP_VERSION=8.0 BUILD_SERVICE=php-worker
- PHP_VERSION=7.0 BUILD_SERVICE=laravel-horizon
- PHP_VERSION=7.1 BUILD_SERVICE=laravel-horizon
- PHP_VERSION=7.2 BUILD_SERVICE=laravel-horizon
- PHP_VERSION=7.3 BUILD_SERVICE=laravel-horizon
- PHP_VERSION=7.4 BUILD_SERVICE=laravel-horizon
- PHP_VERSION=8.0 BUILD_SERVICE=laravel-horizon
- PHP_VERSION=NA BUILD_SERVICE=solr
- PHP_VERSION=NA BUILD_SERVICE="mssql rethinkdb aerospike"

6
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"recommendations": [
"editorconfig.editorconfig",
"mikestead.dotenv"
]
}

View File

@ -1,5 +1,6 @@
{
"files.associations": {
"env-example": "dotenv",
"Dockerfile-*": "dockerfile"
},
}
}

3
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,3 @@
# Laradock Code of Conduct
We follow the [Contributor Covenant](https://www.contributor-covenant.org/version/1/4/code-of-conduct) Code of Conduct.

3
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,3 @@
# Thank you for your consideration
Checkout out our [contribution guide](http://laradock.io/contributing).

View File

@ -17,11 +17,11 @@ googleAnalytics = "UA-37514928-9"
# Repository
provider = ""
repo_url = ""
repo_url = "https://github.com/laradock/laradock"
version = ""
logo = "images/logo.png"
favicon = ""
logo = "images/favicons/ms-icon-310x310.png"
favicon = "images/favicons/favicon.ico"
permalink = "#"
@ -43,49 +43,39 @@ googleAnalytics = "UA-37514928-9"
[social]
twitter = ""
github = "laradock/laradock"
email = ""
email = "support@laradock.io"
# ------- MENU START -----------------------------------------
[[menu.main]]
name = "1. Introduction"
name = "Introduction"
url = "introduction/"
weight = 1
[[menu.main]]
name = "2. Getting Started"
name = "Getting Started"
url = "getting-started/"
weight = 2
[[menu.main]]
name = "3. Documentation"
name = "Documentation"
url = "documentation/"
weight = 3
[[menu.main]]
name = "4. Guides"
url = "guides/"
name = "Help & Questions"
url = "help/"
weight = 4
[[menu.main]]
name = "5. Help & Questions"
url = "help/"
name = "Related Projects"
url = "related-projects/"
weight = 5
[[menu.main]]
name = "6. Related Projects"
url = "related-projects/"
weight = 6
[[menu.main]]
name = "7. Contributing"
name = "Contributions"
url = "contributing/"
weight = 7
[[menu.main]]
name = "8. License"
url = "license/"
weight = 8
weight = 6
# ------- MENU END -----------------------------------------

View File

@ -1,9 +1,11 @@
---
title: 7. Contributing
title: Contributions
type: index
weight: 7
weight: 6
---
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/laradock/laradock)
## Have a Question
@ -51,12 +53,20 @@ To update the sidebar or add a new section to it, you can edit this `DOCUMENTATI
### Host the documentation locally
**Option 1: Use Hugo Docker Image:**
1. Update the `DOCUMENTATION/content`.
2. Go to `DOCUMENTATION/`.
3. Run `docker run --rm -it -v $PWD:/src -p 1313:1313 -u hugo jguyomard/hugo-builder hugo server -w --bind=0.0.0.0`
4. Visit [http://localhost:1313/](http://localhost:1313/)
**Option 2: Install Hugo Locally:**
1. Install [Hugo](https://gohugo.io/) on your machine.
2. Edit the `DOCUMENTATION/content`.
2. Update 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).
4. Go to `DOCUMENTATION/`.
5. Run the `hugo` command to generate the HTML docs inside a new `/docs` folder.
## Support new Software (Add new Container)
@ -100,7 +110,7 @@ To update the sidebar or add a new section to it, you can edit this `DOCUMENTATI
* 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.*
*Most of the image in Laradock are official 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.
@ -204,4 +214,4 @@ After your pull request is merged, you can safely delete your branch and pull th
<br>
#### Happy Coding :)
## Happy Coding :)

View File

@ -1,5 +1,5 @@
---
title: 3. Documentation
title: Documentation
type: index
weight: 3
---
@ -57,9 +57,11 @@ docker-compose down
<br>
<a name="Enter-Container"></a>
## Enter a Container (run commands in a running Container)
## Enter a Container
1 - First list the current running containers with `docker ps`
> Run commands in a running Container.
1 - First list the currently running containers with `docker ps`
2 - Enter any container using:
@ -88,7 +90,8 @@ docker-compose exec mysql mysql -udefault -psecret
<br>
<a name="Edit-Container"></a>
## Edit default container configuration
## Edit default Container config
Open the `docker-compose.yml` and change anything you want.
Examples:
@ -161,7 +164,7 @@ You might use the `--no-cache` option if you want full rebuilding (`docker-compo
<br>
<a name="Add-Docker-Images"></a>
## Add more Software (Docker Images)
## Add more 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/).
@ -193,6 +196,7 @@ More [options](https://docs.docker.com/compose/reference/logs/)
<br>
<a name="PHP"></a>
@ -203,11 +207,14 @@ More [options](https://docs.docker.com/compose/reference/logs/)
<a name="Install-PHP-Extensions"></a>
## Install PHP Extensions
Before installing PHP extensions, you have to decide first whether you need `FPM` or `CLI`, because each of them has it's own different container, if you need it for both, you have to edit both containers.
You can set extensions to install in the .env file's corresponding section (`PHP_FPM`, `WORKSPACE`, `PHP_WORKER`),
just change the `false` to `true` at the desired extension's line.
After this you have to rebuild the container with the `--no-cache` option.
```bash
docker build --no-cache {container-name}
```
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`.
@ -215,11 +222,13 @@ 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 the latest stable PHP versin is configured to run.
>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.
By default the latest stable PHP version is configured to run.
>The PHP-FPM is responsible for 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.2` to PHP `5.6`
@ -253,7 +262,7 @@ docker-compose build php-fpm
>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 simply change the `PHP_VERSION` in te .env file as follow:
The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to simply change the `PHP_VERSION` in the .env file as follow:
1 - Open the `.env`.
@ -272,10 +281,6 @@ docker-compose build workspace
```
<br>
<a name="Install-xDebug"></a>
## Install xDebug
@ -310,7 +315,7 @@ To control the behavior of xDebug (in the `php-fpm` Container), you can run the
- Start xDebug by default: `.php-fpm/xdebug start`.
- See the status: `.php-fpm/xdebug status`.
Note: If `.php-fpm/xdebug` doesn't execute and gives `Permission Denied` error the problem can be that file `xdebug` doesn't have execution access. This can be fixed by running `chmod` command with desired access permissions.
Note: If `.php-fpm/xdebug` doesn't execute and gives `Permission Denied` error the problem can be that file `xdebug` doesn't have execution access. This can be fixed by running `chmod` command with desired access permissions.
@ -388,7 +393,9 @@ Always download the latest version of [Loaders for ionCube ](http://www.ioncube.
<br>
<a name="Install-Deployer"></a>
## Install Deployer (Deployment tool for PHP)
## Install Deployer
> A deployment tool for PHP.
1 - Open the `.env` file
<br>
@ -399,14 +406,17 @@ Always download the latest version of [Loaders for ionCube ](http://www.ioncube.
4 - Re-build the containers `docker-compose build workspace`
[**Deployer Documentation Here**](https://deployer.org/docs)
[**Deployer Documentation Here**](https://deployer.org/docs/getting-started.html)
<br>
<a name="Install-SonarQube"></a>
## Install SonarQube (automatic code review tool)
## Install SonarQube
> An automatic code review tool.
SonarQube® is an automatic code review tool to detect bugs, vulnerabilities and code smells in your code. It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests.
<br>
1 - Open the `.env` file
@ -467,14 +477,6 @@ 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
### [Full Guide Here](/guides/#Digital-Ocean)
@ -487,7 +489,7 @@ To learn more about how Docker publishes ports, please read [this excellent post
<a name="Install-Laravel"></a>
## Install Laravel from a Docker Container
## Install Laravel from Container
1 - First you need to enter the Workspace Container.
@ -513,7 +515,7 @@ Since the new Laravel application is in the `my-cool-app` folder, we need to rep
```dotenv
APP_CODE_PATH_HOST=../my-cool-app/
```
4 - Go to that folder and start working..
4 - Go to that folder and start working.
```bash
cd my-cool-app
@ -564,8 +566,14 @@ composer update
```bash
phpunit
```
```
vue serve
```
(browse the results at `http://localhost:[WORKSPACE_VUE_CLI_SERVE_HOST_PORT]`)
```
vue ui
```
(browse the results at `http://localhost:[WORKSPACE_VUE_CLI_UI_HOST_PORT]`)
@ -615,6 +623,34 @@ docker-compose up -d php-worker
<br>
<a name="Use-Browsersync-With-Laravel-Mix"></a>
## Use Browsersync
> Using Use Browsersync with Laravel Mix.
1. Add the following settings to your `webpack.mix.js` file. Please refer to Browsersync [Options](https://browsersync.io/docs/options) page for more options.
```
const mix = require('laravel-mix')
(...)
mix.browserSync({
open: false,
proxy: 'nginx' // replace with your web server container
})
```
2. Run `npm run watch` within your `workspace` container.
3. Open your browser and visit address `http://localhost:[WORKSPACE_BROWSERSYNC_HOST_PORT]`. It will refresh the page automatically whenever you edit any source file in your project.
4. If you wish to access Browsersync UI for your project, visit address `http://localhost:[WORKSPACE_BROWSERSYNC_UI_HOST_PORT]`.
<br>
<a name="Use-Mailu"></a>
## Use Mailu
@ -697,6 +733,7 @@ You may wanna change the default security configuration, so go to `http://localh
<br>
<a name="Use-Redis"></a>
## Use Redis
1 - First make sure you run the Redis Container (`redis`) with the `docker-compose up` command.
@ -784,12 +821,81 @@ Read the [Laravel official documentation](https://laravel.com/docs/5.7/redis#con
```
<br>
<a name="Use-Varnish"></a>
## Use Varnish
The goal was to proxy the request to varnish server using nginx. So only nginx has been configured for Varnish proxy.
Nginx is on port 80 or 443. Nginx sends request through varnish server and varnish server sends request back to nginx on port 81 (external port is defined in `VARNISH_BACKEND_PORT`).
The idea was taken from this [post](https://www.linode.com/docs/websites/varnish/use-varnish-and-nginx-to-serve-wordpress-over-ssl-and-http-on-debian-8/)
The Varnish configuration was developed and tested for Wordpress only. Probably it works with other systems.
#### Steps to configure varnish proxy server:
1. You have to set domain name for VARNISH_PROXY1_BACKEND_HOST variable.
2. If you want to use varnish for different domains, you have to add new configuration section in your env file.
```
VARNISH_PROXY1_CACHE_SIZE=128m
VARNISH_PROXY1_BACKEND_HOST=replace_with_your_domain.name
VARNISH_PROXY1_SERVER=SERVER1
```
3. Then you have to add new config section into docker-compose.yml with related variables:
```
custom_proxy_name:
container_name: custom_proxy_name
build: ./varnish
expose:
- ${VARNISH_PORT}
environment:
- VARNISH_CONFIG=${VARNISH_CONFIG}
- CACHE_SIZE=${VARNISH_PROXY2_CACHE_SIZE}
- VARNISHD_PARAMS=${VARNISHD_PARAMS}
- VARNISH_PORT=${VARNISH_PORT}
- BACKEND_HOST=${VARNISH_PROXY2_BACKEND_HOST}
- BACKEND_PORT=${VARNISH_BACKEND_PORT}
- VARNISH_SERVER=${VARNISH_PROXY2_SERVER}
ports:
- "${VARNISH_PORT}:${VARNISH_PORT}"
links:
- workspace
networks:
- frontend
```
4. change your varnish config and add nginx configuration. Example Nginx configuration is here: `nginx/sites/laravel_varnish.conf.example`.
5. `varnish/default.vcl` is old varnish configuration, which was used in the previous version. Use `default_wordpress.vcl` instead.
#### How to run:
1. Rename `default_wordpress.vcl` to `default.vcl`
2. `docker-compose up -d nginx`
3. `docker-compose up -d proxy`
Keep in mind that varnish server must be built after Nginx cause varnish checks domain affordability.
#### FAQ:
1. How to purge cache? <br>
run from any cli: <br>`curl -X PURGE https://yourwebsite.com/`.
2. How to reload varnish?<br>
`docker container exec proxy varnishreload`
3. Which varnish commands are allowed?
- varnishadm
- varnishd
- varnishhist
- varnishlog
- varnishncsa
- varnishreload
- varnishstat
- varnishtest
- varnishtop
4. How to reload Nginx?<br>
`docker exec Nginx nginx -t`<br>
`docker exec Nginx nginx -s reload`
<br>
<a name="Use-Mongo"></a>
## Use Mongo
1 - First install `mongo` in the Workspace and the PHP-FPM Containers:
@ -853,7 +959,7 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins
7 - Test it:
- First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent).
- First, let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent).
- Enter the Workspace Container.
- Migrate the Database `php artisan migrate`.
@ -878,7 +984,7 @@ docker-compose up -d mariadb phpmyadmin
*Note: To use with MariaDB, open `.env` and set `PMA_DB_ENGINE=mysql` to `PMA_DB_ENGINE=mariadb`.*
2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080`
2 - Open your browser and visit the localhost on port **8081**: `http://localhost:8081`
@ -958,7 +1064,7 @@ job1:
7 - Push changes to gitlab
8 - Verify that pipeline is run successful
8 - Verify that pipeline is running successfully
@ -975,9 +1081,16 @@ job1:
docker-compose up -d adminer
```
2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080`
2 - Open your browser and visit the localhost on port **8081**: `http://localhost:8081`
#### Additional Notes
- You can load plugins in the `ADM_PLUGINS` variable in the `.env` file. If a plugin requires parameters to work correctly you will need to add a custom file to the container. [Find more info in section 'Loading plugins'](https://hub.docker.com/_/adminer).
- You can choose a design in the `ADM_DESIGN` variable in the `.env` file. [Find more info in section 'Choosing a design'](https://hub.docker.com/_/adminer).
- You can specify the default host with the `ADM_DEFAULT_SERVER` variable in the `.env` file. This is useful if you are connecting to an external server or a docker container named something other than the default `mysql`.
**Note:** We've locked Adminer to version 4.3.0 as at the time of writing [it contained a major bug](https://sourceforge.net/p/adminer/bugs-and-features/548/) preventing PostgreSQL users from logging in. If that bug is fixed (or if you're not using PostgreSQL) feel free to set Adminer to the latest version within [the Dockerfile](https://github.com/laradock/laradock/blob/master/adminer/Dockerfile#L1): `FROM adminer:latest`
@ -1112,6 +1225,12 @@ docker-compose up -d elasticsearch
```bash
docker-compose exec elasticsearch /usr/share/elasticsearch/bin/plugin install {plugin-name}
```
For ElasticSearch 5.0 and above, the previous "plugin" command has been renamed to "elasticsearch-plguin".
Use the following instead:
```bash
docker-compose exec elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install {plugin-name}
```
2 - Restart elasticsearch container
@ -1120,7 +1239,19 @@ docker-compose restart elasticsearch
```
<br>
<a name="Use-MeiliSearch"></a>
## Use MeiliSearch
1 - Run the MeiliSearch Container (`meilisearch`) with the `docker-compose up` command. Example:
```bash
docker-compose up -d meilisearch
```
2 - Open your browser and visit the localhost on port **7700** at the following URL: `http://localhost:7700`
> The private API key is `masterkey`
@ -1210,12 +1341,26 @@ docker-compose up -d minio
5 - When configuring your other clients use the following details:
```
S3_HOST=http://minio
S3_KEY=access
S3_SECRET=secretkey
S3_REGION=us-east-1
S3_BUCKET=bucket
AWS_URL=http://minio:9000
AWS_ACCESS_KEY_ID=access
AWS_SECRET_ACCESS_KEY=secretkey
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=test
AWS_PATH_STYLE=true
```
6 - In `filesystems.php` you shoud use the following details (s3):
```
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'endpoint' => env('AWS_URL'),
'use_path_style_endpoint' => env('AWS_PATH_STYLE', false)
],
```
`'AWS_PATH_STYLE'` shout set to true only for local purpouse
@ -1248,7 +1393,7 @@ For more documentation on Thumbor visit the [Thumbor documenation](http://thumbo
## Use AWS
1 - Configure AWS:
- make sure to add your SSH keys in aws/ssh_keys folder
- make sure to add your SSH keys in aws-eb-cli/ssh_keys folder
2 - Run the Aws Container (`aws`) with the `docker-compose up` command. Example:
@ -1320,30 +1465,13 @@ GRAYLOG_SHA256_PASSWORD=b1cb6e31e172577918c9e7806c572b5ed8477d3f57aa737bee4b5b1d
<a name="Use-Traefik"></a>
## Use Traefik
To use Traefik you need to do some changes in `traefik/trafik.toml` and `docker-compose.yml`.
To use Traefik you need to do some changes in `.env` and `docker-compose.yml`.
1 - Open `traefik.toml` and change the `e-mail` property in `acme` section.
1 - Open `.env` and change `ACME_DOMAIN` to your domain and `ACME_EMAIL` to your email.
2 - Change your domain in `acme.domains`. For example: `main = "example.org"`
2 - You need to change the `docker-compose.yml` file to match the Traefik needs. If you want to use Traefik, you must not expose the ports of each container to the internet, but specify some labels.
2.1 - If you have subdomains, you must add them to `sans` property in `acme.domains` section.
```bash
[[acme.domais]]
main = "example.org"
sans = ["monitor.example.org", "pma.example.org"]
```
3 - If you need to add basic authentication (https://docs.traefik.io/configuration/entrypoints/#basic-authentication), you just need to add the following text after `[entryPoints.https.tls]`:
```bash
[entryPoints.https.auth.basic]
users = ["user:password"]
```
4 - You need to change the `docker-compose.yml` file to match the Traefik needs. If you want to use Traefik, you must not expose the ports of each container to the internet, but specify some labels.
4.1 For example, let's try with NGINX. You must have:
2.1 For example, let's try with NGINX. You must have:
```bash
nginx:
@ -1363,9 +1491,25 @@ nginx:
- frontend
- backend
labels:
- traefik.backend=nginx
- traefik.frontend.rule=Host:example.org
- traefik.port=80
- "traefik.enable=true"
- "traefik.http.services.nginx.loadbalancer.server.port=80"
# https router
- "traefik.http.routers.https.rule=Host(`${ACME_DOMAIN}`, `www.${ACME_DOMAIN}`)"
- "traefik.http.routers.https.entrypoints=https"
- "traefik.http.routers.https.middlewares=www-redirectregex"
- "traefik.http.routers.https.service=nginx"
- "traefik.http.routers.https.tls.certresolver=letsencrypt"
# http router
- "traefik.http.routers.http.rule=Host(`${ACME_DOMAIN}`, `www.${ACME_DOMAIN}`)"
- "traefik.http.routers.http.entrypoints=http"
- "traefik.http.routers.http.middlewares=http-redirectscheme"
- "traefik.http.routers.http.service=nginx"
# middlewares
- "traefik.http.middlewares.www-redirectregex.redirectregex.permanent=true"
- "traefik.http.middlewares.www-redirectregex.redirectregex.regex=^https://www.(.*)"
- "traefik.http.middlewares.www-redirectregex.redirectregex.replacement=https://$$1"
- "traefik.http.middlewares.http-redirectscheme.redirectscheme.permanent=true"
- "traefik.http.middlewares.http-redirectscheme.redirectscheme.scheme=https"
```
instead of
@ -1628,7 +1772,9 @@ The default username and password for the root MySQL user are `root` and `root `
<br>
<a name="Create-Multiple-Databases"></a>
## Create Multiple Databases (MySQL)
## Create Multiple Databases
> With MySQL.
Create `createdb.sql` from `mysql/docker-entrypoint-initdb.d/createdb.sql.example` in `mysql/docker-entrypoint-initdb.d/*` and add your SQL syntax as follow:
@ -1662,7 +1808,9 @@ If you need <a href="#MySQL-access-from-host">MySQL access from your host</a>, d
<br>
<a name="Use-custom-Domain"></a>
## Use custom Domain (instead of the Docker IP)
## Use custom Domain
> How to use a custom domain, instead of the Docker IP.
Assuming your custom domain is `laravel.test`
@ -1688,7 +1836,7 @@ server_name laravel.test;
<br>
<a name="Enable-Global-Composer-Build-Install"></a>
## Enable Global Composer Build Install
## Global Composer Build Install
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.
@ -1707,7 +1855,9 @@ Enabling Global Composer Install during the build for the container allows you t
<br>
<a name="Magento-2-authentication-credentials"></a>
## Add authentication credential for Magento 2
## Add authentication for Magento
> Adding authentication credentials for Magento 2.
1 - Open the `.env` file
@ -1757,6 +1907,24 @@ To install NVM and NodeJS in the Workspace container
3 - Re-build the container `docker-compose build workspace`
A `.npmrc` file is included in the `workspace` folder if you need to utilise this globally. This is copied automatically into the root and laradock user's folders on build.
<br>
<a name="Install-PNPM"></a>
## Install PNPM
pnpm uses hard links and symlinks to save one version of a module only ever once on a disk. When using npm or Yarn for example, if you have 100 projects using the same version of lodash, you will have 100 copies of lodash on disk. With pnpm, lodash will be saved in a single place on the disk and a hard link will put it into the node_modules where it should be installed.
As a result, you save gigabytes of space on your disk and you have a lot faster installations! If you'd like more details about the unique node_modules structure that pnpm creates and why it works fine with the Node.js ecosystem.
More info here: https://pnpm.js.org/en/motivation
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_NODE` and `WORKSPACE_INSTALL_PNPM` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
@ -1799,7 +1967,7 @@ To install NPM GULP toolkit in the Workspace container
<br>
<a name="Install-NPM-BOWER"></a>
## Install NPM BOWER package manager
## Install NPM BOWER
To install NPM BOWER package manager in the Workspace container
@ -1824,7 +1992,11 @@ To install NPM VUE CLI in the Workspace container
2 - Search for the `WORKSPACE_INSTALL_NPM_VUE_CLI` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
3 - Change `vue serve` port using `WORKSPACE_VUE_CLI_SERVE_HOST_PORT` if you wish to (default value is 8080)
4 - Change `vue ui` port using `WORKSPACE_VUE_CLI_UI_HOST_PORT` if you wish to (default value is 8001)
5 - Re-build the container `docker-compose build workspace`
@ -1877,10 +2049,45 @@ To install FFMPEG in the Workspace container
4 - If you use the `php-worker` container too, please follow the same steps above especially if you have conversions that have been queued.
**PS** Don't forget to install the binary in the `php-fpm` container too by applying the same steps above to its container, otherwise the you'll get an error when running the `php-ffmpeg` binary.
**PS** Don't forget to install the binary in the `php-fpm` container too by applying the same steps above to its container, otherwise you'll get an error when running the `php-ffmpeg` binary.
<br>
<a name="Install-audiowaveform"></a>
## Install BBC Audio Waveform Image Generator
audiowaveform is a C++ command-line application that generates waveform data from either MP3, WAV, FLAC, or Ogg Vorbis format audio files.
Waveform data can be used to produce a visual rendering of the audio, similar in appearance to audio editing applications.
Waveform data files are saved in either binary format (.dat) or JSON (.json).
To install BBC Audio Waveform Image Generator in the Workspace container
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_AUDIOWAVEFORM` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
4 - If you use the `php-worker` or `laravel-horizon` container too, please follow the same steps above especially if you have processing that have been queued.
**PS** Don't forget to install the binary in the `php-fpm` container too by applying the same steps above to its container, otherwise you'll get an error when running the `audiowaveform` binary.
<br>
<a name="Install-wkhtmltopdf"></a>
## Install wkhtmltopdf
[wkhtmltopdf](https://wkhtmltopdf.org/) is a utility for outputting a PDF from HTML
To install wkhtmltopdf in the Workspace container
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_WKHTMLTOPDF` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`
**PS** Don't forget to install the binary in the `php-fpm` container too by applying the same steps above to its container, otherwise the you'll get an error when running the `wkhtmltopdf` binary.
@ -1921,7 +2128,7 @@ To install Supervisor in the Workspace container
3 - Create supervisor configuration file (for ex., named `laravel-worker.conf`) for Laravel Queue Worker in `php-worker/supervisord.d/` by simply copy from `laravel-worker.conf.example`
4 - Re-build the container `docker-compose build workspace` Or `docker-composer up --build -d workspace`
4 - Re-build the container `docker-compose build workspace` Or `docker-compose up --build -d workspace`
@ -1967,7 +2174,9 @@ e) set it to `true`
<br>
<a name="Install-Laravel-Envoy"></a>
## Install Laravel Envoy (Envoy Task Runner)
## Install Laravel Envoy
> A Tasks Runner.
1 - Open the `.env` file
<br>
@ -2000,7 +2209,8 @@ e) set it to `true`
<br>
<a name="Install-Faketime"></a>
## Install libfaketime in the php-fpm container
## Install libfaketime in php-fpm
Libfaketime allows you to control the date and time that is returned from the operating system.
It can be used by specifying a special string in the `PHP_FPM_FAKETIME` variable in the `.env` file.
For example:
@ -2024,7 +2234,8 @@ will set the clock back 1 day. See (https://github.com/wolfcw/libfaketime) for m
<br>
<a name="Install-YAML"></a>
## Install YAML PHP extension in the php-fpm container
## Install YAML extension in php-fpm
YAML PHP extension allows you to easily parse and create YAML structured data. I like YAML because it's well readable for humans. See http://php.net/manual/en/ref.yaml.php and http://yaml.org/ for more info.
1 - Open the `.env` file
@ -2036,6 +2247,32 @@ YAML PHP extension allows you to easily parse and create YAML structured data. I
4 - Re-build the container `docker-compose build php-fpm`<br>
<br>
<a name="Install-RDKAFKA-php"></a>
## Install RDKAFKA extension in php-fpm
1 - Open the `.env` file
<br>
2 - Search for the `PHP_FPM_INSTALL_RDKAFKA` argument under the PHP-FPM container
<br>
3 - Set it to `true`
<br>
4 - Re-build the container `docker-compose build php-fpm`<br>
<br>
<a name="Install-RDKAFKA-workspace"></a>
## Install RDKAFKA extension in workspace
This is needed for 'composer install' if your dependencies require Kafka.
1 - Open the `.env` file
<br>
2 - Search for the `WORKSPACE_INSTALL_RDKAFKA` argument under the WORKSPACE container
<br>
3 - Set it to `true`
<br>
4 - Re-build the container `docker-compose build workspace`<br>
<br>
@ -2056,6 +2293,66 @@ AST exposes the abstract syntax tree generated by PHP 7+. This extension is requ
<br>
<a name="Install-Bash-Git-Prompt"></a>
## Install Git Bash Prompt
A bash prompt that displays information about the current git repository. In particular the branch name, difference with remote branch, number of files staged, changed, etc.
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_GIT_PROMPT` argument under the Workspace Container
3 - Set it to `true`
4 - Re-build the container `docker-compose build workspace`
**Note** You can configure bash-git-prompt by editing the `workspace/gitprompt.sh` file and re-building the workspace container.
For configuration information, visit the [bash-git-prompt repository](https://github.com/magicmonty/bash-git-prompt).
<br>
<a name="Install-Oh-My-Zsh"></a>
## Install Oh My ZSH
> With the Laravel autocomplete plugin.
[Zsh](https://en.wikipedia.org/wiki/Z_shell) is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.
[Oh My Zsh](https://ohmyz.sh/) is a delightful, open source, community-driven framework for managing your Zsh configuration.
[Laravel autocomplete plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/laravel) adds aliases and autocompletion for Laravel Artisan and Bob command-line interfaces.
1 - Open the `.env` file
2 - Search for the `SHELL_OH_MY_ZSH` argument under the Workspace Container
3 - Set it to `true`
4 - Re-build the container `docker-compose build workspace`
5 - Use it `docker-compose exec --user=laradock workspace zsh`
**Note** You can configure Oh My ZSH by editing the `/home/laradock/.zshrc` in running container.
> With the ZSH autosuggestions plugin.
[ZSH autosuggestions plugin](https://github.com/zsh-users/zsh-autosuggestions) suggests commands as you type based on history and completions.
1 - Enable ZSH as described previously
2 - Set `SHELL_OH_MY_ZSH_AUTOSUGESTIONS` to `true`
3 - Rebuild and use ZSH as described previously
> With bash aliases loaded.
Laradock provides aliases through the `aliases.sh` file located in the `laradock/workspace` directory. You can load it into ZSH.
1 - Enable ZSH as described previously
2 - Set `SHELL_OH_MY_ZSH_ALIASES` to `true`
3 - Rebuild and enjoy aliases
<br>
<a name="phpstorm-debugging"></a>
## PHPStorm Debugging Guide
@ -2065,12 +2362,27 @@ Remote debug Laravel web and phpunit tests.
<br>
<a name="Setup-gcloud"></a>
## Setup Google Cloud
> Setting up Google Cloud for the docker registry.
```
gcloud auth configure-docker
```
Login to gcloud for use the registry and auth the permission.
```
gcloud auth login
```
<br>
<a name="keep-tracking-Laradock"></a>
## Keep track of your Laradock changes
## Track your Laradock changes
1. Fork the Laradock repository.
2. Use that fork as a submodule.

View File

@ -1,19 +1,18 @@
---
title: 2. Getting Started
title: Getting Started
type: index
weight: 2
---
## 2.1 Requirements
## Requirements
- [Git](https://git-scm.com/downloads)
- [Docker](https://www.docker.com/products/docker/) `>= 17.12`
- [gcloud](https://cloud.google.com/sdk/install)
- [Docker](https://www.docker.com/products/docker/) [ >= 17.12 ]
## 2.2 Installation
## Installation
Choose the setup the best suits your needs.
@ -22,17 +21,6 @@ Choose the setup the best suits your needs.
- [A.2) Don't have a PHP project yet](#A2)
- [B) Setup for Multiple Projects](#B)
### Setup gcloud for docker registry
```
gcloud auth configure-docker
```
and login to gcloud for use the registry and auth the permission.
```
gcloud auth login
```
<a name="A"></a>
### A) Setup for Single Project
@ -50,16 +38,16 @@ git submodule add https://github.com/Laradock/laradock.git
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)*
*To keep track of your Laradock changes, between your projects and also keep Laradock updated [check these docs](/documentation/#track-your-laradock-changes)*
2 - Make sure your folder structure should look like this: