From 00a38fe274f2d2275a4c16523261f67abf28e62f Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Fri, 14 Jul 2017 17:03:01 -0400 Subject: [PATCH 01/49] added docker-sync support --- .gitignore | 3 ++- docker-compose.yml | 7 ++++++- docker-sync.yml | 9 +++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 docker-sync.yml diff --git a/.gitignore b/.gitignore index a6b304c9..702790af 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /logs /data .env -/.project \ No newline at end of file +/.project +.docker-sync \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 29b0109a..17cdde94 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,9 @@ services: applications: image: tianon/true volumes: - - ${APPLICATION}:/var/www + #- ${APPLICATION}:/var/www + - applications-sync:/var/www:nocopy # nocopy is required + ### Workspace Utilities Container ########################### @@ -668,3 +670,6 @@ volumes: driver: "local" elasticsearch-plugins: driver: "local" + applications-sync: + external: + name: "applications-sync" diff --git a/docker-sync.yml b/docker-sync.yml new file mode 100644 index 00000000..c68352aa --- /dev/null +++ b/docker-sync.yml @@ -0,0 +1,9 @@ +version: "2" + +options: + verbose: true +syncs: + applications-host-sync: # name of the sync volume + src: '${APPLICATION}' # host source directory + # sync_strategy: 'native_osx' # native_osx is the default + # sync_excludes: ['ignored_folder', '.ignored_dot_folder'] # ignored folders form sync \ No newline at end of file From aa22f5d64822f402e7bd82392d7e71a07cf654ed Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Fri, 14 Jul 2017 17:15:45 -0400 Subject: [PATCH 02/49] fixing applications sync volume name --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 17cdde94..3fba283a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -672,4 +672,4 @@ volumes: driver: "local" applications-sync: external: - name: "applications-sync" + name: "applications-host-sync" From 11687ffd364636884380b750e99bd137e092d0ec Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Fri, 14 Jul 2017 19:14:51 -0400 Subject: [PATCH 03/49] disabling docker-sync --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3fba283a..66c82d3f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,8 @@ services: applications: image: tianon/true volumes: - #- ${APPLICATION}:/var/www - - applications-sync:/var/www:nocopy # nocopy is required + - ${APPLICATION}:/var/www +# - applications-sync:/var/www:nocopy # nocopy is required ### Workspace Utilities Container ########################### From 0baf7917282cf92ac69d08b32d163397b9056aaa Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Fri, 14 Jul 2017 19:17:50 -0400 Subject: [PATCH 04/49] enabling sync --- docker-compose.yml | 4 ++-- docker-sync.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 66c82d3f..b6ac1b29 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,8 @@ services: applications: image: tianon/true volumes: - - ${APPLICATION}:/var/www -# - applications-sync:/var/www:nocopy # nocopy is required +# - ${APPLICATION}:/var/www + - applications-sync:/var/www:nocopy # nocopy is required ### Workspace Utilities Container ########################### diff --git a/docker-sync.yml b/docker-sync.yml index c68352aa..d602e519 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -5,5 +5,5 @@ options: syncs: applications-host-sync: # name of the sync volume src: '${APPLICATION}' # host source directory - # sync_strategy: 'native_osx' # native_osx is the default - # sync_excludes: ['ignored_folder', '.ignored_dot_folder'] # ignored folders form sync \ No newline at end of file + sync_strategy: 'native_osx' # native_osx is the default + sync_excludes: ['laradock', '.ignored_dot_folder'] \ No newline at end of file From 3752f482498951489e16debdc75448640efc1bd8 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Fri, 14 Jul 2017 19:27:16 -0400 Subject: [PATCH 05/49] displaying php errors --- php-fpm/php71.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php-fpm/php71.ini b/php-fpm/php71.ini index c8242dc0..2c39db84 100644 --- a/php-fpm/php71.ini +++ b/php-fpm/php71.ini @@ -474,7 +474,7 @@ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; Development Value: On ; Production Value: Off ; http://php.net/display-errors -display_errors = Off +display_errors = On ; The display of errors which occur during PHP's startup sequence are handled ; separately from display_errors. PHP's default behavior is to suppress those @@ -485,7 +485,7 @@ display_errors = Off ; Development Value: On ; Production Value: Off ; http://php.net/display-startup-errors -display_startup_errors = Off +display_startup_errors = On ; Besides displaying errors, PHP can also log errors to locations such as a ; server-specific log, STDERR, or a location specified by the error_log From 9970a00533cb551e2a697a61fcc4ec6c03e0b233 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 06:40:06 -0400 Subject: [PATCH 06/49] adding php-fpm user --- docker-sync.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-sync.yml b/docker-sync.yml index d602e519..6df8bd55 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -6,4 +6,6 @@ syncs: applications-host-sync: # name of the sync volume src: '${APPLICATION}' # host source directory sync_strategy: 'native_osx' # native_osx is the default - sync_excludes: ['laradock', '.ignored_dot_folder'] \ No newline at end of file + sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories + sync_user: www-data # php-fpm user should have permission to read the files + #sync_userid: 82 \ No newline at end of file From b2c6e53bfae21375a897e0673c55dbad32c62867 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 06:48:23 -0400 Subject: [PATCH 07/49] adding quotes to user --- docker-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-sync.yml b/docker-sync.yml index 6df8bd55..6471720f 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -5,7 +5,7 @@ options: syncs: applications-host-sync: # name of the sync volume src: '${APPLICATION}' # host source directory + sync_user: 'www-data' # php-fpm user should have permission to read the files sync_strategy: 'native_osx' # native_osx is the default sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories - sync_user: www-data # php-fpm user should have permission to read the files #sync_userid: 82 \ No newline at end of file From f59b9ebda697b86eca60b51d953c6bf20c08fb0e Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 07:01:45 -0400 Subject: [PATCH 08/49] removed user --- docker-sync.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-sync.yml b/docker-sync.yml index 6471720f..b8282b43 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -5,7 +5,6 @@ options: syncs: applications-host-sync: # name of the sync volume src: '${APPLICATION}' # host source directory - sync_user: 'www-data' # php-fpm user should have permission to read the files sync_strategy: 'native_osx' # native_osx is the default sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories #sync_userid: 82 \ No newline at end of file From 0aa63c40f85cefc5c5362c987eda79582b9150d9 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 07:09:58 -0400 Subject: [PATCH 09/49] defining user id 1000 --- docker-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-sync.yml b/docker-sync.yml index b8282b43..0de3d134 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -5,6 +5,6 @@ options: syncs: applications-host-sync: # name of the sync volume src: '${APPLICATION}' # host source directory + sync_userid: 1000 # giving permissions to www-data user (as defined in nginx and php-fpm Dockerfiles) sync_strategy: 'native_osx' # native_osx is the default sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories - #sync_userid: 82 \ No newline at end of file From 42fc8b7b577c8e339dbfe37fa78c3f54728f72d3 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 08:19:49 -0400 Subject: [PATCH 10/49] separating syn compose file --- docker-compose.sync.yml | 17 +++++++++++++++++ docker-compose.yml | 7 +------ docker-sync.yml | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 docker-compose.sync.yml diff --git a/docker-compose.sync.yml b/docker-compose.sync.yml new file mode 100644 index 00000000..b4b383a7 --- /dev/null +++ b/docker-compose.sync.yml @@ -0,0 +1,17 @@ +version: '2' + +services: + +### Applications Code Container ############################# + + applications: + image: tianon/true + volumes: + - applications-sync:/var/www:nocopy # nocopy is required + +### Volumes Setup ############################################# + +volumes: + applications-sync: + external: + name: "applications-host-sync" diff --git a/docker-compose.yml b/docker-compose.yml index b6ac1b29..29b0109a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,7 @@ services: applications: image: tianon/true volumes: -# - ${APPLICATION}:/var/www - - applications-sync:/var/www:nocopy # nocopy is required - + - ${APPLICATION}:/var/www ### Workspace Utilities Container ########################### @@ -670,6 +668,3 @@ volumes: driver: "local" elasticsearch-plugins: driver: "local" - applications-sync: - external: - name: "applications-host-sync" diff --git a/docker-sync.yml b/docker-sync.yml index 0de3d134..d497a56d 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -6,5 +6,5 @@ syncs: applications-host-sync: # name of the sync volume src: '${APPLICATION}' # host source directory sync_userid: 1000 # giving permissions to www-data user (as defined in nginx and php-fpm Dockerfiles) - sync_strategy: 'native_osx' # native_osx is the default + sync_strategy: 'native_osx' # for windows use 'unison' for linux docker-sync is not necessary sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories From 9585a4a7ab82423f1771663f60a9fa2e57176c37 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 08:28:15 -0400 Subject: [PATCH 11/49] changing compose file name for using docker sync stack --- docker-compose.sync.yml => docker-compose-dev.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docker-compose.sync.yml => docker-compose-dev.yml (100%) diff --git a/docker-compose.sync.yml b/docker-compose-dev.yml similarity index 100% rename from docker-compose.sync.yml rename to docker-compose-dev.yml From d83c9be2ea4bdc49c09715b8b81aea6353496bcf Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:05:29 -0400 Subject: [PATCH 12/49] disabling unused services --- docker-compose.yml | 745 +++++++++++++++++++++++---------------------- 1 file changed, 373 insertions(+), 372 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 29b0109a..94926ddc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -130,64 +130,64 @@ services: ### Blackfire Container ################################# - blackfire: - image: blackfire/blackfire - environment: - - BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID} - - BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN} - depends_on: - - php-fpm - networks: - - backend +# blackfire: +# image: blackfire/blackfire +# environment: +# - BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID} +# - BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN} +# depends_on: +# - php-fpm +# networks: +# - backend ### Apache Server Container ################################# - apache2: - build: - context: ./apache2 - args: - - PHP_SOCKET=${PHP_SOCKET} - volumes_from: - - applications - volumes: - - ${APACHE_HOST_LOG_PATH}:/var/log/apache2 - - ${APACHE_SITES_PATH}:/etc/apache2/sites-available - ports: - - "${APACHE_HOST_HTTP_PORT}:80" - - "${APACHE_HOST_HTTPS_PORT}:443" - depends_on: - - php-fpm - networks: - - frontend - - backend +# apache2: +# build: +# context: ./apache2 +# args: +# - PHP_SOCKET=${PHP_SOCKET} +# volumes_from: +# - applications +# volumes: +# - ${APACHE_HOST_LOG_PATH}:/var/log/apache2 +# - ${APACHE_SITES_PATH}:/etc/apache2/sites-available +# ports: +# - "${APACHE_HOST_HTTP_PORT}:80" +# - "${APACHE_HOST_HTTPS_PORT}:443" +# depends_on: +# - php-fpm +# networks: +# - frontend +# - backend ### HHVM Container ########################################## - hhvm: - build: ./hhvm - volumes_from: - - applications - expose: - - "9000" - depends_on: - - workspace - networks: - - frontend - - backend +# hhvm: +# build: ./hhvm +# volumes_from: +# - applications +# expose: +# - "9000" +# depends_on: +# - workspace +# networks: +# - frontend +# - backend ### Minio Container ######################################### - minio: - build: ./minio - volumes: - - minio:/export - ports: - - "${MINIO_PORT}:9000" - environment: - - MINIO_ACCESS_KEY=access - - MINIO_SECRET_KEY=secretkey - networks: - - frontend +# minio: +# build: ./minio +# volumes: +# - minio:/export +# ports: +# - "${MINIO_PORT}:9000" +# environment: +# - MINIO_ACCESS_KEY=access +# - MINIO_SECRET_KEY=secretkey +# networks: +# - frontend ### MySQL Container ######################################### @@ -210,120 +210,120 @@ services: ### Percona Container ######################################### - percona: - build: - context: ./percona - environment: - - MYSQL_DATABASE=${PERCONA_DATABASE} - - MYSQL_USER=${PERCONA_USER} - - MYSQL_PASSWORD=${PERCONA_PASSWORD} - - MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD} - volumes: - - ${DATA_SAVE_PATH}/percona:/var/lib/mysql - - ${PERCONA_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d - ports: - - "${PERCONA_PORT}:3306" - networks: - - backend +# percona: +# build: +# context: ./percona +# environment: +# - MYSQL_DATABASE=${PERCONA_DATABASE} +# - MYSQL_USER=${PERCONA_USER} +# - MYSQL_PASSWORD=${PERCONA_PASSWORD} +# - MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD} +# volumes: +# - ${DATA_SAVE_PATH}/percona:/var/lib/mysql +# - ${PERCONA_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d +# ports: +# - "${PERCONA_PORT}:3306" +# networks: +# - backend ### MSSQL Container ######################################### - mssql: - build: - context: ./mssql - environment: - - MSSQL_DATABASE=${MSSQL_DATABASE} - - SA_PASSWORD=${MSSQL_PASSWORD} - - ACCEPT_EULA=Y - volumes: - - ${DATA_SAVE_PATH}/mssql:/var/opt/mssql - ports: - - "${MSSQL_PORT}:1433" - networks: - - backend +# mssql: +# build: +# context: ./mssql +# environment: +# - MSSQL_DATABASE=${MSSQL_DATABASE} +# - SA_PASSWORD=${MSSQL_PASSWORD} +# - ACCEPT_EULA=Y +# volumes: +# - ${DATA_SAVE_PATH}/mssql:/var/opt/mssql +# ports: +# - "${MSSQL_PORT}:1433" +# networks: +# - backend ### MariaDB Container ####################################### - mariadb: - build: ./mariadb - volumes: - - ${DATA_SAVE_PATH}/mariadb:/var/lib/mysql - - ${MARIADB_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d - ports: - - "${MARIADB_PORT}:3306" - environment: - - MYSQL_DATABASE=${MARIADB_DATABASE} - - MYSQL_USER=${MARIADB_USER} - - MYSQL_PASSWORD=${MARIADB_PASSWORD} - - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} - networks: - - backend +# mariadb: +# build: ./mariadb +# volumes: +# - ${DATA_SAVE_PATH}/mariadb:/var/lib/mysql +# - ${MARIADB_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d +# ports: +# - "${MARIADB_PORT}:3306" +# environment: +# - MYSQL_DATABASE=${MARIADB_DATABASE} +# - MYSQL_USER=${MARIADB_USER} +# - MYSQL_PASSWORD=${MARIADB_PASSWORD} +# - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} +# networks: +# - backend ### PostgreSQL Container #################################### - postgres: - build: ./postgres - volumes: - - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data - ports: - - "${POSTGRES_PORT}:5432" - environment: - - POSTGRES_DB=${POSTGRES_DB} - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - networks: - - backend +# postgres: +# build: ./postgres +# volumes: +# - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data +# ports: +# - "${POSTGRES_PORT}:5432" +# environment: +# - POSTGRES_DB=${POSTGRES_DB} +# - POSTGRES_USER=${POSTGRES_USER} +# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} +# networks: +# - backend ### PostgreSQL PostGis Container ############################ - postgres-postgis: - build: ./postgres-postgis - volumes: - - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data - ports: - - "${POSTGRES_PORT}:5432" - environment: - - POSTGRES_DB=${POSTGRES_DB} - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - networks: - - backend +# postgres-postgis: +# build: ./postgres-postgis +# volumes: +# - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data +# ports: +# - "${POSTGRES_PORT}:5432" +# environment: +# - POSTGRES_DB=${POSTGRES_DB} +# - POSTGRES_USER=${POSTGRES_USER} +# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} +# networks: +# - backend ### Neo4j Container ######################################### - neo4j: - build: ./neo4j - ports: - - "7474:7474" - - "1337:1337" - environment: - - NEO4J_AUTH=default:secret - volumes: - - ${DATA_SAVE_PATH}/neo4j:/var/lib/neo4j/data - networks: - - backend +# neo4j: +# build: ./neo4j +# ports: +# - "7474:7474" +# - "1337:1337" +# environment: +# - NEO4J_AUTH=default:secret +# volumes: +# - ${DATA_SAVE_PATH}/neo4j:/var/lib/neo4j/data +# networks: +# - backend ### MongoDB Container ####################################### - mongo: - build: ./mongo - ports: - - "${MONGODB_PORT}:27017" - volumes: - - ${DATA_SAVE_PATH}/mongo:/data/db - networks: - - backend +# mongo: +# build: ./mongo +# ports: +# - "${MONGODB_PORT}:27017" +# volumes: +# - ${DATA_SAVE_PATH}/mongo:/data/db +# networks: +# - backend ### RethinkDB Container ####################################### - rethinkdb: - build: ./rethinkdb - ports: - - "${RETHINKDB_PORT}:8080" - volumes: - - ${DATA_SAVE_PATH}/rethinkdb:/data/rethinkdb_data - networks: - - backend +# rethinkdb: +# build: ./rethinkdb +# ports: +# - "${RETHINKDB_PORT}:8080" +# volumes: +# - ${DATA_SAVE_PATH}/rethinkdb:/data/rethinkdb_data +# networks: +# - backend ### Redis Container ######################################### @@ -338,290 +338,291 @@ services: ### Aerospike c Container ################################### - aerospike: - build: ./aerospike - volumes_from: - - workspace - volumes: - - ${DATA_SAVE_PATH}/aerospike:/opt/aerospike/data - ports: - - "${AEROSPIKE_SERVICE_PORT}:3000" - - "${AEROSPIKE_FABRIC_PORT}:3001" - - "${AEROSPIKE_HEARTBEAT_PORT}:3002" - - "${AEROSPIKE_INFO_PORT}:3003" - networks: - - backend +# aerospike: +# build: ./aerospike +# volumes_from: +# - workspace +# volumes: +# - ${DATA_SAVE_PATH}/aerospike:/opt/aerospike/data +# ports: +# - "${AEROSPIKE_SERVICE_PORT}:3000" +# - "${AEROSPIKE_FABRIC_PORT}:3001" +# - "${AEROSPIKE_HEARTBEAT_PORT}:3002" +# - "${AEROSPIKE_INFO_PORT}:3003" +# networks: +# - backend ### Memcached Container ##################################### - memcached: - build: ./memcached - volumes: - - ${DATA_SAVE_PATH}/memcached:/var/lib/memcached - ports: - - "${MEMCACHED_HOST_PORT}:11211" - depends_on: - - php-fpm - networks: - - backend +# memcached: +# build: ./memcached +# volumes: +# - ${DATA_SAVE_PATH}/memcached:/var/lib/memcached +# ports: +# - "${MEMCACHED_HOST_PORT}:11211" +# depends_on: +# - php-fpm +# networks: +# - backend ### Beanstalkd Container #################################### - beanstalkd: - build: ./beanstalkd - ports: - - "${BEANSTALKD_HOST_PORT}:11300" - privileged: true - depends_on: - - php-fpm - networks: - - backend +# beanstalkd: +# build: ./beanstalkd +# ports: +# - "${BEANSTALKD_HOST_PORT}:11300" +# privileged: true +# depends_on: +# - php-fpm +# networks: +# - backend ### RabbitMQ Container ###################################### - rabbitmq: - build: ./rabbitmq - ports: - - "${RABBITMQ_NODE_HOST_PORT}:5672" - - "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672" - - "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671" - privileged: true - environment: - - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER} - - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS} - depends_on: - - php-fpm - networks: - - backend +# rabbitmq: +# build: ./rabbitmq +# ports: +# - "${RABBITMQ_NODE_HOST_PORT}:5672" +# - "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672" +# - "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671" +# privileged: true +# environment: +# - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER} +# - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS} +# depends_on: +# - php-fpm +# networks: +# - backend ### Beanstalkd Console Container ############################ - beanstalkd-console: - build: ./beanstalkd-console - ports: - - "2080:2080" - depends_on: - - beanstalkd - networks: - - backend +# beanstalkd-console: +# build: ./beanstalkd-console +# ports: +# - "2080:2080" +# depends_on: +# - beanstalkd +# networks: +# - backend ### Caddy Server Container ################################## - caddy: - build: ./caddy - volumes_from: - - applications - volumes: - - ${CADDY_CUSTOM_CADDYFILE}:/etc/Caddyfile - - ${CADDY_HOST_LOG_PATH}:/var/log/caddy - - ${DATA_SAVE_PATH}:/root/.caddy - ports: - - "${CADDY_HOST_HTTP_PORT}:80" - - "${CADDY_HOST_HTTPS_PORT}:443" - depends_on: - - php-fpm - networks: - - frontend - - backend +# caddy: +# build: ./caddy +# volumes_from: +# - applications +# volumes: +# - ${CADDY_CUSTOM_CADDYFILE}:/etc/Caddyfile +# - ${CADDY_HOST_LOG_PATH}:/var/log/caddy +# - ${DATA_SAVE_PATH}:/root/.caddy +# ports: +# - "${CADDY_HOST_HTTP_PORT}:80" +# - "${CADDY_HOST_HTTPS_PORT}:443" +# depends_on: +# - php-fpm +# networks: +# - frontend +# - backend ### phpMyAdmin Container #################################### - phpmyadmin: - build: ./phpmyadmin - environment: - - PMA_ARBITRARY=1 - - MYSQL_USER=${PMA_USER} - - MYSQL_PASSWORD=${PMA_PASSWORD} - - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD} - ports: - - "${PMA_PORT}:80" - depends_on: - - "${PMA_DB_ENGINE}" - networks: - - frontend - - backend +# phpmyadmin: +# build: ./phpmyadmin +# environment: +# - PMA_ARBITRARY=1 +# - MYSQL_USER=${PMA_USER} +# - MYSQL_PASSWORD=${PMA_PASSWORD} +# - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD} +# ports: +# - "${PMA_PORT}:80" +# depends_on: +# - "${PMA_DB_ENGINE}" +# networks: +# - frontend +# - backend ### Adminer Container #################################### - adminer: - build: - context: ./adminer - args: - - INSTALL_MSSQL=${ADM_INSTALL_MSSQL} - ports: - - "${ADM_PORT}:8080" - depends_on: - - php-fpm - networks: - - frontend - - backend +# adminer: +# build: +# context: ./adminer +# args: +# - INSTALL_MSSQL=${ADM_INSTALL_MSSQL} +# ports: +# - "${ADM_PORT}:8080" +# depends_on: +# - php-fpm +# networks: +# - frontend +# - backend ### pgAdmin Container ####################################### - pgadmin: - build: ./pgadmin - ports: - - "5050:5050" - depends_on: - - postgres - networks: - - frontend - - backend +# pgadmin: +# build: ./pgadmin +# ports: +# - "5050:5050" +# depends_on: +# - postgres +# networks: +# - frontend +# - backend ### ElasticSearch Container ################################# - elasticsearch: - build: ./elasticsearch - volumes: - - elasticsearch-data:/usr/share/elasticsearch/data - - elasticsearch-plugins:/usr/share/elasticsearch/plugins - environment: - - cluster.name=laradock-cluster - - bootstrap.memory_lock=true - - "ES_JAVA_OPTS=-Xms256m -Xmx256m" - ulimits: - memlock: - soft: -1 - hard: -1 - mem_limit: 512m - ports: - - "${ELASTICSEARCH_HOST_HTTP_PORT}:9200" - - "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300" - depends_on: - - php-fpm - networks: - - frontend - - backend +# elasticsearch: +# build: ./elasticsearch +# volumes: +# - elasticsearch-data:/usr/share/elasticsearch/data +# - elasticsearch-plugins:/usr/share/elasticsearch/plugins +# environment: +# - cluster.name=laradock-cluster +# - bootstrap.memory_lock=true +# - "ES_JAVA_OPTS=-Xms256m -Xmx256m" +# ulimits: +# memlock: +# soft: -1 +# hard: -1 +# mem_limit: 512m +# ports: +# - "${ELASTICSEARCH_HOST_HTTP_PORT}:9200" +# - "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300" +# depends_on: +# - php-fpm +# networks: +# - frontend +# - backend ### Kibana Container ####################################### - kibana: - build: ./kibana - ports: - - "${KIBANA_HTTP_PORT}:5601" - depends_on: - - elasticsearch - networks: - - frontend - - backend +# kibana: +# build: ./kibana +# ports: +# - "${KIBANA_HTTP_PORT}:5601" +# depends_on: +# - elasticsearch +# networks: +# - frontend +# - backend ### Certbot Container ################################## - certbot: - build: - context: ./certbot - volumes: - - ./data/certbot/certs/:/var/certs - - ./certbot/letsencrypt/:/var/www/letsencrypt - environment: - - CN="fake.domain.com" - - EMAIL="fake.email@gmail.com" - networks: - - frontend +# certbot: +# build: +# context: ./certbot +# volumes: +# - ./data/certbot/certs/:/var/certs +# - ./certbot/letsencrypt/:/var/www/letsencrypt +# environment: +# - CN="fake.domain.com" +# - EMAIL="fake.email@gmail.com" +# networks: +# - frontend ### Mailhog Container ######################################### - mailhog: - build: ./mailhog - ports: - - "1025:1025" - - "8025:8025" - networks: - - frontend - - backend +# mailhog: +# build: ./mailhog +# ports: +# - "1025:1025" +# - "8025:8025" +# networks: +# - frontend +# - backend ### Selenium Container ######################################## - selenium: - build: ./selenium - ports: - - "${SELENIUM_PORT}:4444" - volumes: - - /dev/shm:/dev/shm - networks: - - frontend +# selenium: +# build: ./selenium +# ports: +# - "${SELENIUM_PORT}:4444" +# volumes: +# - /dev/shm:/dev/shm +# networks: +# - frontend ### Varnish Proxy 1 ########################################## - proxy: - build: ./varnish - expose: - - ${VARNISH_PORT} - environment: - - VARNISH_CONFIG=${VARNISH_CONFIG} - - CACHE_SIZE=${VARNISH_PROXY1_CACHE_SIZE} - - VARNISHD_PARAMS=${VARNISHD_PARAMS} - - VARNISH_PORT=${VARNISH_PORT} - - BACKEND_HOST=${VARNISH_PROXY1_BACKEND_HOST} - - BACKEND_PORT=${VARNISH_BACKEND_PORT} - - VARNISH_SERVER=${VARNISH_PROXY1_SERVER} - links: - - workspace - networks: - - frontend +# proxy: +# build: ./varnish +# expose: +# - ${VARNISH_PORT} +# environment: +# - VARNISH_CONFIG=${VARNISH_CONFIG} +# - CACHE_SIZE=${VARNISH_PROXY1_CACHE_SIZE} +# - VARNISHD_PARAMS=${VARNISHD_PARAMS} +# - VARNISH_PORT=${VARNISH_PORT} +# - BACKEND_HOST=${VARNISH_PROXY1_BACKEND_HOST} +# - BACKEND_PORT=${VARNISH_BACKEND_PORT} +# - VARNISH_SERVER=${VARNISH_PROXY1_SERVER} +# links: +# - workspace +# networks: +# - frontend ### Varnish Proxy 2 ########################################## - proxy2: - 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} - links: - - workspace - networks: - - frontend +# proxy2: +# 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} +# links: +# - workspace +# networks: +# - frontend ### Balancer Haproxy ########################################## - balancer: - build: ./haproxy - ports: - - "${HAPROXY_HOST_HTTP_PORT}:8085" - volumes: - - /var/run/docker.sock:/var/run/docker.sock - links: - - proxy - - proxy2 +# balancer: +# build: ./haproxy +# ports: +# - "${HAPROXY_HOST_HTTP_PORT}:8085" +# volumes: +# - /var/run/docker.sock:/var/run/docker.sock +# links: +# - proxy +# - proxy2 ### Jenkins ################################################### - jenkins: - build: ./jenkins - environment: - JAVA_OPTS: "-Djava.awt.headless=true" - ports: - - "${JENKINS_HOST_SLAVE_AGENT_PORT}:50000" - - "${JENKINS_HOST_HTTP_PORT}:8080" - privileged: true - volumes: - - ${JENKINS_HOME}:/var/jenkins_home - - /var/run/docker.sock:/var/run/docker.sock - networks: - - frontend - - backend +# jenkins: +# build: ./jenkins +# environment: +# JAVA_OPTS: "-Djava.awt.headless=true" +# ports: +# - "${JENKINS_HOST_SLAVE_AGENT_PORT}:50000" +# - "${JENKINS_HOST_HTTP_PORT}:8080" +# privileged: true +# volumes: +# - ${JENKINS_HOME}:/var/jenkins_home +# - /var/run/docker.sock:/var/run/docker.sock +# networks: +# - frontend +# - backend ### Laravel Echo Server ####################################### - laravel-echo-server: - build: - context: ./laravel-echo-server - volumes: - - ./laravel-echo-server/laravel-echo-server.json:/app/laravel-echo-server.json:ro - ports: - - "${LARAVEL_ECHO_SERVER_PORT}:6001" - links: - - redis - networks: - - frontend - - backend + +# laravel-echo-server: +# build: +# context: ./laravel-echo-server +# volumes: +# - ./laravel-echo-server/laravel-echo-server.json:/app/laravel-echo-server.json:ro +# ports: +# - "${LARAVEL_ECHO_SERVER_PORT}:6001" +# links: +# - redis +# networks: +# - frontend +# - backend ### Networks Setup ############################################ From 5eae7f30062c3d02398e313ec3321346274a2954 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:23:32 -0400 Subject: [PATCH 13/49] organizing sync file --- docker-compose-dev.yml => docker-compose.sync.yml | 0 docker-sync.yml | 3 +++ 2 files changed, 3 insertions(+) rename docker-compose-dev.yml => docker-compose.sync.yml (100%) diff --git a/docker-compose-dev.yml b/docker-compose.sync.yml similarity index 100% rename from docker-compose-dev.yml rename to docker-compose.sync.yml diff --git a/docker-sync.yml b/docker-sync.yml index d497a56d..77a2f624 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -4,7 +4,10 @@ options: verbose: true syncs: applications-host-sync: # name of the sync volume + compose-dev-file-path: 'docker-compose.sync.yml' # compose override file for sync + src: '${APPLICATION}' # host source directory sync_userid: 1000 # giving permissions to www-data user (as defined in nginx and php-fpm Dockerfiles) sync_strategy: 'native_osx' # for windows use 'unison' for linux docker-sync is not necessary + sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories From 5ea7b98db86b865a5d0d7ddc1417b78b82a99e33 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:40:05 -0400 Subject: [PATCH 14/49] added bash script --- laradock.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 laradock.sh diff --git a/laradock.sh b/laradock.sh new file mode 100644 index 00000000..e69de29b From e9a01c017414cf2737d44a731d0cacb46a3ff040 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:40:25 -0400 Subject: [PATCH 15/49] modified bash script --- laradock.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) mode change 100644 => 100755 laradock.sh diff --git a/laradock.sh b/laradock.sh old mode 100644 new mode 100755 index e69de29b..a14d030c --- a/laradock.sh +++ b/laradock.sh @@ -0,0 +1,17 @@ +#!/bin/bash +if [[ $# -eq 0 ]] ; then + echo "Missing arguments. Please specify 'up' or 'down'."; + exit 1 +fi + +if [[ $1 -eq "up" ]] ; then + echo "Initializing Docker Sync"; + docker-sync start; + echo "Initializing Docker Compose"; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml -d nginx mysql; +else + echo "Stopping Docker Compose"; + docker-compose down; + echo "Stopping Docker Sync"; + docker-sync start; +fi From 0d5080d6bbe419e739ff73b751fb7fadcd6e3cf9 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:41:57 -0400 Subject: [PATCH 16/49] fixed typo --- laradock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laradock.sh b/laradock.sh index a14d030c..39eab138 100755 --- a/laradock.sh +++ b/laradock.sh @@ -8,7 +8,7 @@ if [[ $1 -eq "up" ]] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml -d nginx mysql; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d nginx mysql; else echo "Stopping Docker Compose"; docker-compose down; From c17abbea6e74d01f180910abbda55aa490dac542 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:44:09 -0400 Subject: [PATCH 17/49] stopping docker sync --- laradock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laradock.sh b/laradock.sh index 39eab138..2f03b620 100755 --- a/laradock.sh +++ b/laradock.sh @@ -13,5 +13,5 @@ else echo "Stopping Docker Compose"; docker-compose down; echo "Stopping Docker Sync"; - docker-sync start; + docker-sync stop; fi From 56ca814ebb507d79a7f74e50681149bcb82fd9ad Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:46:52 -0400 Subject: [PATCH 18/49] comparing bash strings correctly --- laradock.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/laradock.sh b/laradock.sh index 2f03b620..64f2f3a7 100755 --- a/laradock.sh +++ b/laradock.sh @@ -4,14 +4,16 @@ if [[ $# -eq 0 ]] ; then exit 1 fi -if [[ $1 -eq "up" ]] ; then +if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d nginx mysql; -else +elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; echo "Stopping Docker Sync"; docker-sync stop; +else + echo "Invalid arguments. Use 'up' or 'down'"; fi From a38794ebccf23ed6c7fdabfc4465761ab278f93c Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:53:56 -0400 Subject: [PATCH 19/49] passing parameters --- laradock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laradock.sh b/laradock.sh index 64f2f3a7..78d141f5 100755 --- a/laradock.sh +++ b/laradock.sh @@ -8,7 +8,7 @@ if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d nginx mysql; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml $@; elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; From 3e5d1d919a5345ea2c8fe8bfa16533ac1933becb Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 09:56:03 -0400 Subject: [PATCH 20/49] running in daemon mode --- laradock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laradock.sh b/laradock.sh index 78d141f5..4517d5bf 100755 --- a/laradock.sh +++ b/laradock.sh @@ -8,7 +8,7 @@ if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml $@; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml $@ -d; elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; From 3d29c62bfbbac1e143ad6ef4276ecabf0650a75f Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 11:01:52 -0400 Subject: [PATCH 21/49] adding more commands --- laradock.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/laradock.sh b/laradock.sh index 4517d5bf..126eab1e 100755 --- a/laradock.sh +++ b/laradock.sh @@ -4,6 +4,8 @@ if [[ $# -eq 0 ]] ; then exit 1 fi +echo -e "Default \e[44mBlue"; + if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; @@ -14,6 +16,13 @@ elif [ "$1" == "down" ]; then docker-compose down; echo "Stopping Docker Sync"; docker-sync stop; +elif [ "$1" == "install" ]; then + echo "Installing docker-sync"; + gem install docker-sync; +elif [ "$1" == "sync" ]; then + docker-sync sync; +elif [ "$1" == "clean" ]; then + docker-sync clean; else echo "Invalid arguments. Use 'up' or 'down'"; fi From ef7f2516540a5a84c25fc973ab8ae9603e1c88ca Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 11:04:45 -0400 Subject: [PATCH 22/49] fixed command --- laradock.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/laradock.sh b/laradock.sh index 126eab1e..6b2627b6 100755 --- a/laradock.sh +++ b/laradock.sh @@ -4,13 +4,14 @@ if [[ $# -eq 0 ]] ; then exit 1 fi -echo -e "Default \e[44mBlue"; +echo -e '\E[37;44m'"\033[1mContact List\033[0m"; + if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml $@ -d; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml -d $@; elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; From 988bbf7bdef88cc5f701c753a32da9c1ff99a1cd Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 11:05:16 -0400 Subject: [PATCH 23/49] putting up arg --- laradock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laradock.sh b/laradock.sh index 6b2627b6..14f7bdc4 100755 --- a/laradock.sh +++ b/laradock.sh @@ -11,7 +11,7 @@ if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml -d $@; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d $@; elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; From 855e2a47b53c5bdebf8c187cf72a0c4c5861b9ec Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 11:08:01 -0400 Subject: [PATCH 24/49] passing only the second argument and onward --- laradock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laradock.sh b/laradock.sh index 14f7bdc4..da267a55 100755 --- a/laradock.sh +++ b/laradock.sh @@ -11,7 +11,7 @@ if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d $@; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@:2}; elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; From 0c1b6ba9bfe6a8a2a2a3bac82f07c63b6a4a56fc Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 11:13:50 -0400 Subject: [PATCH 25/49] improving script --- laradock.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/laradock.sh b/laradock.sh index da267a55..9c9ea93f 100755 --- a/laradock.sh +++ b/laradock.sh @@ -4,14 +4,12 @@ if [[ $# -eq 0 ]] ; then exit 1 fi -echo -e '\E[37;44m'"\033[1mContact List\033[0m"; - - if [ "$1" == "up" ] ; then echo "Initializing Docker Sync"; docker-sync start; echo "Initializing Docker Compose"; - docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@:2}; + shift; # removing first argument + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; elif [ "$1" == "down" ]; then echo "Stopping Docker Compose"; docker-compose down; @@ -25,5 +23,5 @@ elif [ "$1" == "sync" ]; then elif [ "$1" == "clean" ]; then docker-sync clean; else - echo "Invalid arguments. Use 'up' or 'down'"; + echo "Invalid argument. Use 'up','down','install','sync' or 'clean' "; fi From 407fb7a395228b78ed51ab7893728cdda20ce83a Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 12:00:35 -0400 Subject: [PATCH 26/49] updaeted commmand --- laradock.sh => sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename laradock.sh => sync.sh (90%) diff --git a/laradock.sh b/sync.sh similarity index 90% rename from laradock.sh rename to sync.sh index 9c9ea93f..c88a600b 100755 --- a/laradock.sh +++ b/sync.sh @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then fi if [ "$1" == "up" ] ; then - echo "Initializing Docker Sync"; + echo "Initializing Docker Sync (may take several minutes the first time)"; docker-sync start; echo "Initializing Docker Compose"; shift; # removing first argument From abae2dc09ecfa191a8b13330d3138f95996b6d82 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 12:00:44 -0400 Subject: [PATCH 27/49] updated command --- sync.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sync.sh b/sync.sh index c88a600b..c452eb1e 100755 --- a/sync.sh +++ b/sync.sh @@ -1,27 +1,39 @@ #!/bin/bash if [[ $# -eq 0 ]] ; then - echo "Missing arguments. Please specify 'up' or 'down'."; + printf "Available commands:\n"; + printf " install\t\t Installs docker-sync gem on the host machine.\n"; + printf " up \t Starts docker-sync and runs docker compose.\n"; + printf " down \t\t Stops containers and docker-sync.\n"; + printf " trigger \t\t Manually triggers the synchronization of files.\n"; + printf " clean \t\t Removes all synched files from docker-sync container.\n"; exit 1 fi if [ "$1" == "up" ] ; then - echo "Initializing Docker Sync (may take several minutes the first time)"; + printf "Initializing Docker Sync (may take several minutes the first time)"; docker-sync start; - echo "Initializing Docker Compose"; + printf "Initializing Docker Compose"; shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; + elif [ "$1" == "down" ]; then - echo "Stopping Docker Compose"; + printf "Stopping Docker Compose"; docker-compose down; - echo "Stopping Docker Sync"; + printf "Stopping Docker Sync"; docker-sync stop; + elif [ "$1" == "install" ]; then - echo "Installing docker-sync"; + printf "Installing docker-sync"; gem install docker-sync; -elif [ "$1" == "sync" ]; then + +elif [ "$1" == "trigger" ]; then + printf "Manually triggering sync between host and docker-sync container."; docker-sync sync; + elif [ "$1" == "clean" ]; then + printf "Removing and cleaning up files from the docker-sync container."; docker-sync clean; + else - echo "Invalid argument. Use 'up','down','install','sync' or 'clean' "; + printf "Invalid argument. Use 'up','down','install','trigger' or 'clean' "; fi From 2acc9f5d6fe3d4d80d2a3f614df93c13e2028e72 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 12:36:02 -0400 Subject: [PATCH 28/49] cleaning up files --- docker-compose.yml | 744 ++++++++++++++++++++++----------------------- docker-sync.yml | 6 +- 2 files changed, 375 insertions(+), 375 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 94926ddc..4dcc1080 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -130,64 +130,64 @@ services: ### Blackfire Container ################################# -# blackfire: -# image: blackfire/blackfire -# environment: -# - BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID} -# - BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN} -# depends_on: -# - php-fpm -# networks: -# - backend + blackfire: + image: blackfire/blackfire + environment: + - BLACKFIRE_SERVER_ID=${BLACKFIRE_SERVER_ID} + - BLACKFIRE_SERVER_TOKEN=${BLACKFIRE_SERVER_TOKEN} + depends_on: + - php-fpm + networks: + - backend ### Apache Server Container ################################# -# apache2: -# build: -# context: ./apache2 -# args: -# - PHP_SOCKET=${PHP_SOCKET} -# volumes_from: -# - applications -# volumes: -# - ${APACHE_HOST_LOG_PATH}:/var/log/apache2 -# - ${APACHE_SITES_PATH}:/etc/apache2/sites-available -# ports: -# - "${APACHE_HOST_HTTP_PORT}:80" -# - "${APACHE_HOST_HTTPS_PORT}:443" -# depends_on: -# - php-fpm -# networks: -# - frontend -# - backend + apache2: + build: + context: ./apache2 + args: + - PHP_SOCKET=${PHP_SOCKET} + volumes_from: + - applications + volumes: + - ${APACHE_HOST_LOG_PATH}:/var/log/apache2 + - ${APACHE_SITES_PATH}:/etc/apache2/sites-available + ports: + - "${APACHE_HOST_HTTP_PORT}:80" + - "${APACHE_HOST_HTTPS_PORT}:443" + depends_on: + - php-fpm + networks: + - frontend + - backend ### HHVM Container ########################################## -# hhvm: -# build: ./hhvm -# volumes_from: -# - applications -# expose: -# - "9000" -# depends_on: -# - workspace -# networks: -# - frontend -# - backend + hhvm: + build: ./hhvm + volumes_from: + - applications + expose: + - "9000" + depends_on: + - workspace + networks: + - frontend + - backend ### Minio Container ######################################### -# minio: -# build: ./minio -# volumes: -# - minio:/export -# ports: -# - "${MINIO_PORT}:9000" -# environment: -# - MINIO_ACCESS_KEY=access -# - MINIO_SECRET_KEY=secretkey -# networks: -# - frontend + minio: + build: ./minio + volumes: + - minio:/export + ports: + - "${MINIO_PORT}:9000" + environment: + - MINIO_ACCESS_KEY=access + - MINIO_SECRET_KEY=secretkey + networks: + - frontend ### MySQL Container ######################################### @@ -210,120 +210,120 @@ services: ### Percona Container ######################################### -# percona: -# build: -# context: ./percona -# environment: -# - MYSQL_DATABASE=${PERCONA_DATABASE} -# - MYSQL_USER=${PERCONA_USER} -# - MYSQL_PASSWORD=${PERCONA_PASSWORD} -# - MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD} -# volumes: -# - ${DATA_SAVE_PATH}/percona:/var/lib/mysql -# - ${PERCONA_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d -# ports: -# - "${PERCONA_PORT}:3306" -# networks: -# - backend + percona: + build: + context: ./percona + environment: + - MYSQL_DATABASE=${PERCONA_DATABASE} + - MYSQL_USER=${PERCONA_USER} + - MYSQL_PASSWORD=${PERCONA_PASSWORD} + - MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD} + volumes: + - ${DATA_SAVE_PATH}/percona:/var/lib/mysql + - ${PERCONA_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d + ports: + - "${PERCONA_PORT}:3306" + networks: + - backend ### MSSQL Container ######################################### -# mssql: -# build: -# context: ./mssql -# environment: -# - MSSQL_DATABASE=${MSSQL_DATABASE} -# - SA_PASSWORD=${MSSQL_PASSWORD} -# - ACCEPT_EULA=Y -# volumes: -# - ${DATA_SAVE_PATH}/mssql:/var/opt/mssql -# ports: -# - "${MSSQL_PORT}:1433" -# networks: -# - backend + mssql: + build: + context: ./mssql + environment: + - MSSQL_DATABASE=${MSSQL_DATABASE} + - SA_PASSWORD=${MSSQL_PASSWORD} + - ACCEPT_EULA=Y + volumes: + - ${DATA_SAVE_PATH}/mssql:/var/opt/mssql + ports: + - "${MSSQL_PORT}:1433" + networks: + - backend ### MariaDB Container ####################################### -# mariadb: -# build: ./mariadb -# volumes: -# - ${DATA_SAVE_PATH}/mariadb:/var/lib/mysql -# - ${MARIADB_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d -# ports: -# - "${MARIADB_PORT}:3306" -# environment: -# - MYSQL_DATABASE=${MARIADB_DATABASE} -# - MYSQL_USER=${MARIADB_USER} -# - MYSQL_PASSWORD=${MARIADB_PASSWORD} -# - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} -# networks: -# - backend + mariadb: + build: ./mariadb + volumes: + - ${DATA_SAVE_PATH}/mariadb:/var/lib/mysql + - ${MARIADB_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d + ports: + - "${MARIADB_PORT}:3306" + environment: + - MYSQL_DATABASE=${MARIADB_DATABASE} + - MYSQL_USER=${MARIADB_USER} + - MYSQL_PASSWORD=${MARIADB_PASSWORD} + - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} + networks: + - backend ### PostgreSQL Container #################################### -# postgres: -# build: ./postgres -# volumes: -# - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data -# ports: -# - "${POSTGRES_PORT}:5432" -# environment: -# - POSTGRES_DB=${POSTGRES_DB} -# - POSTGRES_USER=${POSTGRES_USER} -# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -# networks: -# - backend + postgres: + build: ./postgres + volumes: + - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data + ports: + - "${POSTGRES_PORT}:5432" + environment: + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + networks: + - backend ### PostgreSQL PostGis Container ############################ -# postgres-postgis: -# build: ./postgres-postgis -# volumes: -# - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data -# ports: -# - "${POSTGRES_PORT}:5432" -# environment: -# - POSTGRES_DB=${POSTGRES_DB} -# - POSTGRES_USER=${POSTGRES_USER} -# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -# networks: -# - backend + postgres-postgis: + build: ./postgres-postgis + volumes: + - ${DATA_SAVE_PATH}/postgres:/var/lib/postgresql/data + ports: + - "${POSTGRES_PORT}:5432" + environment: + - POSTGRES_DB=${POSTGRES_DB} + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + networks: + - backend ### Neo4j Container ######################################### -# neo4j: -# build: ./neo4j -# ports: -# - "7474:7474" -# - "1337:1337" -# environment: -# - NEO4J_AUTH=default:secret -# volumes: -# - ${DATA_SAVE_PATH}/neo4j:/var/lib/neo4j/data -# networks: -# - backend + neo4j: + build: ./neo4j + ports: + - "7474:7474" + - "1337:1337" + environment: + - NEO4J_AUTH=default:secret + volumes: + - ${DATA_SAVE_PATH}/neo4j:/var/lib/neo4j/data + networks: + - backend ### MongoDB Container ####################################### -# mongo: -# build: ./mongo -# ports: -# - "${MONGODB_PORT}:27017" -# volumes: -# - ${DATA_SAVE_PATH}/mongo:/data/db -# networks: -# - backend + mongo: + build: ./mongo + ports: + - "${MONGODB_PORT}:27017" + volumes: + - ${DATA_SAVE_PATH}/mongo:/data/db + networks: + - backend ### RethinkDB Container ####################################### -# rethinkdb: -# build: ./rethinkdb -# ports: -# - "${RETHINKDB_PORT}:8080" -# volumes: -# - ${DATA_SAVE_PATH}/rethinkdb:/data/rethinkdb_data -# networks: -# - backend + rethinkdb: + build: ./rethinkdb + ports: + - "${RETHINKDB_PORT}:8080" + volumes: + - ${DATA_SAVE_PATH}/rethinkdb:/data/rethinkdb_data + networks: + - backend ### Redis Container ######################################### @@ -338,291 +338,291 @@ services: ### Aerospike c Container ################################### -# aerospike: -# build: ./aerospike -# volumes_from: -# - workspace -# volumes: -# - ${DATA_SAVE_PATH}/aerospike:/opt/aerospike/data -# ports: -# - "${AEROSPIKE_SERVICE_PORT}:3000" -# - "${AEROSPIKE_FABRIC_PORT}:3001" -# - "${AEROSPIKE_HEARTBEAT_PORT}:3002" -# - "${AEROSPIKE_INFO_PORT}:3003" -# networks: -# - backend + aerospike: + build: ./aerospike + volumes_from: + - workspace + volumes: + - ${DATA_SAVE_PATH}/aerospike:/opt/aerospike/data + ports: + - "${AEROSPIKE_SERVICE_PORT}:3000" + - "${AEROSPIKE_FABRIC_PORT}:3001" + - "${AEROSPIKE_HEARTBEAT_PORT}:3002" + - "${AEROSPIKE_INFO_PORT}:3003" + networks: + - backend ### Memcached Container ##################################### -# memcached: -# build: ./memcached -# volumes: -# - ${DATA_SAVE_PATH}/memcached:/var/lib/memcached -# ports: -# - "${MEMCACHED_HOST_PORT}:11211" -# depends_on: -# - php-fpm -# networks: -# - backend + memcached: + build: ./memcached + volumes: + - ${DATA_SAVE_PATH}/memcached:/var/lib/memcached + ports: + - "${MEMCACHED_HOST_PORT}:11211" + depends_on: + - php-fpm + networks: + - backend ### Beanstalkd Container #################################### -# beanstalkd: -# build: ./beanstalkd -# ports: -# - "${BEANSTALKD_HOST_PORT}:11300" -# privileged: true -# depends_on: -# - php-fpm -# networks: -# - backend + beanstalkd: + build: ./beanstalkd + ports: + - "${BEANSTALKD_HOST_PORT}:11300" + privileged: true + depends_on: + - php-fpm + networks: + - backend ### RabbitMQ Container ###################################### -# rabbitmq: -# build: ./rabbitmq -# ports: -# - "${RABBITMQ_NODE_HOST_PORT}:5672" -# - "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672" -# - "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671" -# privileged: true -# environment: -# - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER} -# - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS} -# depends_on: -# - php-fpm -# networks: -# - backend + rabbitmq: + build: ./rabbitmq + ports: + - "${RABBITMQ_NODE_HOST_PORT}:5672" + - "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672" + - "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671" + privileged: true + environment: + - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER} + - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS} + depends_on: + - php-fpm + networks: + - backend ### Beanstalkd Console Container ############################ -# beanstalkd-console: -# build: ./beanstalkd-console -# ports: -# - "2080:2080" -# depends_on: -# - beanstalkd -# networks: -# - backend + beanstalkd-console: + build: ./beanstalkd-console + ports: + - "2080:2080" + depends_on: + - beanstalkd + networks: + - backend ### Caddy Server Container ################################## -# caddy: -# build: ./caddy -# volumes_from: -# - applications -# volumes: -# - ${CADDY_CUSTOM_CADDYFILE}:/etc/Caddyfile -# - ${CADDY_HOST_LOG_PATH}:/var/log/caddy -# - ${DATA_SAVE_PATH}:/root/.caddy -# ports: -# - "${CADDY_HOST_HTTP_PORT}:80" -# - "${CADDY_HOST_HTTPS_PORT}:443" -# depends_on: -# - php-fpm -# networks: -# - frontend -# - backend + caddy: + build: ./caddy + volumes_from: + - applications + volumes: + - ${CADDY_CUSTOM_CADDYFILE}:/etc/Caddyfile + - ${CADDY_HOST_LOG_PATH}:/var/log/caddy + - ${DATA_SAVE_PATH}:/root/.caddy + ports: + - "${CADDY_HOST_HTTP_PORT}:80" + - "${CADDY_HOST_HTTPS_PORT}:443" + depends_on: + - php-fpm + networks: + - frontend + - backend ### phpMyAdmin Container #################################### -# phpmyadmin: -# build: ./phpmyadmin -# environment: -# - PMA_ARBITRARY=1 -# - MYSQL_USER=${PMA_USER} -# - MYSQL_PASSWORD=${PMA_PASSWORD} -# - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD} -# ports: -# - "${PMA_PORT}:80" -# depends_on: -# - "${PMA_DB_ENGINE}" -# networks: -# - frontend -# - backend + phpmyadmin: + build: ./phpmyadmin + environment: + - PMA_ARBITRARY=1 + - MYSQL_USER=${PMA_USER} + - MYSQL_PASSWORD=${PMA_PASSWORD} + - MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD} + ports: + - "${PMA_PORT}:80" + depends_on: + - "${PMA_DB_ENGINE}" + networks: + - frontend + - backend ### Adminer Container #################################### -# adminer: -# build: -# context: ./adminer -# args: -# - INSTALL_MSSQL=${ADM_INSTALL_MSSQL} -# ports: -# - "${ADM_PORT}:8080" -# depends_on: -# - php-fpm -# networks: -# - frontend -# - backend + adminer: + build: + context: ./adminer + args: + - INSTALL_MSSQL=${ADM_INSTALL_MSSQL} + ports: + - "${ADM_PORT}:8080" + depends_on: + - php-fpm + networks: + - frontend + - backend ### pgAdmin Container ####################################### -# pgadmin: -# build: ./pgadmin -# ports: -# - "5050:5050" -# depends_on: -# - postgres -# networks: -# - frontend -# - backend + pgadmin: + build: ./pgadmin + ports: + - "5050:5050" + depends_on: + - postgres + networks: + - frontend + - backend ### ElasticSearch Container ################################# -# elasticsearch: -# build: ./elasticsearch -# volumes: -# - elasticsearch-data:/usr/share/elasticsearch/data -# - elasticsearch-plugins:/usr/share/elasticsearch/plugins -# environment: -# - cluster.name=laradock-cluster -# - bootstrap.memory_lock=true -# - "ES_JAVA_OPTS=-Xms256m -Xmx256m" -# ulimits: -# memlock: -# soft: -1 -# hard: -1 -# mem_limit: 512m -# ports: -# - "${ELASTICSEARCH_HOST_HTTP_PORT}:9200" -# - "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300" -# depends_on: -# - php-fpm -# networks: -# - frontend -# - backend + elasticsearch: + build: ./elasticsearch + volumes: + - elasticsearch-data:/usr/share/elasticsearch/data + - elasticsearch-plugins:/usr/share/elasticsearch/plugins + environment: + - cluster.name=laradock-cluster + - bootstrap.memory_lock=true + - "ES_JAVA_OPTS=-Xms256m -Xmx256m" + ulimits: + memlock: + soft: -1 + hard: -1 + mem_limit: 512m + ports: + - "${ELASTICSEARCH_HOST_HTTP_PORT}:9200" + - "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300" + depends_on: + - php-fpm + networks: + - frontend + - backend ### Kibana Container ####################################### -# kibana: -# build: ./kibana -# ports: -# - "${KIBANA_HTTP_PORT}:5601" -# depends_on: -# - elasticsearch -# networks: -# - frontend -# - backend + kibana: + build: ./kibana + ports: + - "${KIBANA_HTTP_PORT}:5601" + depends_on: + - elasticsearch + networks: + - frontend + - backend ### Certbot Container ################################## -# certbot: -# build: -# context: ./certbot -# volumes: -# - ./data/certbot/certs/:/var/certs -# - ./certbot/letsencrypt/:/var/www/letsencrypt -# environment: -# - CN="fake.domain.com" -# - EMAIL="fake.email@gmail.com" -# networks: -# - frontend + certbot: + build: + context: ./certbot + volumes: + - ./data/certbot/certs/:/var/certs + - ./certbot/letsencrypt/:/var/www/letsencrypt + environment: + - CN="fake.domain.com" + - EMAIL="fake.email@gmail.com" + networks: + - frontend ### Mailhog Container ######################################### -# mailhog: -# build: ./mailhog -# ports: -# - "1025:1025" -# - "8025:8025" -# networks: -# - frontend -# - backend + mailhog: + build: ./mailhog + ports: + - "1025:1025" + - "8025:8025" + networks: + - frontend + - backend ### Selenium Container ######################################## -# selenium: -# build: ./selenium -# ports: -# - "${SELENIUM_PORT}:4444" -# volumes: -# - /dev/shm:/dev/shm -# networks: -# - frontend + selenium: + build: ./selenium + ports: + - "${SELENIUM_PORT}:4444" + volumes: + - /dev/shm:/dev/shm + networks: + - frontend ### Varnish Proxy 1 ########################################## -# proxy: -# build: ./varnish -# expose: -# - ${VARNISH_PORT} -# environment: -# - VARNISH_CONFIG=${VARNISH_CONFIG} -# - CACHE_SIZE=${VARNISH_PROXY1_CACHE_SIZE} -# - VARNISHD_PARAMS=${VARNISHD_PARAMS} -# - VARNISH_PORT=${VARNISH_PORT} -# - BACKEND_HOST=${VARNISH_PROXY1_BACKEND_HOST} -# - BACKEND_PORT=${VARNISH_BACKEND_PORT} -# - VARNISH_SERVER=${VARNISH_PROXY1_SERVER} -# links: -# - workspace -# networks: -# - frontend + proxy: + build: ./varnish + expose: + - ${VARNISH_PORT} + environment: + - VARNISH_CONFIG=${VARNISH_CONFIG} + - CACHE_SIZE=${VARNISH_PROXY1_CACHE_SIZE} + - VARNISHD_PARAMS=${VARNISHD_PARAMS} + - VARNISH_PORT=${VARNISH_PORT} + - BACKEND_HOST=${VARNISH_PROXY1_BACKEND_HOST} + - BACKEND_PORT=${VARNISH_BACKEND_PORT} + - VARNISH_SERVER=${VARNISH_PROXY1_SERVER} + links: + - workspace + networks: + - frontend ### Varnish Proxy 2 ########################################## -# proxy2: -# 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} -# links: -# - workspace -# networks: -# - frontend + proxy2: + 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} + links: + - workspace + networks: + - frontend ### Balancer Haproxy ########################################## -# balancer: -# build: ./haproxy -# ports: -# - "${HAPROXY_HOST_HTTP_PORT}:8085" -# volumes: -# - /var/run/docker.sock:/var/run/docker.sock -# links: -# - proxy -# - proxy2 + balancer: + build: ./haproxy + ports: + - "${HAPROXY_HOST_HTTP_PORT}:8085" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + links: + - proxy + - proxy2 ### Jenkins ################################################### -# jenkins: -# build: ./jenkins -# environment: -# JAVA_OPTS: "-Djava.awt.headless=true" -# ports: -# - "${JENKINS_HOST_SLAVE_AGENT_PORT}:50000" -# - "${JENKINS_HOST_HTTP_PORT}:8080" -# privileged: true -# volumes: -# - ${JENKINS_HOME}:/var/jenkins_home -# - /var/run/docker.sock:/var/run/docker.sock -# networks: -# - frontend -# - backend + jenkins: + build: ./jenkins + environment: + JAVA_OPTS: "-Djava.awt.headless=true" + ports: + - "${JENKINS_HOST_SLAVE_AGENT_PORT}:50000" + - "${JENKINS_HOST_HTTP_PORT}:8080" + privileged: true + volumes: + - ${JENKINS_HOME}:/var/jenkins_home + - /var/run/docker.sock:/var/run/docker.sock + networks: + - frontend + - backend ### Laravel Echo Server ####################################### -# laravel-echo-server: -# build: -# context: ./laravel-echo-server -# volumes: -# - ./laravel-echo-server/laravel-echo-server.json:/app/laravel-echo-server.json:ro -# ports: -# - "${LARAVEL_ECHO_SERVER_PORT}:6001" -# links: -# - redis -# networks: -# - frontend -# - backend + laravel-echo-server: + build: + context: ./laravel-echo-server + volumes: + - ./laravel-echo-server/laravel-echo-server.json:/app/laravel-echo-server.json:ro + ports: + - "${LARAVEL_ECHO_SERVER_PORT}:6001" + links: + - redis + networks: + - frontend + - backend ### Networks Setup ############################################ diff --git a/docker-sync.yml b/docker-sync.yml index 77a2f624..1da12b77 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -4,10 +4,10 @@ options: verbose: true syncs: applications-host-sync: # name of the sync volume - compose-dev-file-path: 'docker-compose.sync.yml' # compose override file for sync + compose-dev-file-path: 'docker-compose.sync.yml' # docker-compose override file src: '${APPLICATION}' # host source directory sync_userid: 1000 # giving permissions to www-data user (as defined in nginx and php-fpm Dockerfiles) - sync_strategy: 'native_osx' # for windows use 'unison' for linux docker-sync is not necessary + sync_strategy: 'native_osx' # for windows use 'unison', for linux docker-sync is not necessary - sync_excludes: ['laradock', '.ignored_dot_folder'] # ignored directories + sync_excludes: ['laradock', 'ignored_folder_example'] # ignored directories From 3bf572b7a4b11b095406befcdf0282427f5e572c Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 13:52:23 -0400 Subject: [PATCH 29/49] added colors --- docker-sync.yml | 2 +- env-example | 10 ++++++++-- sync.sh | 49 +++++++++++++++++++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/docker-sync.yml b/docker-sync.yml index 1da12b77..0a3b4394 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -8,6 +8,6 @@ syncs: src: '${APPLICATION}' # host source directory sync_userid: 1000 # giving permissions to www-data user (as defined in nginx and php-fpm Dockerfiles) - sync_strategy: 'native_osx' # for windows use 'unison', for linux docker-sync is not necessary + sync_strategy: '${DOCKER_SYNC_STRATEGY}' # for osx use 'native_osx', for windows use 'unison' sync_excludes: ['laradock', 'ignored_folder_example'] # ignored directories diff --git a/env-example b/env-example index 23eba15a..91d295cc 100644 --- a/env-example +++ b/env-example @@ -255,6 +255,13 @@ CADDY_CUSTOM_CADDYFILE=./caddy/Caddyfile LARAVEL_ECHO_SERVER_PORT=6001 +### DOCKER-SYNC ################################################################################################ + +# osx: 'native_osx' (default) +# windows: 'unison' +# linux: docker-sync not required + +DOCKER_SYNC_STRATEGY=native_osx ##### TO BE CONTINUE ................................. @@ -262,8 +269,6 @@ LARAVEL_ECHO_SERVER_PORT=6001 # ......... # ......... - - ############################ # Miscellaneous ############################ @@ -281,3 +286,4 @@ PHP_IDE_CONFIG=serverName=laradock # Fix for windows users to make sure the application path works. COMPOSE_CONVERT_WINDOWS_PATHS=1 + diff --git a/sync.sh b/sync.sh index c452eb1e..3cf8bf0a 100755 --- a/sync.sh +++ b/sync.sh @@ -1,39 +1,60 @@ #!/bin/bash + +# prints colored text +print_style () { + + if [ "$2" == "info" ] ; then + COLOR="1;96m"; + elif [ "$2" == "success" ] ; then + COLOR="1;92m"; + elif [ "$2" == "warning" ] ; then + COLOR="1;93m"; + elif [ "$2" == "danger" ] ; then + COLOR="1;31m"; + else #white + COLOR="1;97m"; + fi + + printf "\e[$COLOR%-6s\e[m" "$1"; +} + if [[ $# -eq 0 ]] ; then - printf "Available commands:\n"; - printf " install\t\t Installs docker-sync gem on the host machine.\n"; - printf " up \t Starts docker-sync and runs docker compose.\n"; - printf " down \t\t Stops containers and docker-sync.\n"; - printf " trigger \t\t Manually triggers the synchronization of files.\n"; - printf " clean \t\t Removes all synched files from docker-sync container.\n"; + print_style "Invalid argument." 'danger'; printf " Available commands:\n"; + print_style " install" "success"; printf "\t\t Installs docker-sync gem on the host machine.\n"; + print_style " up " "success"; printf "\t Starts docker-sync and runs docker compose.\n"; + print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; + print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; + print_style " clean" "warning"; printf "\t\t Removes all synched files from docker-sync container.\n"; + exit 1 fi if [ "$1" == "up" ] ; then - printf "Initializing Docker Sync (may take several minutes the first time)"; + print_style "Initializing Docker Sync\n" 'info'; + print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" 'warning'; docker-sync start; - printf "Initializing Docker Compose"; + print_style "Initializing Docker Compose\n" 'info'; shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; elif [ "$1" == "down" ]; then - printf "Stopping Docker Compose"; + print_style "Stopping Docker Compose\n" 'info'; docker-compose down; - printf "Stopping Docker Sync"; + print_style "Stopping Docker Sync\n" 'info'; docker-sync stop; elif [ "$1" == "install" ]; then - printf "Installing docker-sync"; + print_style "Installing docker-sync" 'info'; gem install docker-sync; elif [ "$1" == "trigger" ]; then - printf "Manually triggering sync between host and docker-sync container."; + print_style "Manually triggering sync between host and docker-sync container.\n" 'info'; docker-sync sync; elif [ "$1" == "clean" ]; then - printf "Removing and cleaning up files from the docker-sync container."; + print_style "Removing and cleaning up files from the docker-sync container.\n" 'warning'; docker-sync clean; else - printf "Invalid argument. Use 'up','down','install','trigger' or 'clean' "; + print_style "Invalid argument. Use 'up','down','install','trigger' or 'clean'\n" 'danger'; fi From a38cecef923c453416b2ed351ea9ed957f15ac44 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 14:24:01 -0400 Subject: [PATCH 30/49] improving colors --- sync.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sync.sh b/sync.sh index 3cf8bf0a..8e8aa691 100755 --- a/sync.sh +++ b/sync.sh @@ -2,20 +2,22 @@ # prints colored text print_style () { - if [ "$2" == "info" ] ; then - COLOR="1;96m"; + COLOR="96m"; elif [ "$2" == "success" ] ; then - COLOR="1;92m"; + COLOR="92m"; elif [ "$2" == "warning" ] ; then - COLOR="1;93m"; + COLOR="93m"; elif [ "$2" == "danger" ] ; then - COLOR="1;31m"; + COLOR="41m"; else #white - COLOR="1;97m"; + COLOR="97m"; fi - printf "\e[$COLOR%-6s\e[m" "$1"; + STARTCOLOR="\e[1;$COLOR"; + ENDCOLOR="\e[m"; + + printf "$STARTCOLOR%b$ENDCOLOR" "$1"; } if [[ $# -eq 0 ]] ; then @@ -30,7 +32,7 @@ if [[ $# -eq 0 ]] ; then fi if [ "$1" == "up" ] ; then - print_style "Initializing Docker Sync\n" 'info'; + print_style "Initializing Docker Sync\n" "info"; print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" 'warning'; docker-sync start; print_style "Initializing Docker Compose\n" 'info'; @@ -44,7 +46,7 @@ elif [ "$1" == "down" ]; then docker-sync stop; elif [ "$1" == "install" ]; then - print_style "Installing docker-sync" 'info'; + print_style "Installing docker-sync\n" 'info'; gem install docker-sync; elif [ "$1" == "trigger" ]; then @@ -56,5 +58,5 @@ elif [ "$1" == "clean" ]; then docker-sync clean; else - print_style "Invalid argument. Use 'up','down','install','trigger' or 'clean'\n" 'danger'; + print_style "Invalid argument. Use 'up','down','install','trigger' or 'clean'" 'danger'; fi From 8e20ec7617cd381cf762ee4e8938742b5816a768 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 14:36:15 -0400 Subject: [PATCH 31/49] improved colors --- sync.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sync.sh b/sync.sh index 8e8aa691..46b15864 100755 --- a/sync.sh +++ b/sync.sh @@ -2,6 +2,7 @@ # prints colored text print_style () { + if [ "$2" == "info" ] ; then COLOR="96m"; elif [ "$2" == "success" ] ; then @@ -21,7 +22,7 @@ print_style () { } if [[ $# -eq 0 ]] ; then - print_style "Invalid argument." 'danger'; printf " Available commands:\n"; + print_style "Invalid argument." "danger"; printf " Available commands:\n"; print_style " install" "success"; printf "\t\t Installs docker-sync gem on the host machine.\n"; print_style " up " "success"; printf "\t Starts docker-sync and runs docker compose.\n"; print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; @@ -33,30 +34,30 @@ fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; - print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" 'warning'; + print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" "warning"; docker-sync start; - print_style "Initializing Docker Compose\n" 'info'; + print_style "Initializing Docker Compose\n" "info"; shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; elif [ "$1" == "down" ]; then - print_style "Stopping Docker Compose\n" 'info'; + print_style "Stopping Docker Compose\n" "info"; docker-compose down; - print_style "Stopping Docker Sync\n" 'info'; + print_style "Stopping Docker Sync\n" "info"; docker-sync stop; elif [ "$1" == "install" ]; then - print_style "Installing docker-sync\n" 'info'; + print_style "Installing docker-sync\n" "info"; gem install docker-sync; elif [ "$1" == "trigger" ]; then - print_style "Manually triggering sync between host and docker-sync container.\n" 'info'; + print_style "Manually triggering sync between host and docker-sync container.\n" "info"; docker-sync sync; elif [ "$1" == "clean" ]; then - print_style "Removing and cleaning up files from the docker-sync container.\n" 'warning'; + print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; docker-sync clean; else - print_style "Invalid argument. Use 'up','down','install','trigger' or 'clean'" 'danger'; + print_style "Invalid argument. Use 'up','down','install','trigger' or 'clean'" "danger"; fi From b0a6f2d68917f1b55467f3da94d57c75bef7140f Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 14:39:49 -0400 Subject: [PATCH 32/49] stopping if errors happen --- sync.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sync.sh b/sync.sh index 46b15864..bd320a76 100755 --- a/sync.sh +++ b/sync.sh @@ -35,15 +35,15 @@ fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" "warning"; - docker-sync start; - print_style "Initializing Docker Compose\n" "info"; - shift; # removing first argument + docker-sync start && + print_style "Initializing Docker Compose\n" "info" && + shift && # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; elif [ "$1" == "down" ]; then print_style "Stopping Docker Compose\n" "info"; - docker-compose down; - print_style "Stopping Docker Sync\n" "info"; + docker-compose down && + print_style "Stopping Docker Sync\n" "info" && docker-sync stop; elif [ "$1" == "install" ]; then From b7d3691c8d8eddaa5fef611ac577cef16f5249b9 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 14:41:35 -0400 Subject: [PATCH 33/49] resetting last change --- sync.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sync.sh b/sync.sh index bd320a76..46b15864 100755 --- a/sync.sh +++ b/sync.sh @@ -35,15 +35,15 @@ fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" "warning"; - docker-sync start && - print_style "Initializing Docker Compose\n" "info" && - shift && # removing first argument + docker-sync start; + print_style "Initializing Docker Compose\n" "info"; + shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; elif [ "$1" == "down" ]; then print_style "Stopping Docker Compose\n" "info"; - docker-compose down && - print_style "Stopping Docker Sync\n" "info" && + docker-compose down; + print_style "Stopping Docker Sync\n" "info"; docker-sync stop; elif [ "$1" == "install" ]; then From 7fdda613a524d1b36f478d11036883bf5c849f3b Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 14:43:22 -0400 Subject: [PATCH 34/49] improving messages --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 46b15864..93010414 100755 --- a/sync.sh +++ b/sync.sh @@ -34,7 +34,7 @@ fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; - print_style "(May take a long time (15min+) on the 'Looking for changes' step the first time)\n" "warning"; + print_style "May take a long time (15 min+) the first time\n" "info"; docker-sync start; print_style "Initializing Docker Compose\n" "info"; shift; # removing first argument From e26ff8bb1e040d84eeb15b40c2d0aef4342b58ea Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 14:46:00 -0400 Subject: [PATCH 35/49] improving comments --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 93010414..d014e24f 100755 --- a/sync.sh +++ b/sync.sh @@ -34,7 +34,7 @@ fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; - print_style "May take a long time (15 min+) the first time\n" "info"; + print_style "May take a long time (15min+) the first time\n" "info"; docker-sync start; print_style "Initializing Docker Compose\n" "info"; shift; # removing first argument From 6bed8d14f159f7b11eb084a27c1eadd67e98d8a6 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 15:46:00 -0400 Subject: [PATCH 36/49] improved messages --- sync.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sync.sh b/sync.sh index d014e24f..d48eb18c 100755 --- a/sync.sh +++ b/sync.sh @@ -10,32 +10,37 @@ print_style () { elif [ "$2" == "warning" ] ; then COLOR="93m"; elif [ "$2" == "danger" ] ; then - COLOR="41m"; - else #white - COLOR="97m"; + COLOR="91m"; + else #default color + COLOR="0m"; fi - STARTCOLOR="\e[1;$COLOR"; - ENDCOLOR="\e[m"; + STARTCOLOR="\e[$COLOR"; + ENDCOLOR="\e[0m"; printf "$STARTCOLOR%b$ENDCOLOR" "$1"; } -if [[ $# -eq 0 ]] ; then - print_style "Invalid argument." "danger"; printf " Available commands:\n"; +display_options () { + printf "Available options:\n"; print_style " install" "success"; printf "\t\t Installs docker-sync gem on the host machine.\n"; - print_style " up " "success"; printf "\t Starts docker-sync and runs docker compose.\n"; + print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; - print_style " clean" "warning"; printf "\t\t Removes all synched files from docker-sync container.\n"; + print_style " clean" "warning"; printf "\t\t Removes all files from the docker-sync container.\n"; +} +if [[ $# -eq 0 ]] ; then + print_style "Missing arguments.\n" "danger"; + display_options; exit 1 fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; - print_style "May take a long time (15min+) the first time\n" "info"; + print_style "May take a long time (15min+) the first run\n" "info"; docker-sync start; + print_style "Initializing Docker Compose\n" "info"; shift; # removing first argument docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; @@ -43,6 +48,7 @@ if [ "$1" == "up" ] ; then elif [ "$1" == "down" ]; then print_style "Stopping Docker Compose\n" "info"; docker-compose down; + print_style "Stopping Docker Sync\n" "info"; docker-sync stop; @@ -59,5 +65,7 @@ elif [ "$1" == "clean" ]; then docker-sync clean; else - print_style "Invalid argument. Use 'up','down','install','trigger' or 'clean'" "danger"; + print_style "Invalid arguments.\n" "danger"; + display_options; + exit 1 fi From a0f1d39ce42e6cb3f1fff618cf1c4552ffdaf3b9 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:03:33 -0400 Subject: [PATCH 37/49] added bash option --- sync.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sync.sh b/sync.sh index d48eb18c..4dec67a7 100755 --- a/sync.sh +++ b/sync.sh @@ -1,5 +1,19 @@ #!/bin/bash +# This shell script is an optional tool to simplify +# the installation and usage of laradock with docker-sync. + +# To run, make sure to add permissions to this file: +# chmod 755 sync.sh + +# Usage: +# Install docker-sync: ./sync.sh install +# Start workspace with nginx and mysql: ./sync.sh up nginx mysql +# Open bash inside the workspace: ./sync.sh bash +# Stop workspace: ./sync.sh down +# Force sync: ./sync.sh trigger +# Clean synced files: ./sync.sh clean + # prints colored text print_style () { @@ -26,6 +40,7 @@ display_options () { print_style " install" "success"; printf "\t\t Installs docker-sync gem on the host machine.\n"; print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; + print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace\n"; print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; print_style " clean" "warning"; printf "\t\t Removes all files from the docker-sync container.\n"; } @@ -56,6 +71,9 @@ elif [ "$1" == "install" ]; then print_style "Installing docker-sync\n" "info"; gem install docker-sync; +elif [ "$1" == "bash" ]; then + docker-compose exec workspace bash; + elif [ "$1" == "trigger" ]; then print_style "Manually triggering sync between host and docker-sync container.\n" "info"; docker-sync sync; @@ -64,6 +82,7 @@ elif [ "$1" == "clean" ]; then print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; docker-sync clean; + else print_style "Invalid arguments.\n" "danger"; display_options; From a670dd91cd58a23bc20f46f24543104c83c9c3d7 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:24:49 -0400 Subject: [PATCH 38/49] adding base functions --- sync.sh => laradock.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename sync.sh => laradock.sh (94%) diff --git a/sync.sh b/laradock.sh similarity index 94% rename from sync.sh rename to laradock.sh index 4dec67a7..cd57a300 100755 --- a/sync.sh +++ b/laradock.sh @@ -37,12 +37,12 @@ print_style () { display_options () { printf "Available options:\n"; - print_style " install" "success"; printf "\t\t Installs docker-sync gem on the host machine.\n"; + print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"; print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; - print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace\n"; + print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n"; print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; - print_style " clean" "warning"; printf "\t\t Removes all files from the docker-sync container.\n"; + print_style " clean" "warning"; printf "\t\t Removes all files from docker-sync.\n"; } if [[ $# -eq 0 ]] ; then From 7b180524e3d07ea2580082e41df12df4c888a912 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:24:59 -0400 Subject: [PATCH 39/49] adding base functions --- laradock.sh | 79 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/laradock.sh b/laradock.sh index cd57a300..a682e5af 100755 --- a/laradock.sh +++ b/laradock.sh @@ -8,9 +8,9 @@ # Usage: # Install docker-sync: ./sync.sh install -# Start workspace with nginx and mysql: ./sync.sh up nginx mysql +# Start sync and services with nginx and mysql: ./sync.sh up nginx mysql # Open bash inside the workspace: ./sync.sh bash -# Stop workspace: ./sync.sh down +# Stop containers and sync: ./sync.sh down # Force sync: ./sync.sh trigger # Clean synced files: ./sync.sh clean @@ -51,40 +51,61 @@ if [[ $# -eq 0 ]] ; then exit 1 fi -if [ "$1" == "up" ] ; then - print_style "Initializing Docker Sync\n" "info"; - print_style "May take a long time (15min+) the first run\n" "info"; - docker-sync start; - - print_style "Initializing Docker Compose\n" "info"; +if [ "$1" == "sync" ] ; then shift; # removing first argument - docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; + print_style "Using Docker Sync\n" "info"; -elif [ "$1" == "down" ]; then - print_style "Stopping Docker Compose\n" "info"; - docker-compose down; + if [ "$1" == "up" ] ; then + print_style "Initializing Docker Sync\n" "info"; + print_style "May take a long time (15min+) the first run\n" "info"; + docker-sync start; - print_style "Stopping Docker Sync\n" "info"; - docker-sync stop; + print_style "Initializing Docker Compose\n" "info"; + shift; # removing first argument + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; -elif [ "$1" == "install" ]; then - print_style "Installing docker-sync\n" "info"; - gem install docker-sync; + elif [ "$1" == "down" ]; then + print_style "Stopping Docker Compose\n" "info"; + docker-compose down; -elif [ "$1" == "bash" ]; then - docker-compose exec workspace bash; + print_style "Stopping Docker Sync\n" "info"; + docker-sync stop; -elif [ "$1" == "trigger" ]; then - print_style "Manually triggering sync between host and docker-sync container.\n" "info"; - docker-sync sync; - -elif [ "$1" == "clean" ]; then - print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; - docker-sync clean; + elif [ "$1" == "install" ]; then + print_style "Installing docker-sync\n" "info"; + gem install docker-sync; + elif [ "$1" == "trigger" ]; then + print_style "Manually triggering sync between host and docker-sync container.\n" "info"; + docker-sync sync; + elif [ "$1" == "clean" ]; then + print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; + docker-sync clean; + else + print_style "Invalid arguments.\n" "danger"; + display_options; + exit 1 + fi else - print_style "Invalid arguments.\n" "danger"; - display_options; - exit 1 + print_style "Not using synced files might be slow on OSX and Windows. Use 'sync' option to speed up.\n"; + + if [ "$1" == "up" ] ; then + print_style "Initializing Docker Compose\n" "info"; + shift; # removing first argument + docker-compose up -d ${@}; + + elif [ "$1" == "down" ]; then + print_style "Stopping Docker Compose\n" "info"; + docker-compose down; + + elif [ "$1" == "bash" ]; then + docker-compose exec workspace bash; + + else + print_style "Invalid arguments.\n" "danger"; + display_options; + exit 1 + fi + fi From 1d2f385586e39a2513b60bf83d7e2245c578bb6d Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:36:25 -0400 Subject: [PATCH 40/49] adding options --- laradock.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/laradock.sh b/laradock.sh index a682e5af..e0a00242 100755 --- a/laradock.sh +++ b/laradock.sh @@ -7,12 +7,12 @@ # chmod 755 sync.sh # Usage: -# Install docker-sync: ./sync.sh install -# Start sync and services with nginx and mysql: ./sync.sh up nginx mysql -# Open bash inside the workspace: ./sync.sh bash -# Stop containers and sync: ./sync.sh down -# Force sync: ./sync.sh trigger -# Clean synced files: ./sync.sh clean +# Install docker-sync: ./laradock.sh sync install +# Start sync and services with nginx and mysql: ./laradock.sh sync up nginx mysql +# Stop containers and sync: ./laradock.sh sync down +# Open bash inside the workspace: ./laradock.sh bash +# Force sync: ./laradock.sh sync trigger +# Clean synced files: ./laradock.sh sync clean # prints colored text print_style () { @@ -53,7 +53,7 @@ fi if [ "$1" == "sync" ] ; then shift; # removing first argument - print_style "Using Docker Sync\n" "info"; + print_style "Using docker-sync to speed up Docker on OSX and Windows.\n" "success"; if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info"; @@ -88,7 +88,7 @@ if [ "$1" == "sync" ] ; then exit 1 fi else - print_style "Not using synced files might be slow on OSX and Windows. Use 'sync' option to speed up.\n"; + print_style "Not using docker-sync might might be slow on OSX and Windows. Use 'sync' option to speed up.\n"; if [ "$1" == "up" ] ; then print_style "Initializing Docker Compose\n" "info"; @@ -99,6 +99,10 @@ else print_style "Stopping Docker Compose\n" "info"; docker-compose down; + elif [ "$1" == "build" ]; then + print_style "Building workspace\n" "info"; + docker-compose build workspace; + elif [ "$1" == "bash" ]; then docker-compose exec workspace bash; From 722e73a3e62bda047a1605fbf8c632f6de303dd8 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:58:07 -0400 Subject: [PATCH 41/49] kept only sync specific functions --- laradock.sh => sync.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) rename laradock.sh => sync.sh (82%) diff --git a/laradock.sh b/sync.sh similarity index 82% rename from laradock.sh rename to sync.sh index e0a00242..871a9607 100755 --- a/laradock.sh +++ b/sync.sh @@ -37,12 +37,16 @@ print_style () { display_options () { printf "Available options:\n"; - print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"; - print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; - print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; + print_style " up [services]" "success"; printf "\t Starts workspace and services.\n"; + print_style " down" "success"; printf "\t\t\t Stops services.\n"; print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n"; - print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; - print_style " clean" "warning"; printf "\t\t Removes all files from docker-sync.\n"; + print_style " build" "success"; printf "\t\t\t Builds images.\n"; + + print_style " sync install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"; + print_style " sync up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; + print_style " sync down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; + print_style " sync trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; + print_style " sync clean" "warning"; printf "\t\t Removes all files from docker-sync.\n"; } if [[ $# -eq 0 ]] ; then From 97d198e96777dcd8e3c9ae3b2a17f22fa6f08a13 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 16:58:17 -0400 Subject: [PATCH 42/49] sync functions only --- sync.sh | 105 ++++++++++++++++++++------------------------------------ 1 file changed, 37 insertions(+), 68 deletions(-) diff --git a/sync.sh b/sync.sh index 871a9607..a1f8bbbf 100755 --- a/sync.sh +++ b/sync.sh @@ -7,12 +7,12 @@ # chmod 755 sync.sh # Usage: -# Install docker-sync: ./laradock.sh sync install -# Start sync and services with nginx and mysql: ./laradock.sh sync up nginx mysql -# Stop containers and sync: ./laradock.sh sync down -# Open bash inside the workspace: ./laradock.sh bash -# Force sync: ./laradock.sh sync trigger -# Clean synced files: ./laradock.sh sync clean +# Install docker-sync: ./sync.sh install +# Start sync and services with nginx and mysql: ./sync.sh up nginx mysql +# Stop containers and sync: ./sync.sh down +# Open bash inside the workspace: ./sync.sh bash +# Force sync: ./sync.sh sync trigger +# Clean synced files: ./sync.sh clean # prints colored text print_style () { @@ -37,16 +37,12 @@ print_style () { display_options () { printf "Available options:\n"; - print_style " up [services]" "success"; printf "\t Starts workspace and services.\n"; - print_style " down" "success"; printf "\t\t\t Stops services.\n"; + print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"; + print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; + print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n"; - print_style " build" "success"; printf "\t\t\t Builds images.\n"; - - print_style " sync install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"; - print_style " sync up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; - print_style " sync down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; - print_style " sync trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; - print_style " sync clean" "warning"; printf "\t\t Removes all files from docker-sync.\n"; + print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; + print_style " clean" "warning"; printf "\t\t Removes all files from docker-sync.\n"; } if [[ $# -eq 0 ]] ; then @@ -55,65 +51,38 @@ if [[ $# -eq 0 ]] ; then exit 1 fi -if [ "$1" == "sync" ] ; then +if [ "$1" == "up" ] ; then + print_style "Initializing Docker Sync\n" "info"; + print_style "May take a long time (15min+) the first run\n" "info"; + docker-sync start; + + print_style "Initializing Docker Compose\n" "info"; shift; # removing first argument - print_style "Using docker-sync to speed up Docker on OSX and Windows.\n" "success"; + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; - if [ "$1" == "up" ] ; then - print_style "Initializing Docker Sync\n" "info"; - print_style "May take a long time (15min+) the first run\n" "info"; - docker-sync start; +elif [ "$1" == "down" ]; then + print_style "Stopping Docker Compose\n" "info"; + docker-compose down; - print_style "Initializing Docker Compose\n" "info"; - shift; # removing first argument - docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@}; + print_style "Stopping Docker Sync\n" "info"; + docker-sync stop; - elif [ "$1" == "down" ]; then - print_style "Stopping Docker Compose\n" "info"; - docker-compose down; +elif [ "$1" == "bash" ]; then + docker-compose exec workspace bash; - print_style "Stopping Docker Sync\n" "info"; - docker-sync stop; +elif [ "$1" == "install" ]; then + print_style "Installing docker-sync\n" "info"; + gem install docker-sync; - elif [ "$1" == "install" ]; then - print_style "Installing docker-sync\n" "info"; - gem install docker-sync; +elif [ "$1" == "trigger" ]; then + print_style "Manually triggering sync between host and docker-sync container.\n" "info"; + docker-sync sync; - elif [ "$1" == "trigger" ]; then - print_style "Manually triggering sync between host and docker-sync container.\n" "info"; - docker-sync sync; - - elif [ "$1" == "clean" ]; then - print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; - docker-sync clean; - else - print_style "Invalid arguments.\n" "danger"; - display_options; - exit 1 - fi +elif [ "$1" == "clean" ]; then + print_style "Removing and cleaning up files from the docker-sync container.\n" "warning"; + docker-sync clean; else - print_style "Not using docker-sync might might be slow on OSX and Windows. Use 'sync' option to speed up.\n"; - - if [ "$1" == "up" ] ; then - print_style "Initializing Docker Compose\n" "info"; - shift; # removing first argument - docker-compose up -d ${@}; - - elif [ "$1" == "down" ]; then - print_style "Stopping Docker Compose\n" "info"; - docker-compose down; - - elif [ "$1" == "build" ]; then - print_style "Building workspace\n" "info"; - docker-compose build workspace; - - elif [ "$1" == "bash" ]; then - docker-compose exec workspace bash; - - else - print_style "Invalid arguments.\n" "danger"; - display_options; - exit 1 - fi - + print_style "Invalid arguments.\n" "danger"; + display_options; + exit 1 fi From a1f8ef9614e4ff6ec737264a3c82d69fca315558 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 17:15:07 -0400 Subject: [PATCH 43/49] adding default services --- config.txt | 1 + sync-services.txt | 1 + sync.sh | 69 ++++++++++++++++++++++++----------------------- 3 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 config.txt create mode 100644 sync-services.txt diff --git a/config.txt b/config.txt new file mode 100644 index 00000000..072cf128 --- /dev/null +++ b/config.txt @@ -0,0 +1 @@ +THIS ARE THE DEFAILTS diff --git a/sync-services.txt b/sync-services.txt new file mode 100644 index 00000000..dbe16ddf --- /dev/null +++ b/sync-services.txt @@ -0,0 +1 @@ +nginx mysql \ No newline at end of file diff --git a/sync.sh b/sync.sh index a1f8bbbf..9ce4a600 100755 --- a/sync.sh +++ b/sync.sh @@ -18,71 +18,74 @@ print_style () { if [ "$2" == "info" ] ; then - COLOR="96m"; + COLOR="96m" elif [ "$2" == "success" ] ; then - COLOR="92m"; + COLOR="92m" elif [ "$2" == "warning" ] ; then - COLOR="93m"; + COLOR="93m" elif [ "$2" == "danger" ] ; then - COLOR="91m"; + COLOR="91m" else #default color - COLOR="0m"; + COLOR="0m" fi - STARTCOLOR="\e[$COLOR"; - ENDCOLOR="\e[0m"; + STARTCOLOR="\e[$COLOR" + ENDCOLOR="\e[0m" - printf "$STARTCOLOR%b$ENDCOLOR" "$1"; + printf "$STARTCOLOR%b$ENDCOLOR" "$1" } display_options () { printf "Available options:\n"; - print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"; - print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"; - print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"; - print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n"; - print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n"; - print_style " clean" "warning"; printf "\t\t Removes all files from docker-sync.\n"; + print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n" + print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n" + print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n" + print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n" + print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n" + print_style " clean" "warning"; printf "\t\t Removes all files from docker-sync.\n" } if [[ $# -eq 0 ]] ; then - print_style "Missing arguments.\n" "danger"; - display_options; + print_style "Missing arguments.\n" "danger" + display_options exit 1 fi if [ "$1" == "up" ] ; then - print_style "Initializing Docker Sync\n" "info"; - print_style "May take a long time (15min+) the first run\n" "info"; + value=$( Date: Sat, 15 Jul 2017 17:16:30 -0400 Subject: [PATCH 44/49] sdfasdf --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 9ce4a600..f5144a0a 100755 --- a/sync.sh +++ b/sync.sh @@ -61,7 +61,7 @@ if [ "$1" == "up" ] ; then print_style "Initializing Docker Compose\n" "info" shift # removing first argument - docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d "$value" + docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d $value elif [ "$1" == "down" ]; then print_style "Stopping Docker Compose\n" "info" From 8af22b5b376a3a9d8655aa56ad45292c2f4e2314 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 18:32:05 -0400 Subject: [PATCH 45/49] finalizing changes --- sync-services.txt | 1 - sync.sh | 21 +++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 sync-services.txt diff --git a/sync-services.txt b/sync-services.txt deleted file mode 100644 index dbe16ddf..00000000 --- a/sync-services.txt +++ /dev/null @@ -1 +0,0 @@ -nginx mysql \ No newline at end of file diff --git a/sync.sh b/sync.sh index f5144a0a..9a7df180 100755 --- a/sync.sh +++ b/sync.sh @@ -3,15 +3,19 @@ # This shell script is an optional tool to simplify # the installation and usage of laradock with docker-sync. +# Make sure that the DOCKER_SYNC_STRATEGY is set in the .env +# DOCKER_SYNC_STRATEGY=native_osx # osx +# DOCKER_SYNC_STRATEGY=unison # windows + # To run, make sure to add permissions to this file: # chmod 755 sync.sh -# Usage: +# USAGE EXAMPLE: # Install docker-sync: ./sync.sh install # Start sync and services with nginx and mysql: ./sync.sh up nginx mysql # Stop containers and sync: ./sync.sh down # Open bash inside the workspace: ./sync.sh bash -# Force sync: ./sync.sh sync trigger +# Force sync: ./sync.sh sync # Clean synced files: ./sync.sh clean # prints colored text @@ -41,8 +45,8 @@ display_options () { print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n" print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n" print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n" - print_style " trigger" "success"; printf "\t\t Manually triggers the synchronization of files.\n" - print_style " clean" "warning"; printf "\t\t Removes all files from docker-sync.\n" + print_style " sync" "success"; printf "\t\t Manually triggers the synchronization of files.\n" + print_style " clean" "danger"; printf "\t\t Removes all files from docker-sync.\n" } if [[ $# -eq 0 ]] ; then @@ -52,16 +56,13 @@ if [[ $# -eq 0 ]] ; then fi if [ "$1" == "up" ] ; then - value=$( Date: Sat, 15 Jul 2017 18:47:02 -0400 Subject: [PATCH 46/49] polishing last details --- docker-compose.sync.yml | 2 +- docker-sync.yml | 2 +- sync.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.sync.yml b/docker-compose.sync.yml index b4b383a7..20bb016a 100644 --- a/docker-compose.sync.yml +++ b/docker-compose.sync.yml @@ -14,4 +14,4 @@ services: volumes: applications-sync: external: - name: "applications-host-sync" + name: "applications-docker-sync" diff --git a/docker-sync.yml b/docker-sync.yml index 0a3b4394..bb70a26e 100644 --- a/docker-sync.yml +++ b/docker-sync.yml @@ -3,7 +3,7 @@ version: "2" options: verbose: true syncs: - applications-host-sync: # name of the sync volume + applications-docker-sync: # name of the intermediary sync volume compose-dev-file-path: 'docker-compose.sync.yml' # docker-compose override file src: '${APPLICATION}' # host source directory diff --git a/sync.sh b/sync.sh index 9a7df180..1a70283b 100755 --- a/sync.sh +++ b/sync.sh @@ -57,7 +57,7 @@ fi if [ "$1" == "up" ] ; then print_style "Initializing Docker Sync\n" "info" - print_style "May take a long time (15min+) the first run\n" "info" + print_style "May take a long time (15min+) on the first run\n" "info" docker-sync start; print_style "Initializing Docker Compose\n" "info" From 829a5b5acff3734753d01cd61ea452001a637ed1 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 18:53:01 -0400 Subject: [PATCH 47/49] cleaning up --- config.txt | 1 - php-fpm/php71.ini | 4 ++-- sync.sh | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 config.txt diff --git a/config.txt b/config.txt deleted file mode 100644 index 072cf128..00000000 --- a/config.txt +++ /dev/null @@ -1 +0,0 @@ -THIS ARE THE DEFAILTS diff --git a/php-fpm/php71.ini b/php-fpm/php71.ini index 2c39db84..c8242dc0 100644 --- a/php-fpm/php71.ini +++ b/php-fpm/php71.ini @@ -474,7 +474,7 @@ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; Development Value: On ; Production Value: Off ; http://php.net/display-errors -display_errors = On +display_errors = Off ; The display of errors which occur during PHP's startup sequence are handled ; separately from display_errors. PHP's default behavior is to suppress those @@ -485,7 +485,7 @@ display_errors = On ; Development Value: On ; Production Value: Off ; http://php.net/display-startup-errors -display_startup_errors = On +display_startup_errors = Off ; Besides displaying errors, PHP can also log errors to locations such as a ; server-specific log, STDERR, or a location specified by the error_log diff --git a/sync.sh b/sync.sh index 1a70283b..2dc1d209 100755 --- a/sync.sh +++ b/sync.sh @@ -14,9 +14,6 @@ # Install docker-sync: ./sync.sh install # Start sync and services with nginx and mysql: ./sync.sh up nginx mysql # Stop containers and sync: ./sync.sh down -# Open bash inside the workspace: ./sync.sh bash -# Force sync: ./sync.sh sync -# Clean synced files: ./sync.sh clean # prints colored text print_style () { From 1e2d368e439523944a6833afd450b3ef159fb146 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sat, 15 Jul 2017 19:28:02 -0400 Subject: [PATCH 48/49] improved docs --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 2dc1d209..6955358d 100755 --- a/sync.sh +++ b/sync.sh @@ -42,7 +42,7 @@ display_options () { print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n" print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n" print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n" - print_style " sync" "success"; printf "\t\t Manually triggers the synchronization of files.\n" + print_style " sync" "info"; printf "\t\t\t Manually triggers the synchronization of files.\n" print_style " clean" "danger"; printf "\t\t Removes all files from docker-sync.\n" } From 6b0ee109886883ee1fd017dff691cd407387f384 Mon Sep 17 00:00:00 2001 From: Arian Acosta Date: Sun, 16 Jul 2017 10:06:12 -0400 Subject: [PATCH 49/49] added docker sync documentation --- DOCUMENTATION/content/documentation/index.md | 73 ++++++++++++++++++-- 1 file changed, 67 insertions(+), 6 deletions(-) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index e4a7ced1..0b4a3f05 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -156,21 +156,82 @@ You might use the `--no-cache` option if you want full rebuilding (`docker-compo
-## Docker-Sync +## Speed up with docker-sync -Docker on the Mac [is slow](https://github.com/docker/for-mac/issues/77), at the time of writing. Especially for larger projects, this can be a problem. The problem is [older than March 2016](https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076) - as it's a such a long-running issue, we're including it in the docs here. +Docker for Mac is [slow](https://github.com/docker/for-mac/issues/77) due to poor performance when the application accesses files shared with the host machine. +One solution is to use [docker-sync](https://github.com/EugenMayer/docker-sync). -The problem originates in bind-mount performance on MacOS. Docker for Mac uses osxfs by default. This is not without reason, it has [a lot of advantages](https://docs.docker.com/docker-for-mac/osxfs/). +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. -Solutions to resolve this issue are easily installed however, we're hoping it'll be fixed by Docker themselves over time. They are currently [adding "cached and delegated" options](https://github.com/docker/for-mac/issues/77#issuecomment-283996750), which is partly available for Docker Edge. +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` -Options are [to switch over to NFS](https://github.com/IFSight/d4m-nfs) which is the simplest. The fastest option is [Docker-Sync "native"](https://github.com/EugenMayer/docker-sync) which is still quite easy to install. +#### Usage -Clone [this repo](https://github.com/EugenMayer/docker-sync-boilerplate) to your machine, copy `default/docker-sync.yml` to your Laradock directory and run `docker-sync-stack start`. Be sure to use `docker-sync-stack clean` to stop and `docker-compose build` to rebuild. More information can be found [in the Docker-sync docs](https://github.com/EugenMayer/docker-sync). +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` + +1) Configure your Laradock environment as you would normally do and test your application to make sure that your sites are running correctly. + +2) Make sure to set `DOCKER_SYNC_STRATEGY` on the `.env`. Read the [syncing strategies](https://github.com/EugenMayer/docker-sync/wiki/8.-Strategies) for details. +``` +# osx: 'native_osx' (default) +# windows: 'unison' +# linux: docker-sync not required + +DOCKER_SYNC_STRATEGY=native_osx +``` + +2) Install the docker-sync gem on the host-machine: +```bash +./sync.sh install +``` +3) 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: +```bash +./sync.sh down +``` + +#### 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`: + +```bash +alias devup="cd /PATH_TO_LARADOCK/laradock; ./sync.sh up nginx mysql" #add your services +alias devbash="cd /PATH_TO_LARADOCK/laradock; ./sync.sh bash" +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 + +Opening bash on the workspace container (to run artisan for example): + ```bash + ./sync.sh bash + ``` +Manually triggering the synchronization of the files: +```bash +./sync.sh sync +``` +Removing and cleaning up the files and the docker-sync container. Use only if you want to rebuild or remove docker-sync completely. The files on the host will be kept untouched. +```bash +./sync.sh clean +``` +**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. +- If a container cannot access the files on docker-sync, you may need to set a user on the Dockerfile of that container with an id of 1000 (this is the UID that nginx and php-fpm have configured on laradock). Alternatively, you may change the permissions to 777, but this is **not** recommended. + +Visit the [docker-sync documentation](https://github.com/EugenMayer/docker-sync/wiki) for more details.