From 7f80888fc1ad2bae126c7c452264cbac77378fa4 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 7 May 2016 18:48:27 +0300 Subject: [PATCH 01/10] add more info to the readme file --- README.md | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c442a0f8..c2286e45 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Intro](#Intro) + - [What is Docker](#what-is-docker) + - [What is Laravel](#what-is-laravel) + - [Why Docker not Vagrant](#why-docker-not-vagrant) + - [LaraDock VS Homestead](#laradock-vs-homestead) - [Supported Containers](#Supported-Containers) - [Requirements](#Requirements) - [Installation](#Installation) @@ -47,20 +51,40 @@ 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. - + ### 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. + ### What is Laravel? Seriously!!! + + ### Why Docker not Vagrant!? -[Vagrant](https://www.vagrantup.com) gives you Virtual Machines in minutes while Docker gives you Virtual Containers in seconds. + +[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). + + + +### 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. +
Thus **LaraDock is much faster than Homestead**. ## Supported Containers @@ -72,6 +96,10 @@ Instead of providing a full Virtual Machines, like you get with Vagrant, Docker - Redis - Data Volume +Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to the list. + + + ## Requirements - Laravel ([Download](https://laravel.com/docs/master/installation)) @@ -79,6 +107,8 @@ Instead of providing a full Virtual Machines, like you get with Vagrant, Docker - Git ([Download](https://git-scm.com/downloads)) - Composer ([Download](https://getcomposer.org/download/)) + + ## Installation @@ -97,6 +127,8 @@ git submodule add https://github.com/LaraDock/laradock.git docker >These commands should create a `docker` folder, on the root directory of your Laravel project. + + ## Usage @@ -176,6 +208,8 @@ To stop single container do: docker-compose stop {container-name} ``` + +
#### Delete all existing Containers @@ -346,6 +380,8 @@ server_name laravel.dev; The Log files are stored in the `docker/logs` directory. + +
#### Enter a Container (SSH into a running Container) @@ -375,6 +411,7 @@ To prevent a container (software) from running, open the `docker-compose.yml` fi +
#### Edit a Docker Image From bfa0d54b5a45ba0763b42f1236ebdcc93bd01998 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 7 May 2016 19:51:45 +0300 Subject: [PATCH 02/10] add features list to the readme file --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index c2286e45..37bf4c0a 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Intro](#Intro) + - [Features](#features) - [What is Docker](#what-is-docker) - [What is Laravel](#what-is-laravel) - [Why Docker not Vagrant](#why-docker-not-vagrant) @@ -51,6 +52,24 @@ 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. + +### Features + +- Easy switch between PHP versions: 7.0 - 5.6 - 5.5 - ... +- Choose your favorite database engine: MySQL - Postgres - Redis - ... +- Run your own combination of software's: PHP - NGINX - MySQL - ... +- Everything runs on a separate container: PHP - NGINX - Postgres - Redis ... +- Easy to customzie any container, with simple edit to the `dockerfile`. +- All Images extends from the official base Image. (Trusted base Images). +- Pre-configured Nginx for Laravel. And very easy to update. +- Using of a Data container, to keep the Data safe and access it anytime. +- Easy to apply configurations inside containers. +- Clean and well structured Docker files (`dockerfile`). +- Latest version of the Docker Compose file (`docker-compose`). +- Everything is visible and editable. +- Best practices everywhere. + + ### What is Docker? From f9c13090c6a216cfdd08d22811ad717694dd1584 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 7 May 2016 19:59:59 +0300 Subject: [PATCH 03/10] general updates to the readme file --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37bf4c0a..54dd7455 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ It contains pre-packaged Docker Images that provides you a wonderful development - Choose your favorite database engine: MySQL - Postgres - Redis - ... - Run your own combination of software's: PHP - NGINX - MySQL - ... - Everything runs on a separate container: PHP - NGINX - Postgres - Redis ... -- Easy to customzie any container, with simple edit to the `dockerfile`. +- Easy to customize any container, with simple edit to the `dockerfile`. - All Images extends from the official base Image. (Trusted base Images). - Pre-configured Nginx for Laravel. And very easy to update. - Using of a Data container, to keep the Data safe and access it anytime. @@ -250,10 +250,10 @@ If you do any change to any `dockerfile` make sure you run this command, for the ```bash docker-compose build ``` -Optionally you can specify which container to rebuild (instead of rebuilding all the containers), example rebuilding `PHP`: +Optionally you can specify which container to rebuild (instead of rebuilding all the containers): ```bash -docker-compose build php +docker-compose build {container-name} ``` @@ -326,7 +326,11 @@ Supported Versions: For more details visit the [official PHP docker images](https://hub.docker.com/_/php/). +3 - Finally rebuild the container +```bash +docker-compose build php +```
From e52f8f561343abb05d4477a13d257ca5781d6a7b Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 8 May 2016 10:54:10 +0300 Subject: [PATCH 04/10] update readme file, add more details on linux --- README.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 54dd7455..13ccb2dc 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ It contains pre-packaged Docker Images that provides you a wonderful development - Easy switch between PHP versions: 7.0 - 5.6 - 5.5 - ... - Choose your favorite database engine: MySQL - Postgres - Redis - ... - Run your own combination of software's: PHP - NGINX - MySQL - ... -- Everything runs on a separate container: PHP - NGINX - Postgres - Redis ... +- Every software runs on a separate container: PHP - NGINX - ... - Easy to customize any container, with simple edit to the `dockerfile`. -- All Images extends from the official base Image. (Trusted base Images). +- All Images extends from an official base Image. (Trusted base Images). - Pre-configured Nginx for Laravel. And very easy to update. -- Using of a Data container, to keep the Data safe and access it anytime. +- Using of a Data container, to keep the Data safe and accessible at anytime. - Easy to apply configurations inside containers. -- Clean and well structured Docker files (`dockerfile`). +- Clean and well structured Dockerfiles (`dockerfile`). - Latest version of the Docker Compose file (`docker-compose`). - Everything is visible and editable. - Best practices everywhere. @@ -121,10 +121,18 @@ Cannot find your container! we would love to have it as well. Consider contribut ## Requirements + - Laravel ([Download](https://laravel.com/docs/master/installation)) -- Docker Toolbox ([Download](https://www.docker.com/toolbox)) - Git ([Download](https://git-scm.com/downloads)) -- Composer ([Download](https://getcomposer.org/download/)) + +> For Windows & MAC users only: + +- Docker Toolbox ([Download](https://www.docker.com/toolbox)) + +> For Linux users only: + +- Docker Engine ([Install](https://docs.docker.com/engine/installation/linux/ubuntulinux/#install)) +- Docker Compose ([Install](https://docs.docker.com/compose/install)) @@ -151,9 +159,7 @@ git submodule add https://github.com/LaraDock/laradock.git docker ## Usage ->**(Windows & MAC users)** Make sure you have a running Docker Virtual Host on your machine first. ->
->[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host) +0 - For **Windows & MAC** users only: 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).
From fdaa983e773a63a42098a0064c60ec5a049075a5 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 8 May 2016 11:25:43 +0300 Subject: [PATCH 05/10] update readme, put requirements in table --- README.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 13ccb2dc..144b76aa 100644 --- a/README.md +++ b/README.md @@ -108,32 +108,26 @@ Running a virtual Container is much faster than running a full virtual Machine. ## Supported Containers -- PHP +- PHP (7.0 - 5.6 - 5.5) - NGINX - MySQL - PostgreSQL - Redis - Data Volume -Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to the list. +Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to this list. ## Requirements -- Laravel ([Download](https://laravel.com/docs/master/installation)) -- Git ([Download](https://git-scm.com/downloads)) - -> For Windows & MAC users only: - -- Docker Toolbox ([Download](https://www.docker.com/toolbox)) - -> For Linux users only: - -- Docker Engine ([Install](https://docs.docker.com/engine/installation/linux/ubuntulinux/#install)) -- Docker Compose ([Install](https://docs.docker.com/compose/install)) - +| Linux | Windows & MAC | +|-----------------------------------------------------------------------------------------|---------------------------------------------------------| +| [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) | +| [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) | +| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux/#install) | [Docker Toolbox](https://www.docker.com/toolbox) | +| [Docker Compose](https://docs.docker.com/compose/install) | | @@ -159,7 +153,10 @@ git submodule add https://github.com/LaraDock/laradock.git docker ## Usage -0 - For **Windows & MAC** users only: 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). +0 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine. +(**Linux** users don't need a Virtual Host, so skip this step) +
+[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
From 5190da831a26688c18791f7a1924c3af12c70682 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 8 May 2016 13:39:43 +0300 Subject: [PATCH 06/10] remove containers names from docker-compose to void conflict while scalling using the scale command --- README.md | 2 +- docker-compose.yml | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 144b76aa..c7a29ee5 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ docker-compose stop To stop single container do: -```php +```bash docker-compose stop {container-name} ``` diff --git a/docker-compose.yml b/docker-compose.yml index e2eb14e2..cca43603 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,6 @@ services: nginx: build: ./nginx - container_name: nginx volumes_from: - php volumes: @@ -19,7 +18,6 @@ services: php: build: ./php - container_name: php volumes: - ../:/var/www/laravel - ./logs/php/:/usr/local/var/log @@ -30,7 +28,6 @@ services: data: build: ./data - container_name: data volumes: - /var/lib/mysql - /var/lib/postgresql/data @@ -40,7 +37,6 @@ services: mysql: build: ./mysql - container_name: mysql volumes_from: - data ports: @@ -57,7 +53,6 @@ services: postgres: build: ./postgres - container_name: postgres volumes_from: - data ports: @@ -73,7 +68,6 @@ services: redis: build: ./redis - container_name: redis volumes_from: - data ports: From de8cbb0605cbc1d57bed8f6f5e7242288f08767a Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 8 May 2016 15:21:59 +0300 Subject: [PATCH 07/10] simple updates to docker compose and readme --- README.md | 4 ++-- docker-compose.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7a29ee5..77d02525 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ Cannot find your container! we would love to have it as well. Consider contribut git clone https://github.com/LaraDock/laradock.git docker ``` -Instead of `git clone` you can use `git submodule add` in case you are already using Git for your Laravel project *(Recommended)*: +You can use `git submodule add` instead of `git clone` if you are already using Git for your Laravel project *(Recommended)*: ```bash git submodule add https://github.com/LaraDock/laradock.git docker @@ -154,7 +154,7 @@ git submodule add https://github.com/LaraDock/laradock.git docker ## Usage 0 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine. -(**Linux** users don't need a Virtual Host, so skip this step) +(**Linux** users don't need a Virtual Host, so skip this step).
[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host) diff --git a/docker-compose.yml b/docker-compose.yml index cca43603..25b5ea5b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,5 @@ version: '2' + services: ### Nginx Server Container ################################## From ecefee4d653b192f0f0f68af5a7a9d7d6cb9b2a9 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 9 May 2016 04:20:03 +0300 Subject: [PATCH 08/10] update postgres volume path --- docker-compose.yml | 2 +- postgres/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 25b5ea5b..bab6da68 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: build: ./data volumes: - /var/lib/mysql - - /var/lib/postgresql/data + - /var/lib/postgres - /var/lib/redis ### MySQL Container ######################################### diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 295b63c1..87d80cc9 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -2,7 +2,7 @@ FROM postgres:latest MAINTAINER Ben M -VOLUME /var/lib/postgresql/data +VOLUME /var/lib/postgres CMD ["postgres"] From 81f2602464885361653d69b3f9920b3a2fd6573a Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 9 May 2016 04:23:03 +0300 Subject: [PATCH 09/10] Support MariaDB closes feature #21 --- README.md | 21 +++++++-------------- docker-compose.yml | 17 +++++++++++++++++ mariadb/Dockerfile | 9 +++++++++ 3 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 mariadb/Dockerfile diff --git a/README.md b/README.md index 77d02525..acae5449 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LaraDock -[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://www.zalt.me) +[![forthebadge](http://forthebadge.com/images/badges/built-by-developers.svg)](http://zalt.me) LaraDock helps you run your **Laravel** App on **Docker** real quick. @@ -110,9 +110,10 @@ Running a virtual Container is much faster than running a full virtual Machine. - PHP (7.0 - 5.6 - 5.5) - NGINX +- Redis - MySQL - PostgreSQL -- Redis +- MariaDB - Data Volume Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to this list. @@ -186,7 +187,7 @@ Note: you can choose your own combination of software's (containers), another ex docker-compose up -d php nginx postgres redis ``` -Supported Containers: `php`, `nginx`, `mysql`, `postgres`, `redis`, `data`. +Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `data`, `php`.
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). @@ -414,20 +415,12 @@ The Log files are stored in the `docker/logs` directory. 1 - first list the current running containers with `docker ps` -2 - enter any container with: - -Example: enter the `php` container +2 - enter any container using: ```bash -docker exec -it php bash +docker exec -it {container-name-or-id} bash ``` - -Example: enter the `nginx` container - -```bash -docker exec -it nginx bash -``` - +3 - to exit a container, type `exit`.
diff --git a/docker-compose.yml b/docker-compose.yml index bab6da68..1be50859 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: volumes: - /var/lib/mysql - /var/lib/postgres + - /var/lib/mariadb - /var/lib/redis ### MySQL Container ######################################### @@ -65,6 +66,22 @@ services: links: - php +### MariaDB Container ####################################### + + mariadb: + build: ./mariadb + volumes_from: + - data + ports: + - "3306:3306" + environment: + MYSQL_DATABASE: homestead + MYSQL_USER: homestead + MYSQL_PASSWORD: secret + MYSQL_ROOT_PASSWORD: root + links: + - php + ### Redis Container ######################################### redis: diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile new file mode 100644 index 00000000..d798d26c --- /dev/null +++ b/mariadb/Dockerfile @@ -0,0 +1,9 @@ +FROM mariadb:latest + +MAINTAINER Mahmoud Zalt + +VOLUME /var/lib/mariadb + +CMD ["mysqld"] + +EXPOSE 3306 From 12587bc7125b48156069822a75d3d121f8eae7d5 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 9 May 2016 05:02:15 +0300 Subject: [PATCH 10/10] Support Beanstalkd and Beanstalkd Console Closes feature #38 --- README.md | 8 +++++--- beanstalkd-console/Dockerfile | 15 +++++++++++++++ beanstalkd/Dockerfile | 16 ++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 beanstalkd-console/Dockerfile create mode 100644 beanstalkd/Dockerfile diff --git a/README.md b/README.md index acae5449..842039b2 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,8 @@ Running a virtual Container is much faster than running a full virtual Machine. - MySQL - PostgreSQL - MariaDB +- Beanstalkd +- Beanstalkd Console - Data Volume Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to this list. @@ -176,7 +178,7 @@ DB_HOST=xxx.xxx.xxx.xxx > Running PHP, NGINX and MySQL: ```bash -docker-compose up -d php nginx mysql +docker-compose up -d php nginx mysql redis ``` Note: you can choose your own combination of software's (containers), another example: @@ -184,10 +186,10 @@ Note: you can choose your own combination of software's (containers), another ex > Running PHP, NGINX, Postgres and Redis: ```bash -docker-compose up -d php nginx postgres redis +docker-compose up -d php nginx beanstalkd postgres ``` -Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `data`, `php`. +Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `beanstalkd`, `beanstalkd-console`, `data`, `php`.
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). diff --git a/beanstalkd-console/Dockerfile b/beanstalkd-console/Dockerfile new file mode 100644 index 00000000..f42178dd --- /dev/null +++ b/beanstalkd-console/Dockerfile @@ -0,0 +1,15 @@ +FROM php:latest + +MAINTAINER Mahmoud Zalt + +RUN apt-get update && apt-get install -y curl + +RUN curl -sL https://github.com/ptrofimov/beanstalk_console/archive/master.tar.gz | tar xvz -C /tmp +RUN mv /tmp/beanstalk_console-master /source + +RUN apt-get remove --purge -y curl && apt-get autoclean && apt-get clean +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +EXPOSE 2080 + +CMD bash -c 'BEANSTALK_SERVERS=$BEANSTALKD_PORT_11300_TCP_ADDR:11300 php -S 0.0.0.0:2080 -t /source/public' \ No newline at end of file diff --git a/beanstalkd/Dockerfile b/beanstalkd/Dockerfile new file mode 100644 index 00000000..ea1f87a8 --- /dev/null +++ b/beanstalkd/Dockerfile @@ -0,0 +1,16 @@ +FROM phusion/baseimage:latest + +MAINTAINER Mahmoud Zalt + +ENV DEBIAN_FRONTEND noninteractive +ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +RUN apt-get update +RUN apt-get install -y beanstalkd +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +VOLUME /var/lib/beanstalkd/data + +EXPOSE 11300 + +CMD ["/usr/bin/beanstalkd"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1be50859..0946d8ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,4 +91,21 @@ services: ports: - "6379:6379" +### Beanstalkd Container #################################### + + beanstalkd: + build: ./beanstalkd + ports: + - "11300:11300" + privileged: true + +### Beanstalkd-Console Container ############################ + + beanstalkd-console: + build: ./beanstalkd-console + ports: + - "2080:2080" + links: + - beanstalkd + ### Add more Containers below ###############################