From 19751d1bb22c94cb4d1fa16138a0e04d1f4c7357 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 18 Nov 2019 14:34:19 -0800 Subject: [PATCH 1/5] Removed PHP CLI memory limit --- 7.1/config/php/zz-php.ini | 2 +- 7.2/config/php/zz-php.ini | 2 +- 7.3/config/php/zz-php.ini | 2 +- tests/test.bats | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/7.1/config/php/zz-php.ini b/7.1/config/php/zz-php.ini index 2ef39cd7..c653442d 100644 --- a/7.1/config/php/zz-php.ini +++ b/7.1/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use zz-php-fpm.conf [php] -memory_limit = 1024M +memory_limit = -1 max_execution_time = 600 date.timezone = UTC display_errors = On diff --git a/7.2/config/php/zz-php.ini b/7.2/config/php/zz-php.ini index 2ef39cd7..c653442d 100644 --- a/7.2/config/php/zz-php.ini +++ b/7.2/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use zz-php-fpm.conf [php] -memory_limit = 1024M +memory_limit = -1 max_execution_time = 600 date.timezone = UTC display_errors = On diff --git a/7.3/config/php/zz-php.ini b/7.3/config/php/zz-php.ini index 2ef39cd7..c653442d 100644 --- a/7.3/config/php/zz-php.ini +++ b/7.3/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use zz-php-fpm.conf [php] -memory_limit = 1024M +memory_limit = -1 max_execution_time = 600 date.timezone = UTC display_errors = On diff --git a/tests/test.bats b/tests/test.bats index e3f6e501..c96593dd 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -156,7 +156,7 @@ _healthcheck_wait () unset output output=$(echo "$phpInfo" | grep "memory_limit") - echo "$output" | grep "1024M => 1024M" + echo "$output" | grep "-1 => -1" unset output output=$(echo "$phpInfo" | grep "sendmail_path") From f1ec0cce68a2ece11e75b095e4a493bf90fb83a3 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 18 Nov 2019 15:12:45 -0800 Subject: [PATCH 2/5] Fixed memory_limit grep in tests --- tests/test.bats | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test.bats b/tests/test.bats index c96593dd..3c94731b 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -156,7 +156,9 @@ _healthcheck_wait () unset output output=$(echo "$phpInfo" | grep "memory_limit") - echo "$output" | grep "-1 => -1" + # grep expression cannot start with "-", so prepending the expression with "memory_limit" here. + # Another option is to do "grep -- '-...'". + echo "$output" | grep "memory_limit => -1 => -1" unset output output=$(echo "$phpInfo" | grep "sendmail_path") From 75851d243973d429f0e5f5f63008a8c4ac52fdbc Mon Sep 17 00:00:00 2001 From: Sergey Zabolotny Date: Wed, 20 Nov 2019 16:08:54 +0200 Subject: [PATCH 3/5] Update makefile and deploy script --- .travis.yml | 3 ++- 7.1/Makefile | 7 +++++-- 7.2/Makefile | 7 +++++-- 7.3/Makefile | 7 +++++-- scripts/docker-push.sh | 32 +++++++++++++------------------- 5 files changed, 30 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8689556a..078c8230 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,8 @@ script: after_success: - docker image ls - - ${TRAVIS_BUILD_DIR}/scripts/docker-push.sh + - make release + - make APPENDIX="php${VERSION}-ide" release after_failure: - cd ${TRAVIS_BUILD_DIR}/${VERSION} && make logs diff --git a/7.1/Makefile b/7.1/Makefile index 4dccddaa..d4392c33 100644 --- a/7.1/Makefile +++ b/7.1/Makefile @@ -2,6 +2,7 @@ -include env_make VERSION ?= 7.1 +APPENDIX ?= php$(VERSION) REPO = docksal/cli TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) @@ -10,6 +11,8 @@ CWD = $(shell pwd) # Improve write performance for /home/docker by turning it into a volume VOLUMES += -v /home/docker +.EXPORT_ALL_VARIABLES: + .PHONY: build test push shell run start stop logs clean release build: @@ -50,7 +53,7 @@ logs-follow: clean: docker rm -vf $(NAME) >/dev/null 2>&1 || true -release: build - make push -e TAG=$(TAG) +release: + @../scripts/docker-push.sh default: build diff --git a/7.2/Makefile b/7.2/Makefile index 44cf6856..7c3166d3 100644 --- a/7.2/Makefile +++ b/7.2/Makefile @@ -2,6 +2,7 @@ -include env_make VERSION ?= 7.2 +APPENDIX ?= php$(VERSION) REPO = docksal/cli TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) @@ -10,6 +11,8 @@ CWD = $(shell pwd) # Improve write performance for /home/docker by turning it into a volume VOLUMES += -v /home/docker +.EXPORT_ALL_VARIABLES: + .PHONY: build test push shell run start stop logs clean release build: @@ -50,7 +53,7 @@ logs-follow: clean: docker rm -vf $(NAME) >/dev/null 2>&1 || true -release: build - make push -e TAG=$(TAG) +release: + @../scripts/docker-push.sh default: build diff --git a/7.3/Makefile b/7.3/Makefile index 913fb83b..7d0453b6 100644 --- a/7.3/Makefile +++ b/7.3/Makefile @@ -2,6 +2,7 @@ -include env_make VERSION ?= 7.3 +APPENDIX ?= php$(VERSION) REPO = docksal/cli TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) @@ -10,6 +11,8 @@ CWD = $(shell pwd) # Improve write performance for /home/docker by turning it into a volume VOLUMES += -v /home/docker +.EXPORT_ALL_VARIABLES: + .PHONY: build test push shell run start stop logs clean release build: @@ -50,7 +53,7 @@ logs-follow: clean: docker rm -vf $(NAME) >/dev/null 2>&1 || true -release: build - make push -e TAG=$(TAG) +release: + @../scripts/docker-push.sh default: build diff --git a/scripts/docker-push.sh b/scripts/docker-push.sh index c8724c9d..59097710 100755 --- a/scripts/docker-push.sh +++ b/scripts/docker-push.sh @@ -40,27 +40,23 @@ tag_and_push () echo "Pushing ${target} image ..." docker tag ${source} ${target} docker push ${target} - - # Cloud9 flavor - echo "Pushing ${target}-ide image ..." - docker tag ${source}-ide ${target}-ide - docker push ${target}-ide } # ---------------------------- # # Possible docker image tags -IMAGE_TAG_EDGE="edge-php${VERSION}" -IMAGE_TAG_STABLE="php${VERSION}" +IMAGE_TAG_EDGE="edge${APPENDIX:+-${APPENDIX}}" +IMAGE_TAG_STABLE="stable${APPENDIX:+-${APPENDIX}}" # Read the split parts IFS='.' read -a ver_arr <<< "$TRAVIS_TAG" -# Major version, e.g. 2-php7.2 -IMAGE_TAG_RELEASE_MAJOR="${ver_arr[0]#v*}-php${VERSION}" +# Major version, e.g. 2[-APPENDIX] +# APPENDIX may be php version php7.3 for example +IMAGE_TAG_RELEASE_MAJOR="${ver_arr[0]#v*}${APPENDIX:+-${APPENDIX}}" -# Major-minor version, e.g. 2.5-php7.2 -IMAGE_TAG_RELEASE_MAJOR_MINOR="${ver_arr[0]#v*}.${ver_arr[1]}-php${VERSION}" +# Major-minor version, e.g. 2.7[-APPENDIX] +IMAGE_TAG_RELEASE_MAJOR_MINOR="${ver_arr[0]#v*}.${ver_arr[1]}${APPENDIX:+-${APPENDIX}}" IMAGE_TAG_LATEST="latest" # Skip pull request builds @@ -70,14 +66,14 @@ docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}" # Push images if is_edge; then - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_EDGE} # Example tag: edge-php7.3 + tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_EDGE} # Example tag: edge[-APPENDIX] elif is_stable; then - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: php7.3 + tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: stable[-APPENDIX] elif is_release; then # Have stable, major, minor tags match - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: php7.3 - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} # Example tag: 2-php7.3 - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} # Example tag: 2.7-php7.3 + tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: stable[-APPENDIX] + tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} # Example tag: 2[-APPENDIX] + tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} # Example tag: 2.7[-APPENDIX] else # Exit if not on develop, master or release tag exit @@ -86,7 +82,5 @@ fi # Special case for the "latest" tag # Push (base image only) on stable and release builds if is_latest && (is_stable || is_release); then - echo "Pushing ${REPO}:${IMAGE_TAG_LATEST} image ..." - docker tag ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_LATEST} - docker push ${REPO}:${IMAGE_TAG_LATEST} + tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_LATEST} fi From 41e5a2b9b11cbd24b2ddf7fb2b73db0544e9a3ab Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 21 Nov 2019 10:22:14 -0800 Subject: [PATCH 4/5] Cosmetic refactoring in Makefile and docker-push.sh script - Renamed APPENDIX to TAG_APPENDIX - Grouped IMAGE_TAG variables so they can all be easily seen in one place --- 7.1/Makefile | 14 +++++++------- 7.2/Makefile | 14 +++++++------- 7.3/Makefile | 14 +++++++------- scripts/docker-push.sh | 32 +++++++++++++++----------------- 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/7.1/Makefile b/7.1/Makefile index d4392c33..72d0ee68 100644 --- a/7.1/Makefile +++ b/7.1/Makefile @@ -2,9 +2,9 @@ -include env_make VERSION ?= 7.1 -APPENDIX ?= php$(VERSION) +TAG_APPENDIX ?= -php$(VERSION) +BUILD_TAG = build-$(TAG_APPENDIX) REPO = docksal/cli -TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) CWD = $(shell pwd) @@ -16,19 +16,19 @@ VOLUMES += -v /home/docker .PHONY: build test push shell run start stop logs clean release build: - docker build --cache-from=$(REPO):edge-php$(VERSION) -t $(REPO):$(TAG) . + docker build --cache-from=$(REPO):edge$(TAG_APPENDIX) -t $(REPO):$(BUILD_TAG) . test: - IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + IMAGE=$(REPO):$(BUILD_TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats push: - docker push $(REPO):$(TAG) + docker push $(REPO):$(BUILD_TAG) run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) start: clean - docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) # Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) exec: diff --git a/7.2/Makefile b/7.2/Makefile index 7c3166d3..e127bccc 100644 --- a/7.2/Makefile +++ b/7.2/Makefile @@ -2,9 +2,9 @@ -include env_make VERSION ?= 7.2 -APPENDIX ?= php$(VERSION) +TAG_APPENDIX ?= -php$(VERSION) +BUILD_TAG = build-$(TAG_APPENDIX) REPO = docksal/cli -TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) CWD = $(shell pwd) @@ -16,19 +16,19 @@ VOLUMES += -v /home/docker .PHONY: build test push shell run start stop logs clean release build: - docker build --cache-from=$(REPO):edge-php$(VERSION) -t $(REPO):$(TAG) . + docker build --cache-from=$(REPO):edge$(TAG_APPENDIX) -t $(REPO):$(BUILD_TAG) . test: - IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + IMAGE=$(REPO):$(BUILD_TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats push: - docker push $(REPO):$(TAG) + docker push $(REPO):$(BUILD_TAG) run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) start: clean - docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) # Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) exec: diff --git a/7.3/Makefile b/7.3/Makefile index 7d0453b6..0d425226 100644 --- a/7.3/Makefile +++ b/7.3/Makefile @@ -2,9 +2,9 @@ -include env_make VERSION ?= 7.3 -APPENDIX ?= php$(VERSION) +TAG_APPENDIX ?= -php$(VERSION) +BUILD_TAG = build-$(TAG_APPENDIX) REPO = docksal/cli -TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) CWD = $(shell pwd) @@ -16,19 +16,19 @@ VOLUMES += -v /home/docker .PHONY: build test push shell run start stop logs clean release build: - docker build --cache-from=$(REPO):edge-php$(VERSION) -t $(REPO):$(TAG) . + docker build --cache-from=$(REPO):edge$(TAG_APPENDIX) -t $(REPO):$(BUILD_TAG) . test: - IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + IMAGE=$(REPO):$(BUILD_TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats push: - docker push $(REPO):$(TAG) + docker push $(REPO):$(BUILD_TAG) run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) start: clean - docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) # Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) exec: diff --git a/scripts/docker-push.sh b/scripts/docker-push.sh index 59097710..de955b29 100755 --- a/scripts/docker-push.sh +++ b/scripts/docker-push.sh @@ -44,19 +44,17 @@ tag_and_push () # ---------------------------- # -# Possible docker image tags -IMAGE_TAG_EDGE="edge${APPENDIX:+-${APPENDIX}}" -IMAGE_TAG_STABLE="stable${APPENDIX:+-${APPENDIX}}" - -# Read the split parts +# Extract version parts from release tag IFS='.' read -a ver_arr <<< "$TRAVIS_TAG" +VERSION_MAJOR=${ver_arr[0]#v*} # 2.7.0 => "2" +VERSION_MINOR=${ver_arr[1]} # "2.7.0" => "7" -# Major version, e.g. 2[-APPENDIX] -# APPENDIX may be php version php7.3 for example -IMAGE_TAG_RELEASE_MAJOR="${ver_arr[0]#v*}${APPENDIX:+-${APPENDIX}}" - -# Major-minor version, e.g. 2.7[-APPENDIX] -IMAGE_TAG_RELEASE_MAJOR_MINOR="${ver_arr[0]#v*}.${ver_arr[1]}${APPENDIX:+-${APPENDIX}}" +# Possible docker image tags +# "image:tag" pattern: :[-][-] +IMAGE_TAG_EDGE="edge${TAG_APPENDIX}" # e.g., edge[APPENDIX] +IMAGE_TAG_STABLE="stable${TAG_APPENDIX}" # e.g., stable[APPENDIX] +IMAGE_TAG_RELEASE_MAJOR="${VERSION_MAJOR}${TAG_APPENDIX}" # e.g., 2[APPENDIX] +IMAGE_TAG_RELEASE_MAJOR_MINOR="${VERSION_MAJOR}.${VERSION_MINOR}${TAG_APPENDIX}" # e.g., 2.7[APPENDIX] IMAGE_TAG_LATEST="latest" # Skip pull request builds @@ -66,14 +64,14 @@ docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}" # Push images if is_edge; then - tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_EDGE} # Example tag: edge[-APPENDIX] + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_EDGE} elif is_stable; then - tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: stable[-APPENDIX] + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_STABLE} elif is_release; then # Have stable, major, minor tags match - tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: stable[-APPENDIX] - tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} # Example tag: 2[-APPENDIX] - tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} # Example tag: 2.7[-APPENDIX] + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_STABLE} + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} else # Exit if not on develop, master or release tag exit @@ -82,5 +80,5 @@ fi # Special case for the "latest" tag # Push (base image only) on stable and release builds if is_latest && (is_stable || is_release); then - tag_and_push ${REPO}:${TAG} ${REPO}:${IMAGE_TAG_LATEST} + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_LATEST} fi From cabb95ec6ae5b1e1249cee43feaaa19fb858080d Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 21 Nov 2019 10:23:19 -0800 Subject: [PATCH 5/5] Dropped ide flavor from travis.yml IDE is now part of the main image --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 078c8230..5a631ab7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,6 @@ script: after_success: - docker image ls - make release - - make APPENDIX="php${VERSION}-ide" release after_failure: - cd ${TRAVIS_BUILD_DIR}/${VERSION} && make logs