Browse Source

HDDS-1518. Use /etc/ozone for configuration inside docker-compose.
Contributed by Elek, Marton.

(cherry picked from commit ac814f15b15a0f70cab96fd7262a31477af6e2a8)

Anu Engineer 6 years ago
parent
commit
cc0bd3ccbb
3 changed files with 7 additions and 3 deletions
  1. 3 1
      Dockerfile
  2. 3 1
      scripts/envtoconf.py
  3. 1 1
      scripts/starter.sh

+ 3 - 1
Dockerfile

@@ -36,7 +36,9 @@ RUN chown hadoop /opt
 ADD scripts /opt/
 ADD scripts/krb5.conf /etc/
 RUN yum install -y krb5-workstation
-
+RUN mkdir -p /etc/hadoop && mkdir -p /var/log/hadoop && chmod 1777 /etc/hadoop && chmod 1777 /var/log/hadoop
+ENV HADOOP_LOG_DIR=/var/log/hadoop
+ENV HADOOP_CONF_DIR=/etc/hadoop
 WORKDIR /opt/hadoop
 
 VOLUME /data

+ 3 - 1
scripts/envtoconf.py

@@ -36,7 +36,7 @@ class Simple(object):
 
     self.known_formats = ['xml', 'properties', 'yaml', 'yml', 'env', "sh", "cfg", 'conf']
     self.output_dir = self.args.destination
-
+    self.excluded_envs = ['HADOOP_CONF_DIR']
     self.configurables = {}
 
   def destination_file_path(self, name, extension):
@@ -51,6 +51,8 @@ class Simple(object):
   def process_envs(self):
     """Process environment variables"""
     for key in os.environ.keys():
+      if key in self.excluded_envs:
+          continue
       pattern = re.compile("[_\\.]")
       parts = pattern.split(key)
       extension = None

+ 1 - 1
scripts/starter.sh

@@ -99,7 +99,7 @@ fi
 #To avoid docker volume permission problems
 sudo chmod o+rwx /data
 
-"$DIR"/envtoconf.py --destination /opt/hadoop/etc/hadoop
+"$DIR"/envtoconf.py --destination "${HADOOP_CONF_DIR:-/opt/hadoop/etc/hadoop}"
 
 if [ -n "$ENSURE_NAMENODE_DIR" ]; then
   CLUSTERID_OPTS=""