Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 50da371

Browse files
authored
Merge pull request #274 from jdeathe/centos-7-mysql57-community-develop
Release changes for 2.3.2
2 parents caa66b6 + 75b3062 commit 50da371

File tree

11 files changed

+152
-154
lines changed

11 files changed

+152
-154
lines changed

.dockerignore

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
.env
2-
.env.example
3-
.git
4-
.gitignore
5-
dist
6-
images
7-
test
8-
docker-compose.yml
9-
LICENSE
10-
README-short.txt
11-
*.md
1+
/.env
2+
/.env.example
3+
/.git
4+
/.gitignore
5+
/dist
6+
/docs
7+
/images
8+
/test
9+
/docker-compose.yml
10+
/LICENSE
11+
/README-short.txt
12+
/*.md
1213
!README.md
1314
**/*.mk
14-
**/Makefile
15+
**/Makefile

.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
.env
2-
packages
3-
dist
1+
/.env
2+
/dist

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44

55
Summary of release changes.
66

7+
### 2.3.2 - 2019-09-28
8+
9+
- Deprecate Makefile target `logs-delayed`; replaced with `logsdef`.
10+
- Updates source image to [2.6.1](https://github.com/jdeathe/centos-ssh/releases/tag/2.6.1).
11+
- Updates `mysql-community-server` package to 5.7.27-1.
12+
- Updates `psmisc` package to 22.20-16.
13+
- Updates `test/health_status` helper script with for consistency.
14+
- Updates Makefile target `logs` to accept `[OPTIONS]` (e.g `make -- logs -ft`).
15+
- Updates info/error output for consistency.
16+
- Updates healthcheck failure messages to remove EOL character that is rendered in status response.
17+
- Updates wrapper script; only emit "waiting on" info message if bootstrap hasn't completed.
18+
- Updates ordering of Tags and respective Dockerfile links in README.md for readability.
19+
- Adds improved test workflow; added `test-setup` target to Makefile.
20+
- Adds Makefile target `logsdef` to handle deferred logs output within a target chain.
21+
- Adds `/docs` directory for supplementary documentation.
22+
- Fixes validation failure of 0 second --timeout value in `test/health_status`.
23+
724
### 2.3.1 - 2019-08-23
825

926
- Updates healthcheck script for consistency.

Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM jdeathe/centos-ssh:2.6.0
1+
FROM jdeathe/centos-ssh:2.6.1
22

3-
ARG RELEASE_VERSION="2.3.1"
3+
ARG RELEASE_VERSION="2.3.2"
44

55
# ------------------------------------------------------------------------------
66
# Base install of required packages
@@ -19,11 +19,11 @@ RUN { printf -- \
1919
&& yum -y install \
2020
--setopt=tsflags=nodocs \
2121
--disableplugin=fastestmirror \
22-
mysql-community-client-5.7.26-1.el7 \
23-
mysql-community-common-5.7.26-1.el7 \
24-
mysql-community-libs-5.7.26-1.el7 \
25-
mysql-community-server-5.7.26-1.el7 \
26-
psmisc-22.20-15.el7 \
22+
mysql-community-client-5.7.27-1.el7 \
23+
mysql-community-common-5.7.27-1.el7 \
24+
mysql-community-libs-5.7.27-1.el7 \
25+
mysql-community-server-5.7.27-1.el7 \
26+
psmisc-22.20-16.el7 \
2727
sshpass-1.06-2.el7 \
2828
&& yum versionlock add \
2929
mysql-community-* \

Makefile

+38-7
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ Targets:
2525
images Show container's image details.
2626
load Loads from the distribution package. Requires
2727
DOCKER_IMAGE_TAG variable.
28-
logs Display log output from the running container.
29-
logs-delayed Display log output from the running container after
30-
backing off for STARTUP_TIME seconds. This can be
31-
necessary when chaining make targets together.
28+
logs [OPTIONS] Display log output from the container.
29+
logsdef Display log output from the container deferred for
30+
STARTUP_TIME seconds. This will work in a chain
31+
unlike the logs target.
32+
logs-delayed [DEPRECATED] Replaced with logsdef.
3233
pause Pause the running container.
3334
pull Pull the release image from the registry. Requires
3435
the DOCKER_IMAGE_TAG variable.
@@ -45,6 +46,7 @@ Targets:
4546
stop Stop the container when in a running state.
4647
terminate Unpause, stop and remove the container.
4748
test Run all test cases.
49+
test-setup Install test dependencies.
4850
top [ps OPTIONS] Display the running processes of the container.
4951
unpause Unpause the container when in a paused state.
5052

@@ -161,6 +163,7 @@ endef
161163
_require-docker-image-tag \
162164
_require-docker-release-tag \
163165
_require-package-path \
166+
_require-root \
164167
_test-prerequisites \
165168
_usage \
166169
all \
@@ -176,6 +179,7 @@ endef
176179
images \
177180
load \
178181
logs \
182+
logsdef \
179183
logs-delayed \
180184
pause \
181185
pull \
@@ -191,6 +195,7 @@ endef
191195
stop \
192196
terminate \
193197
test \
198+
test-setup \
194199
top \
195200
unpause
196201

@@ -365,9 +370,17 @@ _require-package-path:
365370
exit 1; \
366371
fi
367372

373+
_require-root:
374+
@ if [[ $${EUID} -ne 0 ]]; \
375+
then \
376+
>&2 printf -- '%sMust be run as root\n' \
377+
"$(PREFIX_STEP_NEGATIVE)"; \
378+
exit 1; \
379+
fi
380+
368381
_test-prerequisites:
369382
ifeq ($(shpec),)
370-
$(error "Please install shpec.")
383+
$(error "Please install shpec. Try: DOCKER_NAME=$(DOCKER_NAME) make test-setup")
371384
endif
372385

373386
_usage:
@@ -581,14 +594,20 @@ install: | \
581594
logs: \
582595
_prerequisites \
583596
_require-docker-container
584-
@ $(docker) logs $(DOCKER_NAME)
597+
@ $(docker) logs \
598+
$(filter-out $@, $(MAKECMDGOALS)) \
599+
$(DOCKER_NAME)
600+
%:; @:
585601

586-
logs-delayed: \
602+
logsdef: \
587603
_prerequisites \
588604
_require-docker-container
589605
@ sleep $(STARTUP_TIME)
590606
@ $(MAKE) logs
591607

608+
logs-delayed: \
609+
logsdef
610+
592611
load: \
593612
_prerequisites \
594613
_require-docker-release-tag \
@@ -980,6 +999,18 @@ test: \
980999
"Functional test"
9811000
@ SHPEC_ROOT=$(SHPEC_ROOT) $(shpec)
9821001

1002+
test-setup: \
1003+
_require-root
1004+
@ printf -- '%s%s\n' \
1005+
"$(PREFIX_STEP)" \
1006+
"Installing shpec"
1007+
@ bash -c "$$(curl -LSs \
1008+
https://raw.githubusercontent.com/rylnd/shpec/master/install.sh \
1009+
)"
1010+
@ ln -sf \
1011+
/usr/local/bin/shpec \
1012+
/usr/bin/shpec
1013+
9831014
unpause: \
9841015
_prerequisites \
9851016
_require-docker-container \

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Tags and respective `Dockerfile` links
22

3-
- `centos-7-mysql57-community`, [`2.3.1`](https://github.com/jdeathe/centos-ssh-mysql/tree/2.3.1) [(centos-7-mysql57-community/Dockerfile)](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-7-mysql57-community/Dockerfile)
4-
- `centos-6`, [`1.11.1`](https://github.com/jdeathe/centos-ssh-mysql/tree/1.11.1) [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-6/Dockerfile)
3+
- [`2.3.2`](https://github.com/jdeathe/centos-ssh-mysql/tree/2.3.2), `centos-7-mysql57-community` [(centos-7-mysql57-community/Dockerfile)](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-7-mysql57-community/Dockerfile)
4+
- [`1.11.2`](https://github.com/jdeathe/centos-ssh-mysql/tree/1.11.2), `centos-6` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-mysql/blob/centos-6/Dockerfile)
55

66
## Overview
77

@@ -25,7 +25,7 @@ $ docker run -d \
2525
--name mysql.1 \
2626
-p 3306:3306 \
2727
-v /var/lib/mysql \
28-
jdeathe/centos-ssh-mysql:2.3.1
28+
jdeathe/centos-ssh-mysql:2.3.2
2929
```
3030

3131
Verify the named container's process status and health.
@@ -114,7 +114,7 @@ $ docker stop mysql.1 && \
114114
--env "MYSQL_USER_PASSWORD=" \
115115
--env "MYSQL_USER_DATABASE=app-db" \
116116
--volume mysql.1.data-mysql:/var/lib/mysql \
117-
jdeathe/centos-ssh-mysql:2.3.1
117+
jdeathe/centos-ssh-mysql:2.3.2
118118
```
119119

120120
The environmental variable `MYSQL_SUBNET` is optional but can be used to generate users with access to databases outside the `localhost`, (the default for the root user). In the example, the subnet definition `0.0.0.0/0.0.0.0` allows connections from any network which is equivalent to the wildcard symbol, `%`, in MySQL GRANT definitions.

docs/testing.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Testing
2+
3+
## Functional
4+
5+
The functional test cases are written in [shpec](https://github.com/rylnd/shpec).
6+
7+
To run the tests use the `test` Makefile target after building.
8+
9+
> *Note:* You might need to run via sudo if your environment requires root privileges to run docker.
10+
11+
```
12+
$ make build test
13+
```

src/usr/bin/healthcheck

+17-61
Original file line numberDiff line numberDiff line change
@@ -130,45 +130,6 @@ function __mysql_get_option ()
130130
"${value:-$3}"
131131
}
132132

133-
function __print_message ()
134-
{
135-
local -r quiet="${quiet:-false}"
136-
local -r type="${1:-}"
137-
138-
local message="${2:-}"
139-
local prefix
140-
141-
case "${type}" in
142-
error)
143-
prefix="ERROR: "
144-
;;
145-
info)
146-
prefix="INFO: "
147-
;;
148-
*)
149-
message="${type}"
150-
;;
151-
esac
152-
153-
if [[ ${quiet} == true ]] \
154-
&& [[ ${type} != error ]]
155-
then
156-
return 0
157-
elif [[ ${quiet} == true ]] \
158-
&& [[ ${type} == error ]]
159-
then
160-
>&2 printf -- \
161-
'%s%s\n' \
162-
"${prefix}" \
163-
"${message}"
164-
else
165-
printf -- \
166-
'%s%s\n' \
167-
"${prefix}" \
168-
"${message}"
169-
fi
170-
}
171-
172133
function __record_exit_status ()
173134
{
174135
local -r status_directory="${status_path%/*}"
@@ -255,14 +216,14 @@ function main ()
255216
__usage
256217
break
257218
;;
258-
-i)
259-
interval="${2}"
260-
shift 2 || break
261-
;;
262219
--interval=*)
263220
interval="${1#*=}"
264221
shift 1
265222
;;
223+
-i|--interval)
224+
interval="${2}"
225+
shift 2 || break
226+
;;
266227
-q|--quiet)
267228
quiet="true"
268229
shift 1
@@ -275,26 +236,24 @@ function main ()
275236

