diff --git a/README.md b/README.md index fac718c..59bb386 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,63 @@ # MooseFS Docker Cluster -This is a sample configuration of a multiple node MooseFS cluster on Docker using Ubuntu 14.04 LTS. It consists of a master server with a management GUI, 5 chunkservers and one client machine. After a successful installation you have a fully working MooseFS cluster to play with its amazing features. +This is a sample configuration of a multiple node MooseFS cluster on Docker using Ubuntu 14.04 LTS. It consists of a master server with a CGI, 5 chunkservers and one client machine. After a successful installation you have a fully working MooseFS cluster to play with its amazing features. -## Cluster configurations +# Updates + +New features: +- specify storage size per chunkserver (env: **SIZE**, default: 10) +- specify label per chunkserver (env: **LABEL**, default: *empty*) +- switched to *debian:stretch* as base image +- example with 4 chunkservers (labels: M, MB, MB, B) +- MooseFS disks are now mounted as volumes + +# Cluster configurations + +In this repository you will find 2 sample configurations which you can run to try MooseFS. + +## 4 Chunkservers + Client + +Build and run in background: + +``` +docker-compose build +docker-compose up -d +``` **File docker-compose.yml** -- master with management GUI [http://172.20.0.2:9425](http://172.20.0.2:9425) -- chunkserver1 **172.20.0.11** with **10 GiB** of storage -- chunkserver2 **172.20.0.12** with **10 GiB** of storage -- chunkserver3 **172.20.0.13** with **10 GiB** of storage -- chunkserver4 **172.20.0.14** with **10 GiB** of storage -- chunkserver5 **172.20.0.15** with **10 GiB** of storage +- master with CGI [http://172.20.0.2:9425](http://172.20.0.2:9425) +- chunkserver1 **172.20.0.11**, **10 GiB** storage, label: **M** +- chunkserver2 **172.20.0.12**, **10 GiB** storage, label: **M**,**B** +- chunkserver3 **172.20.0.13**, **10 GiB** storage, label: **M**,**B** +- chunkserver4 **172.20.0.14**, **10 GiB** storage, label: **B** - client **172.168.20.0.5** +## 4 Chunkservers + 4 Clients + +Build and run in background: + +``` +docker-compose -f docker-compose-chunkserver-client.yml build +docker-compose -f docker-compose-chunkserver-client.yml up -d +``` + **File docker-compose-chunkserver-client.yml** - master with CGI [http://172.20.0.2:9425](http://172.20.0.2:9425) -- chunkserver1 **172.20.0.11** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) -- chunkserver2 **172.20.0.12** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) -- chunkserver3 **172.20.0.13** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) -- chunkserver4 **172.20.0.14** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) -- chunkserver5 **172.20.0.15** with **10 GiB** of storage and client (mount point: `/mnt/mfs`) +- chunkserver1 **172.20.0.11**, **10 GiB** storage, label: **M** (mount point: `/mnt/moosefs`) +- chunkserver2 **172.20.0.12**, **10 GiB** storage, label: **M,B** (mount point: `/mnt/moosefs`) +- chunkserver3 **172.20.0.13**, **10 GiB** storage, label: **M,B** (mount point: `/mnt/moosefs`) +- chunkserver4 **172.20.0.14**, **10 GiB** storage, label: **B** (mount point: `/mnt/moosefs`) -![MooseFS CGI](https://github.com/moosefs/moosefs-docker-cluster/raw/master/images/cgi.png) +# Setup -## Setup - -Install Docker with composer from [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) +Install Docker with Docker Composer from [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/) Clone MooseFS docker config files: ``` git clone https://github.com/moosefs/moosefs-docker-cluster -``` - -### Start MooseFS cluster: - -Go to repo directory: - -``` cd moosefs-docker-cluster ``` @@ -50,18 +68,26 @@ docker-compose build docker-compose up -d ``` -"-d" is for running Docker nodes in background, so Docker console output is invisible. +or -Check if instances are running with: +``` +docker-compose -f docker-compose-chunkserver-client.yml build +docker-compose -f docker-compose-chunkserver-client.yml up -d +``` + +"-d" is detached - running Docker nodes in background, so Docker console output is invisible. + +You can check if instances are running: ``` docker ps ``` -You should have 1 master, 5 chunkservers and 1 client running. Expected output should be similar to: + +You should have 1 master, 4 chunkservers and 1 client running (first configuration). Expected output should be similar to: + ``` CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2fe620447b37 dockermoosefscluster_client "/home/start-clien..." 5 minutes ago Up 5 minutes client -1951d867c078 dockermoosefscluster_chunkserver5 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver5 204c115cd8ad dockermoosefscluster_chunkserver2 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver2 48343721de4f dockermoosefscluster_chunkserver4 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver4 30ca217fa862 dockermoosefscluster_master "/home/start.sh -d" 5 minutes ago Up 5 minutes 9420-9425/tcp master @@ -69,54 +95,37 @@ CONTAINER ID IMAGE COMMAND c83c70580795 dockermoosefscluster_chunkserver3 "/home/start-chunk..." 5 minutes ago Up 5 minutes 9419-9420/tcp, 9422/tcp chunkserver3 ``` +# Attach/detach to/from container + You can **attach** to the client node (press "Enter" twice): ``` -docker container attach mfsclient #press the "Enter" key twice +docker container attach mfsclient ``` To **detach** from container use the escape sequence `Ctrl + p`, `Ctrl + q`. -Now MooseFS filesystem is mounted as `/mnt/mfs`. If everything is ok you should see our welcome message with: +Now MooseFS filesystem is mounted as `/mnt/moosefs`. If everything is ok you should see our welcome message with: ``` -cd /mnt/mfs +cd /mnt/moosefs cat welcome_to_moosefs.txt ``` -The management GUI is available here: [http://172.20.0.2:9425](http://172.20.0.2:9425) (be aware of a local 172.20.0.* network). -To stop all (all means ALL, not just MooseFS's) your Docker containers: -``` -docker stop $(docker ps -aq) -``` +# CGI -Your MooseFS Docker cluster is persistent. It means all files you created in the /mnt/mfs folder will remain there even after turning containers off. +The CGI is available here: [http://172.20.0.2:9425](http://172.20.0.2:9425) (be aware of a local 172.20.0.* network). -### Stop the cluster -`docker-compose stop` +![MooseFS CGI](https://github.com/moosefs/moosefs-docker-cluster/raw/master/images/cgi.png) -### Restart the stopped cluster -`docker-compose start` +# Persistence -### Remove containers -`docker-compose rm -f` +Your MooseFS Docker cluster is persistent. It means all files you created in the /mnt/moosefs folder will remain there even after turning containers off. +MooseFS disks are now mounted in host `./data` directory. -# Change configuration +# Warning -If you want to change storage size modify the chunkserver start script [moosefs-chunkserver/start-chunkserver.sh](https://github.com/moosefs/moosefs-docker-cluster/blob/master/moosefs-chunkserver/start-chunkserver.sh) - -Default configuration is stored in [docker-compose.yml](https://github.com/moosefs/moosefs-docker-cluster/blob/master/docker-compose.yml) - -**Other configurations** - -If you want to use other than default compose yml file (`docker-compose.yml`) use following commands: - -``` -docker-compose -f docker-compose-chunkserver-client.yml build -docker-compose -f docker-compose-chunkserver-client.yml up -d -``` - -When using `docker-compose-chunkserver-client.yml` you will have 5 chunkserver/client machines so you can attach to mfschunkserverclient1, ..., mfschunkserverclient5. +Chunkservers are paired with Master server, so if you destroy the machine with master server you will not be able to access your data. Data will still be there in volumes (`./data` directory) but chunkservers will not want to connect to the new Master server. # Docker Hub diff --git a/bin/build.sh b/bin/build.sh deleted file mode 100755 index 59bdb5a..0000000 --- a/bin/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -PROGNAME=$(basename $0) -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -$DIR/build_cluster.sh build \ No newline at end of file diff --git a/bin/build_cluster.sh b/bin/build_cluster.sh deleted file mode 100755 index bbeb3f3..0000000 --- a/bin/build_cluster.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash - -PROGNAME=$(basename $0) -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -print_usage() { - echo "Usage: $0 [launch|destroy]" - echo "" - echo " launch : Launch moosefs cluster on docker" - echo " destroy : Remove moosefs cluster on docker" - echo " build : Build docker images with local moosefs binary" - echo "" - echo " Options:" - echo " -h, --help : Print usage" - echo " -s, --chunkservers : Specify the number of chunkservers" - echo "" -} - -if [ $# -eq 0 ]; then - print_usage -fi - -DATANODE_NUM=3 -CLUSTER_NAME=default_cluster - -for OPT in "$@" -do - case "$OPT" in - '-h'|'--help' ) - print_usage - exit 1 - ;; - '-s'|'--chunkservers' ) - if [[ -z "$2" ]] || [[ "$2" =~ ^-+ ]]; then - echo "$PROGNAME: option requires an argument -- $1" 1>&2 - exit 1 - fi - DATANODE_NUM="$2" - shift 2 - ;; - '-c'|'--cluster' ) - CLUSTER_NAME="$2" - shift 2 - ;; - -*) - echo "$PROGNAME: illegal option -- '$(echo $1 | sed 's/^-*//')'" 1>&2 - exit 1 - ;; - *) - ;; - esac -done - -launch_cluster() { - if ! docker network inspect moosefs-network > /dev/null ; then - echo "Creating moosefs-network" - docker network create --driver bridge moosefs-network - fi - echo "Launching master server" - docker run -d -p 9870:9870 -p 8088:8088 -p 19888:19888 -p 8188:8188 --net moosefs-network --name master -h master karolmajek/moosefs-master:latest - echo "Launching chunkservers" - for i in `seq 1 $DATANODE_NUM`; do - docker run -d -p 990${i}:9864 -p 804${i}:8042 --name chunkserver${i} -h chunkserver${i} --net moosefs-network karolmajek/moosefs-chunkserver:latest - done -} - -destroy_cluster() { - docker kill master; docker rm master - for i in `seq 1 $DATANODE_NUM`; do - docker kill chunkserver${i}; docker rm chunkserver${i} - done - docker network rm moosefs-network -} - -build_images() { - # cd $DIR/../moosefs-base - # docker build -f Dockerfile-local -t karolmajek/moosefs-base:latest . - cd $DIR/../moosefs-master - docker build -t karolmajek/moosefs-master:latest . - cd $DIR/../moosefs-chunkserver - docker build -t karolmajek/moosefs-chunkserver:latest . -} - -case $1 in - launch) launch_cluster - ;; - destroy) destroy_cluster - ;; - build) build_images - ;; -esac - -exit 0 diff --git a/bin/destroy.sh b/bin/destroy.sh deleted file mode 100755 index 3cf55df..0000000 --- a/bin/destroy.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -PROGNAME=$(basename $0) -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -$DIR/build_cluster.sh -s $1 destroy \ No newline at end of file diff --git a/bin/launch.sh b/bin/launch.sh deleted file mode 100755 index 1c793b4..0000000 --- a/bin/launch.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -PROGNAME=$(basename $0) -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -$DIR/build_cluster.sh -s $1 launch \ No newline at end of file diff --git a/bin/resolv_host.py b/bin/resolv_host.py deleted file mode 100755 index 8054f5e..0000000 --- a/bin/resolv_host.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -import sys -import subprocess -import json - -def exec_process(cmd): - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout_data, stderr_data = p.communicate() - return p.returncode, stdout_data, stderr_data - -def get_ipaddress(host): - (code, out, err) = exec_process('sudo docker inspect {}'.format(host)) - conf = json.loads(out) - return conf[0]['NetworkSettings']['IPAddress'] - -if __name__ == "__main__": - argvs = sys.argv - for h in range(0, int(argvs[1])): - print("{}\tdn{}".format(get_ipaddress('dn' + str(h + 1)), h + 1)) - print("{}\tdn{}.bridge".format(get_ipaddress('dn' + str(h + 1)), h + 1)) - diff --git a/docker-compose-chunkserver-client.yml b/docker-compose-chunkserver-client.yml index db07dcb..2aa4f49 100644 --- a/docker-compose-chunkserver-client.yml +++ b/docker-compose-chunkserver-client.yml @@ -1,119 +1,112 @@ version: '2' services: mfsmaster: - image: moosefs/master - # build: ./moosefs-master + # image: moosefs/master + build: ./moosefs-master container_name: "mfsmaster" networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.2" + ports: + - "9425:9425" mfschunkserverclient1: - image: moosefs/chunkserver-client - # build: ./moosefs-chunkserver-client + # image: moosefs/chunkserver-client + build: ./moosefs-chunkserver-client container_name: "mfschunkserverclient1" - hostname: mfschunkserverclient1 + environment: + - LABELS=M + - SIZE=10 cap_add: - # Needed for mount. - SYS_ADMIN devices: - # Needed for mount. - /dev/fuse:/dev/fuse security_opt: - # Needed for mount. - apparmor:unconfined stdin_open: true tty: true links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.11" + volumes: + - ./data/cs1_hdd0:/mnt/hdd0 + depends_on: + - mfsmaster mfschunkserverclient2: - image: moosefs/chunkserver-client - # build: ./moosefs-chunkserver-client + # image: moosefs/chunkserver-client + build: ./moosefs-chunkserver-client container_name: "mfschunkserverclient2" - hostname: mfschunkserverclient2 + environment: + - LABELS=MB + - SIZE=10 cap_add: - # Needed for mount. - SYS_ADMIN devices: - # Needed for mount. - /dev/fuse:/dev/fuse security_opt: - # Needed for mount. - apparmor:unconfined stdin_open: true tty: true links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.12" + volumes: + - ./data/cs2_hdd0:/mnt/hdd0 + depends_on: + - mfsmaster mfschunkserverclient3: - image: moosefs/chunkserver-client - # build: ./moosefs-chunkserver-client + # image: moosefs/chunkserver-client + build: ./moosefs-chunkserver-client container_name: "mfschunkserverclient3" - hostname: mfschunkserverclient3 + environment: + - LABELS=MB + - SIZE=10 cap_add: - # Needed for mount. - SYS_ADMIN devices: - # Needed for mount. - /dev/fuse:/dev/fuse security_opt: - # Needed for mount. - apparmor:unconfined stdin_open: true tty: true links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.13" + volumes: + - ./data/cs3_hdd0:/mnt/hdd0 + depends_on: + - mfsmaster mfschunkserverclient4: - image: moosefs/chunkserver-client - # build: ./moosefs-chunkserver-client + # image: moosefs/chunkserver-client + build: ./moosefs-chunkserver-client container_name: "mfschunkserverclient4" - hostname: mfschunkserverclient4 + environment: + - LABELS=B + - SIZE=10 cap_add: - # Needed for mount. - SYS_ADMIN devices: - # Needed for mount. - /dev/fuse:/dev/fuse security_opt: - # Needed for mount. - apparmor:unconfined stdin_open: true tty: true links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.14" - mfschunkserverclient5: - image: moosefs/chunkserver-client - # build: ./moosefs-chunkserver-client - container_name: "mfschunkserverclient5" - hostname: mfschunkserverclient5 - cap_add: - # Needed for mount. - - SYS_ADMIN - devices: - # Needed for mount. - - /dev/fuse:/dev/fuse - security_opt: - # Needed for mount. - - apparmor:unconfined - stdin_open: true - tty: true - links: + volumes: + - ./data/cs4_hdd0:/mnt/hdd0 + depends_on: - mfsmaster - networks: - mfsnet: - ipv4_address: "172.20.0.15" networks: - mfsnet: + moosefsnet: driver: bridge ipam: config: diff --git a/docker-compose.yml b/docker-compose.yml index accc91c..5f3e1c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,79 +1,99 @@ version: '2' services: mfsmaster: - image: moosefs/master #use GitHub version - #build: ./moosefs-master #use local version + # image: moosefs/master #use GitHub version + build: ./moosefs-master #use local version container_name: "mfsmaster" networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.2" + ports: + - "9425:9425" mfsclient: - image: moosefs/client #use GitHub version - #build: ./moosefs-client #use local version + # image: moosefs/client #use GitHub version + build: ./moosefs-client #use local version container_name: "mfsclient" cap_add: - # Needed for mount. - SYS_ADMIN devices: - # Needed for mount. - /dev/fuse:/dev/fuse security_opt: - # Needed for mount. - apparmor:unconfined stdin_open: true tty: true links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.5" + depends_on: + - mfsmaster mfschunkserver1: - image: moosefs/chunkserver #use GitHub version - #build: ./moosefs-chunkserver #use local version + # image: moosefs/chunkserver #use GitHub version + build: ./moosefs-chunkserver #use local version container_name: "mfschunkserver1" + environment: + - LABELS=M + - SIZE=10 links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.11" + volumes: + - ./data/cs1_hdd0:/mnt/hdd0 + depends_on: + - mfsmaster mfschunkserver2: - image: moosefs/chunkserver #use GitHub version - #build: ./moosefs-chunkserver #use local version + # image: moosefs/chunkserver #use GitHub version + build: ./moosefs-chunkserver #use local version container_name: "mfschunkserver2" + environment: + - LABELS=MB + - SIZE=10 links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.12" + volumes: + - ./data/cs2_hdd0:/mnt/hdd0 + depends_on: + - mfsmaster mfschunkserver3: - image: moosefs/chunkserver #use GitHub version - #build: ./moosefs-chunkserver #use local version + # image: moosefs/chunkserver #use GitHub version + build: ./moosefs-chunkserver #use local version container_name: "mfschunkserver3" + environment: + - LABELS=MB + - SIZE=10 links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.13" + volumes: + - ./data/cs3_hdd0:/mnt/hdd0 + depends_on: + - mfsmaster mfschunkserver4: - image: moosefs/chunkserver #use GitHub version - #build: ./moosefs-chunkserver #use local version + # image: moosefs/chunkserver #use GitHub version + build: ./moosefs-chunkserver #use local version container_name: "mfschunkserver4" + environment: + - LABELS=B + - SIZE=10 links: - mfsmaster networks: - mfsnet: + moosefsnet: ipv4_address: "172.20.0.14" - mfschunkserver5: - image: moosefs/chunkserver #use GitHub version - #build: ./moosefs-chunkserver #use local version - container_name: "mfschunkserver5" - links: + volumes: + - ./data/cs4_hdd0:/mnt/hdd0 + depends_on: - mfsmaster - networks: - mfsnet: - ipv4_address: "172.20.0.15" networks: - mfsnet: + moosefsnet: driver: bridge ipam: config: diff --git a/images/cgi.png b/images/cgi.png index d5f50dc..b7e06da 100644 Binary files a/images/cgi.png and b/images/cgi.png differ diff --git a/moosefs-chunkserver-client/Dockerfile b/moosefs-chunkserver-client/Dockerfile index 5a0dac1..89d8997 100644 --- a/moosefs-chunkserver-client/Dockerfile +++ b/moosefs-chunkserver-client/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:14.04 +FROM debian:stretch -# Install wget, lsb-release and curl -RUN apt-get update && apt-get install -y wget lsb-release curl fuse libfuse2 tree +# Install wget, lsb-release, curl, fuse and tree +RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl fuse libfuse2 net-tools gnupg2 systemd tree # Add key RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - -RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list +RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list # Install MooseFS chunkserver and client RUN apt-get update && apt-get install -y moosefs-chunkserver moosefs-client diff --git a/moosefs-chunkserver-client/start-chunkserver-client.sh b/moosefs-chunkserver-client/start-chunkserver-client.sh index 6af7fd4..636449f 100644 --- a/moosefs-chunkserver-client/start-chunkserver-client.sh +++ b/moosefs-chunkserver-client/start-chunkserver-client.sh @@ -1,29 +1,32 @@ #!/bin/bash cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg -mkdir -p /mnt/sdb1 -chmod -R 777 /mnt/sdb1 -echo "/mnt/sdb1 10GiB" >> /etc/mfs/mfshdd.cfg +mkdir -p /mnt/hdd0 +chmod -R 777 /mnt/hdd0 +chown -R mfs:mfs /mnt/hdd0 -ifconfig eth0 | awk '/inet addr/{print substr($2,6)}' +#Default size if not set +SIZE="${SIZE:- 10}" + +echo "/mnt/hdd0 "$SIZE"GiB" >> /etc/mfs/mfshdd.cfg +echo "LABELS=$LABELS" >> /etc/mfs/mfschunkserver.cfg -sed -i '/# LABELS =/c\LABELS = DOCKER' /etc/mfs/mfschunkserver.cfg -sed -i '/MFSCHUNKSERVER_ENABLE=false/c\MFSCHUNKSERVER_ENABLE=true' /etc/default/moosefs-chunkserver mfschunkserver start # wait for mfsmaster startup ping -c 10 mfsmaster -mkdir -p /mnt/mfs +mkdir -p /mnt/moosefs # mount mfs -mfsmount /mnt/mfs -H mfsmaster +mfsmount /mnt/moosefs -H mfsmaster # create example file to MooseFS -echo "If you can find this file in /mnt/mfs/SUCCESS on your client instance it means MooseFS is working correctly, congratulations!" > /mnt/mfs/welcome_to_moosefs.txt +echo "If you can find this file in /mnt/moosefs/welcome_to_moosefs.txt on your client instance it means MooseFS is working correctly, congratulations!" > /mnt/moosefs/welcome_to_moosefs.txt # list files in MooseFS -ls /mnt/mfs/ +ls /mnt/moosefs/ +tree /mnt/moosefs/ if [[ $1 == "-d" ]]; then while true; do sleep 1000; done diff --git a/moosefs-chunkserver/Dockerfile b/moosefs-chunkserver/Dockerfile index 731a25b..eb8302b 100644 --- a/moosefs-chunkserver/Dockerfile +++ b/moosefs-chunkserver/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:14.04 +FROM debian:stretch # Install wget, lsb-release and curl -RUN apt-get update && apt-get install -y wget lsb-release curl +RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl net-tools gnupg2 systemd # Add key RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - -RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list +RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list # Install MooseFS chunkserver RUN apt-get update && apt-get install -y moosefs-chunkserver diff --git a/moosefs-chunkserver/start-chunkserver.sh b/moosefs-chunkserver/start-chunkserver.sh index 8ab5ec2..4f2c0f2 100755 --- a/moosefs-chunkserver/start-chunkserver.sh +++ b/moosefs-chunkserver/start-chunkserver.sh @@ -1,14 +1,16 @@ #!/bin/bash cp /etc/mfs/mfschunkserver.cfg.sample /etc/mfs/mfschunkserver.cfg -mkdir -p /mnt/sdb1 -chown -R mfs:mfs /mnt/sdb1 -echo "/mnt/sdb1 10GiB" >> /etc/mfs/mfshdd.cfg +mkdir -p /mnt/hdd0 +chmod -R 777 /mnt/hdd0 +chown -R mfs:mfs /mnt/hdd0 -ifconfig eth0 | awk '/inet addr/{print substr($2,6)}' +#Default size if not set +SIZE="${SIZE:- 10}" + +echo "/mnt/hdd0 "$SIZE"GiB" >> /etc/mfs/mfshdd.cfg +echo "LABELS=$LABELS" >> /etc/mfs/mfschunkserver.cfg -sed -i '/# LABELS =/c\LABELS = DOCKER' /etc/mfs/mfschunkserver.cfg -sed -i '/MFSCHUNKSERVER_ENABLE=false/c\MFSCHUNKSERVER_ENABLE=true' /etc/default/moosefs-chunkserver mfschunkserver start if [[ $1 == "-d" ]]; then diff --git a/moosefs-client/Dockerfile b/moosefs-client/Dockerfile index 6158ed6..0332723 100644 --- a/moosefs-client/Dockerfile +++ b/moosefs-client/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:14.04 +FROM debian:stretch -# Install wget, lsb-release and curl -RUN apt-get update && apt-get install -y wget lsb-release curl fuse libfuse2 tree +# Install wget, lsb-release, curl, fuse and tree +RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl fuse libfuse2 net-tools gnupg2 systemd tree # Add key RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - -RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list +RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list # Install MooseFS client RUN apt-get update && apt-get install -y moosefs-client diff --git a/moosefs-client/start-client.sh b/moosefs-client/start-client.sh index 2b2997e..20c7e33 100644 --- a/moosefs-client/start-client.sh +++ b/moosefs-client/start-client.sh @@ -3,16 +3,17 @@ # wait for mfsmaster startup ping -c 10 mfsmaster -mkdir -p /mnt/mfs +mkdir -p /mnt/moosefs # mount mfs -mfsmount /mnt/mfs -H mfsmaster +mfsmount /mnt/moosefs -H mfsmaster # create example file to MooseFS -echo "If you can find this file in /mnt/mfs/ on your client machine - it means MooseFS is working correctly, congratulations!" > /mnt/mfs/welcome_to_moosefs.txt +echo "If you can find this file in /mnt/moosefs/welcome_to_moosefs.txt on your client machine - it means MooseFS is working correctly, congratulations!" > /mnt/moosefs/welcome_to_moosefs.txt # list files in MooseFS -ls /mnt/mfs/ +ls /mnt/moosefs/ +tree /mnt/moosefs/ if [[ $1 == "-d" ]]; then while true; do sleep 1000; done diff --git a/moosefs-master/Dockerfile b/moosefs-master/Dockerfile index 8576c9c..911cea4 100644 --- a/moosefs-master/Dockerfile +++ b/moosefs-master/Dockerfile @@ -1,17 +1,20 @@ -FROM ubuntu:14.04 +FROM debian:stretch # Install wget, lsb-release and curl -RUN apt-get update && apt-get install -y wget lsb-release curl +RUN apt-get update && apt-get upgrade -y && apt-get install -y wget lsb-release curl net-tools gnupg2 systemd python # Add key RUN wget -O - http://ppa.moosefs.com/moosefs.key | apt-key add - -RUN . /etc/lsb-release && echo "deb http://ppa.moosefs.com/moosefs-3/apt/ubuntu/$DISTRIB_CODENAME $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/moosefs.list +RUN echo "deb http://ppa.moosefs.com/moosefs-3/apt/$(awk -F= '$1=="ID" { print $2 ;}' /etc/os-release)/$(lsb_release -sc) $(lsb_release -sc) main" > /etc/apt/sources.list.d/moosefs.list # Install MooseFS master and CGI RUN apt-get update && apt-get install -y moosefs-master moosefs-cgi moosefs-cgiserv -#Enable CGI Serv -ADD moosefs-cgiserv /etc/default/moosefs-cgiserv +#Enable CGI server autostart +RUN systemctl enable moosefs-cgiserv + +#Enable master server autostart +RUN systemctl enable moosefs-master # Expose ports EXPOSE 9420 9421 9422 9423 9424 9425 diff --git a/moosefs-master/moosefs-cgiserv b/moosefs-master/moosefs-cgiserv deleted file mode 100644 index 604641e..0000000 --- a/moosefs-master/moosefs-cgiserv +++ /dev/null @@ -1,12 +0,0 @@ -# /etc/default/moosefs-cgiserv - -# Start mfscgiserv from init.d script on boot. -# Only allowed values are "true" and "false". -# Undefined values default to "false". -MFSCGISERV_ENABLE=true - -# user and group used to run mfscgiserv -MFSCGISERV_USER=nobody -MFSCGISERV_GROUP=nogroup - -DAEMON_OPTS="" diff --git a/moosefs-master/start.sh b/moosefs-master/start.sh index fe25efe..681da9a 100755 --- a/moosefs-master/start.sh +++ b/moosefs-master/start.sh @@ -8,7 +8,7 @@ echo " mfsmaster" >> /etc/hosts ifconfig eth0 | awk '/inet addr/{print substr($2,6)}' mfsmaster start -a -service moosefs-cgiserv start +mfscgiserv if [[ $1 == "-d" ]]; then while true; do sleep 1000; done