Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
sudo: true

addons:
apt:
sources:
- sourceline: 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
packages:
- shellcheck

services:
- docker

before_install:
- sudo apt-get update
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-engine
- docker build -t gluster/client ./gluster-client/
- docker run -it --name client gluster/client rpm -qa | grep gluster
- docker build -t gluster/centos ./CentOS/
- docker run -d --name gcentos --privileged gluster/centos
- sleep 10
- docker exec -it gcentos systemctl is-active glusterd
- docker build -t gluster/fedora ./Fedora/
- docker run -d --name gfedora --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro gluster/fedora
- sleep 10
- docker exec -it gfedora systemctl is-active glusterd
- docker build -t gluster/swift ./gluster-object/CentOS/docker-gluster-swift/
- docker run -d --name swift --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro -e GLUSTER_VOLUMES=vol gluster/swift
- sleep 10
- docker exec -it swift systemctl is-active swift-object

script:
- make test
76 changes: 31 additions & 45 deletions CentOS/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,65 +1,51 @@
FROM centos:latest
FROM centos:7

MAINTAINER Humble Chirammal hchiramm@redhat.com Mohamed Ashiq Liyazudeen mliyazud@redhat.com

ENV container docker

RUN yum --setopt=tsflags=nodocs -y update; yum clean all;

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
LABEL architecture="x86_64" \
name="gluster/gluster-centos" \
version="3.10" \
vendor="Red Hat, Inc" \
summary="This image has a running glusterfs service ( CentOS 7 + Gluster 3.10)" \
io.k8s.display-name="Gluster 3.10 based on CentOS 7" \
io.k8s.description="Gluster Image is based on CentOS Image which is a scalable network filesystem. Using common off-the-shelf hardware, you can create large, distributed storage solutions for media streaming, data analysis, and other data- and bandwidth-intensive tasks." \
description="Gluster Image is based on CentOS Image which is a scalable network filesystem. Using common off-the-shelf hardware, you can create large, distributed storage solutions for media streaming, data analysis, and other data- and bandwidth-intensive tasks." \
io.openshift.tags="gluster,glusterfs,glusterfs-centos"

RUN yum --setopt=tsflags=nodocs -y update; yum install -y centos-release-gluster; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

RUN yum --setopt=tsflags=nodocs -y install wget nfs-utils attr iputils iproute centos-release-gluster

RUN yum --setopt=tsflags=nodocs -y install openssh-server openssh-clients ntp rsync tar cronie sudo xfsprogs glusterfs glusterfs-server glusterfs-geo-replication;yum clean all;

RUN sed -i '/Defaults requiretty/c\#Defaults requiretty' /etc/sudoers

# Changing the port of sshd to avoid conflicting with host sshd
RUN sed -i '/Port 22/c\Port 2222' /etc/ssh/sshd_config

# Fixing RPC port conflict issue
RUN sed -i 's/Requires\=rpcbind\.service//g' /usr/lib/systemd/system/glusterd.service

RUN sed -i 's/rpcbind\.service/gluster-setup\.service/g' /usr/lib/systemd/system/glusterd.service

# Fix for the separate /var on host issue
RUN sed -i 's/ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"/ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="systemd_end"/g' /usr/lib/udev/rules.d/99-systemd.rules

