Skip to content

Commit 6af834f

Browse files
authored
Merge pull request #73 from influxdata/enterprise-images
Add enterprise clustering images for influxdb
2 parents 67f9d68 + e829617 commit 6af834f

File tree

11 files changed

+260
-2
lines changed

11 files changed

+260
-2
lines changed

dockerlib/dockerlib/version.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ func DockerfileVersion(dir string) (*Version, error) {
119119
if len(parts) != 3 || !strings.HasSuffix(parts[1], "_VERSION") {
120120
continue
121121
}
122-
return NewVersion(parts[2])
122+
123+
// Split the version on a dash.
124+
sections := strings.Split(parts[2], "-")
125+
return NewVersion(sections[0])
123126
}
124127
return nil, nil
125128
}

influxdb-meta/1.3/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM buildpack-deps:stretch-curl
2+
3+
RUN set -ex && \
4+
for key in \
5+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
6+
do \
7+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
8+
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
9+
gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \
10+
done
11+
12+
ENV INFLUXDB_VERSION 1.3.8-c1.3.8
13+
RUN wget -q https://dl.influxdata.com/enterprise/releases/influxdb-meta_${INFLUXDB_VERSION}_amd64.deb.asc && \
14+
wget -q https://dl.influxdata.com/enterprise/releases/influxdb-meta_${INFLUXDB_VERSION}_amd64.deb && \
15+
gpg --batch --verify influxdb-meta_${INFLUXDB_VERSION}_amd64.deb.asc influxdb-meta_${INFLUXDB_VERSION}_amd64.deb && \
16+
dpkg -i influxdb-meta_${INFLUXDB_VERSION}_amd64.deb && \
17+
rm -f influxdb-meta_${INFLUXDB_VERSION}_amd64.deb*
18+
COPY influxdb-meta.conf /etc/influxdb/influxdb-meta.conf
19+
20+
EXPOSE 8091
21+
22+
VOLUME /var/lib/influxdb
23+
24+
COPY entrypoint.sh /entrypoint.sh
25+
ENTRYPOINT ["/entrypoint.sh"]
26+
CMD ["influxd-meta"]

influxdb-meta/1.3/entrypoint.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -e
3+
4+
export INFLUXDB_HOSTNAME=${INFLUXDB_HOSTNAME:-$HOSTNAME}
5+
export INFLUXDB_META_CONFIG_PATH=${INFLUXDB_META_CONFIG_PATH:-/etc/influxdb/influxdb-meta.conf}
6+
7+
if [ "${1:0:1}" = '-' ]; then
8+
set -- influxd-meta "$@"
9+
fi
10+
11+
if [ "$1" = 'influxd-meta' ]; then
12+
shift
13+
if [ $# -gt 0 ]; then
14+
case $1 in
15+
config)
16+
shift
17+
set -- influxd-meta config -config "${INFLUXDB_META_CONFIG_PATH}" "$@"
18+
;;
19+
run)
20+
shift
21+
set -- influxd-meta run -config "${INFLUXDB_META_CONFIG_PATH}" "$@"
22+
;;
23+
-*)
24+
set -- influxd-meta -config "${INFLUXDB_META_CONFIG_PATH}" "$@"
25+
;;
26+
*)
27+
set -- influxd-meta "$@"
28+
;;
29+
esac
30+
else
31+
set -- influxd-meta -config "${INFLUXDB_META_CONFIG_PATH}"
32+
fi
33+
fi
34+
35+
exec "$@"

influxdb-meta/1.3/influxdb-meta.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[meta]
2+
dir = "/var/lib/influxdb/meta"

