From ac26f48f90f3ea0cb5c1e299b20be0b33d05b7aa Mon Sep 17 00:00:00 2001 From: lrkwz Date: Thu, 18 Feb 2021 15:43:03 +0100 Subject: [PATCH 1/8] Success on `docker-compose build` - Dismissed nginx image `amazeeio/centos7-nginx:1.10` replaced by `amazeeio/nginx:21.2.1` - Unused port 443 removed from `docker-compse.yml` - Contenta `composer.json` requires php 7.25|8: replace `remi-php71' with `remi-php74` - Added `php-zip` as required by composer.json --- docker-compose.yml | 1 - nginx/Dockerfile | 2 +- php/Dockerfile | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 377f430..6000656 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ services: build: ./nginx ports: - "80:80" - - "443:443" networks: - contenta volumes: diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 9eb2d1c..208188b 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,4 +1,4 @@ -FROM amazeeio/centos7-nginx:1.10 +FROM amazeeio/nginx:21.2.1 COPY conf/drupal.conf /etc/nginx/sites/drupal.conf diff --git a/php/Dockerfile b/php/Dockerfile index 8d5bb3a..2056b10 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -4,7 +4,7 @@ FROM amazeeio/centos:7 RUN yum install -y epel-release \ http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ yum-utils && \ - yum-config-manager --enable remi-php71 && \ + yum-config-manager --enable remi-php74 && \ yum update -y && \ yum install -y \ php-bcmath \ @@ -22,6 +22,7 @@ RUN yum install -y epel-release \ php-opcache \ php-pcntl \ php-pdo \ + php-zip \ php-pecl-apcu \ php-pecl-apcu-bc \ php-pecl-geoip \ @@ -39,7 +40,7 @@ RUN yum install -y epel-release \ yum clean all # Install Composer -ENV COMPOSER_VERSION 1.9.0 +ENV COMPOSER_VERSION 1.10.20 RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && \ chmod +x /usr/local/bin/composer && \ composer global require "hirak/prestissimo:^0.3" && \ From 0d67a1511480c7082029f859582567ee5fe849a1 Mon Sep 17 00:00:00 2001 From: lrkwz Date: Thu, 18 Feb 2021 17:18:17 +0100 Subject: [PATCH 2/8] Database version min requirement --- database/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/Dockerfile b/database/Dockerfile index 80f3d90..a121a21 100644 --- a/database/Dockerfile +++ b/database/Dockerfile @@ -1,6 +1,6 @@ FROM amazeeio/centos:7 -ENV MARIADB_VERSION=10.1 +ENV MARIADB_VERSION=10.4 RUN { \ echo '[mariadb]'; \ From befb5f89a1c7c21f57539c27a3f623f465688e44 Mon Sep 17 00:00:00 2001 From: lrkwz Date: Thu, 18 Feb 2021 17:19:17 +0100 Subject: [PATCH 3/8] Updated readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a7a11e0..6116fca 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ The container doesn't automatically run `drush site-install` because we want it `docker-compose exec php composer run-script install:with-mysql` +Environment configuration used by the install script is described in `.env`. + # Persistence Persistent state is stored in a database volume named `data`. You can destroy and recreate the containers as much as you like and your site will be preserved until you also destroy the volume. From e324346809405da51a9b63b0fe605991df9b1853 Mon Sep 17 00:00:00 2001 From: lrkwz Date: Thu, 18 Feb 2021 18:21:36 +0100 Subject: [PATCH 4/8] Using a plain centos for nginx as for db and php --- docker-compose.yml | 2 +- nginx/Dockerfile | 13 +++++++++++-- nginx/conf/drupal.conf | 9 +++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6000656..fa61f94 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: nginx: build: ./nginx ports: - - "80:80" + - "80:8080" networks: - contenta volumes: diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 208188b..7b2c482 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,5 +1,14 @@ -FROM amazeeio/nginx:21.2.1 +FROM amazeeio/centos:7 -COPY conf/drupal.conf /etc/nginx/sites/drupal.conf +RUN yum install -y epel-release \ + yum check-update \ + yum update -y +RUN yum install -y nginx \ + yum clean all + +EXPOSE 8080 +COPY conf/drupal.conf /etc/nginx/conf.d/default.conf RUN fix-permissions /etc/nginx + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx/conf/drupal.conf b/nginx/conf/drupal.conf index ea5cd29..4874dd4 100644 --- a/nginx/conf/drupal.conf +++ b/nginx/conf/drupal.conf @@ -1,5 +1,6 @@ server { - listen 80; + listen 8080 default_server; + listen [::]:8080 default_server; fastcgi_keep_conn on; root /var/www/web; @@ -59,7 +60,7 @@ server { include /etc/nginx/fastcgi.conf; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param SCRIPT_FILENAME $realpath_root/index.php; - fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; + fastcgi_pass php:9000; } ## Trying to access private files directly returns a 404. @@ -137,11 +138,11 @@ server { ### Directives for installing drupal. location = /install.php { - fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; + fastcgi_pass php:9000; } ### Directives for installing drupal. location = /core/install.php { - fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; + fastcgi_pass php:9000; } } From b1b1d62a73f084db259a4853b4b65a09ac335643 Mon Sep 17 00:00:00 2001 From: Luca Orlandi Date: Fri, 19 Feb 2021 12:35:17 +0100 Subject: [PATCH 5/8] Update Dockerfile --- database/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/Dockerfile b/database/Dockerfile index a121a21..8e1fa26 100644 --- a/database/Dockerfile +++ b/database/Dockerfile @@ -1,6 +1,6 @@ FROM amazeeio/centos:7 -ENV MARIADB_VERSION=10.4 +ENV MARIADB_VERSION=10.3 RUN { \ echo '[mariadb]'; \ From dcc527138dde76e153b59bd83e208cfec9955ac6 Mon Sep 17 00:00:00 2001 From: lrkwz Date: Thu, 18 Feb 2021 23:25:31 +0100 Subject: [PATCH 6/8] Little security on --- docker-compose.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fa61f94..2d5c3eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,27 +14,26 @@ services: - php php: build: ./php - ports: - - "9000:9000" volumes: - ./www:/var/www:cached env_file: - .env networks: - contenta + - contenta_internal + depends_on: [database] database: build: ./database - ports: - - "3306:3306" volumes: - data:/var/lib/mysql env_file: - .env networks: - - contenta + - contenta_internal volumes: data: networks: contenta: + contenta_internal: From a45d550c68a82f199ed90b266c74742c4f72ac36 Mon Sep 17 00:00:00 2001 From: lrkwz Date: Fri, 19 Feb 2021 13:06:34 +0100 Subject: [PATCH 7/8] Restored ep usage --- nginx/Dockerfile | 3 ++- nginx/conf/drupal.conf | 6 +++--- php/docker-entrypoint | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 7b2c482..05ee4b5 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -10,5 +10,6 @@ EXPOSE 8080 COPY conf/drupal.conf /etc/nginx/conf.d/default.conf RUN fix-permissions /etc/nginx +RUN curl -sLo /usr/local/bin/ep https://github.com/kreuzwerker/envplate/releases/download/v0.0.8/ep-linux && chmod +x /usr/local/bin/ep -CMD ["nginx", "-g", "daemon off;"] +CMD [ "/usr/local/bin/ep", "-v", "/etc/nginx/conf.d/default.conf", "--", "/usr/sbin/nginx", "-g", "daemon off;" ] diff --git a/nginx/conf/drupal.conf b/nginx/conf/drupal.conf index 4874dd4..b29e98f 100644 --- a/nginx/conf/drupal.conf +++ b/nginx/conf/drupal.conf @@ -60,7 +60,7 @@ server { include /etc/nginx/fastcgi.conf; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param SCRIPT_FILENAME $realpath_root/index.php; - fastcgi_pass php:9000; + fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; } ## Trying to access private files directly returns a 404. @@ -138,11 +138,11 @@ server { ### Directives for installing drupal. location = /install.php { - fastcgi_pass php:9000; + fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; } ### Directives for installing drupal. location = /core/install.php { - fastcgi_pass php:9000; + fastcgi_pass ${NGINX_FASTCGI_PASS:-php}:9000; } } diff --git a/php/docker-entrypoint b/php/docker-entrypoint index 4d1332b..e319828 100644 --- a/php/docker-entrypoint +++ b/php/docker-entrypoint @@ -16,6 +16,12 @@ else COMPOSER_MEMORY_LIMIT=-1 composer create-project contentacms/contenta-jsonapi-project /var/www/. --stability dev --no-progress --no-interaction cd /var/www composer config repositories.contenta_jsonapi path . + + GITLAB_TOKEN=${GITLAB_TOKEN:-soub85Z7ATtvc3NcSBXv} + composer config repositories.gitlab composer https://__token__:${GITLAB_TOKEN}@gitlab.com/api/v4/group/1437687/-/packages/composer/packages.json + composer config gitlab.com ${GITLAB_TOKEN} + COMPOSER_MEMORY_LIMIT=-1 composer require "garanteasy/garanteasy_migrations":"^1.8" "garanteasy/garanteasy_sync":"^1.32" "garanteasy/garanteasy_product":"^1.1" "garanteasy/garanteasy_overrides":"^1.4" + fi exec "$@" From 3a19d8ce2fb71ba00debdcccda0f318a56473e44 Mon Sep 17 00:00:00 2001 From: Luca Orlandi Date: Fri, 19 Feb 2021 13:08:37 +0100 Subject: [PATCH 8/8] Update docker-entrypoint --- php/docker-entrypoint | 6 ------ 1 file changed, 6 deletions(-) diff --git a/php/docker-entrypoint b/php/docker-entrypoint index e319828..4d1332b 100644 --- a/php/docker-entrypoint +++ b/php/docker-entrypoint @@ -16,12 +16,6 @@ else COMPOSER_MEMORY_LIMIT=-1 composer create-project contentacms/contenta-jsonapi-project /var/www/. --stability dev --no-progress --no-interaction cd /var/www composer config repositories.contenta_jsonapi path . - - GITLAB_TOKEN=${GITLAB_TOKEN:-soub85Z7ATtvc3NcSBXv} - composer config repositories.gitlab composer https://__token__:${GITLAB_TOKEN}@gitlab.com/api/v4/group/1437687/-/packages/composer/packages.json - composer config gitlab.com ${GITLAB_TOKEN} - COMPOSER_MEMORY_LIMIT=-1 composer require "garanteasy/garanteasy_migrations":"^1.8" "garanteasy/garanteasy_sync":"^1.32" "garanteasy/garanteasy_product":"^1.1" "garanteasy/garanteasy_overrides":"^1.4" - fi exec "$@"