# Backing up gluster config as it overlaps when bind mounting.
RUN mkdir -p /etc/glusterfs_bkp /var/lib/glusterd_bkp /var/log/glusterfs_bkp;\
rm -f /lib/systemd/system/anaconda.target.wants/*;\
yum --setopt=tsflags=nodocs -y install wget nfs-utils attr iputils iproute openssh-server openssh-clients ntp rsync tar cronie sudo xfsprogs glusterfs glusterfs-server glusterfs-geo-replication;yum clean all; \
sed -i '/Defaults requiretty/c\#Defaults requiretty' /etc/sudoers; \
sed -i '/Port 22/c\Port 2222' /etc/ssh/sshd_config; \
sed -i 's/Requires\=rpcbind\.service//g' /usr/lib/systemd/system/glusterd.service; \
sed -i 's/rpcbind\.service/gluster-setup\.service/g' /usr/lib/systemd/system/glusterd.service; \
sed -i 's/ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"/ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="systemd_end"/g' /usr/lib/udev/rules.d/99-systemd.rules; \
mkdir -p /etc/glusterfs_bkp /var/lib/glusterd_bkp /var/log/glusterfs_bkp;\
cp -r /etc/glusterfs/* /etc/glusterfs_bkp;\
cp -r /var/lib/glusterd/* /var/lib/glusterd_bkp;\
cp -r /var/log/glusterfs/* /var/log/glusterfs_bkp;
cp -r /var/log/glusterfs/* /var/log/glusterfs_bkp; \
sed -i.save -e "s#udev_sync = 1#udev_sync = 0#" -e "s#udev_rules = 1#udev_rules = 0#" -e "s#use_lvmetad = 1#use_lvmetad = 0#" /etc/lvm/lvm.conf;

# Configure LVM to create LVs and snapshots
RUN sed -i.save -e "s#udev_sync = 1#udev_sync = 0#" \
-e "s#udev_rules = 1#udev_rules = 0#" \
-e "s#use_lvmetad = 1#use_lvmetad = 0#" /etc/lvm/lvm.conf

# Adding script to move the glusterfs config file to location
VOLUME [ "/sys/fs/cgroup" ]
ADD gluster-setup.service /etc/systemd/system/gluster-setup.service
RUN chmod 644 /etc/systemd/system/gluster-setup.service

# Adding script to move the glusterfs config file to location
ADD gluster-setup.sh /usr/sbin/gluster-setup.sh
RUN chmod 500 /usr/sbin/gluster-setup.sh

#RUN echo 'root:password' | chpasswd
VOLUME [ "/sys/fs/cgroup" ]

RUN systemctl disable nfs-server.service
# stops getty from consuming all the memory
RUN systemctl mask getty.target
RUN systemctl enable ntpd.service
RUN systemctl enable glusterd.service
RUN systemctl enable gluster-setup.service
RUN chmod 644 /etc/systemd/system/gluster-setup.service; \
chmod 500 /usr/sbin/gluster-setup.sh; \
systemctl disable nfs-server.service; \
systemctl mask getty.target; \
systemctl enable ntpd.service; \
systemctl enable glusterd.service; \
systemctl enable gluster-setup.service;

EXPOSE 2222 111 245 443 24007 2049 8080 6010 6011 6012 38465 38466 38468 38469 49152 49153 49154 49156 49157 49158 49159 49160 49161 49162

Expand Down
28 changes: 18 additions & 10 deletions Fedora/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
FROM fedora

MAINTAINER Humble Chirammal hchiramm@redhat.com
MAINTAINER Humble Chirammal hchiramm@redhat.com Mohamed Ashiq Liyazudeen mliyazud@redhat.com

ENV container docker

RUN yum -y update && yum clean all
LABEL architecture="x86_64" \
name="gluster/gluster-fedora" \
version="3.10" \
vendor="Red Hat, Inc" \
summary="This image has a running glusterfs service ( Fedora + Gluster 3.10)" \
io.k8s.display-name="Gluster 3.10 based on Fedora" \
io.k8s.description="Gluster Image is based on Fedora Image which is a scalable network filesystem. Using common off-the-shelf hardware, you can create large, distributed storage solutions for media streaming, data analysis, and other data- and bandwidth-intensive tasks." \
description="Gluster Image is based on fedora Image which is a scalable network filesystem. Using common off-the-shelf hardware, you can create large, distributed storage solutions for media streaming, data analysis, and other data- and bandwidth-intensive tasks." \
io.openshift.tags="gluster,glusterfs,gluster-fedora"

RUN yum -y install systemd; yum clean all; \

RUN yum -y update;\
yum -y install systemd; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;

RUN yum --setopt=tsflags=nodocs -y install wget nfs-utils iputils iproute attr glusterfs glusterfs-server glusterfs-geo-replication openssh-server; yum clean all
rm -f /lib/systemd/system/anaconda.target.wants/*; \
yum --setopt=tsflags=nodocs -y install wget nfs-utils iputils iproute attr glusterfs glusterfs-server glusterfs-geo-replication openssh-server; yum clean all;\
systemctl disable nfs-server.service;\
systemctl enable rpcbind.service;\
systemctl enable glusterd.service;

RUN echo 'root:password' | chpasswd
VOLUME [ "/sys/fs/cgroup" ]

EXPOSE 22 111 245 443 24007 2049 8080 6010 6011 6012 38465 38466 38468 38469 49152 49153 49154 49156 49157 49158 49159 49160 49161 49162 49163

RUN systemctl disable nfs-server.service
RUN systemctl enable rpcbind.service
RUN systemctl enable glusterd.service
CMD ["/usr/sbin/init"]

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
$(MAKE) -C tests test
47 changes: 20 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,80 @@
This repo contains dockerfiles (CentOS, Fedora, Red Hat) for GlusterFS containers namely server, client and object.
This repo contains dockerfiles (CentOS and Fedora) for GlusterFS containers namely server, client and object.

## Gluster Server Docker container:

Although Setting up a glusterfs environment is a pretty simple and straight forward procedure, Gluster community do maintain docker images for gluster both in Fedora and CentOS in the docker hub for the ease of users. This blog is intented to walk the user through the steps of running GlusterFS with the help of docker.
The community maintains docker images of GlusterFS release in both Fedora and CentOS distributions. The following are the steps to build the GlusterFS docker images that we maintain:
Although Setting up a glusterfs environment is a pretty simple and straight forward procedure, Gluster community do maintain docker images of gluster both Fedora and CentOS as base image in the docker hub for the ease of users. The community maintains docker images of GlusterFS release in both Fedora and CentOS distributions.

The following are the steps to run the GlusterFS docker images that we maintain:

To pull the docker image from the docker hub run the following command:

### Fedora:

~~~
$ docker pull gluster/gluster-fedora

~~~

### CentOS:

~~~
$ docker pull gluster/gluster-centos

~~~
This will fetch and build the docker image for you from the docker hub.
Alternatively, one could build the image from the Dockerfile directly. For this, one should pull the Gluster-Fedora Dockerfile from the source repository and build the image using that. For getting the source, One can make use of git:

This will pull the glusterfs docker image from the docker hub.
Alternatively, one could build the image from the Dockerfile directly. For this, clone the gluster-containers source repository and build the image using Dockerfiles in the repository. For getting the source, One can make use of git:

~~~
$ git clone git@github.com:gluster/gluster-containers.git
~~~

This repository consists of Dockerfiles for GlusterFS built in both CentOS and Fedora distributions. Once you clone the repository, to build the image, run the following commands:
This repository consists of Dockerfiles for GlusterFS to build on both CentOS and Fedora distributions. Once you clone the repository, to build the image, run the following commands:

For Fedora,

~~~
$ docker build -t gluster-fedora docker/Fedora/Dockerfile

~~~
For CentOS,
~~~
$ docker build -t gluster-centos docker/CentOS/Dockerfile
~~~
This command will build the docker image from the Dockerfile you just cloned and will be assigned the name gluster-fedora or gluster-centos respectively. ‘-t’ option is used to give a name to the image we are about the build.
This command will build the docker image from the Dockerfile and will be assigned the name gluster-fedora or gluster-centos respectively. ‘-t’ option is used to give a name to the image we built.

Once the image is built in either of the above two steps, we can now run the container with gluster daemon running.
Once the image is built in either of the above two steps, now we can run the container with gluster daemon running.

Before this, ensure the following directories are created in the system from where docker is launched:
- /etc/glusterfs
Before this, ensure the following directories are created on the host where docker is running:
- /etc/glusterfs
- /var/lib/glusterd
- /var/log/glusterfs
Also, ensure they are empty to avoid any conflicts.
Now run the following command:

~~~

$ docker run -v /etc/glusterfs:/etc/glusterfs:z -v /var/lib/glusterd:/var/lib/glusterd:z -v /var/log/glusterfs:/var/log/glusterfs:z -v /sys/fs/cgroup:/sys/fs/cgroup:ro -d --privileged=true --net=host -v /dev/:/dev gluster/gluster-centos
~~~

( is either gluster-fedora or gluster-centos as per the configurations so far)

Where:

~~~
--net=host ( Optional: This option brings maximum network throughput for your storage container)

--privileged=true ( If you are exposing the `/dev/` tree of host to the container to create bricks from the container)


~~~
Bind mounting of following directories enables:

~~~
`/var/lib/glusterd` : To make gluster metadata persistent in the host.
`/var/log/glusterfs` : To make gluster logs persistent in the host.
`/etc/glusterfs` : To make gluster configuration persistent in the host.
~~~




Systemd has been installed and is running in the container we maintain.
Systemd has been installed and is running in the container we maintain.

Once issued, this will boot up the Fedora or CentOS system and you have a container started with glusterd running in it.

##### Verify the container is running successfully:

~~~

$ docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Expand Down Expand Up @@ -115,7 +111,6 @@ root 159 0.0 0.0 112992 2224 pts/0 S+ 06:22 0:00 grep --color=auto glusterd
Number of Peers: 0

-bash-4.3# gluster --version

~~~
That’s it!

Expand All @@ -127,7 +122,6 @@ Additional Ref# https://goo.gl/3031Mm
### To pull gluster-object:
~~~
$ docker pull gluster/gluster-object

~~~

### To run gluster-object container:
Expand All @@ -149,8 +143,7 @@ GLUSTER_VOLUMES='tv1'
Where tv1 is the volume name.

~~~
$ docker run -d --privileged -v /sys/fs/cgroup/:/sys/fs/cgroup/:ro -p 8080:8080 -v /mnt/gluster-object:/mnt/gluster-object gluster/gluster-object

$ docker run -d --privileged -v /sys/fs/cgroup/:/sys/fs/cgroup/:ro -p 8080:8080 -v /mnt/gluster-object:/mnt/gluster-object gluster/gluster-object
~~~

Now, We can get/put objects into the gluster volume, using the gluster-object Docker container.
Expand Down
26 changes: 20 additions & 6 deletions gluster-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
FROM fedora
MAINTAINER Humble Devassy Chirammal <hchiramm@redhat.com>
LABEL Name="glusterfs-client"
FROM fedora

MAINTAINER Humble Devassy Chirammal <hchiramm@redhat.com>

LABEL architecture="x86_64" \
name="gluster/glusterfs-client" \
version="3.10" \
vendor="Red Hat, Inc" \
summary="This image has a running glusterfs service ( Fedora + Gluster 3.10 client)" \
io.k8s.display-name="Gluster 3.10 client based on Fedora" \
io.k8s.description="Gluster Client Image is based on Fedora Image which is used to mount a glusterfs volume." \
description="Gluster Client Image is based on Fedora Image which is used to mount a glusterfs volume." \
io.openshift.tags="gluster,glusterfs,glusterfs-client"

ENV container docker
RUN dnf --setopt=tsflags=nodocs -y update; dnf clean all; dnf --setopt=tsflags=nodocs -y install wget nfs-utils attr iputils iproute;
RUN sed -i "s/LANG/\#LANG/g" /etc/locale.conf
RUN dnf install -y glusterfs-fuse; dnf clean all;

RUN dnf --setopt=tsflags=nodocs -y update; dnf --setopt=tsflags=nodocs -y install wget nfs-utils attr iputils iproute; \
sed -i "s/LANG/\#LANG/g" /etc/locale.conf;\
dnf install -y glusterfs-fuse;\
dnf clean all;

CMD ["/bin/bash"]
Loading