Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CrateDB to version 2.3.4 #4101

Merged
merged 1 commit into from
Mar 9, 2018
Merged

Conversation

autophagy
Copy link
Contributor

No description provided.

@yosifkit
Copy link
Member

yosifkit commented Mar 7, 2018

Diff:
diff --git a/_bashbrew-list b/_bashbrew-list
index a6381d2..77483dd 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -5,5 +5,5 @@ crate:2.1.10
 crate:2.2
 crate:2.2.7
 crate:2.3
-crate:2.3.3
+crate:2.3.4
 crate:latest
diff --git a/crate_latest/Dockerfile b/crate_latest/Dockerfile
index cf0e4a2..6820c1d 100644
--- a/crate_latest/Dockerfile
+++ b/crate_latest/Dockerfile
@@ -27,13 +27,13 @@ RUN set -x \
 RUN addgroup crate && adduser -G crate -H crate -D
 
 # install crate
-ENV CRATE_VERSION 2.3.3
+ENV CRATE_VERSION 2.3.4
 RUN apk add --no-cache --virtual .crate-rundeps \
         openjdk8-jre-base \
         python3 \
         openssl \
-    && apk add --no-cache --virtual .build-deps \
         curl \
+    && apk add --no-cache --virtual .build-deps \
         gnupg \
         tar \
     && curl -fSL -O https://cdn.crate.io/downloads/releases/crate-$CRATE_VERSION.tar.gz \
@@ -52,6 +52,12 @@ ENV PATH /crate/bin:$PATH
 # Default heap size for Docker, can be overwritten by args
 ENV CRATE_HEAP_SIZE 512M
 
+# This healthcheck indicates if a CrateDB node is up and running. It will fail
+# if we cannot get any response from the CrateDB (connection refused, timeout
+# etc). If any response is received (regardless of http status code) we
+# consider the node as running.
+HEALTHCHECK CMD eval "curl $(hostname):4200"
+
 VOLUME ["/data"]
 
 ADD config/crate.yml /crate/config/crate.yml
diff --git a/crate_latest/Dockerfile.template b/crate_latest/Dockerfile.template
index 449ba0a..22a9aad 100644
--- a/crate_latest/Dockerfile.template
+++ b/crate_latest/Dockerfile.template
@@ -32,9 +32,8 @@ RUN apk add --no-cache --virtual .crate-rundeps \
         openjdk8-jre-base \
         python3 \
         openssl \
-        sigar \
-    && apk add --no-cache --virtual .build-deps \
         curl \
+    && apk add --no-cache --virtual .build-deps \
         gnupg \
         tar \
     && curl -fSL -O https://cdn.crate.io/downloads/releases/crate-$CRATE_VERSION.tar.gz \
@@ -47,13 +46,18 @@ RUN apk add --no-cache --virtual .crate-rundeps \
     && tar -xf crate-$CRATE_VERSION.tar.gz -C /crate --strip-components=1 \
     && rm crate-$CRATE_VERSION.tar.gz \
     && ln -s /usr/bin/python3 /usr/bin/python \
-    && rm /crate/lib/sigar/libsigar-amd64-linux.so \
     && apk del .build-deps
 
 ENV PATH /crate/bin:$PATH
 # Default heap size for Docker, can be overwritten by args
 ENV CRATE_HEAP_SIZE 512M
 
+# This healthcheck indicates if a CrateDB node is up and running. It will fail
+# if we cannot get any response from the CrateDB (connection refused, timeout
+# etc). If any response is received (regardless of http status code) we
+# consider the node as running.
+HEALTHCHECK CMD eval "curl $(hostname):4200"
+
 VOLUME ["/data"]
 
 ADD config/crate.yml /crate/config/crate.yml
diff --git a/crate_latest/Dockerfile_2.3.template b/crate_latest/Dockerfile_3.0.template
similarity index 87%
rename from crate_latest/Dockerfile_2.3.template
rename to crate_latest/Dockerfile_3.0.template
index 4215c11..fafb1c6 100644
--- a/crate_latest/Dockerfile_2.3.template
+++ b/crate_latest/Dockerfile_3.0.template
@@ -32,8 +32,8 @@ RUN apk add --no-cache --virtual .crate-rundeps \
         openjdk8-jre-base \
         python3 \
         openssl \
