summaryrefslogtreecommitdiffstats
path: root/gluster-object/CentOS/docker-gluster-swift
diff options
context:
space:
mode:
authorSaravanakumar Arumugam <sarumuga@redhat.com>2017-03-21 11:52:47 +0530
committerSaravanakumar Arumugam <sarumuga@redhat.com>2017-03-21 12:21:47 +0530
commit9a86ba3da34bab3347029951b71333dcf46c8688 (patch)
treea1dba72c5d6b6af48676e8c62a58b10ff4532b91 /gluster-object/CentOS/docker-gluster-swift
parentf4b9c98f3c22cd1caeed6ff03bc04828f2fdc9a5 (diff)
downloadgluster-9a86ba3da34bab3347029951b71333dcf46c8688.tar.gz
gluster-9a86ba3da34bab3347029951b71333dcf46c8688.tar.bz2
gluster-9a86ba3da34bab3347029951b71333dcf46c8688.tar.xz
gluster-9a86ba3da34bab3347029951b71333dcf46c8688.zip
Pass gluster volume as argument while running docker.
This will be updated by update_gluster_vol.sh in swift-volumes file. This will be inturn be used by swift-gen-builders service. Updated README to pass gluster volume. Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com>
Diffstat (limited to 'gluster-object/CentOS/docker-gluster-swift')
-rw-r--r--gluster-object/CentOS/docker-gluster-swift/Dockerfile12
-rw-r--r--gluster-object/CentOS/docker-gluster-swift/README.md2
-rw-r--r--gluster-object/CentOS/docker-gluster-swift/etc/sysconfig/swift-volumes4
-rw-r--r--gluster-object/CentOS/docker-gluster-swift/update_gluster_vol.sh13
4 files changed, 25 insertions, 6 deletions
diff --git a/gluster-object/CentOS/docker-gluster-swift/Dockerfile b/gluster-object/CentOS/docker-gluster-swift/Dockerfile
index 78be0b7..65599ec 100644
--- a/gluster-object/CentOS/docker-gluster-swift/Dockerfile
+++ b/gluster-object/CentOS/docker-gluster-swift/Dockerfile
@@ -37,9 +37,6 @@ RUN git clone git://review.gluster.org/gluster-swift /tmp/gluster-swift && \
# Gluster volumes will be mounted *under* this directory.
VOLUME /mnt/gluster-object
-# volumes to be exposed as object storage is present in swift-volumes file
-COPY etc/sysconfig/swift-volumes /etc/sysconfig/
-
# Copy systemd scripts
COPY swift-gen-builders.service /lib/systemd/system/
COPY swift-proxy.service /lib/systemd/system/
@@ -50,6 +47,13 @@ COPY swift-object.service /lib/systemd/system/
# Replace openstack swift conf files with local gluster-swift ones
COPY etc/swift/* /etc/swift/
+# To update volume name used by swift-gen-builders service
+COPY update_gluster_vol.sh /usr/local/bin/update_gluster_vol.sh
+RUN chmod +x /usr/local/bin/update_gluster_vol.sh
+
+# volumes to be exposed as object storage is present in swift-volumes file
+COPY etc/sysconfig/swift-volumes /etc/sysconfig/swift-volumes
+
# The proxy server listens on port 8080
EXPOSE 8080
@@ -62,4 +66,6 @@ RUN systemctl enable swift-proxy.service
RUN systemctl enable swift-account.service
RUN systemctl enable swift-container.service
RUN systemctl enable swift-object.service
+
+ENTRYPOINT ["/usr/local/bin/update_gluster_vol.sh"]
CMD ["/usr/sbin/init"]
diff --git a/gluster-object/CentOS/docker-gluster-swift/README.md b/gluster-object/CentOS/docker-gluster-swift/README.md
index 1692be9..41e966d 100644
--- a/gluster-object/CentOS/docker-gluster-swift/README.md
+++ b/gluster-object/CentOS/docker-gluster-swift/README.md
@@ -30,7 +30,7 @@ Where tv1 is the volume name.
**Example:**
```bash
-# docker run -d --privileged -v /sys/fs/cgroup/:/sys/fs/cgroup/:ro -p 8080:8080 -v /mnt/gluster-object:/mnt/gluster-object gluster-swift
+# docker run -d --privileged -v /sys/fs/cgroup/:/sys/fs/cgroup/:ro -p 8080:8080 -v /mnt/gluster-object:/mnt/gluster-object -e GLUSTER_VOLUMES="tv1" gluster-swift
```
If you have selinux set to enforced on the host machine, refer to the
diff --git a/gluster-object/CentOS/docker-gluster-swift/etc/sysconfig/swift-volumes b/gluster-object/CentOS/docker-gluster-swift/etc/sysconfig/swift-volumes
index 02ebe33..8b49f07 100644
--- a/gluster-object/CentOS/docker-gluster-swift/etc/sysconfig/swift-volumes
+++ b/gluster-object/CentOS/docker-gluster-swift/etc/sysconfig/swift-volumes
@@ -1,2 +1,2 @@
-# Set Gluster volumes to be used by gluster-swift service
-GLUSTER_VOLUMES='tv1'
+# Set Gluster volumes to be used by gluster-object service
+GLUSTER_VOLUMES="tv1"
diff --git a/gluster-object/CentOS/docker-gluster-swift/update_gluster_vol.sh b/gluster-object/CentOS/docker-gluster-swift/update_gluster_vol.sh
new file mode 100644
index 0000000..dfb891d
--- /dev/null
+++ b/gluster-object/CentOS/docker-gluster-swift/update_gluster_vol.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# To update gluster volume name in swift-volumes, used by swift-gen-builders.service
+if [ -z "$GLUSTER_VOLUMES" ]; then
+ echo "You need to set GLUSTER_VOLUMES env variable"
+ exit 1
+else
+ echo "GLUSTER_VOLUMES env variable is set. Update in swift-volumes"
+ sed -i.bak '/^GLUSTER_VOLUMES=/s/=.*/='\""$GLUSTER_VOLUMES"\"'/' /etc/sysconfig/swift-volumes
+fi
+
+# Hand off to CMD
+exec "$@"