Skip to content

Commit 04edd5f

Browse files
committed
Merge branch 'hotfix-0.1.3' into stable
2 parents 3080b17 + e3bf0d0 commit 04edd5f

File tree

8 files changed

+62
-55
lines changed

8 files changed

+62
-55
lines changed

CHANGELOG.md

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

3+
## 0.1.3
4+
- Upgrade baseimage: light-baseimage:0.2.5
5+
- Add TINC_CMD_ARGS environment variable
6+
- Compile tinc from sources
7+
8+
## 0.1.2 (unreleased)
9+
310
## 0.1.1
411
- Upgrade baseimage: experimental-light-baseimage:0.1.3
512

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NAME = osixia/tinc
2-
VERSION = 0.1.1
2+
VERSION = 0.1.3
33

44
.PHONY: all build build-nocache test tag_latest release
55

@@ -15,7 +15,7 @@ test:
1515
env NAME=$(NAME) VERSION=$(VERSION) bats test/test.bats
1616

1717
tag_latest:
18-
docker tag -f $(NAME):$(VERSION) $(NAME):latest
18+
docker tag $(NAME):$(VERSION) $(NAME):latest
1919

2020
release: build test tag_latest
2121
@if ! docker images $(NAME) | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME) version $(VERSION) is not yet built. Please run 'make build'"; false; fi

image/Dockerfile

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,43 @@
1-
FROM osixia/experimental-light-baseimage:0.1.3
1+
# Use osixia/light-baseimage
2+
# sources: https://github.com/osixia/docker-light-baseimage
3+
FROM osixia/light-baseimage:0.2.5
24
MAINTAINER Bertrand Gouny <bertrand.gouny@osixia.net>
35

4-
# Install OpenLDAP, ldap-utils and ssl-helper from baseimage and remove default ldap db
5-
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service-available
6-
RUN echo "deb http://http.debian.net/debian experimental main" >> /etc/apt/sources.list && apt-get -y update \
7-
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
8-
-t experimental tinc \
9-
&& apt-get clean \
10-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6+
# Tinc version
7+
ENV TINC_VERSION 1.1pre14
8+
9+
# Download, build and install Tinc
10+
RUN apt-get -y update \
11+
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
curl \
14+
gcc \
15+
libssl1.0.0 \
16+
libssl-dev \
17+
liblzo2-2 \
18+
liblzo2-dev \
19+
libncurses5 \
20+
libncurses5-dev \
21+
libreadline6 \
22+
libreadline-dev \
23+
make \
24+
pkg-config \
25+
zlib1g \
26+
zlib1g-dev \
27+
&& curl -o tinc.tar.gz -SL https://www.tinc-vpn.org/packages/tinc-${TINC_VERSION}.tar.gz \
28+
&& mkdir -p /container/tinc-sources \
29+
&& tar -xzf tinc.tar.gz --strip 1 -C /container/tinc-sources \
30+
&& cd /container/tinc-sources \
31+
&& ./configure \
32+
&& make && make install \
33+
&& cd - \
34+
&& mkdir -p /usr/local/var/run/ \
35+
&& apt-get remove -y --purge --auto-remove ca-certificates curl gcc \
36+
libssl-dev liblzo2-dev libncurses5-dev libreadline-dev make pkg-config zlib1g-dev \
37+
&& rm -f tinc.tar.gz \
38+
&& rm -rf /container/tinc-sources \
39+
&& apt-get clean \
40+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1141

1242
# Add service directory to /container/service
1343
ADD service /container/service
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TINC_RUN_BEFORE_START_COMMANDS:
2+
- add Address = 1.1.1.1
3+
- add Subnet = 10.244.1.0/24
4+
- add Mode = switch
5+
- add DeviceType = tap

image/environment/default.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
TINC_RUN_BEFORE_START_COMMANDS:
2-
- add Address = 1.1.1.1
3-
- add Subnet = 10.244.1.0/24
4-
- add Mode = switch
5-
- add DeviceType = tap
1+
# more info: https://www.tinc-vpn.org/documentation/tincd.8
2+
TINC_CMD_ARGS: --debug=3

image/service/tinc/process.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/log-helper
55
log-helper level eq trace && set -x
66

7-
exec tinc -c ${CONTAINER_SERVICE_DIR}/tinc/data start -D
7+
exec tincd --config ${CONTAINER_SERVICE_DIR}/tinc/data --no-detach $TINC_CMD_ARGS

image/service/tinc/startup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ if [ ! -e "$FIRST_START_DONE" ]; then
1010

1111
mkdir -p ${CONTAINER_SERVICE_DIR}/tinc/data
1212

13-
TINC_HOSTNAME=$(echo $HOSTNAME | sed -e 's/[^a-zA-Z0-9\-]/_/g')
14-
tinc -c ${CONTAINER_SERVICE_DIR}/tinc/data init $TINC_HOSTNAME
13+
TINC_HOSTNAME=$(echo $HOSTNAME | sed -e 's/[^a-zA-Z0-9\_]/_/g')
14+
tinc --config ${CONTAINER_SERVICE_DIR}/tinc/data init $TINC_HOSTNAME
1515

1616
for command in $(complex-bash-env iterate TINC_RUN_BEFORE_START_COMMANDS)
1717
do
1818
log-helper info "Run tinc command: ${!command}"
19-
tinc -c ${CONTAINER_SERVICE_DIR}/tinc/data ${!command}
19+
tinc --config ${CONTAINER_SERVICE_DIR}/tinc/data ${!command}
2020
done
2121

2222
fi

test/test_helper.bash

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,10 @@ clear_container() {
3030
remove_containers_by_cid $CONTAINER_ID
3131
}
3232

33-
is_service_running() {
34-
is_service_running_by_cid $CONTAINER_ID $1
33+
wait_process() {
34+
wait_process_by_cid $CONTAINER_ID $@
3535
}
3636

37-
is_file_exists() {
38-
is_file_exists_by_cid $CONTAINER_ID $1
39-
}
40-
41-
wait_service() {
42-
wait_service_by_cid $CONTAINER_ID $@
43-
}
44-
45-
4637
# generic functions
4738
get_container_ip_by_cid() {
4839
local IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $1)
@@ -78,30 +69,7 @@ clear_containers_by_cid() {
7869
remove_containers_by_cid $@
7970
}
8071

81-
is_service_running_by_cid() {
82-
docker exec $1 ps cax | grep $2 > /dev/null
83-
}
84-
85-
is_file_exists_by_cid() {
86-
docker exec $1 cat $2 > /dev/null 2>&1
87-
}
88-
89-
wait_service_by_cid() {
90-
72+
wait_process_by_cid() {
9173
cid=$1
92-
93-
# first wait image init end
94-
while ! is_file_exists_by_cid $cid /container/run/state/startup-done
95-
do
96-
sleep 0.5
97-
done
98-
99-
for service in "${@:2}"
100-
do
101-
# wait service
102-
while ! is_service_running_by_cid $cid $service
103-
do
104-
sleep 0.5
105-
done
106-
done
74+
docker exec $cid /container/tool/wait-process ${@:2}
10775
}

0 commit comments

Comments
 (0)