From b5df5742ded64ea3305afe36e641fc2ca0f7293c Mon Sep 17 00:00:00 2001 From: Ladislav Gazo Date: Fri, 6 Apr 2018 09:54:22 +0200 Subject: [PATCH 1/9] fix potentially missing /run/php-fpm directory --- php/docker-entrypoint | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/docker-entrypoint b/php/docker-entrypoint index 76d58c8..781b7f4 100644 --- a/php/docker-entrypoint +++ b/php/docker-entrypoint @@ -4,4 +4,6 @@ ep /etc/php.ini ep /etc/php-fpm.conf ep /etc/php-fpm.d/* +[ ! -e /run/php-fpm ] && mkdir -p /run/php-fpm + exec "$@" From 44809448cb8df561caa0292102dff0b250dd9ba6 Mon Sep 17 00:00:00 2001 From: Wil Roboly Date: Thu, 12 Apr 2018 15:08:43 -0400 Subject: [PATCH 2/9] Added a few variables into the compose yml to allow for more fine grain tuning of PORTS in the docker-compose setup as it was colliding with my own dockers and ports locally --- .env | 8 ++++++++ docker-compose.yml | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.env b/.env index b3a3e2c..05906ab 100644 --- a/.env +++ b/.env @@ -3,3 +3,11 @@ MYSQL_USER=contenta MYSQL_PASSWORD=contenta MYSQL_ALLOW_EMPTY_PASSWORD=yes MYSQL_ROOT_PASSWORD=root + +HOSTNAME=contenta.local +HOSTIP=192.168.1.1 + +HOST_MYSQL_PORT=3336 +HOST_PHP_PORT=9009 +HOST_HTTP_PORT=8888 +HOST_HTTPS_PORT=4443 diff --git a/docker-compose.yml b/docker-compose.yml index cf9267f..6bd955f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,12 @@ services: nginx: build: ./nginx ports: - - "80:80" - - "443:443" + - "${HOST_HTTP_PORT}:80" + #- "80:80" + - "${HOST_HTTPS_PORT}:443" + #- "443:443" + # extra_hosts: + # - "${HOSTNAME}:${HOSTIP}" networks: - contenta volumes: @@ -16,7 +20,8 @@ services: php: build: ./php ports: - - "9000:9000" + - "${HOST_PHP_PORT}:9000" + #- "9000:9000" volumes: - www:/var/www env_file: @@ -26,12 +31,14 @@ services: database: build: ./database ports: - - "3306:3306" + # HOST:CONTAINER + - "${HOST_MYSQL_PORT}:3306" + #- "3306:3306" volumes: - data:/var/lib/mysql env_file: - .env - networks: + networks: - contenta volumes: @@ -39,4 +46,4 @@ volumes: www: networks: - contenta: + contenta: From 2272debcd9d747ca83cdb02f5b43405ff4eeccff Mon Sep 17 00:00:00 2001 From: Wil Roboly Date: Fri, 13 Apr 2018 09:55:34 -0400 Subject: [PATCH 3/9] Adding Dockerfile ARG for the CMS codebase version --- php/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/Dockerfile b/php/Dockerfile index a678e39..08e3bd9 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -68,9 +68,11 @@ RUN mkdir -p /var/www && \ chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/init-drupal +ARG CMS_VERSION=v1.477 RUN cd /usr/local/src && \ git clone https://github.com/contentacms/contenta_jsonapi && \ cd /usr/local/src/contenta_jsonapi && \ + git checkout CMS_VERSION && \ composer create-project contentacms/contenta-jsonapi-project /var/www --stability dev --no-interaction && \ cd /var/www && \ composer config repositories.contenta_jsonapi path . From af6994f8b3fa4b28000111b162610158d52ef0cd Mon Sep 17 00:00:00 2001 From: Wil Roboly Date: Fri, 13 Apr 2018 10:05:56 -0400 Subject: [PATCH 4/9] Adding missing ${} to CMS_VERSION variable --- php/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/Dockerfile b/php/Dockerfile index 08e3bd9..63cc924 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -68,11 +68,11 @@ RUN mkdir -p /var/www && \ chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/init-drupal -ARG CMS_VERSION=v1.477 +ARG CMS_VERSION=master RUN cd /usr/local/src && \ git clone https://github.com/contentacms/contenta_jsonapi && \ cd /usr/local/src/contenta_jsonapi && \ - git checkout CMS_VERSION && \ + git checkout ${CMS_VERSION} && \ composer create-project contentacms/contenta-jsonapi-project /var/www --stability dev --no-interaction && \ cd /var/www && \ composer config repositories.contenta_jsonapi path . From 8a3ea6b1533acc016473a0996832a32fa761ac06 Mon Sep 17 00:00:00 2001 From: Wil Roboly Date: Fri, 13 Apr 2018 10:10:28 -0400 Subject: [PATCH 5/9] Updated to use --branch instead of a lone git command --- php/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/php/Dockerfile b/php/Dockerfile index 63cc924..b61bef7 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -68,11 +68,10 @@ RUN mkdir -p /var/www && \ chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/init-drupal -ARG CMS_VERSION=master +ARG CMS_VERSION master RUN cd /usr/local/src && \ - git clone https://github.com/contentacms/contenta_jsonapi && \ + git clone https://github.com/contentacms/contenta_jsonapi --branch ${CMS_VERSION} && \ cd /usr/local/src/contenta_jsonapi && \ - git checkout ${CMS_VERSION} && \ composer create-project contentacms/contenta-jsonapi-project /var/www --stability dev --no-interaction && \ cd /var/www && \ composer config repositories.contenta_jsonapi path . From 0e05b56a173fe019c9b7d770410495e05126db01 Mon Sep 17 00:00:00 2001 From: Wil Roboly Date: Fri, 13 Apr 2018 10:11:15 -0400 Subject: [PATCH 6/9] Fix Dockerfile parse error line 71: ARG requires exactly one argument --- php/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/Dockerfile b/php/Dockerfile index b61bef7..c4f4043 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -68,7 +68,7 @@ RUN mkdir -p /var/www && \ chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/init-drupal -ARG CMS_VERSION master +ARG CMS_VERSION=master RUN cd /usr/local/src && \ git clone https://github.com/contentacms/contenta_jsonapi --branch ${CMS_VERSION} && \ cd /usr/local/src/contenta_jsonapi && \ From 161389da6e5e74bfde23d16568df91514945f212 Mon Sep 17 00:00:00 2001 From: Wil Roboly Date: Fri, 13 Apr 2018 10:12:20 -0400 Subject: [PATCH 7/9] Fix branch default from master to 8.x-1.x --- php/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/Dockerfile b/php/Dockerfile index c4f4043..9a7707d 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -68,7 +68,7 @@ RUN mkdir -p /var/www && \ chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/init-drupal -ARG CMS_VERSION=master +ARG CMS_VERSION=8.x-1.x RUN cd /usr/local/src && \ git clone https://github.com/contentacms/contenta_jsonapi --branch ${CMS_VERSION} && \ cd /usr/local/src/contenta_jsonapi && \ From ed64aefe3c8af6f29fa64d9b62d99632fa73e637 Mon Sep 17 00:00:00 2001 From: William Roboly Date: Fri, 13 Apr 2018 10:55:33 -0400 Subject: [PATCH 8/9] Clean up instructions for getting started --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 1fa7b26..e933566 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,17 @@ # Getting started +The following instructions will build the master 8.x-1.x build of the ContentaCMS and run in your active shell ``` docker-compose build docker-compose up ``` +This set of instructions will build according to a particular branch or tag of the ContentaCMS and run your containers detached (great if you have another application that monitors active containers (i.e.: kitematic) +``` +docker-compose build --build-arg CMS_VERSION=v1.477 +docker-compose up -d +``` + # First-time initialization The container doesn't automatically run `drush site-install` because we want it to be possible to stop and start an existing container without rebuilding the site every time. Instead, you need to manually run this after starting the container the first time: @@ -19,5 +26,25 @@ When it finishes successsfully, the command will output a one-time login URL. Persistent state is stored in two docker volumes (named `data` and `www`). You can destroy and recreate the containers as much as you like and your site will be preserved until you also destroy these volumes. +# .env File + +You'll note that you can manage to change up some of the core values for the default db build configuration as well as where the services will sit and what ports they use externally. +``` +MYSQL_DATABASE=contenta +MYSQL_USER=contenta +MYSQL_PASSWORD=contenta +MYSQL_ALLOW_EMPTY_PASSWORD=yes +MYSQL_ROOT_PASSWORD=root + +HOSTNAME=contenta.local +HOSTIP=192.168.1.1 + +HOST_MYSQL_PORT=3336 +HOST_PHP_PORT=9009 +HOST_HTTP_PORT=8888 +HOST_HTTPS_PORT=8443 +``` + +It's really important to manage these values according to where this solution will sit. Both in a secure and insecure environment. From 0c243782e5db45125860717d6bf57f0f1ac26a3f Mon Sep 17 00:00:00 2001 From: William Roboly Date: Fri, 13 Apr 2018 11:00:05 -0400 Subject: [PATCH 9/9] Adding some instructions for the .env file --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e933566..3ab313f 100644 --- a/README.md +++ b/README.md @@ -39,12 +39,14 @@ MYSQL_ALLOW_EMPTY_PASSWORD=yes MYSQL_ROOT_PASSWORD=root HOSTNAME=contenta.local -HOSTIP=192.168.1.1 +HOSTIP=10.0.0.0 -HOST_MYSQL_PORT=3336 -HOST_PHP_PORT=9009 -HOST_HTTP_PORT=8888 -HOST_HTTPS_PORT=8443 +HOST_MYSQL_PORT=3306 +HOST_PHP_PORT=9000 +HOST_HTTP_PORT=80 +HOST_HTTPS_PORT=443 ``` It's really important to manage these values according to where this solution will sit. Both in a secure and insecure environment. + +If you have an environment where you've already used up the MySQL port 3306 for a service that is on your local machine, than change this to something else. You can use anything between 1-65535. Although, for the sake of simplicity and convenience, maybe using something like 3336 might be easier to remember. The same thing can be said of any of the other ports used by this project. Assigning new port numbers for your local setup will greatly diminish any conflicts and build and up command issues.