From a165c66b81dcd3777e08a64f526e9d23190b450d Mon Sep 17 00:00:00 2001 From: Rishabh Date: Sun, 12 Mar 2023 11:46:48 +0530 Subject: [PATCH 1/4] MooseFS --- MooseFS/docker-compose.yml | 81 +++++++++++++++++++ MooseFS/dockerfile | 11 +++ MooseFS/moosefs-chunkserver/Dockerfile | 20 +++++ MooseFS/moosefs-chunkserver/chunkserver.sh | 53 ++++++++++++ MooseFS/moosefs-chunkserver/mfschunserver.cfg | 3 + MooseFS/moosefs-master/Dockerfile | 20 +++++ MooseFS/moosefs-master/master.sh | 39 +++++++++ MooseFS/requirements.txt | 0 MooseFS/weba/app.py | 13 +++ MooseFS/weba/dockerfile | 6 ++ MooseFS/weba/requirements.txt | 0 MooseFS/webb/app.py | 17 ++++ MooseFS/webb/dockerfile | 6 ++ MooseFS/webb/requirements.txt | 0 14 files changed, 269 insertions(+) create mode 100644 MooseFS/docker-compose.yml create mode 100644 MooseFS/dockerfile create mode 100644 MooseFS/moosefs-chunkserver/Dockerfile create mode 100644 MooseFS/moosefs-chunkserver/chunkserver.sh create mode 100644 MooseFS/moosefs-chunkserver/mfschunserver.cfg create mode 100644 MooseFS/moosefs-master/Dockerfile create mode 100644 MooseFS/moosefs-master/master.sh create mode 100644 MooseFS/requirements.txt create mode 100644 MooseFS/weba/app.py create mode 100644 MooseFS/weba/dockerfile create mode 100644 MooseFS/weba/requirements.txt create mode 100644 MooseFS/webb/app.py create mode 100644 MooseFS/webb/dockerfile create mode 100644 MooseFS/webb/requirements.txt diff --git a/MooseFS/docker-compose.yml b/MooseFS/docker-compose.yml new file mode 100644 index 0000000..6164d27 --- /dev/null +++ b/MooseFS/docker-compose.yml @@ -0,0 +1,81 @@ +version: "3" + +services: + weba: + build: + context: ./weba + ports: + - "8001:5000" + volumes: + - type: volume + source: mfs_data + target: /var/lib/mfs + depends_on: + - chunkserver1 + - chunkserver2 + # restart: always + + webb: + build: + context: ./webb + ports: + - "8002:5000" + volumes: + - type: volume + source: mfs_data + target: /var/lib/mfs + depends_on: + - chunkserver1 + - chunkserver2 + # restart: always + mfsmaster: + build: ./moosefs-master + # image: moosefs/moosefs-master + container_name: mfsmaster + ports: + - "9421:9421" + - "9422:9422" + - "9419:9419" + - "9433:9433" + volumes: + - type: volume + source: mfs_data + target: /var/lib/mfs + environment: + - MFS_ENV=TEST + # In the TEST environment, if metadata.mfs file or other metadata files + # like metdata.mfs.back and changelog.0.mfs are missing, the script will + # create an EMPTY metadata file! + # When MFS_ENV=PROD metdata.mfs file will not be created! + + chunkserver1: + build: ./moosefs-chunkserver + container_name: chunkserver1 + volumes: + - type: volume + source: mfs_data + target: /data + environment: + - LABELS=M + #- SIZE=100 + links: + - mfsmaster + depends_on: + - mfsmaster + chunkserver2: + build: ./moosefs-chunkserver + container_name: chunkserver2 + volumes: + - type: volume + source: mfs_data + target: /data + environment: + - LABELS=M,B + #- SIZE=100 + links: + - mfsmaster + depends_on: + - mfsmaster + +volumes: + mfs_data: diff --git a/MooseFS/dockerfile b/MooseFS/dockerfile new file mode 100644 index 0000000..fe65827 --- /dev/null +++ b/MooseFS/dockerfile @@ -0,0 +1,11 @@ +FROM python:3.8-slim-buster + +RUN mkdir /app +WORKDIR /app + +COPY requirements.txt . +RUN pip3 install --no-cache-dir -r requirements.txt + +COPY . . + +CMD [ "python3", "app.py" ] diff --git a/MooseFS/moosefs-chunkserver/Dockerfile b/MooseFS/moosefs-chunkserver/Dockerfile new file mode 100644 index 0000000..9d9a244 --- /dev/null +++ b/MooseFS/moosefs-chunkserver/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:buster + +# Install wget, lsb-release and curl +RUN apt-get update && apt-get install -y wget gnupg2 gettext-base + +# Add key +RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null +RUN echo "deb http://ppa.moosefs.com/3.0.115/apt/debian/buster buster main" > /etc/apt/sources.list.d/moosefs.list + +# Install MooseFS chunkserver +RUN apt-get update && apt-get install -y moosefs-chunkserver dos2unix + +# Expose ports +EXPOSE 9422 + +# Add start script +ADD chunkserver.sh /usr/sbin/chunkserver.sh +RUN chown root:root /usr/sbin/chunkserver.sh ; chmod 700 /usr/sbin/chunkserver.sh ; mkdir -p /mnt/hdd0 +RUN dos2unix /usr/sbin/chunkserver.sh +CMD ["chunkserver.sh"] diff --git a/MooseFS/moosefs-chunkserver/chunkserver.sh b/MooseFS/moosefs-chunkserver/chunkserver.sh new file mode 100644 index 0000000..028f072 --- /dev/null +++ b/MooseFS/moosefs-chunkserver/chunkserver.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +mkdir -p /mnt/hdd0/mfs +# Set correct owner +chown -R mfs:mfs /mnt/hdd0 /mnt/hdd0/mfs /var/lib/mfs + +# Overwrite mfschunkserver.cfg if passed in +# this will base64 decode MFS_CHUNKSERVER_CONFIG variable text +# substitute any env variables in decoded text +# save text into /etc/mfs/mfschunkserver.cfg +if [ ! -z ${MFS_CHUNKSERVER_CONFIG+X} ]; + then + echo $MFS_CHUNKSERVER_CONFIG | base64 -d | envsubst > /etc/mfs/mfschunkserver.cfg +fi + +# Overwrite mfshdd.cfg if passed in +# this will base64 decode MFS_HDD_CONFIG variable text +# substitute any env variables in decoded text +# save text into /etc/mfs/mfshdd.cfg +if [ ! -z ${MFS_HDD_CONFIG+X} ]; + then + echo $MFS_HDD_CONFIG | base64 -d | envsubst > /etc/mfs/mfshdd.cfg +fi + + +#Add size to hdd if defined +if [ -z ${SIZE+X} ]; + then + echo "/mnt/hdd0" > /etc/mfs/mfshdd.cfg + else + echo "/mnt/hdd0 ${SIZE}GiB" > /etc/mfs/mfshdd.cfg +fi + +# Add label if defined +if [ ! -z ${LABELS+X} ]; + then + echo "LABELS=$LABELS" >> /etc/mfs/mfschunkserver.cfg +fi + +if [ ! -z ${MASTER_HOST+X} ]; + then + echo "MASTER_HOST=$MASTER_HOST" >> /etc/mfs/mfschunkserver.cfg +fi +if [ ! -z ${CSSERV_LISTEN_PORT+X} ]; + then + echo "CSSERV_LISTEN_PORT=$CSSERV_LISTEN_PORT" >> /etc/mfs/mfschunkserver.cfg +fi +if [ ! -z ${DATA_PATH+X} ]; + then + echo "DATA_PATH=$DATA_PATH" >> /etc/mfs/mfschunkserver.cfg +fi + +exec mfschunkserver -f diff --git a/MooseFS/moosefs-chunkserver/mfschunserver.cfg b/MooseFS/moosefs-chunkserver/mfschunserver.cfg new file mode 100644 index 0000000..afca1ef --- /dev/null +++ b/MooseFS/moosefs-chunkserver/mfschunserver.cfg @@ -0,0 +1,3 @@ +MASTER_HOST = $MOOSEFS_MASTER_SERVICE_HOST +CSSERV_LISTEN_PORT = $MOOSEFS_CHUNKSERVER_SERVICE_PORT +DATA_PATH = /mnt/hdd0/mfs \ No newline at end of file diff --git a/MooseFS/moosefs-master/Dockerfile b/MooseFS/moosefs-master/Dockerfile new file mode 100644 index 0000000..5753adc --- /dev/null +++ b/MooseFS/moosefs-master/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:buster + +# Install wget and gnupg2 +RUN apt-get update && apt-get install -y wget gnupg2 + +# Add key +RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null +RUN echo "deb http://ppa.moosefs.com/3.0.115/apt/debian/buster buster main" > /etc/apt/sources.list.d/moosefs.list + +# Install MooseFS master +RUN apt-get update && apt-get install -y moosefs-master dos2unix + +# Expose ports master ports +EXPOSE 9419 9420 9421 + +# Add and run start script +ADD master.sh /usr/sbin/master.sh +RUN chown root:root /usr/sbin/master.sh ; chmod 700 /usr/sbin/master.sh +RUN dos2unix /usr/sbin/master.sh +CMD ["master.sh"] diff --git a/MooseFS/moosefs-master/master.sh b/MooseFS/moosefs-master/master.sh new file mode 100644 index 0000000..ed84439 --- /dev/null +++ b/MooseFS/moosefs-master/master.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# Set default MooseFS enviroment to PRODUCTION +MFS_ENV="${MFS_ENV:-PROD}" + +#Set correct owner +chown -R mfs:mfs /var/lib/mfs + +# Overwrite mfsmaster.cfg if passed in +# this will base64 decode MFS_MASTER_CONFIG variable text +# substitute any env variables in decoded text +# save text into /etc/mfs/mfsmaster.cfg +if [ ! -z ${MFS_MASTER_CONFIG+X} ]; + then + echo $MFS_MASTER_CONFIG | base64 -d | envsubst > /etc/mfs/mfsmaster.cfg +fi + +# We have to be sure that we have metadata files +if [ -f /var/lib/mfs/metadata.mfs ]; +then + exec mfsmaster -f +else + if [[ -f /var/lib/mfs/metadata.mfs.back.1 && -f /var/lib/mfs/changelog.0.mfs ]]; + then + echo "Can't find metadata.mfs file" + echo "Let's try to restore it" + exec mfsmaster -a -f + else + if [ "$MFS_ENV" == "TEST" ]; + then + echo "MFSM NEW" > /var/lib/mfs/metadata.mfs + exec mfsmaster -f + else + echo "No /var/lib/mfs/metadata.mfs file!" + echo "EXITING - THIS IS A PRODUCTION ENVIRONMENT!" + exit 1 + fi + fi +fi diff --git a/MooseFS/requirements.txt b/MooseFS/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/MooseFS/weba/app.py b/MooseFS/weba/app.py new file mode 100644 index 0000000..7141f3c --- /dev/null +++ b/MooseFS/weba/app.py @@ -0,0 +1,13 @@ +import os + +path = "/var/lib/mfs/test.txt" + +if not os.path.exists(os.path.dirname(path)): + os.makedirs(os.path.dirname(path)) + +with open(path, "w") as f: + f.write("Hello World! from webA") + + +if __name__ == "__main__": + print("File written successfully from webA!") diff --git a/MooseFS/weba/dockerfile b/MooseFS/weba/dockerfile new file mode 100644 index 0000000..d5e6ac7 --- /dev/null +++ b/MooseFS/weba/dockerfile @@ -0,0 +1,6 @@ +FROM python:3.9 +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +COPY . . +CMD [ "python", "app.py", "write" ] diff --git a/MooseFS/weba/requirements.txt b/MooseFS/weba/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/MooseFS/webb/app.py b/MooseFS/webb/app.py new file mode 100644 index 0000000..763f6d7 --- /dev/null +++ b/MooseFS/webb/app.py @@ -0,0 +1,17 @@ +import os + +path = "/var/lib/mfs/test.txt" + +# if not os.path.exists(os.path.dirname(path)): +# os.makedirs(os.path.dirname(path)) + +if os.path.exists(path): + with open(path, "r") as f: + print(f.read()) + os.remove(path) +else: + print("File not found!") + + +if __name__ == "__main__": + print("File read successfully from webB!") diff --git a/MooseFS/webb/dockerfile b/MooseFS/webb/dockerfile new file mode 100644 index 0000000..062c8d0 --- /dev/null +++ b/MooseFS/webb/dockerfile @@ -0,0 +1,6 @@ +FROM python:3.9 +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +COPY . . +CMD [ "python", "app.py", "read" ] diff --git a/MooseFS/webb/requirements.txt b/MooseFS/webb/requirements.txt new file mode 100644 index 0000000..e69de29 From 784968ee49fb8802c31c6af7d9c06f0c1f1ccd2d Mon Sep 17 00:00:00 2001 From: Rishabh Kumar Jaiswal <97736490+Rishabh5903@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:07:29 +0530 Subject: [PATCH 2/4] Update docker-compose.yml --- MooseFS/docker-compose.yml | 168 +++++++++++++++++++++++++------------ 1 file changed, 116 insertions(+), 52 deletions(-) diff --git a/MooseFS/docker-compose.yml b/MooseFS/docker-compose.yml index 6164d27..2f87aa6 100644 --- a/MooseFS/docker-compose.yml +++ b/MooseFS/docker-compose.yml @@ -1,81 +1,145 @@ -version: "3" - +version: '3' services: - weba: - build: - context: ./weba - ports: - - "8001:5000" + mfsmaster: + build: ./moosefs-master + container_name: "mfsmaster" + networks: + moosefsnet: + ipv4_address: "172.23.0.2" volumes: - - type: volume - source: mfs_data - target: /var/lib/mfs - depends_on: - - chunkserver1 - - chunkserver2 - # restart: always + - ./data/master/meta:/var/lib/mfs + hostname: mfsmaster + environment: + - MFS_ENV=TEST + # In the TEST environment, if metadata.mfs file or other metadata files + # like metdata.mfs.back and changelog.0.mfs are missing, the script will + # create an EMPTY metadata file! + # When MFS_ENV=PROD metdata.mfs file will not be created! - webb: - build: - context: ./webb + mfscgi: + build: ./moosefs-cgi + container_name: "mfscgi" + networks: + moosefsnet: + ipv4_address: "172.23.0.3" ports: - - "8002:5000" - volumes: - - type: volume - source: mfs_data - target: /var/lib/mfs + - "9425:9425" depends_on: - - chunkserver1 - - chunkserver2 - # restart: always - mfsmaster: - build: ./moosefs-master - # image: moosefs/moosefs-master - container_name: mfsmaster - ports: - - "9421:9421" - - "9422:9422" - - "9419:9419" - - "9433:9433" + - mfsmaster + + mfsmetalogger: + build: ./moosefs-metalogger + container_name: "mfsmetalogger" + networks: + moosefsnet: + ipv4_address: "172.23.0.4" volumes: - - type: volume - source: mfs_data - target: /var/lib/mfs + - ./data/metalogger/meta:/var/lib/mfs environment: - - MFS_ENV=TEST + - MFS_ENV=TEST # In the TEST environment, if metadata.mfs file or other metadata files # like metdata.mfs.back and changelog.0.mfs are missing, the script will # create an EMPTY metadata file! # When MFS_ENV=PROD metdata.mfs file will not be created! + depends_on: + - mfsmaster - chunkserver1: + mfschunkserver1: build: ./moosefs-chunkserver - container_name: chunkserver1 - volumes: - - type: volume - source: mfs_data - target: /data + container_name: "mfschunkserver1" environment: - LABELS=M #- SIZE=100 links: - mfsmaster + # env_file: + # - ./env.list + networks: + moosefsnet: + ipv4_address: "172.23.0.11" + volumes: + - ./data/cs1/hdd0:/mnt/hdd0 + - ./data/cs1/meta:/var/lib/mfs depends_on: - mfsmaster - chunkserver2: + mfschunkserver2: build: ./moosefs-chunkserver - container_name: chunkserver2 - volumes: - - type: volume - source: mfs_data - target: /data + container_name: "mfschunkserver2" environment: - LABELS=M,B #- SIZE=100 links: - mfsmaster + # env_file: + # - ./env.list + networks: + moosefsnet: + ipv4_address: "172.23.0.12" + volumes: + - ./data/cs2/hdd0:/mnt/hdd0 + - ./data/cs2/meta:/var/lib/mfs + depends_on: + - mfsmaster + weba: + build: ./weba + container_name: weba + volumes: + - ./data/cs1/hdd0:/mnt/hdd0 + - ./data/cs1/meta:/var/lib/mfs + ports: + - "6002:6000" + links: + - mfsmaster + networks: + moosefsnet: + ipv4_address: "172.23.0.13" + depends_on: + - mfschunkserver1 + # - chunkserver2 + # restart: always + + webb: + build: ./webb + container_name: webb + volumes: + - ./data/cs2/hdd0:/mnt/hdd0 + - ./data/cs2/meta:/var/lib/mfs + ports: + - "6001:6000" + links: + - mfsmaster + networks: + moosefsnet: + ipv4_address: "172.23.0.14" + depends_on: + # - chunkserver1 + - mfschunkserver2 + mfsclient: + build: ./moosefs-client + container_name: "mfsclient" + cap_add: + - SYS_ADMIN + devices: + - /dev/fuse:/dev/fuse + security_opt: + - apparmor:unconfined + stdin_open: true + tty: true + links: + - mfsmaster + networks: + moosefsnet: + ipv4_address: "172.23.0.100" depends_on: - mfsmaster + - mfschunkserver1 + - mfschunkserver2 + # - mfschunkserver3 + # - mfschunkserver4 -volumes: - mfs_data: +networks: + moosefsnet: + driver: bridge + ipam: + config: + - subnet: 172.23.0.0/16 From 4616860e57c27d94f1182a846ee1e74f57c32f5d Mon Sep 17 00:00:00 2001 From: Rishabh Kumar Jaiswal <97736490+Rishabh5903@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:11:11 +0530 Subject: [PATCH 3/4] Update and rename mfschunserver.cfg to mfschunkserver.cfg --- MooseFS/moosefs-chunkserver/mfschunkserver.cfg | 16 ++++++++++++++++ MooseFS/moosefs-chunkserver/mfschunserver.cfg | 3 --- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 MooseFS/moosefs-chunkserver/mfschunkserver.cfg delete mode 100644 MooseFS/moosefs-chunkserver/mfschunserver.cfg diff --git a/MooseFS/moosefs-chunkserver/mfschunkserver.cfg b/MooseFS/moosefs-chunkserver/mfschunkserver.cfg new file mode 100644 index 0000000..9596915 --- /dev/null +++ b/MooseFS/moosefs-chunkserver/mfschunkserver.cfg @@ -0,0 +1,16 @@ +# Use the hostname or IP address of the MooseFS master server +MASTER_HOST = "172.23.0.2" + +# Use the port number of the MooseFS master server (default is 9419) +MASTER_PORT = 9419 + +# Use the labels for this chunkserver (M, B, L, R, etc.) +LABELS = M,B + +# Use the IP address or hostname of this chunkserver +CSSERV_LISTEN_HOST = "172.23.0.11" , "172.23.0.12" + +# Use the port number of this chunkserver (default is 9420) +CSSERV_LISTEN_PORT = 9420 + +DATA_PATH = /mnt/hdd0 diff --git a/MooseFS/moosefs-chunkserver/mfschunserver.cfg b/MooseFS/moosefs-chunkserver/mfschunserver.cfg deleted file mode 100644 index afca1ef..0000000 --- a/MooseFS/moosefs-chunkserver/mfschunserver.cfg +++ /dev/null @@ -1,3 +0,0 @@ -MASTER_HOST = $MOOSEFS_MASTER_SERVICE_HOST -CSSERV_LISTEN_PORT = $MOOSEFS_CHUNKSERVER_SERVICE_PORT -DATA_PATH = /mnt/hdd0/mfs \ No newline at end of file From 5fc933b94b438d9df8110e0f468bc0f661629fc6 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Sun, 16 Apr 2023 01:27:40 +0530 Subject: [PATCH 4/4] updated files --- MooseFS/moosefs-cgi/Dockerfile | 20 ++++++++++++++++++++ MooseFS/moosefs-cgi/cgiserver.sh | 17 +++++++++++++++++ MooseFS/moosefs-client/Dockerfile | 17 +++++++++++++++++ MooseFS/moosefs-client/mount.sh | 17 +++++++++++++++++ MooseFS/moosefs-metalogger/Dockerfile | 17 +++++++++++++++++ MooseFS/moosefs-metalogger/metalogger.sh | 19 +++++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 MooseFS/moosefs-cgi/Dockerfile create mode 100644 MooseFS/moosefs-cgi/cgiserver.sh create mode 100644 MooseFS/moosefs-client/Dockerfile create mode 100644 MooseFS/moosefs-client/mount.sh create mode 100644 MooseFS/moosefs-metalogger/Dockerfile create mode 100644 MooseFS/moosefs-metalogger/metalogger.sh diff --git a/MooseFS/moosefs-cgi/Dockerfile b/MooseFS/moosefs-cgi/Dockerfile new file mode 100644 index 0000000..cee130d --- /dev/null +++ b/MooseFS/moosefs-cgi/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:buster + +# Install wget and gnupg2 +RUN apt-get update && apt-get install -y wget gnupg2 python3 + +# Add key +RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null +RUN echo "deb http://ppa.moosefs.com/3.0.115/apt/debian/buster buster main" > /etc/apt/sources.list.d/moosefs.list + +# Install MooseFS master +RUN apt-get update && apt-get install -y moosefs-cgi moosefs-cgiserv moosefs-cli dos2unix + +# Expose ports master ports +EXPOSE 9425 + +# Add start script +ADD cgiserver.sh /usr/sbin/cgiserver.sh +RUN chown root:root /usr/sbin/cgiserver.sh ; chmod 700 /usr/sbin/cgiserver.sh +RUN dos2unix /usr/sbin/cgiserver.sh +CMD ["cgiserver.sh"] diff --git a/MooseFS/moosefs-cgi/cgiserver.sh b/MooseFS/moosefs-cgi/cgiserver.sh new file mode 100644 index 0000000..134de0a --- /dev/null +++ b/MooseFS/moosefs-cgi/cgiserver.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +CMD="mfscgiserv -f" + +#Add host if set +if [ ! -z ${MASTER_HOST+X} ]; + then + CMD="$CMD -H $MASTER_HOST" +fi + +#Add host if set +if [ ! -z ${MASTER_PORT+X} ]; + then + CMD="$CMD -P $MASTER_PORT" +fi + +exec $CMD diff --git a/MooseFS/moosefs-client/Dockerfile b/MooseFS/moosefs-client/Dockerfile new file mode 100644 index 0000000..2a7a631 --- /dev/null +++ b/MooseFS/moosefs-client/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:buster + +# Install libraries +RUN apt-get update && apt-get install -y wget fuse3 libfuse3-3 gnupg2 python3 + +# Add key +RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null +RUN echo "deb http://ppa.moosefs.com/3.0.115/apt/debian/buster buster main" > /etc/apt/sources.list.d/moosefs.list + +# Install MooseFS client and cli +RUN apt-get update && apt-get install -y moosefs-client moosefs-cli dos2unix + +# Add start script +ADD mount.sh /usr/sbin/mount.sh +RUN chown root:root /usr/sbin/mount.sh ; chmod 700 /usr/sbin/mount.sh ; mkdir -p /mnt/moosefs +RUN dos2unix /usr/sbin/mount.sh +CMD ["mount.sh"] diff --git a/MooseFS/moosefs-client/mount.sh b/MooseFS/moosefs-client/mount.sh new file mode 100644 index 0000000..878b120 --- /dev/null +++ b/MooseFS/moosefs-client/mount.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +CMD="mfsmount /mnt/moosefs -f" + +#Add host if set +if [ ! -z ${MASTER_HOST+X} ]; + then + CMD="$CMD -H $MASTER_HOST" +fi + +#Add host if set +if [ ! -z ${MASTER_PORT+X} ]; + then + CMD="$CMD -P $MASTER_PORT" +fi + +exec $CMD diff --git a/MooseFS/moosefs-metalogger/Dockerfile b/MooseFS/moosefs-metalogger/Dockerfile new file mode 100644 index 0000000..2c8b559 --- /dev/null +++ b/MooseFS/moosefs-metalogger/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:buster + +# Install wget and gnupg2 +RUN apt-get update && apt-get install -y wget gnupg2 gettext-base + +# Add key +RUN wget -O - http://ppa.moosefs.com/moosefs.key 2>/dev/null | apt-key add - 2>/dev/null +RUN echo "deb http://ppa.moosefs.com/3.0.115/apt/debian/buster buster main" > /etc/apt/sources.list.d/moosefs.list + +# Install MooseFS metalogger +RUN apt-get update && apt-get install -y moosefs-metalogger dos2unix + +# Add and run start script +ADD metalogger.sh /usr/sbin/metalogger.sh +RUN chown root:root /usr/sbin/metalogger.sh ; chmod 700 /usr/sbin/metalogger.sh +RUN dos2unix /usr/sbin/metalogger.sh +CMD ["metalogger.sh"] diff --git a/MooseFS/moosefs-metalogger/metalogger.sh b/MooseFS/moosefs-metalogger/metalogger.sh new file mode 100644 index 0000000..82c1f14 --- /dev/null +++ b/MooseFS/moosefs-metalogger/metalogger.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Set default MooseFS enviroment to PRODUCTION +MFS_ENV="${MFS_ENV:-PROD}" + +# Set a correct owner +chown -R mfs:mfs /var/lib/mfs + +# Overwrite mfsmetalogger.cfg if passed in +# this will base64 decode MFS_METALOGGER_CONFIG variable text +# substitute any env variables in decoded text +# save text into /etc/mfs/mfsmetalogger.cfg +if [ ! -z ${MFS_METALOGGER_CONFIG+X} ]; + then + echo $MFS_METALOGGER_CONFIG | base64 -d | envsubst > /etc/mfs/mfsmetalogger.cfg +fi + +# Run +exec mfsmetalogger -f