Skip to content

Commit c7f405b

Browse files
committed
MET-6552 Add first version of s3fs for openshift deployment (WIP)
1 parent 46f4036 commit c7f405b

File tree

4 files changed

+64
-6
lines changed

4 files changed

+64
-6
lines changed

docker/build-docker-images.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ set -e
33
echo building flink-poc docker image that can be deployed on the openshift cluster.
44

55
#images
6-
echo "building :: flink java 21 base $(realpath flink-java21)"
7-
docker build --no-cache -t flink:2.0.0-java21_poc flink-java21
6+
#echo "building :: flink java 21 base $(realpath flink-java21)"
7+
#docker build --no-cache -t flink:2.0.0-java21_poc flink-java21
88

9-
echo "building :: flink-node $(realpath flink-with-tools)"
10-
docker build --no-cache -t flink-with-tools:2.0.0-java21 flink-with-tools
9+
#echo "building :: flink-node $(realpath flink-with-tools)"
10+
#docker build --no-cache -t flink-with-tools:2.0.0-java21 flink-with-tools
1111

1212
echo "building :: shared libs: $(realpath metis-processing-engine-flink/shared-libs)"
1313
mvn -f metis-processing-engine-flink/shared-libs clean install
1414
echo "building :: flink-node $(realpath metis-processing-engine-flink)"
1515
docker build --no-cache -t metis-processing-engine-flink:2.0.0-java21 metis-processing-engine-flink
1616

1717
#echo "Pushing to the repository: registry.paas.psnc.pl"
18-
#docker tag metis-processing-engine-flink:2.0.0-java21 registry.paas.psnc.pl/ecloud-poc/metis-processing-engine-flink:2.0.0-java21
19-
#docker push registry.paas.psnc.pl/ecloud-poc/metis-processing-engine-flink:2.0.0-java21
18+
docker tag metis-processing-engine-flink:2.0.0-java21 registry.paas.psnc.pl/ecloud-poc/metis-processing-engine-flink:2.0.0-java21-s3
19+
docker push registry.paas.psnc.pl/ecloud-poc/metis-processing-engine-flink:2.0.0-java21-s3
2020

docker/flink-with-tools/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y \
2121
net-tools \
2222
dnsutils \
2323
vim \
24+
s3fs \
25+
fuse \
2426
&& rm -rf /var/lib/apt/lists/*
2527

2628
COPY install.sh /

docker/metis-processing-engine-flink/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,12 @@ FROM flink-with-tools:2.0.0-java21
22

33
LABEL maintainer="PSNC"
44
COPY shared-libs/target/dependency/* /opt/flink/lib/
5+
6+
RUN mkdir -p /mnt/s3
7+
RUN chmod 777 /mnt/s3
8+
9+
10+
COPY entrypoint.sh /entrypoint.sh
11+
RUN chmod +x /entrypoint.sh
12+
13+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
set -e
3+
if [ -z "${S3_ACCESS_KEY}" ] || [ -z "${S3_SECRET_KEY}" ] || [ -z "${S3_BUCKET}" ] || [ -z "${S3_ENDPOINT}" ] || [ -z "${S3_REGION}" ]; then
4+
echo "Some S3 variables not found in environment"
5+
if [ -z "${S3_ACCESS_KEY}" ]; then
6+
echo "S3_ACCESS_KEY not found in environment"
7+
fi
8+
9+
if [ -z "${S3_SECRET_KEY}" ]; then
10+
echo "S3_SECRET_KEY not found in environment"
11+
fi
12+
13+
if [ -z "${S3_BUCKET}" ]; then
14+
echo "S3_BUCKET not found in environment"
15+
fi
16+
17+
if [ -z "${S3_ENDPOINT}" ]; then
18+
echo "S3_ENDPOINT not found in environment"
19+
fi
20+
21+
if [ -z "${S3_REGION}" ]; then
22+
echo "S3_REGION not found in environment"
23+
fi
24+
25+
echo "Proceeding without mounting s3 to filesystem"
26+
else
27+
# Save credentials in a file for s3fs
28+
echo "${S3_ACCESS_KEY}:${S3_SECRET_KEY}" > /tmp/passwd-s3fs
29+
chmod 600 /tmp/passwd-s3fs
30+
31+
# Mount the S3 bucket using s3fs
32+
s3fs "${S3_BUCKET}" /mnt/s3 \
33+
-o passwd_file=/tmp/passwd-s3fs \
34+
-o url="${S3_ENDPOINT}" \
35+
-o endpoint="${S3_REGION}" \
36+
-o use_path_request_style \
37+
-o allow_other \
38+
-o nonempty
39+
40+
mkdir -p /mnt/s3/http-jobs
41+
mkdir -p /http-jobs
42+
43+
ln -s /mnt/s3/http-jobs /http-jobs
44+
45+
fi
46+
47+
exec "$@"

0 commit comments

Comments
 (0)