Commit a0c5ef75 authored by Mahmoud Zalt's avatar Mahmoud Zalt

upgrade docker-compose to v3

parent 06353031
......@@ -478,18 +478,14 @@ composer create-project laravel/laravel my-cool-app "5.2.*"
For more about the Laravel installation click [here](https://laravel.com/docs/master#installing-laravel).
3 - Edit `docker-compose.yml` to Map the new application path:
3 - Edit `.env` to Map the new application path:
By default, Laradock assumes the Laravel application is living in the parent directory of the laradock folder.
Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www` with `../my-cool-app/:/var/www`, as follow:
```yaml
application:
image: tianon/true
volumes:
- ../my-cool-app/:/var/www
...
```dotenv
APP_CODE_PATH_HOST=../my-cool-app/
```
4 - Go to that folder and start working..
......@@ -1525,14 +1521,14 @@ Quick Setup giude, (we recommend you check their docs)
You can use the d4m-nfs solution in 2 ways, one is using the Laradock built it integration, and the other is using the tool separatly. Below is show case of both methods:
#### B.1: using the built in d4m-nfs integration
### B.1: using the built in d4m-nfs integration
In simple terms, docker-sync creates a docker container with a copy of all the application files that can be accessed very quickly from the other containers.
On the other hand, docker-sync runs a process on the host machine that continuously tracks and updates files changes from the host to this intermediate container.
Out of the box, it comes pre-configured for OS X, but using it on Windows is very easy to set-up by modifying the `DOCKER_SYNC_STRATEGY` on the `.env`
##### Usage
#### Usage
Laradock comes with `sync.sh`, an optional bash script, that automates installing, running and stopping docker-sync. Note that to run the bash script you may need to change the permissions `chmod 755 sync.sh`
......@@ -1547,22 +1543,24 @@ Laradock comes with `sync.sh`, an optional bash script, that automates installin
DOCKER_SYNC_STRATEGY=native_osx
```
2) Install the docker-sync gem on the host-machine:
3) set `APP_CODE_PATH_CONTAINER=/var/www` to `APP_CODE_PATH_CONTAINER=/var/www:nocopy` in the .env file
4) Install the docker-sync gem on the host-machine:
```bash
./sync.sh install
```
3) Start docker-sync and the Laradock environment.
5) Start docker-sync and the Laradock environment.
Specify the services you want to run, as you would normally do with `docker-compose up`
```bash
./sync.sh up nginx mysql
```
Please note that the first time docker-sync runs, it will copy all the files to the intermediate container and that may take a very long time (15min+).
4) To stop the environment and docker-sync do:
6) To stop the environment and docker-sync do:
```bash
./sync.sh down
```
##### Setting up Aliases (optional)
#### Setting up Aliases (optional)
You may create bash profile aliases to avoid having to remember and type these commands for everyday development.
Add the following lines to your `~/.bash_profile`:
......@@ -1576,7 +1574,7 @@ alias devdown="cd /PATH_TO_LARADOCK/laradock; ./sync.sh down"
Now from any location on your machine, you can simply run `devup`, `devbash` and `devdown`.
##### Additional Commands
#### Additional Commands
Opening bash on the workspace container (to run artisan for example):
```bash
......@@ -1592,7 +1590,7 @@ Removing and cleaning up the files and the docker-sync container. Use only if yo
```
##### Additional Notes
#### Additional Notes
- You may run laradock with or without docker-sync at any time using with the same `.env` and `docker-compose.yml`, because the configuration is overridden automatically when docker-sync is used.
- You may inspect the `sync.sh` script to learn each of the commands and even add custom ones.
......@@ -1609,7 +1607,7 @@ Visit the [docker-sync documentation](https://github.com/EugenMayer/docker-sync/
<br>
#### B.2: using the d4m-nfs tool
### B.2: using the d4m-nfs tool
[D4m-nfs](https://github.com/IFSight/d4m-nfs) automatically mount NFS volume instead of osxfs one.
......@@ -1751,4 +1749,4 @@ Example:
```bash
WORKSPACE_NPM_REGISTRY=https://registry.npm.taobao.org
WORKSPACE_COMPOSER_REPO_PACKAGIST=https://packagist.phpcomposer.com
```
\ No newline at end of file
```
......@@ -161,7 +161,7 @@ We recommend using a Docker version which is newer than 1.13.
cp env-example .env
```
You can edit the `.env` file to chose which software's you want to be installed in your environment. You can always refer to the `docker-compose.yml` file to see how those variables are been used.
You can edit the `.env` file to choose which software's you want to be installed in your environment. You can always refer to the `docker-compose.yml` file to see how those variables are been used.
Depending on the host's operating system you may need to change the value given to `COMPOSE_FILE`. When you are running Laradock on Mac OS the correct file separator to use is `:`. When running Laradock from a Windows environment multiple files must be separated with `;`.
......@@ -173,7 +173,7 @@ In this example we'll see how to run NGINX (web server) and MySQL (database engi
docker-compose up -d nginx mysql
```
**Note**: The `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. If you couldn't find them running then you need specify them as follow: `docker-compose up -d nginx php-fpm mysql workspace`.
**Note**: The web servers `nginx`, `apache`.. all depend on `php-fpm`, means if you just run, them they will automatically run the `php-fpm` for you, so no need to specify them in the `up` command. If you don't see them running then you may need run them as follow: `docker-compose up -d nginx php-fpm mysql...`.
You can select your own combination of containers from [this list](http://laradock.io/introduction/#supported-software-images).
......
......@@ -35,7 +35,7 @@ cp env-example .env
3 - Run your containers:
```shell
docker-compose up -d nginx mysql redis beanstalkd
docker-compose up -d nginx mysql phpmyadmin redis workspace
```
4 - Open your project's `.env` file and set the following:
......
version: "2"
services:
### Applications Code Container #############################
applications:
volumes:
- ${APPLICATION}:/var/www:cached
version: '2'
version: '3'
services:
### Applications Code Container #############################
applications:
image: tianon/true
volumes:
- applications-sync:/var/www:nocopy # nocopy is required
# applications:
# image: tianon/true
# volumes:
# - applications-sync:/var/www:nocopy # nocopy is required
### Volumes Setup #############################################
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,9 +8,9 @@
# GRANT ALL ON `myshop_db`.* TO 'appuser'@'%' ;
#
###
### this sql script is auto run when mariadb container start and $DATA_SAVE_PATH/mariadb not exists.
### this sql script is auto run when mariadb container start and $DATA_PATH_HOST/mariadb not exists.
###
### if your $DATA_SAVE_PATH/mariadb is exists and you do not want to delete it, you can run by manual execution:
### if your $DATA_PATH_HOST/mariadb is exists and you do not want to delete it, you can run by manual execution:
###
### docker-compose exec mariadb bash
### mysql -u root -p < /docker-entrypoint-initdb.d/createdb.sql
......
......@@ -8,9 +8,9 @@
# GRANT ALL ON `myshop_db`.* TO 'appuser'@'%' ;
#
#
# this sql script will auto run when the mysql container starts and the $DATA_SAVE_PATH/mysql not found.
# this sql script will auto run when the mysql container starts and the $DATA_PATH_HOST/mysql not found.
#
# if your $DATA_SAVE_PATH/mysql exists and you do not want to delete it, you can run by manual execution:
# if your $DATA_PATH_HOST/mysql exists and you do not want to delete it, you can run by manual execution:
#
# docker-compose exec mysql bash
# mysql -u root -p < /docker-entrypoint-initdb.d/createdb.sql
......
......@@ -8,9 +8,9 @@
# GRANT ALL ON `myshop_db`.* TO 'appuser'@'%' ;
#
###
### this sql script is auto run when percona container start and $DATA_SAVE_PATH/percona not exists.
### this sql script is auto run when percona container start and $DATA_PATH_HOST/percona not exists.
###
### if your $DATA_SAVE_PATH/percona is exists and you do not want to delete it, you can run by manual execution:
### if your $DATA_PATH_HOST/percona is exists and you do not want to delete it, you can run by manual execution:
###
### docker-compose exec percona bash
### mysql -u root -p < /docker-entrypoint-initdb.d/createdb.sql
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment