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

Commit 8b4b011

Browse files
authored
Merge pull request #39 from jdeathe/issue/36
CLOSES #36: Updates upstream source to 2.5.1.
2 parents be4adb2 + 5ccba22 commit 8b4b011

File tree

7 files changed

+76
-73
lines changed

7 files changed

+76
-73
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ Summary of release changes for Version 2.
66

77
CentOS-7 7.5.1804 x86_64 - Redis 4.0.
88

9+
### 2.1.1 - Unreleased
10+
11+
- Updates source image to [2.5.1](https://github.com/jdeathe/centos-ssh/releases/tag/2.5.1).
12+
- Updates Dockerfile with combined ADD to reduce layer count in final image.
13+
- Fixes binary paths in systemd unit files for compatibility with both EL and Ubuntu hosts.
14+
- Adds improvement to pull logic in systemd unit install template.
15+
- Adds `SSH_AUTOSTART_SUPERVISOR_STDOUT` with a value "false", disabling startup of `supervisor_stdout`.
16+
- Adds improved `healtchcheck` script.
17+
918
### 2.1.0 - 2019-02-17
1019

1120
- Updates source image to [2.5.0](https://github.com/jdeathe/centos-ssh/releases/tag/2.5.0).

Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jdeathe/centos-ssh:2.5.0
1+
FROM jdeathe/centos-ssh:2.5.1
22

33
ARG RELEASE_VERSION="2.1.0"
44

@@ -16,12 +16,7 @@ RUN yum -y install \
1616
# ------------------------------------------------------------------------------
1717
# Copy files into place
1818
# ------------------------------------------------------------------------------
19-
ADD src/etc \
20-
/etc/
21-
ADD src/opt/scmi \
22-
/opt/scmi/
23-
ADD src/usr \
24-
/usr/
19+
ADD src /
2520

2621
# ------------------------------------------------------------------------------
2722
# Provisioning
@@ -62,7 +57,8 @@ ENV REDIS_AUTOSTART_REDIS_BOOTSTRAP="true" \
6257
REDIS_OPTIONS="" \
6358
REDIS_TCP_BACKLOG="1024" \
6459
SSH_AUTOSTART_SSHD="false" \
65-
SSH_AUTOSTART_SSHD_BOOTSTRAP="false"
60+
SSH_AUTOSTART_SSHD_BOOTSTRAP="false" \
61+
SSH_AUTOSTART_SUPERVISOR_STDOUT="false"
6662

6763
# ------------------------------------------------------------------------------
6864
# Set image metadata
@@ -101,4 +97,4 @@ HEALTHCHECK \
10197
--retries=4 \
10298
CMD ["/usr/bin/healthcheck"]
10399

104-
CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisord.conf"]
100+
CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisord.conf"]
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[program:redis-server-bootstrap]
2-
priority = 6
3-
command = /usr/sbin/redis-server-bootstrap --verbose
2+
autorestart = false
43
autostart = %(ENV_REDIS_AUTOSTART_REDIS_BOOTSTRAP)s
4+
command = /usr/sbin/redis-server-bootstrap --verbose
5+
priority = 6
6+
redirect_stderr = true
57
startsecs = 0
68
startretries = 0
7-
autorestart = false
8-
redirect_stderr = true
99
stdout_logfile = /dev/stdout
10-
stdout_logfile_maxbytes = 0
10+
stdout_logfile_maxbytes = 0
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[program:redis-server-wrapper]
2-
priority = 100
3-
command = /usr/sbin/redis-server-wrapper
4-
autostart = %(ENV_REDIS_AUTOSTART_REDIS_WRAPPER)s
5-
startsecs = 0
62
autorestart = true
3+
autostart = %(ENV_REDIS_AUTOSTART_REDIS_WRAPPER)s
4+
command = /usr/sbin/redis-server-wrapper
5+
priority = 100
76
redirect_stderr = true
7+
startsecs = 0
88
stdout_logfile = /dev/stdout
99
stdout_logfile_maxbytes = 0
10-
user = redis
10+
user = redis

src/etc/systemd/system/centos-ssh-redis.register@.service

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#
3636
# To uninstall:
3737
# sudo systemctl disable -f {service-unit-instance-name}
38+
# sudo systemctl daemon-reload
3839
# sudo rm /etc/systemd/system/{service-unit-template-name}
3940
# sudo systemctl daemon-reload
4041
# ------------------------------------------------------------------------------
@@ -91,7 +92,7 @@ ExecStart=/bin/bash -c \
9192
\"$(/usr/bin/docker port \
9293
{{SERVICE_UNIT_NAME}}.%i \
9394
6379 \
94-
| /usr/bin/sed 's~^[0-9.]*:~~' \
95+
| /bin/sed 's~^[0-9.]*:~~' \
9596
)\" \
9697
--ttl ${REGISTER_TTL} 2> /dev/null; \
9798
fi; \
@@ -104,7 +105,7 @@ ExecStart=/bin/bash -c \
104105
\"$(/usr/bin/docker port \
105106
{{SERVICE_UNIT_NAME}}.%i \
106107
6379 \
107-
| /usr/bin/sed 's~^[0-9.]*:~~' \
108+
| /bin/sed 's~^[0-9.]*:~~' \
108109
)\" \
109110
--ttl ${REGISTER_TTL} 2> /dev/null; \
110111
fi; \
@@ -129,15 +130,15 @@ ExecStart=/bin/bash -c \
129130
${REGISTER_KEY_ROOT}/ports/tcp/6379 \
130131
&> /dev/null; \
131132
then \
132-
echo set; \
133+
printf -- 'set\n'; \
133134
else \
134-
echo update; \
135+
printf -- 'update\n'; \
135136
fi) \
136137
${REGISTER_KEY_ROOT}/ports/tcp/6379 \
137138
\"$(/usr/bin/docker port \
138139
{{SERVICE_UNIT_NAME}}.%i \
139140
6379 \
140-
| /usr/bin/sed 's~^[0-9.]*:~~' \
141+
| /bin/sed 's~^[0-9.]*:~~' \
141142
)\" \
142143
--ttl ${REGISTER_TTL}; \
143144
/usr/bin/etcdctl \
@@ -148,15 +149,15 @@ ExecStart=/bin/bash -c \
148149
${REGISTER_KEY_ROOT}/ports/udp/6379 \
149150
&> /dev/null; \
150151
then \
151-
echo set; \
152+
printf -- 'set\n'; \
152153
else \
153-
echo update; \
154+
printf -- 'update\n'; \
154155
fi) \
155156
${REGISTER_KEY_ROOT}/ports/udp/6379 \
156157
\"$(/usr/bin/docker port \
157158
{{SERVICE_UNIT_NAME}}.%i \
158159
6379 \
159-
| /usr/bin/sed 's~^[0-9.]*:~~' \
160+
| /bin/sed 's~^[0-9.]*:~~' \
160161
)\" \
161162
--ttl ${REGISTER_TTL}; \
162163
fi; \
@@ -168,9 +169,9 @@ ExecStart=/bin/bash -c \
168169
${REGISTER_KEY_ROOT}/hostname \
169170
&> /dev/null; \
170171
then \
171-
echo set; \
172+
printf -- 'set\n'; \
172173
else \
173-
echo update; \
174+
printf -- 'update\n'; \
174175
fi) \
175176
${REGISTER_KEY_ROOT}/hostname \
176177
%H \

src/etc/systemd/system/centos-ssh-redis@.service

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@
2626
# sudo systemctl enable -f {service-unit-instance-name}
2727
#
2828
# Start using:
29-
# sudo systemctl [start|stop|restart|kill|status] {service-unit-instance-name}
29+
# sudo systemctl [start|stop|restart|kill|status] \
30+
# {service-unit-instance-name}
3031
#
3132
# Debugging:
3233
# sudo systemctl status {service-unit-instance-name}
3334
# journalctl -fn 50 -u {service-unit-instance-name}
3435
#
3536
# To uninstall:
3637
# sudo systemctl disable -f {service-unit-instance-name}
38+
# sudo systemctl daemon-reload
3739
# sudo systemctl stop {service-unit-instance-name}
3840
# sudo rm /etc/systemd/system/{service-unit-template-name}
3941
# sudo docker rm -f {service-unit-long-name}
@@ -68,20 +70,12 @@ Environment="SYSCTL_NET_IPV4_ROUTE_FLUSH=1"
6870

6971
# Initialisation: Load image from local storage if available, otherwise pull.
7072
ExecStartPre=/bin/bash -c \
71-
"if [[ -z $( \
72-
if [[ -n $(/usr/bin/docker images -q \
73-
${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
74-
) ]]; \
75-
then \
76-
echo $(/usr/bin/docker images -q \
77-
${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
78-
); \
79-
else \
80-
echo $(/usr/bin/docker images -q \
81-
docker.io/${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
82-
); \
83-
fi; \
84-
) ]]; \
73+
"if [[ -z \"$(/usr/bin/docker images -q \
74+
${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
75+
)\" ]] \
76+
&& [[ -z \"$(/usr/bin/docker images -q \
77+
docker.io/${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
78+
)\" ]]; \
8579
then \
8680
if [[ -f ${DOCKER_IMAGE_PACKAGE_PATH}/${DOCKER_USER}/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz ]]; \
8781
then \
@@ -146,7 +140,7 @@ ExecStart=/bin/bash -c \
146140
<<< \"${DOCKER_PORT_MAP_TCP_6379}\"; \
147141
&& /usr/bin/grep -qE \
148142
'^.+\.[0-9]+(\.[0-9]+)?$' \
149-
<<< "${DOCKER_NAME}"
143+
<<< %p.%i; \
150144
then \
151145
printf -- '--publish %%s%%s:6379/tcp' \
152146
$(\

src/usr/bin/healthcheck

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,38 @@
22

33
set -e
44

5-
if ! ps axo command | grep -qE '^/usr/bin/python /usr/bin/supervisord'
6-
then
7-
>&2 printf -- \
8-
'%s\n' \
9-
"supervisord not running."
10-
exit 1
11-
fi
5+
function main ()
6+
{
7+
if ! ps axo command | grep -qE '^/usr/bin/python /usr/bin/supervisord'
8+
then
9+
>&2 printf -- \
10+
'%s\n' \
11+
"supervisord not running."
12+
exit 1
13+
fi
1214

13-
# Client only mode
14-
if [[ ! ${REDIS_AUTOSTART_REDIS_BOOTSTRAP} == true ]] \
15-
|| [[ ! ${REDIS_AUTOSTART_REDIS_WRAPPER} == true ]]
16-
then
17-
exit 0
18-
fi
15+
# Client only mode
16+
if [[ ! ${REDIS_AUTOSTART_REDIS_BOOTSTRAP} == true ]] \
17+
|| [[ ! ${REDIS_AUTOSTART_REDIS_WRAPPER} == true ]]
18+
then
19+
exit 0
20+
fi
1921

20-
if ! ps axo command | grep -qE '^/usr/bin/redis-server'
21-
then
22-
>&2 printf -- \
23-
'%s\n' \
24-
"redis-server not running."
25-
exit 1
26-
fi
22+
if ! ps axo command | grep -qE '^/usr/bin/redis-server'
23+
then
24+
>&2 printf -- \
25+
'%s\n' \
26+
"redis-server not running."
27+
exit 1
28+
fi
2729

28-
if ! redis-cli PING | grep -qE '^PONG$'
29-
then
30-
>&2 printf -- \
31-
'%s\n' \
32-
"redis-server not responding."
33-
exit 1
34-
fi
30+
if ! redis-cli PING | grep -qE '^PONG$'
31+
then
32+
>&2 printf -- \
33+
'%s\n' \
34+
"redis-server not responding."
35+
exit 1
36+
fi
37+
}
3538

36-
exit 0
39+
main "${@}"

0 commit comments

Comments
 (0)