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

Commit d8fd43a

Browse files
authored
Merge pull request #100 from jdeathe/centos-7-develop
Release changes for 2.2.1
2 parents 9cf3f38 + a800018 commit d8fd43a

File tree

9 files changed

+108
-89
lines changed

9 files changed

+108
-89
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
.env
2+
.env.example
13
.git
24
.gitignore
35
dist
46
test
7+
docker-compose.yml
58
LICENSE
69
README-short.txt
710
*.md

CHANGELOG.md

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

77
CentOS-7 7.5.1804 x86_64 - Memcached 1.4.
88

9+
### 2.2.1 - 2019-03-20
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` and `memcached-wrapper` scripts.
17+
- Adds `docker-compose.yml` to `.dockerignore`.
18+
919
### 2.2.0 - 2019-02-12
1020

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

Dockerfile

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

3-
ARG RELEASE_VERSION="2.2.0"
3+
ARG RELEASE_VERSION="2.2.1"
44

55
# ------------------------------------------------------------------------------
66
# Base install of required packages
@@ -20,15 +20,11 @@ RUN rpm --rebuilddb \
2020
# ------------------------------------------------------------------------------
2121
# Copy files into place
2222
# ------------------------------------------------------------------------------
23-
ADD src/etc \
24-
/etc/
25-
ADD src/opt/scmi \
26-
/opt/scmi/
27-
ADD src/usr \
28-
/usr/
23+
ADD src /
2924

3025
# ------------------------------------------------------------------------------
3126
# Provisioning
27+
# - Replace placeholders with values in systemd service unit template
3228
# - Set permissions
3329
# ------------------------------------------------------------------------------
3430
RUN sed -i \
@@ -49,7 +45,8 @@ ENV MEMCACHED_AUTOSTART_MEMCACHED_WRAPPER="true" \
4945
MEMCACHED_MAXCONN="1024" \
5046
MEMCACHED_OPTIONS="-U 0" \
5147
SSH_AUTOSTART_SSHD="false" \
52-
SSH_AUTOSTART_SSHD_BOOTSTRAP="false"
48+
SSH_AUTOSTART_SSHD_BOOTSTRAP="false" \
49+
SSH_AUTOSTART_SUPERVISOR_STDOUT="false"
5350

5451
# ------------------------------------------------------------------------------
5552
# Set image metadata
@@ -88,4 +85,4 @@ HEALTHCHECK \
8885
--retries=4 \
8986
CMD ["/usr/bin/healthcheck"]
9087

91-
CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisord.conf"]
88+
CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisord.conf"]

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Docker Image including:
88

99
## Overview & links
1010

11-
The latest CentOS-6 / CentOS-7 based releases can be pulled from the `centos-6` / `centos-7` Docker tags respectively. For production use it is recommended to select a specific release tag - the convention is `centos-6-1.3.0` OR `1.3.0` for the [1.3.0](https://github.com/jdeathe/centos-ssh-memcached/tree/1.3.0) release tag and `centos-7-2.2.0` OR `2.2.0` for the [2.2.0](https://github.com/jdeathe/centos-ssh/tree/2.2.0) release tag.
11+
The latest CentOS-6 / CentOS-7 based releases can be pulled from the `centos-6` / `centos-7` Docker tags respectively. For production use it is recommended to select a specific release tag - the convention is `centos-6-1.3.1` OR `1.3.1` for the [1.3.1](https://github.com/jdeathe/centos-ssh-memcached/tree/1.3.1) release tag and `centos-7-2.2.1` OR `2.2.1` for the [2.2.1](https://github.com/jdeathe/centos-ssh/tree/2.2.1) release tag.
1212

1313
### Tags and respective `Dockerfile` links
1414

15-
- `centos-7`,`centos-7-2.2.0`,`2.2.0` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh-memcached/blob/centos-7/Dockerfile)
16-
- `centos-6`,`centos-6-1.3.0`,`1.3.0` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-memcached/blob/centos-6/Dockerfile)
15+
- `centos-7`,`centos-7-2.2.1`,`2.2.1` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh-memcached/blob/centos-7/Dockerfile)
16+
- `centos-6`,`centos-6-1.3.1`,`1.3.1` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-memcached/blob/centos-6/Dockerfile)
1717

1818
Included in the build are the [SCL](https://www.softwarecollections.org/), [EPEL](http://fedoraproject.org/wiki/EPEL) and [IUS](https://ius.io) repositories. Installed packages include [OpenSSH](http://www.openssh.com/portable.html) secure shell, [vim-minimal](http://www.vim.org/), are installed along with python-setuptools, [supervisor](http://supervisord.org/) and [supervisor-stdout](https://github.com/coderanger/supervisor-stdout).
1919

@@ -40,7 +40,7 @@ $ docker run -d \
4040
--name memcached.1 \
4141
-p 11211:11211/tcp \
4242
--sysctl "net.core.somaxconn=1024" \
43-
jdeathe/centos-ssh-memcached:2.2.0
43+
jdeathe/centos-ssh-memcached:2.2.1
4444
```
4545

