Skip to content

Commit 4cbbbc1

Browse files
committed
Merge branch 'hotfix-0.1.4' into stable
2 parents 43fec88 + 689f1e5 commit 4cbbbc1

File tree

7 files changed

+52
-30
lines changed

7 files changed

+52
-30
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.1.4
4+
- Use light-baseimage
5+
36
## 0.1.3
47
- Fix libnl dependency
58

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME = osixia/keepalived
2-
VERSION = 0.1.3
2+
VERSION = 0.1.4
33

44
.PHONY: all build test tag_latest release
55

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# osixia/keepalived
22

3+
[![](https://badge.imagelayers.io/osixia/keepalived:latest.svg)](https://imagelayers.io/?images=osixia/keepalived:latest 'Get your own badge on imagelayers.io')
4+
35
A docker image to run Keepalived.
46
> [keepalived.org](http://keepalived.org/)
57

image/Dockerfile

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
1-
FROM osixia/baseimage:0.10.4
1+
FROM osixia/light-baseimage:0.1.0
22
MAINTAINER Bertrand Gouny <[email protected]>
33

44
# Keepalived version
55
ENV KEEPALIVED_VERSION 1.2.19
66

7-
# Use baseimage-docker's init system.
8-
CMD ["/sbin/my_init"]
7+
# Use baseimage's init system.
8+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/run
9+
CMD ["/container/tool/run"]
910

1011
# Install Keepalived
1112
RUN apt-get -y update \
1213
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y \
13-
make gcc pkg-config libssl-dev libnl-dev \
14+
curl \
15+
make \
16+
gcc \
17+
pkg-config \
18+
libssl-dev \
19+
libnl-3-dev \
20+
libnl-genl-3-dev \
1421
&& curl -o keepalived.tar.gz -SL http://keepalived.org/software/keepalived-${KEEPALIVED_VERSION}.tar.gz \
15-
&& mkdir -p /osixia/keepalived-sources \
16-
&& tar -xzf keepalived.tar.gz --strip 1 -C /osixia/keepalived-sources \
17-
&& cd osixia/keepalived-sources \
22+
&& mkdir -p /container/keepalived-sources \
23+
&& tar -xzf keepalived.tar.gz --strip 1 -C /container/keepalived-sources \
24+
&& cd container/keepalived-sources \
1825
&& ./configure --with-kernel-dir=/lib/modules/$(uname -r)/build \
1926
&& make && make install \
2027
&& cd - && mkdir -p /etc/keepalived \
21-
&& apt-get remove -y --purge --auto-remove make gcc pkg-config libssl-dev
28+
&& apt-get remove -y --purge --auto-remove curl make gcc pkg-config libssl-dev
2229

23-
# Add Keepalived assets
24-
ADD service/keepalived/assets /osixia/keepalived
30+
# Add service directory to /container/service
31+
ADD service /container/service
2532

26-
# Clean all
27-
RUN rm keepalived.tar.gz \
28-
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
33+
# Use baseimage install-service script and clean all
34+
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service
35+
RUN /container/tool/install-service \
36+
&& rm -f keepalived.tar.gz \
37+
&& rm -rf /container/keepalived-sources \
38+
&& apt-get clean \
39+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2940

3041
# Add default env variables
31-
ADD env.yml /etc/env.yml
32-
33-
# Add Keepalived container start config & daemon
34-
ADD service/keepalived/container-start.sh /etc/my_init.d/keepalived
35-
ADD service/keepalived/daemon.sh /etc/service/keepalived/run
42+
ADD env.yaml /etc/env.yaml

image/env.yml renamed to image/env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ KEEPALIVED_VIRTUAL_IPS:
1313
- 192.168.1.231
1414
- 192.168.1.232
1515

16-
KEEPALIVED_NOTIFY: /osixia/keepalived/notify.sh
16+
KEEPALIVED_NOTIFY: /container/service/keepalived/assets/notify.sh

image/service/keepalived/container-start.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ if [ ! -e "$FIRST_START_DONE" ]; then
88
# config folder is empty use bootstrap config if available
99
if [ ! -e /etc/keepalived/keepalived.conf ]; then
1010
echo "No keepalived.conf provided using image default one"
11-
if [ ! -e /osixia/keepalived/keepalived.conf ]; then
12-
echo "Error: No default keepalived.conf found in /osixia/keepalived/keepalived.conf"
11+
if [ ! -e /container/service/keepalived/assets/keepalived.conf ]; then
12+
echo "Error: No default keepalived.conf found in /container/service/keepalived/assets/keepalived.conf"
1313
exit 1
1414
else
1515

16-
ln -s /osixia/keepalived/keepalived.conf /etc/keepalived/keepalived.conf
16+
ln -s /container/service/keepalived/assets/keepalived.conf /etc/keepalived/keepalived.conf
1717

1818
#
1919
# bootstrap config

test/test_helper.bash

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ setup() {
22
IMAGE_NAME="$NAME:$VERSION"
33
}
44

5-
# function relative to the current container / image
5+
# function relative to the current container / image
66
build_image() {
77
#disable outputs
88
docker build -t $IMAGE_NAME $BATS_TEST_DIRNAME/../image &> /dev/null
@@ -34,12 +34,16 @@ is_service_running() {
3434
is_service_running_by_cid $CONTAINER_ID $1
3535
}
3636

37+
is_file_exists() {
38+
is_file_exists_by_cid $CONTAINER_ID $1
39+
}
40+
3741
wait_service() {
3842
wait_service_by_cid $CONTAINER_ID $@
3943
}
4044

4145

42-
# generic functions
46+
# generic functions
4347
get_container_ip_by_cid() {
4448
local IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $1)
4549
echo "$IP"
@@ -50,23 +54,23 @@ start_containers_by_cid() {
5054
do
5155
#disable outputs
5256
docker start $cid &> /dev/null
53-
done
57+
done
5458
}
5559

5660
stop_containers_by_cid() {
5761
for cid in "$@"
5862
do
5963
#disable outputs
6064
docker stop $cid &> /dev/null
61-
done
65+
done
6266
}
6367

6468
remove_containers_by_cid() {
6569
for cid in "$@"
6670
do
6771
#disable outputs
6872
docker rm $cid &> /dev/null
69-
done
73+
done
7074
}
7175

7276
clear_containers_by_cid() {
@@ -78,12 +82,18 @@ is_service_running_by_cid() {
7882
docker exec $1 ps cax | grep $2 > /dev/null
7983
}
8084

85+
is_file_exists_by_cid() {
86+
docker exec $1 cat "/etc/my_init_startup_files_completed" > /dev/null 2>&1
87+
}
88+
8189
wait_service_by_cid() {
8290

8391
cid=$1
8492

93+
sleep 1
94+
8595
# first wait image init end
86-
while ! is_service_running_by_cid $cid syslog-ng
96+
while ! is_file_exists_by_cid $cid /etc/my_init_startup_files_completed
8797
do
8898
sleep 1
8999
done
@@ -98,4 +108,4 @@ wait_service_by_cid() {
98108
done
99109

100110
sleep 5
101-
}
111+
}

0 commit comments

Comments
 (0)