276237
if [[ ! ${interval} =~ ${pattern_seconds_in_minute} ]]
277238
then
278-
__print_message \
279-
"error" \
280-
"Invalid interval."
239+
>&2 printf -- \
240+
'ERROR: %s invalid interval' \
241+
"${0##*/}"
281242
exit 1
282243
fi
283244

284245
if ! ps axo command \
285246
| grep -qE '^/usr/bin/python /usr/bin/supervisord'
286247
then
287-
__print_message \
288-
"error" \
289-
"supervisord not running."
248+
>&2 printf -- \
249+
"supervisord not running"
290250
exit 1
291251
fi
292252

293253
if [[ ${system_timezone} != "${zone}" ]]
294254
then
295-
__print_message \
296-
"error" \
297-
"system-timezone zone mismatch."
255+
>&2 printf -- \
256+
"system-timezone zone mismatch"
298257
exit 1
299258
fi
300259

@@ -303,9 +262,8 @@ function main ()
303262
if [[ -f /var/lock/subsys/mysqld-bootstrap ]] \
304263
|| ! __is_mysql_data_directory_populated
305264
then
306-
__print_message \
307-
"error" \
308-
"Bootstrap failed to complete."
265+
>&2 printf -- \
266+
"bootstrap failed to complete"
309267
exit 1
310268
fi
311269
fi
@@ -315,9 +273,8 @@ function main ()
315273
if ! ps axo command \
316274
| grep -qE "^${mysqld} "
317275
then
318-
__print_message \
319-
"error" \
320-
"Service process not running."
276+
>&2 printf -- \
277+
"service process not running"
321278
exit 1
322279
fi
323280

@@ -337,9 +294,8 @@ function main ()
337294

338295
if ! __have_mysql_access
339296
then
340-
__print_message \
341-
"error" \
342-
"root@localhost access failed."
297+
>&2 printf -- \
298+
"root@localhost access failed"
343299
exit 1
344300
fi
345301
fi

src/usr/sbin/mysqld-wrapper

+2-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ function main ()
150150
__get_proxy
151151
)"
152152

153-
if [[ ${verbose} == true ]]
153+
if [[ ${verbose} == true ]] \
154+
&& [[ ! -f ${bootstrap_state_file} ]]
154155
then
155156
printf -- \
156157
'INFO: %s waiting on %s\n' \

0 commit comments

Comments
 (0)