-    && apk add --no-cache --virtual .build-deps \
         curl \
+    && apk add --no-cache --virtual .build-deps \
         gnupg \
         tar \
     && curl -fSL -O https://cdn.crate.io/downloads/releases/crate-$CRATE_VERSION.tar.gz \
@@ -52,11 +52,17 @@ ENV PATH /crate/bin:$PATH
 # Default heap size for Docker, can be overwritten by args
 ENV CRATE_HEAP_SIZE 512M
 
+# This healthcheck indicates if a CrateDB node is up and running. It will fail
+# if we cannot get any response from the CrateDB (connection refused, timeout
+# etc). If any response is received (regardless of http status code) we
+# consider the node as running.
+HEALTHCHECK CMD eval "curl $(hostname):4200"
+
 VOLUME ["/data"]
 
 ADD config/crate.yml /crate/config/crate.yml
 ADD config/log4j2.properties /crate/config/log4j2.properties
-COPY docker-entrypoint.sh /
+COPY entrypoint_3.0.sh /docker-entrypoint.sh
 
 WORKDIR /data
 
diff --git a/crate_latest/docker-entrypoint.sh b/crate_latest/docker-entrypoint.sh
index 3654832..9058bc0 100755
--- a/crate_latest/docker-entrypoint.sh
+++ b/crate_latest/docker-entrypoint.sh
@@ -2,6 +2,7 @@
 
 set -ae
 
+# Special VM options for Java in Docker
 CRATE_JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Des.cgroups.hierarchy.override=/ $CRATE_JAVA_OPTS"
 
 if [ "${1:0:1}" = '-' ]; then
diff --git a/crate_latest/docker-entrypoint.sh b/crate_latest/entrypoint_3.0.sh
similarity index 68%
copy from crate_latest/docker-entrypoint.sh
copy to crate_latest/entrypoint_3.0.sh
index 3654832..062dea5 100755
--- a/crate_latest/docker-entrypoint.sh
+++ b/crate_latest/entrypoint_3.0.sh
@@ -2,6 +2,10 @@
 
 set -ae
 
+# GC logging set to default value of path.logs
+CRATE_GC_LOG_DIR="/data/log"
+CRATE_HEAP_DUMP_PATH="/data/data"
+# Special VM options for Java in Docker
 CRATE_JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Des.cgroups.hierarchy.override=/ $CRATE_JAVA_OPTS"
 
 if [ "${1:0:1}" = '-' ]; then

@autophagy
Copy link
Contributor Author

autophagy commented Mar 8, 2018

@tianon @yosifkit Sorry to bother you guys, but is there a reason why this hasnt been merged?

@yosifkit
Copy link
Member

yosifkit commented Mar 8, 2018

Sorry, forgot to post my reply earlier.

On HEALTHCHECK for the official images @tianon and I maintain directly, we have taken the stance that it is up to the user to define (and is usually custom for their needs). See docker-library/cassandra#76 (comment) and the many issues linked there. You are welcome to have one in the crate images, just a warning that it might be an issue for some users.

On the specific HEATHCHECK, you should drop the eval part, since it is running inside sh -c anyway. looks like this was fixed and then lost when put into the template. Is there a reason for using $(hostname), rather than just 127.0.0.1 or localhost? I vaguely recall some instances where hostname might not work.

@andreidan
Copy link

@yosifkit yes, the eval should be dropped and we will from the template as well. Regarding the hostname, we are using that as we don't bind to localhost/127.0.0.1 for security reasons.

@matriv
Copy link
Contributor

matriv commented Mar 9, 2018

