From 721e04370fef8ad76418d45f510bb01143b3cc6b Mon Sep 17 00:00:00 2001 From: TJ Date: Tue, 10 Jan 2017 16:34:55 -0500 Subject: [PATCH 01/10] Updated Crontab for Workspace (#538) - Crontab now gets added to `/etc/cron.d` - Base crontab now runs as the `laradock` user This update resolves #459. --- workspace/Dockerfile | 2 +- workspace/crontab/laradock | 1 + workspace/crontab/root | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 workspace/crontab/laradock delete mode 100644 workspace/crontab/root diff --git a/workspace/Dockerfile b/workspace/Dockerfile index c64ac773..8167c998 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -79,7 +79,7 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ ##################################### USER root -COPY ./crontab /var/spool/cron/crontabs +COPY ./crontab /etc/cron.d ##################################### # xDebug: diff --git a/workspace/crontab/laradock b/workspace/crontab/laradock new file mode 100644 index 00000000..c807cf4d --- /dev/null +++ b/workspace/crontab/laradock @@ -0,0 +1 @@ +* * * * * laradock php /var/www/artisan schedule:run >> /dev/null 2>&1 diff --git a/workspace/crontab/root b/workspace/crontab/root deleted file mode 100644 index db972b14..00000000 --- a/workspace/crontab/root +++ /dev/null @@ -1 +0,0 @@ -* * * * * php /var/www/artisan schedule:run >> /dev/null 2>&1 From 14f6dffe99da546cdb33a85ed3d9e7a0b0c2bf14 Mon Sep 17 00:00:00 2001 From: hexu Date: Thu, 12 Jan 2017 18:47:11 +0800 Subject: [PATCH 02/10] Fix bug on mariadb 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 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0e06bd81..d728dca2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -135,7 +135,7 @@ services: mariadb: build: ./mariadb volumes: - - mysql:/var/lib/mysql + - mariadb:/var/lib/mysql ports: - "3306:3306" environment: From f1cd4bb0e2222b19029052bf232f6348f048f684 Mon Sep 17 00:00:00 2001 From: g0ld3lux Date: Fri, 13 Jan 2017 08:06:08 +0800 Subject: [PATCH 03/10] added phpredis in dockerfile70 (#546) --- php-fpm/Dockerfile-70 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index a00d627f..c389efc8 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -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 + RUN 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 From 6c55f47fd492ed69147864649a0c90ef03745b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Tr=C3=A9panier?= Date: Thu, 12 Jan 2017 19:26:29 -0500 Subject: [PATCH 04/10] Added instructions on how to fix time lag, this fixes #372, #462 (#547) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ad258b2d..dfacfcb4 100644 --- a/README.md +++ b/README.md @@ -1667,6 +1667,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 `) + + #### I get Mysql connection refused From a8120a1c466dd4fbb5ecab90b9c24636f3d28d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=A1=E5=AE=9C=E5=B0=A7?= Date: Fri, 13 Jan 2017 15:06:35 +0800 Subject: [PATCH 05/10] bugfix for phpredis configuration bugfix for phpredis configuration --- php-fpm/Dockerfile-70 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index c389efc8..32e69663 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -68,7 +68,7 @@ RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ # Install Php Redis Extension RUN pecl install -o -f redis \ && rm -rf /tmp/pear \ - && docker-php-ext-enable redis + && docker-php-ext-enable redis \ ;fi # Copy xdebug configration for remote debugging From ad5883cdfd3b77684230ac36b5009003270b0a10 Mon Sep 17 00:00:00 2001 From: FalAngelSt Date: Fri, 13 Jan 2017 15:53:23 +0200 Subject: [PATCH 06/10] fixed redis php extension instalation bug remove unnecessary RUN command --- php-fpm/Dockerfile-70 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 32e69663..0e507311 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -66,7 +66,7 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ ARG INSTALL_PHPREDIS=false RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ # Install Php Redis Extension - RUN pecl install -o -f redis \ + pecl install -o -f redis \ && rm -rf /tmp/pear \ && docker-php-ext-enable redis \ ;fi From a80ef301a98f384d3d3c70ace43463cbbc2e46d6 Mon Sep 17 00:00:00 2001 From: Mike Erickson Date: Fri, 13 Jan 2017 11:12:44 -0800 Subject: [PATCH 07/10] 541-add-linuxbrew-option (#543) * 541-add-linuxbrew-option * 541 updated readme with installation information --- README.md | 53 ++++++++++++++++++++++++++++++++++---------- docker-compose.yml | 5 +++-- workspace/Dockerfile | 33 +++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index dfacfcb4..28c3ea51 100644 --- a/README.md +++ b/README.md @@ -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,7 @@ 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-Brew) - [Debugging](#debugging) - [Upgrading LaraDock](#upgrading-laradock) - [Related Projects](#related-projects) @@ -101,13 +102,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 @@ -316,7 +317,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. @@ -798,7 +799,7 @@ To control the behavior of xDebug (in the `php-fpm` Container), you can run the ### 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 +1214,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 +1320,7 @@ Make sure you [change the timezone](#Change-the-timezone) if you don't want to u
### 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 +1379,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 +1525,34 @@ It should be like this: +
+ +### 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` + + + + + +
### Install Aerospike extension @@ -1659,7 +1688,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. @@ -1701,7 +1730,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!" diff --git a/docker-compose.yml b/docker-compose.yml index d728dca2..d4f9604e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -118,7 +119,7 @@ services: ### MySQL Container ######################################### mysql: - build: + build: context: ./mysql args: - MYSQL_DATABASE=homestead @@ -190,7 +191,7 @@ services: - "27017:27017" volumes: - mongo:/data/db - + ### RethinkDB Container ####################################### rethinkdb: diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 8167c998..46e1f850 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -291,6 +291,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 From 4c8e09526df080f5fb891eecc0c3f00ff50410fb Mon Sep 17 00:00:00 2001 From: TJ Date: Mon, 16 Jan 2017 11:10:49 -0500 Subject: [PATCH 08/10] Fix Workspace Cron Permissions (#555) 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. --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 46e1f850..e961f495 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -80,6 +80,7 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ USER root COPY ./crontab /etc/cron.d +RUN chmod -R 644 /etc/cron.d ##################################### # xDebug: From b52dcd4a1940444e3915babafa5e4cd53a1eda3c Mon Sep 17 00:00:00 2001 From: Mike Erickson Date: Tue, 17 Jan 2017 16:09:05 -0800 Subject: [PATCH 09/10] 540 added alias support (#557) * 540 added alias support * Updated aliases, added content to README.md --- README.md | 19 ++++++++++-- workspace/Dockerfile | 11 +++++++ workspace/aliases.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 workspace/aliases.sh diff --git a/README.md b/README.md index 28c3ea51..d56a8572 100644 --- a/README.md +++ b/README.md @@ -87,7 +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-Brew) + - [Install Linuxbrew](#Install-Linuxbrew) + - [Common Terminal Aliases](#Common-Aliases) - [Debugging](#debugging) - [Upgrading LaraDock](#upgrading-laradock) - [Related Projects](#related-projects) @@ -189,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 :) @@ -410,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 @@ -1552,6 +1556,17 @@ It should be like this: +
+ +
+### 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. + + + +
diff --git a/workspace/Dockerfile b/workspace/Dockerfile index e961f495..2d9440aa 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -82,6 +82,17 @@ USER root 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: ##################################### diff --git a/workspace/aliases.sh b/workspace/aliases.sh new file mode 100644 index 00000000..93384a76 --- /dev/null +++ b/workspace/aliases.sh @@ -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' +} From a94f08920a73ae1e2b21ebc456c559b1fca7327f Mon Sep 17 00:00:00 2001 From: choirudin Date: Sun, 22 Jan 2017 11:20:27 +0700 Subject: [PATCH 10/10] add php exif (#564) * add php exif * format --- docker-compose.yml | 1 + php-fpm/Dockerfile-70 | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index d4f9604e..5a680608 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -54,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 diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 0e507311..f6071232 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -128,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: #####################################