Skip to content

Commit 2907b1b

Browse files
committed
modify scripts so you can pass entire config by env variable
1 parent 38a1948 commit 2907b1b

File tree

9 files changed

+85
-8
lines changed

9 files changed

+85
-8
lines changed

moosefs-cgi/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ RUN apt-get update && apt-get install -y moosefs-cgi moosefs-cgiserv moosefs-cli
1313
# Expose ports master ports
1414
EXPOSE 9425
1515

16-
CMD ["mfscgiserv", "-f"]
16+
# Add start script
17+
ADD cgiserver.sh /usr/sbin/cgiserver.sh
18+
RUN chown root:root /usr/sbin/cgiserver.sh ; chmod 700 /usr/sbin/cgiserver.sh
19+
20+
CMD ["cgiserver.sh"]

moosefs-cgi/cgiserver.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
CMD="mfscgiserv -f"
4+
5+
#Add host if set
6+
if [ ! -z ${MASTER_HOST+X} ];
7+
then
8+
CMD="$CMD -H $MASTER_HOST"
9+
fi
10+
11+
#Add host if set
12+
if [ ! -z ${MASTER_PORT+X} ];
13+
then
14+
CMD="$CMD -P $MASTER_PORT"
15+
fi
16+
17+
exec $CMD

moosefs-chunkserver/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:buster
22

33
# Install wget, lsb-release and curl
4-
RUN apt-get update && apt-get install -y wget gnupg2
4+
RUN apt-get update && apt-get install -y wget gnupg2 gettext-base
55

66
# Add key
77
RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null

moosefs-chunkserver/chunkserver.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
#!/usr/bin/env bash
22

3+
mkdir -p /mnt/hdd0/mfs
34
# Set correct owner
4-
chown -R mfs:mfs /mnt/hdd0 /var/lib/mfs
5+
chown -R mfs:mfs /mnt/hdd0 /mnt/hdd0/mfs /var/lib/mfs
56

6-
#Add size to hdd is defined
7+
# Overwrite mfschunkserver.cfg if passed in
8+
# this will base64 decode MFS_CHUNKSERVER_CONFIG variable text
9+
# substitute any env variables in decoded text
10+
# save text into /etc/mfs/mfschunkserver.cfg
11+
if [ ! -z ${MFS_CHUNKSERVER_CONFIG+X} ];
12+
then
13+
echo $MFS_CHUNKSERVER_CONFIG | base64 -d | envsubst > /etc/mfs/mfschunkserver.cfg
14+
fi
15+
16+
# Overwrite mfshdd.cfg if passed in
17+
# this will base64 decode MFS_HDD_CONFIG variable text
18+
# substitute any env variables in decoded text
19+
# save text into /etc/mfs/mfshdd.cfg
20+
if [ ! -z ${MFS_HDD_CONFIG+X} ];
21+
then
22+
echo $MFS_HDD_CONFIG | base64 -d | envsubst > /etc/mfs/mfshdd.cfg
23+
fi
24+
25+
26+
#Add size to hdd if defined
727
if [ -z ${SIZE+X} ];
828
then
929
echo "/mnt/hdd0" > /etc/mfs/mfshdd.cfg

moosefs-client/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ RUN echo "deb http://ppa.moosefs.com/3.0.115/apt/debian/buster buster main" > /e
1010
# Install MooseFS client and cli
1111
RUN apt-get update && apt-get install -y moosefs-client moosefs-cli
1212

13-
# Make a moosefs mountpoint
14-
RUN mkdir -p /mnt/moosefs
13+
# Add start script
14+
ADD mount.sh /usr/sbin/mount.sh
15+
RUN chown root:root /usr/sbin/mount.sh ; chmod 700 /usr/sbin/mount.sh ; mkdir -p /mnt/moosefs
1516

16-
CMD ["mfsmount", "-f", "/mnt/moosefs"]
17+
CMD ["mount.sh"]

moosefs-client/mount.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
CMD="mfsmount /mnt/moosefs -f"
4+
5+
#Add host if set
6+
if [ ! -z ${MASTER_HOST+X} ];
7+
then
8+
CMD="$CMD -H $MASTER_HOST"
9+
fi
10+
11+
#Add host if set
12+
if [ ! -z ${MASTER_PORT+X} ];
13+
then
14+
CMD="$CMD -P $MASTER_PORT"
15+
fi
16+
17+
exec $CMD

moosefs-master/master.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ MFS_ENV="${MFS_ENV:-PROD}"
66
#Set correct owner
77
chown -R mfs:mfs /var/lib/mfs
88

9+
# Overwrite mfsmaster.cfg if passed in
10+
# this will base64 decode MFS_MASTER_CONFIG variable text
11+
# substitute any env variables in decoded text
12+
# save text into /etc/mfs/mfsmaster.cfg
13+
if [ ! -z ${MFS_MASTER_CONFIG+X} ];
14+
then
15+
echo $MFS_MASTER_CONFIG | base64 -d | envsubst > /etc/mfs/mfsmaster.cfg
16+
fi
17+
918
# We have to be sure that we have metadata files
1019
if [ -f /var/lib/mfs/metadata.mfs ];
1120
then

moosefs-metalogger/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:buster
22

33
# Install wget and gnupg2
4-
RUN apt-get update && apt-get install -y wget gnupg2
4+
RUN apt-get update && apt-get install -y wget gnupg2 gettext-base
55

66
# Add key
77
RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null

moosefs-metalogger/metalogger.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,14 @@ MFS_ENV="${MFS_ENV:-PROD}"
66
# Set a correct owner
77
chown -R mfs:mfs /var/lib/mfs
88

9+
# Overwrite mfsmetalogger.cfg if passed in
10+
# this will base64 decode MFS_METALOGGER_CONFIG variable text
11+
# substitute any env variables in decoded text
12+
# save text into /etc/mfs/mfsmetalogger.cfg
13+
if [ ! -z ${MFS_METALOGGER_CONFIG+X} ];
14+
then
15+
echo $MFS_METALOGGER_CONFIG | base64 -d | envsubst > /etc/mfs/mfsmetalogger.cfg
16+
fi
17+
918
# Run
1019
exec mfsmetalogger -f

0 commit comments

Comments
 (0)