@yosifkit Regarding the HEALTHCHECK it has been a requirement for our users to have this basic healthcheck functionality so that the container health changes to healthy once CrateDB port is available (during startup) and also as a safety net if the java process of CrateDB is still running but the port is unusable. (In both cases the curl command with have ExitStatus != 0

@matriv
Copy link
Contributor

matriv commented Mar 9, 2018

@yosifkit PR updated, eval is removed, thx for your suggestion!

@yosifkit
Copy link
Member

yosifkit commented Mar 9, 2018

Diff:
diff --git a/_bashbrew-list b/_bashbrew-list
index a6381d2..77483dd 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -5,5 +5,5 @@ crate:2.1.10
 crate:2.2
 crate:2.2.7
 crate:2.3
-crate:2.3.3
+crate:2.3.4
 crate:latest
diff --git a/crate_latest/Dockerfile b/crate_latest/Dockerfile
index cf0e4a2..ca1d55d 100644
--- a/crate_latest/Dockerfile
+++ b/crate_latest/Dockerfile
@@ -27,13 +27,13 @@ RUN set -x \
 RUN addgroup crate && adduser -G crate -H crate -D
 
 # install crate
-ENV CRATE_VERSION 2.3.3
+ENV CRATE_VERSION 2.3.4
 RUN apk add --no-cache --virtual .crate-rundeps \
         openjdk8-jre-base \
         python3 \
         openssl \
-    && apk add --no-cache --virtual .build-deps \
         curl \
+    && apk add --no-cache --virtual .build-deps \
         gnupg \
         tar \
     && curl -fSL -O https://cdn.crate.io/downloads/releases/crate-$CRATE_VERSION.tar.gz \
@@ -52,6 +52,12 @@ ENV PATH /crate/bin:$PATH
 # Default heap size for Docker, can be overwritten by args
 ENV CRATE_HEAP_SIZE 512M
 
+# This healthcheck indicates if a CrateDB node is up and running. It will fail
+# if we cannot get any response from the CrateDB (connection refused, timeout
+# etc). If any response is received (regardless of http status code) we
+# consider the node as running.
+HEALTHCHECK CMD curl $(hostname):4200
+
 VOLUME ["/data"]
 
 ADD config/crate.yml /crate/config/crate.yml
diff --git a/crate_latest/Dockerfile.template b/crate_latest/Dockerfile.template
index 449ba0a..4fa2b03 100644
--- a/crate_latest/Dockerfile.template
+++ b/crate_latest/Dockerfile.template
@@ -32,9 +32,8 @@ RUN apk add --no-cache --virtual .crate-rundeps \
         openjdk8-jre-base \
         python3 \
         openssl \
-        sigar \
-    && apk add --no-cache --virtual .build-deps \
         curl \
+    && apk add --no-cache --virtual .build-deps \
         gnupg \
         tar \
     && curl -fSL -O https://cdn.crate.io/downloads/releases/crate-$CRATE_VERSION.tar.gz \
@@ -47,13 +46,18 @@ RUN apk add --no-cache --virtual .crate-rundeps \
     && tar -xf crate-$CRATE_VERSION.tar.gz -C /crate --strip-components=1 \
     && rm crate-$CRATE_VERSION.tar.gz \
     && ln -s /usr/bin/python3 /usr/bin/python \
-    && rm /crate/lib/sigar/libsigar-amd64-linux.so \
     && apk del .build-deps
 
 ENV PATH /crate/bin:$PATH
 # Default heap size for Docker, can be overwritten by args
 ENV CRATE_HEAP_SIZE 512M
 
+# This healthcheck indicates if a CrateDB node is up and running. It will fail
+# if we cannot get any response from the CrateDB (connection refused, timeout
+# etc). If any response is received (regardless of http status code) we
+# consider the node as running.
+HEALTHCHECK CMD curl $(hostname):4200
+
 VOLUME ["/data"]
 
 ADD config/crate.yml /crate/config/crate.yml
diff --git a/crate_latest/Dockerfile_2.3.template b/crate_latest/Dockerfile_3.0.template
similarity index 87%
rename from crate_latest/Dockerfile_2.3.template
rename to crate_latest/Dockerfile_3.0.template
index 4215c11..1c5da00 100644
--- a/crate_latest/Dockerfile_2.3.template
+++ b/crate_latest/Dockerfile_3.0.template
@@ -32,8 +32,8 @@ RUN apk add --no-cache --virtual .crate-rundeps \
         openjdk8-jre-base \
         python3 \
         openssl \
-    && apk add --no-cache --virtual .build-deps \
         curl \
+    && apk add --no-cache --virtual .build-deps \
         gnupg \
         tar \
     && curl -fSL -O https://cdn.crate.io/downloads/releases/crate-$CRATE_VERSION.tar.gz \
@@ -52,11 +52,17 @@ ENV PATH /crate/bin:$PATH
 # Default heap size for Docker, can be overwritten by args
 ENV CRATE_HEAP_SIZE 512M
 
+# This healthcheck indicates if a CrateDB node is up and running. It will fail
+# if we cannot get any response from the CrateDB (connection refused, timeout
+# etc). If any response is received (regardless of http status code) we
+# consider the node as running.
+HEALTHCHECK CMD curl $(hostname):4200
+
 VOLUME ["/data"]
 
 ADD config/crate.yml /crate/config/crate.yml
 ADD config/log4j2.properties /crate/config/log4j2.properties
-COPY docker-entrypoint.sh /
+COPY entrypoint_3.0.sh /docker-entrypoint.sh
 
 WORKDIR /data
 
diff --git a/crate_latest/docker-entrypoint.sh b/crate_latest/docker-entrypoint.sh
index 3654832..9058bc0 100755
--- a/crate_latest/docker-entrypoint.sh
+++ b/crate_latest/docker-entrypoint.sh
@@ -2,6 +2,7 @@
 
 set -ae
 
+# Special VM options for Java in Docker
 CRATE_JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Des.cgroups.hierarchy.override=/ $CRATE_JAVA_OPTS"
 
 if [ "${1:0:1}" = '-' ]; then
diff --git a/crate_latest/docker-entrypoint.sh b/crate_latest/entrypoint_3.0.sh
similarity index 68%
copy from crate_latest/docker-entrypoint.sh
copy to crate_latest/entrypoint_3.0.sh
index 3654832..062dea5 100755
--- a/crate_latest/docker-entrypoint.sh
+++ b/crate_latest/entrypoint_3.0.sh
@@ -2,6 +2,10 @@
 
 set -ae
 
+# GC logging set to default value of path.logs
+CRATE_GC_LOG_DIR="/data/log"
+CRATE_HEAP_DUMP_PATH="/data/data"
+# Special VM options for Java in Docker
 CRATE_JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Des.cgroups.hierarchy.override=/ $CRATE_JAVA_OPTS"
 
 if [ "${1:0:1}" = '-' ]; then

@yosifkit
Copy link
Member

yosifkit commented Mar 9, 2018

Build test of #4101; c6b3147; amd64 (crate):

$ bashbrew build crate:2.3.4
Building bashbrew/cache:695abd6d958d2d13e8f182acd7a0b7b2fd2acb17c0fa5cb56adf6635d4d27223 (crate:2.3.4)
Tagging crate:2.3.4
Tagging crate:2.3
Tagging crate:latest

$ test/run.sh crate:2.3.4
testing crate:2.3.4
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build crate:2.2.7
Using bashbrew/cache:d795065dc20025ed22bbd5208aaaf89ee338db2181cde78d293ed895a6c35460 (crate:2.2.7)
Tagging crate:2.2.7
Tagging crate:2.2

$ test/run.sh crate:2.2.7
testing crate:2.2.7
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build crate:2.1.10
Using bashbrew/cache:33e3ad1f0539760b647d7d37ff8710cbc993b4ef0485ea8be49d6488c6b74e41 (crate:2.1.10)
Tagging crate:2.1.10
Tagging crate:2.1

$ test/run.sh crate:2.1.10
testing crate:2.1.10
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed


$ bashbrew build crate:2.0.7
Using bashbrew/cache:29ee824479fdba930053f59fc94cf94b9e94f1149a8947970706ef06bf9f9302 (crate:2.0.7)
Tagging crate:2.0.7
Tagging crate:2.0

$ test/run.sh crate:2.0.7
testing crate:2.0.7
	'utc' [1/4]...passed
	'cve-2014--shellshock' [2/4]...passed
	'no-hard-coded-passwords' [3/4]...passed
	'override-cmd' [4/4]...passed

@yosifkit yosifkit merged commit 01b111b into docker-library:master Mar 9, 2018
@matriv
Copy link
Contributor

matriv commented Mar 9, 2018

@yosifkit thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants