Skip to content

Commit 880bc5b

Browse files
authored
fix(omid): location and permissions of the tso logging directory (#773)
* change ownership of the tso dir * Set omid.log.dir sys prop and some refactoring * run pre-commit to fix formatting * update delete_caches * successfully ran on OpenShift * works in both kind and openshift * Implement review feedback
1 parent bca5317 commit 880bc5b

File tree

1 file changed

+41
-26
lines changed

1 file changed

+41
-26
lines changed

omid/Dockerfile

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,23 @@
88
FROM stackable/image/java-devel AS builder
99

1010
ARG PRODUCT
11+
ARG DELETE_CACHES="true"
1112

1213
USER stackable
1314
WORKDIR /stackable
1415

15-
RUN curl --fail -L https://dist.apache.org/repos/dist/release/phoenix/phoenix-omid-${PRODUCT}/phoenix-omid-${PRODUCT}-src.tar.gz | tar -xzC .
16+
# hadolint ignore=DL3003
17+
RUN --mount=type=cache,id=maven,uid=1000,target=/stackable/.m2/repository <<EOF
18+
curl --fail -L https://dist.apache.org/repos/dist/release/phoenix/phoenix-omid-${PRODUCT}/phoenix-omid-${PRODUCT}-src.tar.gz | tar -xzC .
19+
cd /stackable/phoenix-omid-${PRODUCT} || exit
20+
mvn package -Phbase-2 -DskipTests
21+
tar -xf tso-server/target/omid-tso-server-${PRODUCT}-bin.tar.gz -C /stackable
22+
tar -xf examples/target/omid-examples-${PRODUCT}-bin.tar.gz -C /stackable
1623

17-
WORKDIR /stackable/phoenix-omid-${PRODUCT}
18-
RUN mvn package -Phbase-2 -DskipTests && \
19-
tar -xf tso-server/target/omid-tso-server-${PRODUCT}-bin.tar.gz -C /stackable && \
20-
tar -xf examples/target/omid-examples-${PRODUCT}-bin.tar.gz -C /stackable
24+
if [ "${DELETE_CACHES}" = "true" ] ; then
25+
rm -rf /stackable/.m2/repository/*
26+
fi
27+
EOF
2128

2229
# ===
2330
# For earlier versions this script removes the .class file that contains the
@@ -51,29 +58,37 @@ LABEL name="Apache Phoenix Omid" \
5158
summary="The Stackable image for Apache Phoenix Omid." \
5259
description="This image is deployed by the Stackable Operator for Apache HBase."
5360

54-
RUN microdnf update && \
55-
microdnf clean all && \
56-
rm -rf /var/cache/yum
57-
58-
ENV HOME=/stackable
59-
60-
COPY --chown=stackable:stackable omid/stackable /stackable
6161
COPY omid/licenses /licenses
6262

63-
USER stackable
64-
WORKDIR /stackable
65-
66-
COPY --from=builder /stackable/omid-tso-server-${PRODUCT} /stackable/omid-tso-server-${PRODUCT}
67-
COPY --from=builder /stackable/omid-examples-${PRODUCT} /stackable/omid-examples-${PRODUCT}
68-
69-
RUN ln -s /stackable/omid-tso-server-${PRODUCT} /stackable/omid-tso-server && \
70-
ln -s /stackable/omid-examples-${PRODUCT} /stackable/omid-examples && \
71-
curl https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar \
72-
-o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar && \
73-
chmod -x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
63+
COPY --chown=stackable:stackable omid/stackable /stackable
64+
COPY --chown=stackable:stackable --from=builder /stackable/omid-tso-server-${PRODUCT} /stackable/omid-tso-server-${PRODUCT}
65+
COPY --chown=stackable:stackable --from=builder /stackable/omid-examples-${PRODUCT} /stackable/omid-examples-${PRODUCT}
66+
67+
RUN <<EOF
68+
microdnf update
69+
microdnf clean all
70+
rm -rf /var/cache/yum
71+
72+
ln -s /stackable/omid-tso-server-${PRODUCT} /stackable/omid-tso-server
73+
ln -s /stackable/omid-examples-${PRODUCT} /stackable/omid-examples
74+
curl https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar \
75+
-o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
76+
chmod -x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
77+
# omid.sh places this file at the front of the classpath: remove it to allow the config map entry to take precedence
78+
rm /stackable/omid-tso-server/conf/hbase-site.xml
79+
80+
# To support arbitrary user ids on OpenShift, this folder must belong to the root group.
81+
mkdir /stackable/logs
82+
chown -R 1000:0 /stackable/logs
83+
chgrp -R 0 /stackable/logs
84+
chmod -R g=u /stackable/logs
85+
EOF
86+
87+
USER 1000
88+
WORKDIR /stackable/omid-tso-server
7489

90+
ENV HOME=/stackable
7591
ENV HBASE_CONF_DIR=/stackable/hbase/conf
76-
# omid.sh places this file at the front of the classpath: remove it to allow the config map entry to take precedence
77-
RUN rm /stackable/omid-tso-server/conf/hbase-site.xml
78-
WORKDIR /stackable/omid-tso-server
92+
ENV OMID_OPTS="-Domid.log.dir=/stackable/logs"
93+
7994
CMD ["./bin/omid.sh", "tso" ]

0 commit comments

Comments
 (0)