Merge pull request #17 from laradock/master

Just update the fork project
This commit is contained in:
Luciano Jr 2017-01-23 16:06:25 +00:00 committed by GitHub
commit 5b5ba53112
7 changed files with 209 additions and 18 deletions

View File

@ -4,7 +4,7 @@
[![Gitter](https://badges.gitter.im/LaraDock/laradock.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Laradock is a Docker PHP development environment. It facilitate running **PHP** Apps on **Docker**.
Laradock is a Docker PHP development environment. It facilitate running **PHP** Apps on **Docker**.
>Use Docker first and learn about it later.
@ -87,6 +87,8 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to
- [Install Prestissimo](#Install-Prestissimo)
- [Install Node + NVM](#Install-Node)
- [Install Node + YARN](#Install-Yarn)
- [Install Linuxbrew](#Install-Linuxbrew)
- [Common Terminal Aliases](#Common-Aliases)
- [Debugging](#debugging)
- [Upgrading LaraDock](#upgrading-laradock)
- [Related Projects](#related-projects)
@ -101,13 +103,13 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to
Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL`, `Redis` and `Beanstalkd`:
1 - Clone Laradock inside your PHP project:
1 - Clone Laradock inside your PHP project:
```shell
git clone https://github.com/Laradock/laradock.git
```
2 - Enter the laradock folder and run this command:
2 - Enter the laradock folder and run this command:
```shell
docker-compose up -d nginx mysql redis beanstalkd
@ -188,12 +190,14 @@ That's it! enjoy :)
- PHP7-CLI
- Composer
- Git
- Linuxbrew
- Node
- Gulp
- SQLite
- xDebug
- Envoy
- Vim
- Yarn
- ... Many other supported tools are not documented. (Will be updated soon)
>If you can't find your Software, build it yourself and add it to this list. Contributions are welcomed :)
@ -316,7 +320,7 @@ Note: In this case the folder structure will be like this:
- myProject
```
2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`).
2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`).
3 - Stop and re-run your docker-compose command for the changes to take place.
@ -409,7 +413,8 @@ You can select your own combination of Containers form the list below:
```bash
docker-compose exec workspace bash
```
Alternatively, for Windows Powershell users: execute the following command to enter any running container:
Alternativey, for Windows Powershell users: execute the following command to enter any running container:
```bash
docker exec -it {workspace-container-id} bash
@ -798,7 +803,7 @@ To control the behavior of xDebug (in the `php-fpm` Container), you can run the
<a name="LaraDock-for-Production"></a>
### Prepare LaraDock for Production
It's recommended for production to create a custom `docker-compose.yml` file. For that reason, LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`).
It's recommended for production to create a custom `docker-compose.yml` file. For that reason, LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`).
Note: The Database (MySQL/MariaDB/...) ports should not be forwarded on production, because Docker will automatically publish the port on the host, which is quite insecure, unless specifically told not to. So make sure to remove these lines:
@ -1213,15 +1218,15 @@ docker-compose up -d rethinkdb
```php
'connections' => [
'rethinkdb' => [
'name' => 'rethinkdb',
'driver' => 'rethinkdb',
'host' => env('DB_HOST', 'rethinkdb'),
'port' => env('DB_PORT', 28015),
'database' => env('DB_DATABASE', 'test'),
'database' => env('DB_DATABASE', 'test'),
]
// ...
],
@ -1319,7 +1324,7 @@ Make sure you [change the timezone](#Change-the-timezone) if you don't want to u
<br>
<a name="Workspace-ssh"></a>
### Access workspace via ssh
You can access the `workspace` container through `localhost:2222` by setting the `INSTALL_WORKSPACE_SSH` build argument to `true`.
To change the default forwarded port for ssh:
@ -1378,7 +1383,7 @@ The default username and password for the root mysql user are `root` and `root `
Modify the `mysql/my.cnf` file to set your port number, `1234` is used as an example.
```
[mysqld]
[mysqld]
port=1234
```
@ -1524,6 +1529,45 @@ It should be like this:
<br>
<a name="Install-Linuxbrew"></a>
### Install Linuxbrew
Linuxbrew is a package manager for Linux. It is the Linux version of MacOS Homebrew and can be found [here](http://linuxbrew.sh). To install Linuxbrew in the Workspace container:
1 - Open the `docker-compose.yml` file
2 - Search for the `INSTALL_LINUXBREW` argument under the Workspace Container and set it to `true`
It should be like this:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_LINUXBREW=true
...
```
3 - Re-build the container `docker-compose build workspace`
<br>
<a name="Common-Aliases"></a>
<br>
### Common Terminal Aliases
When you start your docker container, Laradock will copy the `aliases.sh` file located in the `laradock/workspace` directory and add sourcing to the container `~/.bashrc` file.
You are free to modify the `aliases.sh` as you see fit, adding your own aliases (or function macros) to suit your requirements.
<br>
<a name="Install-Aerospike-Extension"></a>
### Install Aerospike extension
@ -1659,7 +1703,7 @@ Make sure the ports for the services that you are trying to run (22, 80, 443, 33
#### I get Nginx error 404 Not Found on Windows.
1. Go to docker Settings on your Windows machine.
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.
@ -1667,6 +1711,12 @@ Make sure the ports for the services that you are trying to run (22, 80, 443, 33
#### 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>`)
#### I get Mysql connection refused
@ -1695,7 +1745,7 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ
3. Upgrade LaraDock to `v4.*.*` (`git pull origin master`)
4. Use LaraDock as you used to do: `docker-compose up -d nginx mysql`.
**Note:** If you face any problem with the last step above: rebuild all your containers
**Note:** If you face any problem with the last step above: rebuild all your containers
`docker-compose build --no-cache`
"Warnning Containers Data might be lost!"

View File

@ -26,6 +26,7 @@ services:
- COMPOSER_GLOBAL_INSTALL=false
- INSTALL_WORKSPACE_SSH=false
- INSTALL_LARAVEL_ENVOY=false
- INSTALL_LINUXBREW=false
- PUID=1000
- PGID=1000
- NODE_VERSION=stable
@ -53,6 +54,7 @@ services:
- INSTALL_BCMATH=false
- INSTALL_MEMCACHED=false
- INSTALL_OPCACHE=false
- INSTALL_EXIF=false
- INSTALL_AEROSPIKE_EXTENSION=false
- CODEIGNITER=false
dockerfile: Dockerfile-70
@ -118,7 +120,7 @@ services:
### MySQL Container #########################################
mysql:
build:
build:
context: ./mysql
args:
- MYSQL_DATABASE=homestead
@ -135,7 +137,7 @@ services:
mariadb:
build: ./mariadb
volumes:
- mysql:/var/lib/mysql
- mariadb:/var/lib/mysql
ports:
- "3306:3306"
environment:
@ -190,7 +192,7 @@ services:
- "27017:27017"
volumes:
- mongo:/data/db
### RethinkDB Container #######################################
rethinkdb:

View File

@ -60,6 +60,17 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
docker-php-ext-enable xdebug \
;fi
#####################################
# PHP REDIS EXTENSION FOR PHP 7.0
#####################################
ARG INSTALL_PHPREDIS=false
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
# Install Php Redis Extension
pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
;fi
# Copy xdebug configration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
@ -117,6 +128,18 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
&& docker-php-ext-enable memcached \
;fi
#####################################
# Exif:
#####################################
ARG INSTALL_EXIF=false
RUN if [ ${INSTALL_EXIF} = true ]; then \
# Enable Exif PHP extentions requirements
docker-php-ext-install exif && \
docker-php-ext-enable exif \
;fi
#####################################
# PHP Aerospike:
#####################################

View File

@ -79,7 +79,19 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
#####################################
USER root
COPY ./crontab /var/spool/cron/crontabs
COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d
#####################################
# User Aliases
#####################################
USER root
COPY ./aliases.sh /home/laradock/aliases.sh
RUN echo "" >> ~/.bashrc
RUN echo "# Load Custom Aliases" >> ~/.bashrc
RUN echo "source /home/laradock/aliases.sh" >> ~/.bashrc
RUN echo "" >> ~/.bashrc
#####################################
# xDebug:
@ -291,6 +303,39 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
&& composer global require "laravel/envoy=~1.0" \
;fi
#####################################
# Linuxbrew:
#####################################
USER root
ARG INSTALL_LINUXBREW=true
ENV INSTALL_LINUXBREW ${INSTALL_LINUXBREW}
RUN if [ ${INSTALL_LINUXBREW} = true ]; then \
# Preparation
apt-get update && \
apt-get upgrade -y && \
apt-get install -y build-essential make cmake scons curl git \
ruby autoconf automake autoconf-archive \
gettext libtool flex bison \
libbz2-dev libcurl4-openssl-dev \
libexpat-dev libncurses-dev && \
# Install the Linuxbrew
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew && \
echo "" >> ~/.bashrc && \
echo 'export PKG_CONFIG_PATH"=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc && \
# Setup linuxbrew
echo 'export LINUXBREWHOME="$HOME/.linuxbrew"' >> ~/.bashrc && \
echo 'export PATH="$LINUXBREWHOME/bin:$PATH"' >> ~/.bashrc && \
echo 'export MANPATH="$LINUXBREWHOME/man:$MANPATH"' >> ~/.bashrc && \
echo 'export PKG_CONFIG_PATH="$LINUXBREWHOME/lib64/pkgconfig:$LINUXBREWHOME/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc && \
echo 'export LD_LIBRARY_PATH="$LINUXBREWHOME/lib64:$LINUXBREWHOME/lib:$LD_LIBRARY_PATH"' >> ~/.bashrc \
;fi
#
#--------------------------------------------------------------------------
# Final Touch

71
workspace/aliases.sh Normal file
View File

@ -0,0 +1,71 @@
#! /bin/sh
# Colors used for status updates
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
# Commonly Used Aliases
alias ..="cd .."
alias c="clear"
alias cla="clear && ls -l"
alias cll="clear && ls -la"
alias cls="clear && ls"
alias code="cd /var/www"
alias ea="vi ~/aliases"
alias g="gulp"
alias home="cd ~"
alias npm-global="npm list -g --depth 0"
alias ra="reload"
alias reload="source ~/.aliases && echo \"$COL_GREEN ==> Aliases Reloaded... $COL_RESET \n \""
alias run="npm run"
alias tree="xtree"
# Laravel / PHP Alisases
alias art="php artisan"
alias artisan="php artisan"
alias cdump="composer dump-autoload -o"
alias composer:dump="composer dump-autoload -o"
alias db:reset="php artisan migrate:reset && php artisan migrate --seed"
alias migrate="php artisan migrate"
alias seed="php artisan:seed"
alias phpunit="./vendor/bin/phpunit"
# requires installation of 'https://www.npmjs.com/package/npms-cli'
alias npms="npms search"
# requires installation of 'https://www.npmjs.com/package/package-menu-cli'
alias pm="package-menu"
# requires installation of 'https://www.npmjs.com/package/pkg-version-cli'
alias pv="package-version"
# requires installation of 'https://github.com/sindresorhus/latest-version-cli'
alias lv="latest-version"
# git aliases
alias gaa="git add ."
alias gd="git --no-pager diff"
alias git-revert="git reset --hard && git clean -df"
alias gs="git status"
alias whoops="git reset --hard && git clean -df"
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
function md() {
mkdir -p "$@" && cd "$@"
}
function xtree {
find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}

View File

@ -0,0 +1 @@
* * * * * laradock php /var/www/artisan schedule:run >> /dev/null 2>&1

View File

@ -1 +0,0 @@
* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1