diff --git a/.editorconfig b/.editorconfig index 4ca38ef6a..e5bcd85b6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,11 +26,5 @@ indent_size = 2 [*.php] indent_size = 4 -[DOCKER_REPOSITORY] -insert_final_newline = false - -[DOCKER_TAG_LATEST] -insert_final_newline = false - [BLACKLIST] insert_final_newline = false diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 16ecc1b29..c8d43f4ed 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -214,7 +214,7 @@ jobs: name: 'run structure-test' run: |- cd tests/structure-test - /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base-app/test.yaml --config base-app/alpine/test.yaml + /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base-app/test.yaml - if: "${{github.ref == 'refs/heads/master'}}" name: 'Login to ghcr.io' @@ -475,7 +475,7 @@ jobs: name: 'run structure-test' run: |- cd tests/structure-test - /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base/test.yaml --config base/alpine/test.yaml + /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base/test.yaml - if: "${{github.ref == 'refs/heads/master'}}" name: 'Login to ghcr.io' diff --git a/.gitignore b/.gitignore index b6932fd0a..d64af3b3b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ *.log *.pyc .doit.db -/graph diff --git a/AGENTS.md b/AGENTS.md index 4b759b0a5..8c4b1a3f9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ | `docker///Dockerfile.jinja2` | Per-image template (source) | | `provisioning/` | Scripts and configuration files copied into the images (source); `conf/provision.yml` says which go where | | `docker///Dockerfile`, `docker///conf/` | Generated by `make provision`, never edited by hand | -| `bin/` | Old Python 2 tools behind `make provision` and the other Makefile targets | +| `bin/` | Old Python 2 tools behind `make provision` | | `ci/` | PHP generator for `.github/workflows/build.yaml` (`ci/console github:generate-ci`) | | `tests/` | serverspec (Ruby) and container-structure-test definitions run by the CI | | `docs/` | User documentation | @@ -23,7 +23,7 @@ Only these commands are known to work: - `docker build -t webdevops/: docker//` builds one image; its parent and `webdevops/toolbox` come from local images or Docker Hub. - `./build-local.sh [version]` builds all PHP images of one version. -The other Makefile targets need Python 2. Apart from `provision` and `graph` inside `webdevops/dockerfile-build-env`, they do not work; `make test` fails there too (see `docs/known-issues.md`). The CI runs serverspec and container-structure-test for every image; to check a change by hand, start the image and try it as described below. +Besides `provision`, the Makefile has `structure-test` and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. `make structure-test` runs container-structure-test against your local images of `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`, the images that have a suite in `tests/structure-test`. It tests only the tags in `.github/workflows/build.yaml` and fails if a test fails, if `docker` fails or if no such image exists locally; run it inside `webdevops/dockerfile-build-env` with the Docker socket mounted. The CI runs serverspec for every image except `toolbox` and `dockerfile-build-env`, and container-structure-test for the six images above; to check a change by hand, start the image and try it as described below. ## Keep the documentation up to date diff --git a/Makefile b/Makefile index d3deb9cf6..486234952 100644 --- a/Makefile +++ b/Makefile @@ -1,59 +1,22 @@ -ARGS = $(filter-out $@,$(MAKECMDGOALS)) MAKEFLAGS += --silent -.PHONY: test provision - -DOCKER_REPOSITORY=`cat DOCKER_REPOSITORY` -DOCKER_TAG_LATEST=`cat DOCKER_TAG_LATEST` +.PHONY: list setup requirements structure-test provision list: - sh -c "echo; $(MAKE) -p no_targets__ |\ + sh -c "echo; $(MAKE) -p no_targets__ 2>/dev/null |\ awk -F':' '/^[a-zA-Z0-9][^\$$#\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);\ for(i in A)print A[i]}' | \ grep -v '__\$$\|Makefile\|%' | \ sort" -full: provision build - -all: build - -build: - python2 ./bin/console docker:build --threads=auto - -bootstrap: webdevops/bootstrap webdevops/ansible -base: webdevops/base webdevops/base-app - -php: webdevops/php webdevops/php-apache webdevops/php-nginx -php-dev: webdevops/php-dev webdevops/php-apache-dev webdevops/php-nginx-dev -hhvm: webdevops/hhvm webdevops/hhvm-apache webdevops/hhvm-nginx - -web: webdevops/apache webdevops/apache-dev webdevops/nginx webdevops/nginx-dev webdevops/varnish webdevops/certbot - -applications: webdevops/typo3 webdevops/piwik - -misc: webdevops/mail-sandbox webdevops/sphinx webdevops/liquibase - setup: requirements requirements: pip install --upgrade -I -r ./bin/requirements.txt cd tests/serverspec && bundle install --path=vendor -test: - python2 bin/console test:serverspec --threads=auto -v - structure-test: cd tests/structure-test && ./run.sh provision: python2 bin/console generate:dockerfile python2 bin/console generate:provision - -push: - python2 ./bin/console docker:push --threads=auto - -graph: - python2 ./bin/console generate:graph - -graph-full: - python2 ./bin/console generate:graph --all\ - --filename docker-image-full-layout.gv diff --git a/README.md b/README.md index 9962c98d9..96a7ab626 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,8 @@ Build all PHP images of one version (default `8.5`), in the order they depend on ./build-local.sh 8.4 ``` -Then try an image with the quick start above. `make test` and the other Makefile targets that call `bin/console` need Python 2; -only `make provision` and `make graph` still work, inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). +Then try an image with the quick start above. `make provision` calls `bin/console`, which needs Python 2; +run it inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). ### PHP extension builds diff --git a/bin/command/generate_graph_command.py b/bin/command/generate_graph_command.py deleted file mode 100644 index 1a82ee378..000000000 --- a/bin/command/generate_graph_command.py +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/env/python -# -*- coding: utf-8 -*- -# -# (c) 2016 WebDevOps.io -# -# This file is part of Dockerfile Repository. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -# documentation files (the "Software"), to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and -# to permit persons to whom the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or substantial portions -# of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -import os -import re -import yaml -from datetime import date -from graphviz import Digraph -from cleo import Output -from webdevops import DockerfileUtility -from webdevops.command import BaseCommand -from cleo.validators import Enum - -class GenerateGraphCommand(BaseCommand): - """ - Generate a diagram of container - - generate:graph - {--a|all : Show all informations} - {--o|output= : path output} - {--F|format=png (choice) : output format } - {--f|filename=docker-image-layout.gv : file output} - """ - - validation = { - '--format': Enum(['png', 'jpg', 'pdf', 'svg']) - } - - from_regex = re.compile(ur'FROM\s+(?P[^\s:]+)(:(?P.+))?', re.MULTILINE) - - containers = {} - - tags = {} - - subgraph = {} - - edges = {} - - conf = '' - - def run_task(self, configuration): - if self.option('output'): - configuration.set('imagePath', self.option('output')) - - if Output.VERBOSITY_VERBOSE <= self.output.get_verbosity(): - self.line('ALL : %s' % self.option('all')) - self.line('output : %s' % configuration.get('imagePath')) - self.line('format : %s' % self.option('format')) - self.line('dockerPath : %s' % configuration.get('dockerPath')) - self.line('filename : %s' % self.option('filename')) - self.__load_configuration() - - dockerfileList = DockerfileUtility.find_dockerfiles_in_path( - base_path=configuration.get('dockerPath'), - path_regex=configuration.get('docker.pathRegex'), - image_prefix=configuration.get('docker.imagePrefix'), - ) - - for dockerfile in dockerfileList: - self.__process_dockerfile(dockerfile) - - dia = self.build_graph() - dia.render() - - def __process_dockerfile(self, dockerfile): - """ - - :param dockerfile_full_path: - :type dockerfile_full_path: str - - :return: self - :rtype: self - """ - - if Output.VERBOSITY_VERBOSE <= self.output.get_verbosity(): - self.line('-> Processing: %s' % dockerfile['image']['fullname']) - - docker_image = dockerfile['image']['name'] - parent_image_name = DockerfileUtility.image_basename(dockerfile['image']['from']) - parent_image_tag = DockerfileUtility.extract_image_name_tag(dockerfile['image']['from']) - - if not parent_image_name in self.containers: - self.containers[parent_image_name] = 'scratch' - self.__append_tag(parent_image_name, 'latest') - - self.containers[docker_image] = parent_image_name - self.__append_tag(docker_image, parent_image_tag) - - return self - - def __append_tag(self, docker_image, tag): - """ - - :param docker_image: - :type docker_image: str - - :param tag: - :type tag: str - - :return: self - """ - if not self.tags.has_key(docker_image): - self.tags[docker_image] = {} - self.tags[docker_image][tag] = tag - return self - - def __get_graph(self, default_graph, name): - """ - - :param default_graph: Main diagram - :type default_graph: Digraph - - :param name: Name of the sub-diagram - :type name: str - - :return: the selected diagram - :rtype: Digraph - """ - for group, group_attr in self.conf['diagram']['groups'].items(): - for dockerRegex in group_attr['docker']: - if re.match(dockerRegex, name): - return group, self.subgraph[group] - return '__root__', default_graph - - def __load_configuration(self): - conf_file_path = os.path.join(self.configuration.get('confPath'), 'diagram.yml') - - stream = open(conf_file_path, 'r') - self.conf = yaml.safe_load(stream) - - def __apply_styles(self, graph, styles): - """ - - :param graph: Diagraph to apply styles - :type graph Digraph - - :param styles: Styles properties of Diagraph - :type styles: dict - - :return: The GRaph with Style - :rtype: Digraph - """ - graph.graph_attr.update( - ('graph' in styles and styles['graph']) or {} - ) - graph.node_attr.update( - ('nodes' in styles and styles['nodes']) or {} - ) - graph.edge_attr.update( - ('edges' in styles and styles['edges']) or {} - ) - return graph - - def build_graph(self): - """ - - :return: the graph - :rtype: Digraph - """ - dia = Digraph('webdevops', - filename=self.option('filename'), - format=self.option('format'), - directory=self.configuration.get('imagePath') - ) - dia = self.__apply_styles(dia, self.conf['diagram']['styles']) - - label = r'label = "\n\n%s"' % self.configuration.get('graph.label') - - dia.body.append(label % date.today().strftime("%Y-%m-%d")) - dia.body.append('newrank=true;') - - rank_image_list = {} - rank_group_list = {} - - # Create subgraph - for group, group_attr in self.conf['diagram']['groups'].items(): - self.subgraph[group] = Digraph('cluster_%s' % group) - self.subgraph[group].body.append(r'label = "%s"' % group_attr['name']) - self.subgraph[group] = self.__apply_styles(self.subgraph[group], group_attr['styles']) - - if 'rank' in group_attr: - rank_group_list[group] = group_attr['rank'] - - for image, base in self.containers.items(): - group_image, graph_image = self.__get_graph(dia, image) - group_base, graph_base = self.__get_graph(dia, base) - if not "scratch" in base: - if graph_image == graph_base: - graph_image.edge(base, image) - else: - graph_image.node(image) - self.edges[image] = base - if self.option('all'): - self.__attach_tag(graph_image, image) - else: - graph_image.node(image) - - if group_image in rank_group_list: - image_rank = rank_group_list[group_image] - - if not image_rank in rank_image_list: - rank_image_list[image_rank] = [] - - rank_image_list[image_rank].append(image) - - # add repositories (subgraph/cluster) - for name, subgraph in self.subgraph.items(): - dia.subgraph(subgraph) - - # add images (node) - for image, base in self.edges.items(): - dia.edge(base, image) - - # add invisible constraints to add ranked groups - for rank, imagelist in rank_image_list.items(): - rank_next = rank + 1 - - if rank_next in rank_image_list: - imagelist_next = rank_image_list[rank_next] - - for image in imagelist: - for image_next in imagelist_next: - dia.body.append('{ "%s" -> "%s" [style=invis] }' % (image, image_next)) - - return dia - - def __attach_tag(self, graph, image): - for tag in self.tags[image]: - node_name = "%s-%s" % (image, tag) - graph.node(node_name, label=tag, fillcolor='#eeeeee', shape='folder') - graph.edge(image, node_name) diff --git a/bin/console b/bin/console index 0ec2645a0..ebf5b10b2 100755 --- a/bin/console +++ b/bin/console @@ -24,7 +24,6 @@ from command.docker_exec_command import DockerExecCommand from command.test_testinfra_command import TestTestinfraCommand from command.test_serverspec_command import TestServerspecCommand from command.generate_dockerfile_command import GenerateDockerfileCommand -from command.generate_graph_command import GenerateGraphCommand from command.generate_provision_command import GenerateProvisionCommand if __name__ == '__main__': @@ -63,7 +62,6 @@ if __name__ == '__main__': 'dockerPath', 'templatePath', 'provisionPath', - 'imagePath', 'baselayoutPath', 'testinfraPath', 'serverspecPath', @@ -98,7 +96,6 @@ if __name__ == '__main__': application.add(TestTestinfraCommand(configuration=configuration)) application.add(TestServerspecCommand(configuration=configuration)) application.add(GenerateDockerfileCommand(configuration=configuration)) - application.add(GenerateGraphCommand(configuration=configuration)) application.add(GenerateProvisionCommand(configuration=configuration)) application.run() diff --git a/bin/requirements.txt b/bin/requirements.txt index 0a1be6eca..4ca4bcc6d 100644 --- a/bin/requirements.txt +++ b/bin/requirements.txt @@ -1,5 +1,4 @@ Jinja2>=2.8 -graphviz>=0.4.10 cleo<0.7.0 yamlordereddictloader>=0.1.0 testinfra>=1.4.2 diff --git a/bin/webdevops/Configuration.py b/bin/webdevops/Configuration.py index 3d6cfad25..e9f69d61f 100644 --- a/bin/webdevops/Configuration.py +++ b/bin/webdevops/Configuration.py @@ -26,7 +26,6 @@ 'dockerPath': False, 'templatePath': False, 'provisionPath': False, - 'imagePath': False, 'confPath': False, 'baselayoutPath': False, 'testPath': False, diff --git a/conf/console.yml b/conf/console.yml index 344029c93..8456af4c7 100644 --- a/conf/console.yml +++ b/conf/console.yml @@ -3,7 +3,6 @@ dockerPath: 'docker' templatePath: 'template' provisionPath: 'provisioning' -imagePath: 'graph/' baselayoutPath: 'baselayout' testinfraPath: 'tests/testinfra' serverspecPath: 'tests/serverspec' @@ -17,10 +16,6 @@ docker: autoPull: True autoPullBlacklist: '^webdevops/.*' - -graph: - label: 'Webdevops Images\n%s' - dockerTest: serverspec: specPath: 'spec/docker/%s_spec.rb' diff --git a/conf/diagram.yml b/conf/diagram.yml deleted file mode 100644 index 1011ec3f2..000000000 --- a/conf/diagram.yml +++ /dev/null @@ -1,124 +0,0 @@ ---- -diagram: - styles: - graph: - fontsize: "16" - fontcolor: black - bgcolor: white - rankdir: TP - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: white - style: filled - fillcolor: "#E1E1E1" - edges: - style: dashed - color: black - arrowhead: open - fontname: Courier - fontsize: "12" - fontcolor: white - groups: - official: - name: Official images (Docker hub) - rank: 1 - styles: - graph: - style: dashed - fillcolor: gray - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#e1e1e1" - docker: - - "^[^/]+$" - upstream: - name: Upstream images (Docker hub) - rank: 1 - styles: - graph: - style: dashed - fillcolor: gray - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#e1e1e1" - docker: - - "^(?!webdevops)[^/]+/[^/]+" - base: - name: Base images - rank: 2 - styles: - graph: - style: filled - fillcolor: gray - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#e1e1e1" - docker: - - webdevops/bootstrap - - webdevops/base.* - - webdevops/ansible - php: - name: PHP images - rank: 3 - styles: - graph: - style: filled - fillcolor: "#c0e5a8" - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#78c445" - docker: - - webdevops/php - - webdevops/php-apache - - webdevops/php-nginx - php-dev: - name: PHP development images - rank: 4 - styles: - graph: - style: filled - fillcolor: "#c0e5a8" - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#78c445" - docker: - - webdevops/php.*-dev - service: - name: Service images - rank: 3 - styles: - graph: - style: filled - fillcolor: "#fbd3b5" - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#ffa35f" - docker: - - webdevops/apache - - webdevops/nginx diff --git a/conftest.py b/conftest.py deleted file mode 100644 index b26fcf303..000000000 --- a/conftest.py +++ /dev/null @@ -1,49 +0,0 @@ -import os, time -import pytest, testinfra - -conftest_path = os.path.dirname(os.path.realpath(__file__)) -test_path = os.path.join(conftest_path, 'tests') -test_conf_path = os.path.join(test_path, 'conf') -test_conf_app_path = os.path.join(test_conf_path, 'app') - -# Use testinfra to get a handy function to run commands locally -check_output = testinfra.get_backend( - "local://" -).get_module("Command").check_output - - -@pytest.fixture -def TestinfraBackend(request): - # Override the TestinfraBackend fixture, - # all testinfra fixtures (i.e. modules) depend on it. - - docker_command = '' - docker_image = request.param - docker_sleeptime = 5 - - # Check for custom command in docker image name - if "#" in docker_image: - docker_image, docker_command = docker_image.split("#", 2) - - if docker_command == "loop": - docker_command = 'tail -f /dev/null' - docker_sleeptime = 0 - - docker_id = check_output( - "docker run -d -v \"%s:/app:ro\" %s " + docker_command, - test_conf_app_path, - docker_image - ) - - def teardown(): - check_output("docker rm -f %s", docker_id) - - # Destroy the container at the end of the fixture life - request.addfinalizer(teardown) - - # wait for getting the image up - if docker_sleeptime: - time.sleep(docker_sleeptime) - - # Return a dynamic created backend - return testinfra.get_backend("docker://" + docker_id) diff --git a/docker/dockerfile-build-env/latest/Dockerfile b/docker/dockerfile-build-env/latest/Dockerfile index 610e71e73..e1c2b3f26 100644 --- a/docker/dockerfile-build-env/latest/Dockerfile +++ b/docker/dockerfile-build-env/latest/Dockerfile @@ -16,7 +16,6 @@ RUN apt-install \ python2 \ python2-dev \ python-setuptools \ - graphviz \ ruby \ ruby-dev \ ruby-bundler \ diff --git a/docker/dockerfile-build-env/latest/Dockerfile.jinja2 b/docker/dockerfile-build-env/latest/Dockerfile.jinja2 index 31120da94..a16d2e34a 100644 --- a/docker/dockerfile-build-env/latest/Dockerfile.jinja2 +++ b/docker/dockerfile-build-env/latest/Dockerfile.jinja2 @@ -11,7 +11,6 @@ RUN apt-install \ python2 \ python2-dev \ python-setuptools \ - graphviz \ ruby \ ruby-dev \ ruby-bundler \ diff --git a/docker/nginx/alpine/conf/etc/nginx/vhost.conf b/docker/nginx/alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/nginx/alpine/conf/etc/nginx/vhost.conf +++ b/docker/nginx/alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.2/conf/etc/php/php.webdevops.ini b/docker/php-official/8.2/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.2/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.2/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.3/conf/etc/php/php.webdevops.ini b/docker/php-official/8.3/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.3/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.3/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.4/conf/etc/php/php.webdevops.ini b/docker/php-official/8.4/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.4/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.4/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.5/conf/etc/php/php.webdevops.ini b/docker/php-official/8.5/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.5/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.5/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docs/customization.md b/docs/customization.md index 44254316a..38cafe979 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -233,6 +233,7 @@ Images: `php-nginx`, `php-nginx-dev`, `nginx`. The distribution's configuration | `global.conf` | Empty; for your settings at `http` level | | `conf.d/*.conf` | Settings at `http` level. `conf.d/10-php.conf` defines the upstream `php` (`WEB_PHP_SOCKET`). | | `vhost.conf` | The default server for port 80 and port 443: `server_name`, `root`, `index`. Both include `vhost.common.d/*.conf`; port 443 also includes `vhost.ssl.conf`. | +| `vhost.ipv6/listen-80.conf`, `vhost.ipv6/listen-443.conf` | `listen [::]:80` and `listen [::]:443` for the default server, included by `vhost.conf`. Deleted at start if the container has no IPv6, so the default server listens on IPv4 only. | | `vhost.ssl.conf` | TLS protocols, ciphers and the paths of `ssl/server.crt` and `ssl/server.key` | | `vhost.common.d/10-general.conf` | `client_max_body_size` (`SERVICE_NGINX_CLIENT_MAX_BODY_SIZE`) | | `vhost.common.d/10-location-root.conf` | `location /` with `try_files $uri $uri/ /?$query_string` | @@ -284,6 +285,8 @@ Use `COPY` in a Dockerfile for files with placeholders. If `WEB_PHP_SOCKET` is empty, the files that connect the web server to PHP-FPM are deleted at start: `conf.d/10-php.conf` and `vhost.common.d/10-php.conf` (Nginx), `conf.d/10-php.conf` (Apache). This is the default in `nginx` and `apache`. +If the container has no IPv6, the files in `vhost.ipv6/` are deleted at start (Nginx); if you mount `/opt/docker/etc/nginx/` as a whole, also on the host. No other file is changed: a file of your own with `listen [::]` keeps Nginx from starting without IPv6. + ### PHP Images: `php-*`. Files in `/opt/docker/etc/php/`: diff --git a/docs/images/nginx.md b/docs/images/nginx.md index d6365bcb8..3f53e42ba 100644 --- a/docs/images/nginx.md +++ b/docs/images/nginx.md @@ -25,6 +25,6 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Without IPv6 in the container, Nginx does not start and is restarted over and over; [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6) has a start script that fixes it. +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. Your own configuration files with `listen [::]` are not changed, see [Configuration files](../customization.md#configuration-files). Settings: [Web server](../environment-variables.md#web-server) (`WEB_PHP_SOCKET` is empty, there is no PHP), hooks in `/opt/docker/bin/service.d/nginx.d`, see [Customization](../customization.md). diff --git a/docs/images/php-apache.md b/docs/images/php-apache.md index 5fcf045db..0a4063f7f 100644 --- a/docs/images/php-apache.md +++ b/docs/images/php-apache.md @@ -24,7 +24,7 @@ Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for ` ## Services -Started by default: `apache`, `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. In `php-apache-dev`, PHP-FPM does not start without IPv6 in the container, see [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6). +Started by default: `apache`, `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. ## Configuration diff --git a/docs/images/php-nginx.md b/docs/images/php-nginx.md index ea7acbef4..ab754fd29 100644 --- a/docs/images/php-nginx.md +++ b/docs/images/php-nginx.md @@ -20,7 +20,7 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Without IPv6 in the container, Nginx (and in `php-nginx-dev` also PHP-FPM) does not start and is restarted over and over; [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6) has a start script that fixes it. +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. Your own configuration files with `listen [::]` are not changed, see [Configuration files](../customization.md#configuration-files). ## Services diff --git a/docs/images/php.md b/docs/images/php.md index 9a832a189..044fb312e 100644 --- a/docs/images/php.md +++ b/docs/images/php.md @@ -29,7 +29,7 @@ PHP-FPM listens on port `9000`. For a web server in the same container use [`php ## Services -Started by default: `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. See [Customization](../customization.md#services). PHP-FPM listens on `[::]:9000`; without IPv6 in the container it does not start, see [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6). +Started by default: `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. See [Customization](../customization.md#services). PHP-FPM listens on port `9000` of all IPv6 and IPv4 addresses; if the container has no IPv6, of all IPv4 addresses. ## PHP configuration diff --git a/docs/known-issues.md b/docs/known-issues.md index 0ea055085..6d57c5565 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -88,19 +88,6 @@ These options and tools are part of the images but do not work, or work only in - **Images:** `php-nginx` and `php-nginx-dev` with the Debian tags `8.2` to `8.5`. - **Instead:** Add your own repositories as a new file in `/etc/apt/sources.list.d/`, for example `echo "deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backports.list`. -### Nginx and PHP-FPM without IPv6 - -- **Effect:** If the container has no IPv6, Nginx cannot listen on `[::]:80` and `[::]:443`, and PHP-FPM cannot listen on `[::]:9000` (`Address family not supported by protocol`). supervisord restarts them over and over. -- **Images:** Nginx in `php-nginx`, `php-nginx-dev` and `nginx`. PHP-FPM in `php`, `php-dev`, `php-nginx-dev` and `php-apache-dev`; in `php-nginx` and `php-apache` it listens on `127.0.0.1:9000` and is not affected. -- **Instead:** Change the listen addresses in a [start script](customization.md#scripts-at-container-start), for example `/entrypoint.d/10-no-ipv6.sh`: - - ```sh - for f in $(grep -rlE 'listen \[::\]|listen = \[::\]' /opt/docker/etc/nginx /opt/docker/etc/php/fpm 2>/dev/null); do - sed -i -e '/^\s*listen \[::\]/d' -e 's/^listen = \[::\]:9000/listen = 0.0.0.0:9000/' "$f" - done - true - ``` - ### Xdebug settings written into `php.ini` - **Effect:** When an `XDEBUG_*` variable is set, the development images append its setting to `/opt/docker/etc/php/php.ini`, your own file. A read-write mount gets one more line on every start of the container, also on the host; with a `:ro` mount the container exits at start. @@ -146,8 +133,8 @@ These options and tools are part of the images but do not work, or work only in ## Build tools -- **Effect:** The Makefile targets that call `bin/console` (`provision`, `build`, `push`, `test`, `graph`) need Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env`, `make provision` and `make graph` work, but `make test` fails as well. -- **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec and structure tests for every image. +- **Effect:** The Makefile target `provision` calls `bin/console`, which needs Python 2. On a host without Python 2 it fails with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` it works. +- **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec tests for every image except `toolbox` and `dockerfile-build-env`, and the structure tests for `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`. To run the structure tests against the images you built locally, use `docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/app -w /app webdevops/dockerfile-build-env make structure-test`. It tests the local tags that the CI builds and fails if no such image exists. - **Issue:** [#549](https://github.com/webdevops/Dockerfile/issues/549) (move away from Python 2). ## Migration from older images diff --git a/provisioning/nginx/general/etc/nginx/vhost.conf b/provisioning/nginx/general/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/provisioning/nginx/general/etc/nginx/vhost.conf +++ b/provisioning/nginx/general/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..cefd9a4fd 100644 --- a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh +++ b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,9 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true +fi diff --git a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh index 59b4f08b8..d100a7e41 100644 --- a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh +++ b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh @@ -1,24 +1,13 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) - # Configure php-fpm go-replace --mode=lineinfile --regex \ -s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \ -- /opt/docker/etc/php/fpm/pool.d/application.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf \ - /opt/docker/etc/php/fpm/php-fpm.conf -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh b/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Disable blackfire by default -rm -f \ - /etc/php5/cli/conf.d/zz-blackfire.ini \ - /etc/php5/fpm/conf.d/zz-blackfire.ini diff --git a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh b/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh +++ b/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \ -s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \ -s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \ - -s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \ -- /opt/docker/etc/php/php.webdevops.ini diff --git a/provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh b/provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/provisioning/php/general/etc/logrotate.d/php5-fpm b/provisioning/php/general/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/provisioning/php/general/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/provisioning/php/general/etc/php/php.webdevops.ini b/provisioning/php/general/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/provisioning/php/general/etc/php/php.webdevops.ini +++ b/provisioning/php/general/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/provisioning/php/general/provision/bootstrap.d/10-php-init.sh b/provisioning/php/general/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/provisioning/php/general/provision/bootstrap.d/10-php-init.sh +++ b/provisioning/php/general/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..9f96894b1 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" @@ -18,26 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then - # listen on public IPv4 port - # no ipv6 sockets available for old php version - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4) +# and falls back to 0.0.0.0 if the container has no IPv6 +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh b/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh +++ b/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/template/Dockerfile/docker.jinja2 b/template/Dockerfile/docker.jinja2 index dc17193b9..e6c1bd0d0 100644 --- a/template/Dockerfile/docker.jinja2 +++ b/template/Dockerfile/docker.jinja2 @@ -13,10 +13,6 @@ LABEL maintainer=info@webdevops.io \ io.webdevops.version=1.5.0 {%- endmacro %} -{%- macro add(source, target) -%} -ADD {{ source }} {{ target }} -{%- endmacro -%} - {%- macro copy(source, target) -%} COPY {{ source }} {{ target }} {%- endmacro -%} @@ -29,10 +25,6 @@ EXPOSE {{ port }} WORKDIR {{ path }} {%- endmacro -%} -{%- macro volume(volume) -%} -VOLUME {{ volume }} -{%- endmacro -%} - {%- macro entrypoint(command) -%} ENTRYPOINT ["{{ command }}"] {%- endmacro -%} diff --git a/template/Dockerfile/environment.jinja2 b/template/Dockerfile/environment.jinja2 index c71e037d6..4a78fa603 100644 --- a/template/Dockerfile/environment.jinja2 +++ b/template/Dockerfile/environment.jinja2 @@ -5,12 +5,6 @@ ENV TERM="xterm" \ {%- endmacro %} -{% macro mailbox() -%} -ENV MAILBOX_USERNAME="dev" \ - MAILBOX_PASSWORD="dev" -{%- endmacro %} - - {% macro web() -%} ENV WEB_DOCUMENT_ROOT=/app \ WEB_DOCUMENT_INDEX=index.php \ diff --git a/template/Dockerfile/provision.jinja2 b/template/Dockerfile/provision.jinja2 index 36bce08cf..4018504b4 100644 --- a/template/Dockerfile/provision.jinja2 +++ b/template/Dockerfile/provision.jinja2 @@ -1,10 +1,2 @@ -{% macro runRoleInline() %} - {%- if varargs -%}&& /opt/docker/bin/provision run --tag bootstrap {% for roleArg in varargs -%}{% set roleList = roleArg.split(' ') %}{% for role in roleList -%} - {% if role %}--role webdevops-{{ role }} {% endif %} - {%- endfor -%}{%- endfor -%} - \{%- endif %} - && /opt/docker/bin/bootstrap.sh{% endmacro %} - {% macro runBootstrap() %}&& docker-run-bootstrap{% endmacro %} -{% macro registerRole(role='',bootstrap=False,build=False,onbuild=False,entrypoint=False) %}&& /opt/docker/bin/provision add {%if bootstrap%}--tag bootstrap {% endif %}{%if build%}--tag build {% endif %}{%if onbuild%}--tag onbuild {% endif %}{%if entrypoint%}--tag entrypoint {% endif %} webdevops-{{ role }}{% endmacro %} diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/serverspec/spec/collection/base-app.rb b/tests/serverspec/spec/collection/base-app.rb index d5f180cfd..d78d04980 100644 --- a/tests/serverspec/spec/collection/base-app.rb +++ b/tests/serverspec/spec/collection/base-app.rb @@ -1,4 +1,5 @@ shared_examples 'collection::base-app' do include_examples 'base-app::locales' include_examples 'base-app::application-user' + include_examples 'base-app::moreutils' end diff --git a/tests/serverspec/spec/collection/bootstrap.rb b/tests/serverspec/spec/collection/bootstrap.rb index 0936aff20..06bfd1f6f 100644 --- a/tests/serverspec/spec/collection/bootstrap.rb +++ b/tests/serverspec/spec/collection/bootstrap.rb @@ -7,11 +7,3 @@ include_examples 'vendor::alpine::apk' end end - -shared_examples 'collection::bootstrap::upstream-image' do - include_examples 'bootstrap::distribution' - - if (os[:family] == 'alpine') - include_examples 'vendor::alpine::apk' - end -end diff --git a/tests/serverspec/spec/collection/php.rb b/tests/serverspec/spec/collection/php.rb index 92c0ac05e..68158f3f3 100644 --- a/tests/serverspec/spec/collection/php.rb +++ b/tests/serverspec/spec/collection/php.rb @@ -16,6 +16,8 @@ include_examples 'misc::graphicsmagick' include_examples 'misc::imagemagick' include_examples 'misc::ghostscript' + + include_examples 'base::syslog-ng' end shared_examples 'collection::php::production' do diff --git a/tests/serverspec/spec/docker/apache-dev_spec.rb b/tests/serverspec/spec/docker/apache-dev_spec.rb deleted file mode 100644 index 4d839f035..000000000 --- a/tests/serverspec/spec/docker/apache-dev_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'serverspec' -require 'docker' -require 'spec_init' - -describe "Dockerfile" do - before(:all) do - set :docker_image, ENV['DOCKERIMAGE_ID'] - end - - include_examples 'collection::bootstrap' - include_examples 'collection::base' - include_examples 'collection::apache' - -end diff --git a/tests/serverspec/spec/docker/php-official_spec.rb b/tests/serverspec/spec/docker/php-official_spec.rb deleted file mode 100644 index f5bafaeaf..000000000 --- a/tests/serverspec/spec/docker/php-official_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'serverspec' -require 'docker' -require 'spec_init' - -describe "Dockerfile" do - before(:all) do - set :docker_image, ENV['DOCKERIMAGE_ID'] - end - - include_examples 'collection::bootstrap' - include_examples 'collection::base' - include_examples 'collection::base-app' - include_examples 'collection::php::production' - include_examples 'collection::php-fpm' - include_examples 'collection::php-fpm::public' - -end diff --git a/tests/serverspec/spec/shared/base-app/moreutils.rb b/tests/serverspec/spec/shared/base-app/moreutils.rb new file mode 100644 index 000000000..88c0f3ddb --- /dev/null +++ b/tests/serverspec/spec/shared/base-app/moreutils.rb @@ -0,0 +1,6 @@ +shared_examples 'base-app::moreutils' do + describe command('command -v sponge'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:stdout) { should eq "/usr/bin/sponge\n" } + its(:exit_status) { should eq 0 } + end +end diff --git a/tests/serverspec/spec/shared/base-app/packages.rb b/tests/serverspec/spec/shared/base-app/packages.rb deleted file mode 100644 index 28bad4dbc..000000000 --- a/tests/serverspec/spec/shared/base-app/packages.rb +++ /dev/null @@ -1,20 +0,0 @@ -shared_examples 'base-app::packages' do - [ - 'openssh-server', - 'dnsmasq', - 'postfix', - 'unzip', - 'bzip2', - 'wget', - 'curl', - 'moreutils', - 'rsync', - 'git', - 'nano', - 'net-tools', - ].each do |package| - describe package("#{package}") do - it { should be_installed } - end - end -end diff --git a/tests/serverspec/spec/shared/bootstrap/distribution.rb b/tests/serverspec/spec/shared/bootstrap/distribution.rb index ab627b0cd..252b238ab 100644 --- a/tests/serverspec/spec/shared/bootstrap/distribution.rb +++ b/tests/serverspec/spec/shared/bootstrap/distribution.rb @@ -97,6 +97,13 @@ its(:exit_status) { should eq 0 } end + describe command('docker-image-info dist-codename'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:stdout) { should eq command('. /etc/os-release && echo "$VERSION_CODENAME"').stdout } + its(:stdout) { should match /\A[a-z]+\n\z/ } + + its(:exit_status) { should eq 0 } + end + ######################### # Alpine ######################### diff --git a/tests/serverspec/spec/shared/misc/tools.rb b/tests/serverspec/spec/shared/misc/tools.rb index bcf303c86..400c27c98 100644 --- a/tests/serverspec/spec/shared/misc/tools.rb +++ b/tests/serverspec/spec/shared/misc/tools.rb @@ -30,25 +30,3 @@ its(:exit_status) { should eq 0 } end end - -shared_examples 'misc::graphviz' do - it "should include graphviz" do - expect(file("/usr/bin/dot")).to be_executable - end - - describe command('/usr/bin/dot -V') do - its(:stderr) { should match %r!graphviz version! } - its(:exit_status) { should eq 0 } - end -end - -shared_examples 'misc::letsencrypt' do - it "should include certbot" do - expect(file("/usr/bin/certbot")).to be_executable - end - - describe command('/usr/bin/certbot --version') do - its(:stderr) { should match %r!certbot! } - its(:exit_status) { should eq 1 } - end -end diff --git a/tests/serverspec/spec/shared/nginx/layout.rb b/tests/serverspec/spec/shared/nginx/layout.rb index 26db619a2..626f6d06b 100644 --- a/tests/serverspec/spec/shared/nginx/layout.rb +++ b/tests/serverspec/spec/shared/nginx/layout.rb @@ -6,6 +6,7 @@ "/opt/docker/etc/nginx", "/opt/docker/etc/nginx/conf.d", "/opt/docker/etc/nginx/vhost.common.d", + "/opt/docker/etc/nginx/vhost.ipv6", "/opt/docker/bin/service.d/nginx.d", ].each do |file| describe file("#{file}") do @@ -102,6 +103,46 @@ end end + ######################### + ## IPv6 listen directives of the default vhost + ######################### + # The start script deletes them if the kernel has no IPv6. Serverspec runs on + # the Docker host, which shares its kernel with the container. + ipv6_available = File.exist?('/proc/net/if_inet6') + + describe file('/opt/docker/etc/nginx/vhost.conf') do + its(:content) { should include 'include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf;' } + its(:content) { should include 'include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf;' } + end + + { + "/opt/docker/etc/nginx/vhost.ipv6/listen-80.conf" => "listen [::]:80 default_server;", + "/opt/docker/etc/nginx/vhost.ipv6/listen-443.conf" => "listen [::]:443 ssl default_server;", + }.each do |file, directive| + describe file("#{file}"), :if => ipv6_available do + it { should be_file } + its(:content) { should include directive } + + # Owner test + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + + # Read test + it { should be_readable.by('owner') } + it { should be_readable.by('group') } + it { should be_readable.by('others') } + + # Exectuable test + it { should_not be_executable.by('owner') } + it { should_not be_executable.by('group') } + it { should_not be_executable.by('others') } + end + + describe file("#{file}"), :unless => ipv6_available do + it { should_not exist } + end + end + ######################### ## SSL (special rights) ######################### diff --git a/tests/serverspec/spec/shared/php/pear.rb b/tests/serverspec/spec/shared/php/pear.rb deleted file mode 100644 index 0c731213f..000000000 --- a/tests/serverspec/spec/shared/php/pear.rb +++ /dev/null @@ -1,7 +0,0 @@ -shared_examples 'php::pear' do - describe command('pear') do - if (! (os[:family] == 'ubuntu' and os[:version] == '16.04') ) - its(:exit_status) { should eq 0 } - end - end -end diff --git a/tests/serverspec/spec/shared/python/toolchain.rb b/tests/serverspec/spec/shared/python/toolchain.rb deleted file mode 100644 index 8eeb1ea68..000000000 --- a/tests/serverspec/spec/shared/python/toolchain.rb +++ /dev/null @@ -1,18 +0,0 @@ -shared_examples 'python::toolchain' do - - describe command('python --version') do - its(:exit_status) { should eq 0 } - end - - describe command('easy_install --version'), :if => ['debian', 'ubuntu', 'redhat'].include?(os[:family]) do - its(:exit_status) { should eq 0 } - end - - describe command('easy_install-2.7 --version'), :if => ['alpine'].include?(os[:family]) do - its(:exit_status) { should eq 0 } - end - - describe command('pip --help') do - its(:exit_status) { should eq 0 } - end -end diff --git a/tests/structure-test/base-app/alpine/test.yaml b/tests/structure-test/base-app/alpine/test.yaml deleted file mode 100644 index b51e97f50..000000000 --- a/tests/structure-test/base-app/alpine/test.yaml +++ /dev/null @@ -1,7 +0,0 @@ -schemaVersion: "2.0.0" - -commandTests: - - name: "bzip2" - command: "which" - args: ["bzip2"] - expectedOutput: ["/usr/bin/bzip2"] diff --git a/tests/structure-test/base-app/test.yaml b/tests/structure-test/base-app/test.yaml index 0df9e614b..ed8728d8a 100644 --- a/tests/structure-test/base-app/test.yaml +++ b/tests/structure-test/base-app/test.yaml @@ -60,3 +60,7 @@ commandTests: command: "which" args: ["patch"] expectedOutput: ["/usr/bin/patch"] + - name: "bzip2" + command: "which" + args: ["bzip2"] + expectedOutput: ["/usr/bin/bzip2"] diff --git a/tests/structure-test/base/alpine/test.yaml b/tests/structure-test/base/alpine/test.yaml deleted file mode 100644 index 8d9be7b9a..000000000 --- a/tests/structure-test/base/alpine/test.yaml +++ /dev/null @@ -1,11 +0,0 @@ -schemaVersion: "2.0.0" - -commandTests: - - name: "netstat" - command: "which" - args: ["netstat"] - expectedOutput: ["/bin/netstat"] - - name: "sed" - command: "which" - args: ["sed"] - expectedOutput: ["/bin/sed"] \ No newline at end of file diff --git a/tests/structure-test/base/test.yaml b/tests/structure-test/base/test.yaml index ebb45f4b5..ce94f23f8 100644 --- a/tests/structure-test/base/test.yaml +++ b/tests/structure-test/base/test.yaml @@ -102,3 +102,11 @@ commandTests: command: "which" args: ["zic"] expectedOutput: ["/usr/sbin/zic"] + - name: "netstat" + command: "which" + args: ["netstat"] + expectedOutput: ["^/(usr/)?bin/netstat\\s*$"] + - name: "sed" + command: "which" + args: ["sed"] + expectedOutput: ["^/(usr/)?bin/sed\\s*$"] diff --git a/tests/structure-test/bootstrap/alpine/test.yaml b/tests/structure-test/bootstrap/alpine/test.yaml index 6df7622be..8d3a593a3 100644 --- a/tests/structure-test/bootstrap/alpine/test.yaml +++ b/tests/structure-test/bootstrap/alpine/test.yaml @@ -1,10 +1,5 @@ schemaVersion: "2.0.0" -metadataTest: - envVars: - - key: "PATH" - value: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - commandTests: - name: "Check OS family" command: "docker-image-info" diff --git a/tests/structure-test/bootstrap/test.yaml b/tests/structure-test/bootstrap/test.yaml index c3e8447ac..33495e9e5 100644 --- a/tests/structure-test/bootstrap/test.yaml +++ b/tests/structure-test/bootstrap/test.yaml @@ -8,6 +8,8 @@ metadataTest: value: "C.UTF-8" - key: "TERM" value: "xterm" + - key: "PATH" + value: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" fileExistenceTests: - name: 'apk add wrapper' diff --git a/tests/structure-test/php/test.yaml b/tests/structure-test/php/test.yaml index 28363b985..581a5b0e2 100644 --- a/tests/structure-test/php/test.yaml +++ b/tests/structure-test/php/test.yaml @@ -35,10 +35,10 @@ fileExistenceTests: - name: 'PIE working directory was removed after the build' path: '/tmp/pie' shouldExist: false - - name: 'provision: set php version variable script was deleted after execution' + - name: 'provision: image family script was deleted after execution' path: '/opt/docker/provision/bootstrap.d/10-php-init.sh' shouldExist: false - - name: 'provision: set permission script was deleted after execution' + - name: 'provision: PHP path variables script was deleted after execution' path: '/opt/docker/provision/bootstrap.d/11-php-conf.sh' shouldExist: false - name: 'provision: cron installer was deleted after enabling the service' diff --git a/tests/structure-test/run.sh b/tests/structure-test/run.sh index 1801a5106..b5ae5fbad 100755 --- a/tests/structure-test/run.sh +++ b/tests/structure-test/run.sh @@ -1,24 +1,79 @@ -#!/bin/bash +#!/usr/bin/env bash +# Runs container-structure-test against the local webdevops images that have a suite in this directory. +# Only the tags the CI builds are tested (the -t "webdevops/..." lines in .github/workflows/build.yaml); +# tags that are not built locally are skipped, and a tag that is the same image as one already tested +# with the same suites (for example latest and ubuntu-22.04) is tested once. +# Exits non-zero if a test fails, if docker cannot list the images or if no image was tested. +# Needs Bash 4 or newer (declare -A, mapfile). -TEST_REPOS="bootstrap base base-app php" +if (( BASH_VERSINFO[0] < 4 )); then + echo "ERROR: run.sh needs Bash 4 or newer, this is Bash $BASH_VERSION." >&2 + echo "Run make structure-test inside webdevops/dockerfile-build-env, or put a newer bash first in PATH." >&2 + exit 1 +fi -for testRepo in ${TEST_REPOS}; do - if [[ ! -f $testRepo/test.yaml ]]; then - echo "Skipping tests for webdevops/$testRepo as no common test.yaml was found" +cd "$(dirname "$0")" || exit 1 + +BUILD_YAML="../../.github/workflows/build.yaml" + +if [[ ! -f "$BUILD_YAML" ]]; then + echo "ERROR: $BUILD_YAML not found" >&2 + exit 1 +fi + +# ": " per line +if ! LOCAL_IMAGES="$(docker images --no-trunc --format '{{.Repository}}:{{.Tag}} {{.ID}}')"; then + echo "ERROR: docker images failed" >&2 + exit 1 +fi + +FAILED=0 +TESTED=0 +SUITES=() +declare -A TESTED_AS + +for testRepo in */; do + testRepo="${testRepo%/}" + + if [[ ! -f "$testRepo/test.yaml" ]]; then continue fi - TEST_IMAGES="$(docker images -f "reference=webdevops/${testRepo}" --format "{{.Tag}}")" - for imageTag in ${TEST_IMAGES}; do - if [ "$imageTag" = "" ]; then + SUITES+=("$testRepo") + + mapfile -t BUILT_TAGS < <(grep -oE "\"webdevops/${testRepo}:[^\"]+\"" "$BUILD_YAML" | tr -d '"' | cut -d ':' -f 2 | sort -u) + + for imageTag in "${BUILT_TAGS[@]}"; do + image="webdevops/$testRepo:$imageTag" + imageId="$(awk -v image="$image" '$1 == image { print $2; exit }' <<< "$LOCAL_IMAGES")" + if [[ -z "$imageId" ]]; then + continue + fi + + CONFIGS=(--config "$testRepo/test.yaml") + if [[ -f "$testRepo/$imageTag/test.yaml" ]]; then + CONFIGS+=(--config "$testRepo/$imageTag/test.yaml") + fi + + testKey="$imageId ${CONFIGS[*]}" + if [[ -n "${TESTED_AS[$testKey]:-}" ]]; then + echo "Skipping $image: same image and suites as ${TESTED_AS[$testKey]}" continue fi + TESTED_AS[$testKey]="$image" + echo "==============================================" - echo "Testing: webdevops/$testRepo:$imageTag" + echo "Testing: $image" echo "==============================================" - if [[ -f $testRepo/$imageTag/test.yaml ]]; then - container-structure-test test --image webdevops/$testRepo:$imageTag --config $testRepo/$imageTag/test.yaml --config $testRepo/test.yaml - else - container-structure-test test --image webdevops/$testRepo:$imageTag --config $testRepo/test.yaml - fi + + TESTED=$((TESTED + 1)) + container-structure-test test --image "$image" "${CONFIGS[@]}" || FAILED=1 done done + +if [[ "$TESTED" -eq 0 ]]; then + echo "ERROR: no image was tested. Build at least one tag of these images first: ${SUITES[*]}" >&2 + exit 1 +fi + +echo "Tested $TESTED images" +exit $FAILED diff --git a/tests/testinfra/__init__.py b/tests/testinfra/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/testinfra/conf/app/php-test.php b/tests/testinfra/conf/app/php-test.php deleted file mode 100644 index ed3eb6b80..000000000 --- a/tests/testinfra/conf/app/php-test.php +++ /dev/null @@ -1,30 +0,0 @@ -