influxdb-meta/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# About this Repo
2+
3+
This is the Git repo of the Docker [official image](https://docs.docker.com/docker-hub/official_repos/) for [influxdb-meta](https://registry.hub.docker.com/_/influxdb-meta/). See [the Docker Hub page](https://registry.hub.docker.com/_/influxdb-meta/) for the full readme on how to use this Docker image and for information regarding contributing and issues.
4+
5+
The full readme is generated over in [docker-library/docs](https://github.com/docker-library/docs), specifically in [docker-library/docs/influxdb-meta](https://github.com/docker-library/docs/tree/master/influxdb-meta).
6+
7+
See a change merged here that doesn't show up on the Docker Hub yet? Check [the "library/influxdb-meta" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/influxdb-meta), especially [PRs with the "library/influxdb-meta" label on that repo](https://github.com/docker-library/official-images/labels/library%2Finfluxdb-meta). For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md).
8+
9+
[![CircleCI](https://circleci.com/gh/influxdata/influxdata-docker.svg?style=svg)](https://circleci.com/gh/influxdata/influxdata-docker)
10+
11+
<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->

influxdb-meta/manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "influxdb-meta",
3+
"versions": ["1.3"]
4+
}

influxdb/1.3/enterprise/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM buildpack-deps:stretch-curl
2+
3+
RUN set -ex && \
4+
for key in \
5+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
6+
do \
7+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
8+
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
9+
gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \
10+
done
11+
12+
ENV INFLUXDB_VERSION 1.3.8-c1.3.8
13+
RUN wget -q https://dl.influxdata.com/enterprise/releases/influxdb-data_${INFLUXDB_VERSION}_amd64.deb.asc && \
14+
wget -q https://dl.influxdata.com/enterprise/releases/influxdb-data_${INFLUXDB_VERSION}_amd64.deb && \
15+
gpg --batch --verify influxdb-data_${INFLUXDB_VERSION}_amd64.deb.asc influxdb-data_${INFLUXDB_VERSION}_amd64.deb && \
16+
dpkg -i influxdb-data_${INFLUXDB_VERSION}_amd64.deb && \
17+
rm -f influxdb-data_${INFLUXDB_VERSION}_amd64.deb*
18+
COPY influxdb.conf /etc/influxdb/influxdb.conf
19+
20+
EXPOSE 8086
21+
22+
VOLUME /var/lib/influxdb
23+
24+
COPY entrypoint.sh /entrypoint.sh
25+
COPY init-influxdb.sh /init-influxdb.sh
26+
ENTRYPOINT ["/entrypoint.sh"]
27+
CMD ["influxd"]

influxdb/1.3/enterprise/entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -e
3+
4+
export INFLUXDB_HOSTNAME=${INFLUXDB_HOSTNAME:-$HOSTNAME}
5+
6+
if [ "${1:0:1}" = '-' ]; then
7+
set -- influxd "$@"
8+
fi
9+
10+
if [ "$1" = 'influxd' ]; then
11+
/init-influxdb.sh "${@:2}"
12+
fi
13+
14+
exec "$@"

influxdb/1.3/enterprise/influxdb.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[meta]
2+
dir = "/var/lib/influxdb/meta"
3+
4+
[data]
5+
dir = "/var/lib/influxdb/data"
6+
engine = "tsm1"
7+
wal-dir = "/var/lib/influxdb/wal"
8+
9+
[hinted-handoff]
10+
dir = "/var/lib/influxdb/hh"
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
set -e
3+
4+
AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED"
5+
6+
if [ -z "$AUTH_ENABLED" ]; then
7+
AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)"
8+
else
9+
AUTH_ENABLED="$(echo ""$INFLUXDB_HTTP_AUTH_ENABLED"" | grep -io 'true' | cat)"
10+
fi
11+
12+
INIT_USERS=$([ ! -z "$AUTH_ENABLED" ] && [ ! -z "$INFLUXDB_ADMIN_USER" ] && echo 1 || echo)
13+
14+
if ( [ ! -z "$INIT_USERS" ] || [ ! -z "$INFLUXDB_DB" ] || [ "$(ls -A /docker-entrypoint-initdb.d 2> /dev/null)" ] ) && [ ! "$(ls -d /var/lib/influxdb/meta 2>/dev/null)" ]; then
15+
16+
INIT_QUERY=""
17+
CREATE_DB_QUERY="CREATE DATABASE $INFLUXDB_DB"
18+
19+
if [ ! -z "$INIT_USERS" ]; then
20+
21+
if [ -z "$INFLUXDB_ADMIN_PASSWORD" ]; then
22+
INFLUXDB_ADMIN_PASSWORD="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32;echo;)"
23+
echo "INFLUXDB_ADMIN_PASSWORD:$INFLUXDB_ADMIN_PASSWORD"
24+
fi
25+
26+
INIT_QUERY="CREATE USER $INFLUXDB_ADMIN_USER WITH PASSWORD '$INFLUXDB_ADMIN_PASSWORD' WITH ALL PRIVILEGES"
27+
elif [ ! -z "$INFLUXDB_DB" ]; then
28+
INIT_QUERY="$CREATE_DB_QUERY"
29+
else
30+
INIT_QUERY="SHOW DATABASES"
31+
fi
32+
33+
INFLUXDB_INIT_PORT="8086"
34+
35+
INFLUXDB_HTTP_BIND_ADDRESS=127.0.0.1:$INFLUXDB_INIT_PORT INFLUXDB_HTTP_HTTPS_ENABLED=false influxd "$@" &
36+
pid="$!"
37+
38+
INFLUX_CMD="influx -host 127.0.0.1 -port $INFLUXDB_INIT_PORT -execute "
39+
40+
for i in {30..0}; do
41+
if $INFLUX_CMD "$INIT_QUERY" &> /dev/null; then
42+
break
43+
fi
44+
echo 'influxdb init process in progress...'
45+
sleep 1
46+
done
47+
48+
if [ "$i" = 0 ]; then
49+
echo >&2 'influxdb init process failed.'
50+
exit 1
51+
fi
52+
53+
if [ ! -z "$INIT_USERS" ]; then
54+
55+
INFLUX_CMD="influx -host 127.0.0.1 -port $INFLUXDB_INIT_PORT -username ${INFLUXDB_ADMIN_USER} -password ${INFLUXDB_ADMIN_PASSWORD} -execute "
56+
57+
if [ ! -z "$INFLUXDB_DB" ]; then
58+
$INFLUX_CMD "$CREATE_DB_QUERY"
59+
fi
60+
61+
if [ ! -z "$INFLUXDB_USER" ] && [ -z "$INFLUXDB_USER_PASSWORD" ]; then
62+
INFLUXDB_USER_PASSWORD="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32;echo;)"
63+
echo "INFLUXDB_USER_PASSWORD:$INFLUXDB_USER_PASSWORD"
64+
fi
65+
66+
if [ ! -z "$INFLUXDB_USER" ]; then
67+
$INFLUX_CMD "CREATE USER $INFLUXDB_USER WITH PASSWORD '$INFLUXDB_USER_PASSWORD'"
68+
69+
$INFLUX_CMD "REVOKE ALL PRIVILEGES FROM ""$INFLUXDB_USER"""
70+
71+
if [ ! -z "$INFLUXDB_DB" ]; then
72+
$INFLUX_CMD "GRANT ALL ON ""$INFLUXDB_DB"" TO ""$INFLUXDB_USER"""
73+
fi
74+
fi
75+
76+
if [ ! -z "$INFLUXDB_WRITE_USER" ] && [ -z "$INFLUXDB_WRITE_USER_PASSWORD" ]; then
77+
INFLUXDB_WRITE_USER_PASSWORD="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32;echo;)"
78+
echo "INFLUXDB_WRITE_USER_PASSWORD:$INFLUXDB_WRITE_USER_PASSWORD"
79+
fi
80+
81+
if [ ! -z "$INFLUXDB_WRITE_USER" ]; then
82+
$INFLUX_CMD "CREATE USER $INFLUXDB_WRITE_USER WITH PASSWORD '$INFLUXDB_WRITE_USER_PASSWORD'"
83+
$INFLUX_CMD "REVOKE ALL PRIVILEGES FROM ""$INFLUXDB_WRITE_USER"""
84+
85+
if [ ! -z "$INFLUXDB_DB" ]; then
86+
$INFLUX_CMD "GRANT WRITE ON ""$INFLUXDB_DB"" TO ""$INFLUXDB_WRITE_USER"""
87+
fi
88+
fi
89+
90+
if [ ! -z "$INFLUXDB_READ_USER" ] && [ -z "$INFLUXDB_READ_USER_PASSWORD" ]; then
91+
INFLUXDB_READ_USER_PASSWORD="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32;echo;)"
92+
echo "INFLUXDB_READ_USER_PASSWORD:$INFLUXDB_READ_USER_PASSWORD"
93+
fi
94+
95+
if [ ! -z "$INFLUXDB_READ_USER" ]; then
96+
$INFLUX_CMD "CREATE USER $INFLUXDB_READ_USER WITH PASSWORD '$INFLUXDB_READ_USER_PASSWORD'"
97+
$INFLUX_CMD "REVOKE ALL PRIVILEGES FROM ""$INFLUXDB_READ_USER"""
98+
99+
if [ ! -z "$INFLUXDB_DB" ]; then
100+
$INFLUX_CMD "GRANT READ ON ""$INFLUXDB_DB"" TO ""$INFLUXDB_READ_USER"""
101+
fi
102+
fi
103+
104+
fi
105+
106+
for f in /docker-entrypoint-initdb.d/*; do
107+
case "$f" in
108+
*.sh) echo "$0: running $f"; . "$f" ;;
109+
*.iql) echo "$0: running $f"; $INFLUX_CMD "$(cat ""$f"")"; echo ;;
110+
*) echo "$0: ignoring $f" ;;
111+
esac
112+
echo
113+
done
114+
115+
if ! kill -s TERM "$pid" || ! wait "$pid"; then
116+
echo >&2 'influxdb init process failed. (Could not stop influxdb)'
117+
exit 1
118+
fi
119+
120+
fi

0 commit comments

Comments
 (0)