Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.env
.env.example
.git
.gitignore
dist
test
docker-compose.yml
LICENSE
README-short.txt
*.md
/.env
/.env.example
/.git
/.gitignore
/dist
/docs
/test
/docker-compose.yml
/LICENSE
/README-short.txt
/*.md
!README.md
**/*.mk
**/Makefile
**/Makefile
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.env
dist
/.env
/dist
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@

Summary of release changes.

### 4.1.1 - 2019-09-28

- Deprecate Makefile target `logs-delayed`; replaced with `logsdef`.
- Updates source image to [2.6.1](https://github.com/jdeathe/centos-ssh/releases/tag/2.6.1).
- Updates `redis40u` packages to 4.0.14-2.
- Updates `test/health_status` helper script with for consistency.
- Updates Makefile target `logs` to accept `[OPTIONS]` (e.g `make -- logs -ft`).
- Updates info/error output for consistency.
- Updates healthcheck failure messages to remove EOL character that is rendered in status response.
- Updates ordering of Tags and respective Dockerfile links in README.md for readability.
- Adds improved test workflow; added `test-setup` target to Makefile.
- Adds Makefile target `logsdef` to handle deferred logs output within a target chain.
- Adds exec proxy function to `redis-server-wrapper` used to pass through nice.
- Adds `/docs` directory for supplementary documentation.
- Fixes validation failure of 0 second --timeout value in `test/health_status`.
- Removes `ENABLE_REDIS_BOOTSTRAP` from docker-compose example configuration.
- Removes `ENABLE_REDIS_WRAPPER` from docker-compose example configuration.

### 4.1.0 - 2019-06-29

- Updates source image to [2.6.0](https://github.com/jdeathe/centos-ssh/releases/tag/2.6.0).
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM jdeathe/centos-ssh:2.6.0
FROM jdeathe/centos-ssh:2.6.1

ARG RELEASE_VERSION="4.1.0"
ARG RELEASE_VERSION="4.1.1"

# ------------------------------------------------------------------------------
# Base install of required packages
# ------------------------------------------------------------------------------
RUN yum -y install \
--setopt=tsflags=nodocs \
--disableplugin=fastestmirror \
redis40u-4.0.14-1.ius.el7 \
redis40u-4.0.14-2.el7.ius \
&& yum versionlock add \
redis40u* \
&& yum clean all
Expand Down
45 changes: 38 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ Targets:
images Show container's image details.
load Loads from the distribution package. Requires
DOCKER_IMAGE_TAG variable.
logs Display log output from the running container.
logs-delayed Display log output from the running container after
backing off for STARTUP_TIME seconds. This can be
necessary when chaining make targets together.
logs [OPTIONS] Display log output from the container.
logsdef Display log output from the container deferred for
STARTUP_TIME seconds. This will work in a chain
unlike the logs target.
logs-delayed [DEPRECATED] Replaced with logsdef.
pause Pause the running container.
pull Pull the release image from the registry. Requires
the DOCKER_IMAGE_TAG variable.
Expand All @@ -45,6 +46,7 @@ Targets:
stop Stop the container when in a running state.
terminate Unpause, stop and remove the container.
test Run all test cases.
test-setup Install test dependencies.
top [ps OPTIONS] Display the running processes of the container.
unpause Unpause the container when in a paused state.

Expand Down Expand Up @@ -161,6 +163,7 @@ endef
_require-docker-image-tag \
_require-docker-release-tag \
_require-package-path \
_require-root \
_test-prerequisites \
_usage \
all \
Expand All @@ -176,6 +179,7 @@ endef
images \
load \
logs \
logsdef \
logs-delayed \
pause \
pull \
Expand All @@ -191,6 +195,7 @@ endef
stop \
terminate \
test \
test-setup \
top \
unpause

Expand Down Expand Up @@ -365,9 +370,17 @@ _require-package-path:
exit 1; \
fi

_require-root:
@ if [[ $${EUID} -ne 0 ]]; \
then \
>&2 printf -- '%sMust be run as root\n' \
"$(PREFIX_STEP_NEGATIVE)"; \
exit 1; \
fi

_test-prerequisites:
ifeq ($(shpec),)
$(error "Please install shpec.")
$(error "Please install shpec. Try: DOCKER_NAME=$(DOCKER_NAME) make test-setup")
endif

_usage:
Expand Down Expand Up @@ -581,14 +594,20 @@ install: | \
logs: \
_prerequisites \
_require-docker-container
@ $(docker) logs $(DOCKER_NAME)
@ $(docker) logs \
$(filter-out $@, $(MAKECMDGOALS)) \
$(DOCKER_NAME)
%:; @:

logs-delayed: \
logsdef: \
_prerequisites \
_require-docker-container
@ sleep $(STARTUP_TIME)
@ $(MAKE) logs

logs-delayed: \
logsdef

load: \
_prerequisites \
_require-docker-release-tag \
Expand Down Expand Up @@ -980,6 +999,18 @@ test: \
"Functional test"
@ SHPEC_ROOT=$(SHPEC_ROOT) $(shpec)

test-setup: \
_require-root
@ printf -- '%s%s\n' \
"$(PREFIX_STEP)" \
"Installing shpec"
@ bash -c "$$(curl -LSs \
https://raw.githubusercontent.com/rylnd/shpec/master/install.sh \
)"
@ ln -sf \
/usr/local/bin/shpec \
/usr/bin/shpec

unpause: \
_prerequisites \
_require-docker-container \
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Tags and respective `Dockerfile` links

- `centos-7-redis40u`,[`4.1.0`](https://github.com/jdeathe/centos-ssh-redis/tree/4.1.0) [(centos-7-redis40u/Dockerfile)](https://github.com/jdeathe/centos-ssh-redis/blob/centos-7-redis40u/Dockerfile)
- `centos-7`,[`3.1.0`](https://github.com/jdeathe/centos-ssh-redis/tree/3.1.0) [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh-redis/blob/centos-7/Dockerfile)
- `centos-6`,[`1.2.0`](https://github.com/jdeathe/centos-ssh-redis/tree/1.2.0) [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-redis/blob/centos-6/Dockerfile)
- [`4.1.1`](https://github.com/jdeathe/centos-ssh-redis/tree/4.1.1),`centos-7-redis40u` [(centos-7-redis40u/Dockerfile)](https://github.com/jdeathe/centos-ssh-redis/blob/centos-7-redis40u/Dockerfile)
- [`3.1.1`](https://github.com/jdeathe/centos-ssh-redis/tree/3.1.1),`centos-7` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh-redis/blob/centos-7/Dockerfile)
- [`1.2.1`](https://github.com/jdeathe/centos-ssh-redis/tree/1.2.1),`centos-6` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-redis/blob/centos-6/Dockerfile)

## Overview

Expand All @@ -25,14 +25,14 @@ $ docker run -d \
--name redis.1 \
-p 6379:6379/tcp \
--sysctl "net.core.somaxconn=1024" \
jdeathe/centos-ssh-redis:4.1.0
jdeathe/centos-ssh-redis:4.1.1
```

Verify the named container's process status and health.

```
$ docker ps -a \
-f "name=redis.1"
-f "name=redis.1"
```

Verify successful initialisation of the named container.
Expand Down Expand Up @@ -63,7 +63,7 @@ In the following example the redis-server service is bound to port 6379 of the d

```
$ docker stop redis.1 && \
docker rm redis.1 && \
docker rm redis.1; \
docker run \
--detach \
--name redis.1 \
Expand All @@ -76,10 +76,10 @@ $ docker stop redis.1 && \
--env "REDIS_MAXMEMORY_SAMPLES=10" \
--env "REDIS_OPTIONS=--loglevel verbose" \
--env "REDIS_TCP_BACKLOG=2048" \
jdeathe/centos-ssh-redis:4.1.0
jdeathe/centos-ssh-redis:4.1.1
```

#### Environment Variables
#### Environment variables

Environment variables are available, as detailed below, to allow the operator to configure a container on run. Environment variable values cannot be changed after running the container; it's a one-shot type setting. If you need to change a value you have to terminate, (i.e stop and remove), and replace the running container.

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ services:
context: "."
dockerfile: "Dockerfile"
environment:
ENABLE_REDIS_BOOTSTRAP: "true"
ENABLE_REDIS_WRAPPER: "true"
REDIS_MAXMEMORY: "${REDIS_MAXMEMORY}"
REDIS_MAXMEMORY_POLICY: "${REDIS_MAXMEMORY_POLICY}"
REDIS_MAXMEMORY_SAMPLES: "${REDIS_MAXMEMORY_SAMPLES}"
Expand Down
13 changes: 13 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Testing

## Functional

The functional test cases are written in [shpec](https://github.com/rylnd/shpec).

To run the tests use the `test` Makefile target after building.

> *Note:* You might need to run via sudo if your environment requires root privileges to run docker.

```
$ make build test
```
2 changes: 1 addition & 1 deletion src/etc/supervisord.d/20-redis-server-bootstrap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ autorestart = false
autostart = %(ENV_ENABLE_REDIS_BOOTSTRAP)s
command = /usr/sbin/redis-server-bootstrap --verbose
priority = 20
startsecs = 0
startretries = 0
startsecs = 0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
stdout_logfile = /dev/stdout
Expand Down
16 changes: 8 additions & 8 deletions src/usr/bin/healthcheck
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ function main ()
if ! ps axo command | grep -qE '^/usr/bin/python /usr/bin/supervisord'
then
>&2 printf -- \
'%s\n' \
"supervisord not running."
'%s' \
"supervisord not running"
exit 1
fi

if [[ ${system_timezone} != "${zone}" ]]
then
>&2 printf -- \
'%s\n' \
"system-timezone zone mismatch."
'%s' \
"system-timezone zone mismatch"
exit 1
fi

Expand All @@ -69,16 +69,16 @@ function main ()
if ! ps axo command | grep -qE '^/usr/bin/redis-server'
then
>&2 printf -- \
'%s\n' \
"redis-server not running."
'%s' \
"redis-server not running"
exit 1
fi

if ! redis-cli PING | grep -qE '^PONG$'
then
>&2 printf -- \
'%s\n' \
"redis-server not responding."
'%s' \
"redis-server not responding"
exit 1
fi
}
Expand Down
7 changes: 4 additions & 3 deletions src/usr/sbin/redis-server-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ function __get_timer_total ()
|| [[ ${timer_start//.} -gt ${timer_end//.} ]]
then
>&2 printf -- \
'ERROR: invalid timer start: %s\n' \
'ERROR: %s invalid timer start: %s\n' \
"${0##*/}" \
"${timer_start}"
printf -- \
'0.000000'
Expand Down Expand Up @@ -289,13 +290,13 @@ function main ()
if [[ -f ${lock_file} ]]
then
>&2 printf -- \
'ERROR: %s lock detected - aborting.\n' \
'ERROR: %s lock detected - aborting\n' \
"${0##*/}"
exit 1
fi

trap "__cleanup" \
INT TERM EXIT
EXIT INT TERM
__create_lock

__set_wrapper_execute_user \
Expand Down
Loading