4646
Now you can verify it is initialised and running successfully by inspecting the container's logs.
@@ -79,7 +79,7 @@ $ docker run \
7979
--sysctl "net.ipv4.ip_local_port_range=1024 65535" \
8080
--sysctl "net.ipv4.route.flush=1" \
8181
--env "MEMCACHED_CACHESIZE=32" \
82-
jdeathe/centos-ssh-memcached:2.2.0
82+
jdeathe/centos-ssh-memcached:2.2.1
8383
```
8484

8585
#### Environment Variables
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[program:memcached-wrapper]
2-
priority = 100
3-
command = /usr/sbin/memcached-wrapper --verbose
4-
autostart = %(ENV_MEMCACHED_AUTOSTART_MEMCACHED_WRAPPER)s
5-
startsecs = 0
62
autorestart = true
3+
autostart = %(ENV_MEMCACHED_AUTOSTART_MEMCACHED_WRAPPER)s
4+
command = /usr/sbin/memcached-wrapper --verbose
5+
priority = 100
76
redirect_stderr = true
7+
startsecs = 0
88
stdout_logfile = /dev/stdout
9-
stdout_logfile_maxbytes = 0
9+
stdout_logfile_maxbytes = 0

src/etc/systemd/system/centos-ssh-memcached.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
11211 \
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
11211 \
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/11211 \
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/11211 \
137138
\"$(/usr/bin/docker port \
138139
{{SERVICE_UNIT_NAME}}.%i \
139140
11211 \
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/11211 \
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/11211 \
156157
\"$(/usr/bin/docker port \
157158
{{SERVICE_UNIT_NAME}}.%i \
158159
11211 \
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-memcached@.service

Lines changed: 11 additions & 17 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}
@@ -65,20 +67,12 @@ Environment="SYSCTL_NET_IPV4_ROUTE_FLUSH=1"
6567

6668
# Initialisation: Load image from local storage if available, otherwise pull.
6769
ExecStartPre=/bin/bash -c \
68-
"if [[ -z $( \
69-
if [[ -n $(/usr/bin/docker images -q \
70-
${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
71-
) ]]; \
72-
then \
73-
echo $(/usr/bin/docker images -q \
74-
${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
75-
); \
76-
else \
77-
echo $(/usr/bin/docker images -q \
78-
docker.io/${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
79-
); \
80-
fi; \
81-
) ]]; \
70+
"if [[ -z \"$(/usr/bin/docker images -q \
71+
${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
72+
)\" ]] \
73+
&& [[ -z \"$(/usr/bin/docker images -q \
74+
docker.io/${DOCKER_USER}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} \
75+
)\" ]]; \
8276
then \
8377
if [[ -f ${DOCKER_IMAGE_PACKAGE_PATH}/${DOCKER_USER}/${DOCKER_IMAGE_NAME}.${DOCKER_IMAGE_TAG}.tar.xz ]]; \
8478
then \
@@ -140,7 +134,7 @@ ExecStart=/bin/bash -c \
140134
<<< \"${DOCKER_PORT_MAP_TCP_11211}\"; \
141135
&& /usr/bin/grep -qE \
142136
'^.+\.[0-9]+(\.[0-9]+)?$' \
143-
<<< "${DOCKER_NAME}"
137+
<<< %p.%i; \
144138
then \
145139
printf -- '--publish %%s%%s:11211/tcp' \
146140
$(\
@@ -173,7 +167,7 @@ ExecStart=/bin/bash -c \
173167
<<< \"${DOCKER_PORT_MAP_UDP_11211}\"; \
174168
&& /usr/bin/grep -qE \
175169
'^.+\.[0-9]+(\.[0-9]+)?$' \
176-
<<< "${DOCKER_NAME}"
170+
<<< %p.%i; \
177171
then \
178172
printf -- '--publish %%s%%s:11211/udp' \
179173
$(\

src/usr/bin/healthcheck

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,40 @@
22

33
set -e
44

5-
if ! ps axo command \
6-
| grep -qE '^/usr/bin/python /usr/bin/supervisord'
7-
then
8-
>&2 printf -- \
9-
'%s\n' \
10-
"supervisord not running."
11-
exit 1
12-
fi
13-
14-
if [[ ${MEMCACHED_AUTOSTART_MEMCACHED_WRAPPER} == true ]]
15-
then
5+
function main ()
6+
{
167
if ! ps axo command \
17-
| grep -qE '^/usr/bin/memcached '
8+
| grep -qE '^/usr/bin/python /usr/bin/supervisord'
189
then
1910
>&2 printf -- \
2011
'%s\n' \
21-
"memcached not running."
12+
"supervisord not running."
2213
exit 1
2314
fi
2415

25-
if ! memcached-tool \
26-
127.0.0.1:11211 \
27-
stats \
28-
| grep -qP \
29-
'[ ]+accepting_conns[ ]+1[^0-9]*$'
16+
if [[ ${MEMCACHED_AUTOSTART_MEMCACHED_WRAPPER} == true ]]
3017
then
31-
>&2 printf -- \
32-
'%s\n' \
33-
"memcached not accepting connections."
34-
exit 1
18+
if ! ps axo command \
19+
| grep -qE '^/usr/bin/memcached '
20+
then
21+
>&2 printf -- \
22+
'%s\n' \
23+
"memcached not running."
24+
exit 1
25+
fi
26+
27+
if ! memcached-tool \
28+
127.0.0.1:11211 \
29+
stats \
30+
| grep -qP \
31+
'[ ]+accepting_conns[ ]+1[^0-9]*$'
32+
then
33+
>&2 printf -- \
34+
'%s\n' \
35+
"memcached not accepting connections."
36+
exit 1
37+
fi
3538
fi
36-
fi
39+
}
3740

38-
exit 0
41+
main "${@}"

0 commit comments

Comments
 (0)