Advertisement
Guest User

Untitled

a guest
Jun 27th, 2018
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 16.25 KB | None | 0 0
  1. FROM oraclelinux:7.2
  2. LABEL maintainer "eder.quinones@gmail.com" description "Eder Quiñones"
  3.  
  4. # Install required OS packages.
  5. RUN yum -y install unzip && \
  6.     yum -y install tar && \
  7.     yum -y install sudo && \
  8.     yum -y install libaio && \
  9.     yum -y install glibc.i686 && \
  10.     yum -y install less && \
  11.     yum -y install tree
  12.  
  13. # Install GOSU
  14. RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.7/gosu-amd64' \
  15.     && chmod +x /usr/local/bin/gosu
  16.  
  17. # Local Files.
  18. ENV LOCAL_CONF conf
  19. ENV LOCAL_SCRIPTS scripts
  20. ENV LOCAL_PROP properties
  21. ENV INSTALLERS software
  22.  
  23. # Oracle User Data Moint #1.
  24. ENV ORACLE_USER_MOUNT_POINT=/u01/app/
  25. RUN mkdir -p $ORACLE_USER_MOUNT_POINT
  26.  
  27. # Oracle Commerce Guided Search with Experience Manager installation Path.
  28. ENV ENDECA_HOME=$ORACLE_USER_MOUNT_POINT/oracle_atg/product/oracle_gs
  29. RUN mkdir -p $ENDECA_HOME/endeca
  30.  
  31. ###############################################################################
  32. #
  33. #
  34. # Install Java Development Kit
  35. #
  36. #
  37. ###############################################################################
  38.  
  39. # Java 8, JDK installer,  (Version as suggested in Oracle Commerce Compatibility Matrix)
  40. ENV JAVA_INSTALLER=software/jdk-8u*-linux-x64.tar.gz
  41.  
  42. # Install Java 8u*, compatible with Oracle Commerce 11.3.
  43. ADD $JAVA_INSTALLER /usr/java/
  44.  
  45. # Add Java alternatives.
  46. RUN export JAVA_HOME=$(ls -1 -d /usr/java/*) && \
  47.     alternatives --install /usr/bin/java java $JAVA_HOME/bin/java 200001 && \
  48.     alternatives --install /usr/bin/javaws javaws $JAVA_HOME/bin/javaws 200001 && \
  49.     alternatives --install /usr/bin/javac javac $JAVA_HOME/bin/javac 200001 && \
  50.     alternatives --install /usr/bin/jar jar $JAVA_HOME/bin/jar 200001
  51.  
  52. ###############################################################################
  53. #
  54. #
  55. # Endeca User Creation
  56. #
  57. #
  58. ###############################################################################
  59.  
  60. # Create endeca user.
  61. ENV USER_HOME_DIR /home/endeca
  62. RUN useradd -m -d $USER_HOME_DIR endeca -G root -p westitora
  63.  
  64. # Add proper priviledges to the Endeca installation folder.
  65. RUN chown -R endeca:endeca $ENDECA_HOME/endeca
  66. RUN chmod -R 755 $ENDECA_HOME/endeca
  67.  
  68. # Add proper permissions to the Oracle's user mount point #1.
  69. RUN chmod -R 755 $ORACLE_USER_MOUNT_POINT
  70. RUN chown -R endeca:endeca $ORACLE_USER_MOUNT_POINT
  71.  
  72. # Folder used to copy temporarily the Oracle Commerce Guided Search with Experiene Manager installers.
  73. ENV TMP_FOLDER /tmp
  74. ENV TMP_FOLDER_ENDECA_INSTALL $TMP_FOLDER/endeca
  75. ENV TMP_FOLDER_PACKAGE_INSTALL $TMP_FOLDER_ENDECA_INSTALL/packages
  76.  
  77. # Endeca User Config, Properties, and Script location.
  78. ENV SCRIPT_DIR $USER_HOME_DIR/bin
  79. ENV CONF_DIR $USER_HOME_DIR/conf
  80. ENV PROP_DIR $USER_HOME_DIR/properties
  81.  
  82. ###############################################################################
  83. #
  84. #
  85. # Copy installers from local directory to the OS temporary folder
  86. #
  87. #
  88. ###############################################################################
  89.  
  90. # Local copy of Platform and Service 11.3
  91. ADD $INSTALLERS/V861203-01.zip $TMP_FOLDER_ENDECA_INSTALL/V861203-01.zip
  92.  
  93. # Local copy of  MDEX 11.3
  94. ADD $INSTALLERS/V861206-01.zip $TMP_FOLDER_ENDECA_INSTALL/V861206-01.zip
  95.  
  96. # Local copy of Tools And Frameworks with Experience Mangeer 11.3
  97. ADD $INSTALLERS/V861200-01.zip $TMP_FOLDER_ENDECA_INSTALL/V861200-01.zip
  98.  
  99. # Local copy of Content Adquisition System 11.3
  100. ADD $INSTALLERS/V861198-01.zip $TMP_FOLDER_ENDECA_INSTALL/V861198-01.zip
  101.  
  102. # Change the ownership of the installers to the endeca user
  103. RUN chown -R endeca:endeca $TMP_FOLDER_ENDECA_INSTALL/
  104.  
  105.  
  106. # Using the endeca usar, perform the following operations:
  107. #   - Unzip the installers
  108. #   - Change access permissions to write to the bin files gathered thru unzipping the installers
  109. #
  110. USER endeca
  111.  
  112. ###############################################################################
  113. #
  114. #
  115. # Unzip the content inside the following zip files:
  116. #     * V861206-01.zip - MDEX
  117. #     * V861203-01.zip - Platform And Services
  118. #     * V861200-01.zip - Tools And Frameworks
  119. #     * V861198-01.zip - Content Adquisition System
  120. #
  121. #
  122. ###############################################################################
  123.  
  124. RUN unzip -o $TMP_FOLDER_ENDECA_INSTALL/V861203-01.zip -d $TMP_FOLDER_PACKAGE_INSTALL/ && \
  125.     unzip -o $TMP_FOLDER_ENDECA_INSTALL/V861206-01.zip -d $TMP_FOLDER_PACKAGE_INSTALL/ && \
  126.     unzip -o $TMP_FOLDER_ENDECA_INSTALL/V861200-01.zip -d $TMP_FOLDER_PACKAGE_INSTALL/ && \
  127.     unzip -o $TMP_FOLDER_ENDECA_INSTALL/V861198-01.zip -d $TMP_FOLDER_PACKAGE_INSTALL/
  128.  
  129. RUN chmod +x $TMP_FOLDER_PACKAGE_INSTALL/*.bin
  130.  
  131. ###############################################################################
  132. #
  133. #
  134. # Install MDEX Engine
  135. #   Documents:
  136. #     - MDEX Engine Installation Guide [1]
  137. #
  138. #
  139. #  MDEX Engine Installation Guide. (n.d.). Retrieved June 22, 2018, from https://docs.oracle.com/cd/E70266_01/mdex.11.3/EndecaMDEXinstall/html/index.html
  140. #
  141. #
  142. ###############################################################################
  143.  
  144. USER endeca
  145.  
  146. # MDEX silent install script
  147. ENV MDEX_SILENT_PATH $TMP_FOLDER_ENDECA_INSTALL/
  148. ENV MDEX_SILENT_INSTALL_FILE $MDEX_SILENT_PATH/mdex_silent_install.properties
  149.  
  150. # MDEX install directory.
  151. ENV USER_INSTALL_DIR $ENDECA_HOME
  152. ENV ENDECA_MDEX_INSTALL_DIR $ENDECA_HOME/endeca/MDEX/11.3.0
  153.  
  154. # Compose MDEX silent install script (As per Oracle Documentation)
  155. RUN echo USER_INSTALL_DIR=$USER_INSTALL_DIR > $MDEX_SILENT_INSTALL_FILE
  156. RUN sh $TMP_FOLDER_PACKAGE_INSTALL/OCmdex*-Linux64*.bin -i silent -f $MDEX_SILENT_INSTALL_FILE -r mdex_response.properties
  157.  
  158. # Copy MDEX Engine environment variables into .bashrc (In order to be loaded whenever bash is started interactively)
  159. RUN cat $ENDECA_MDEX_INSTALL_DIR/mdex_setup_sh.ini >> $USER_HOME_DIR/.bashrc
  160. # Pre-load variables mentioned above.
  161. RUN source $USER_HOME_DIR/.bashrc
  162.  
  163. # Add ENDECA_MDEX_ROOT into the PATH environment variable.
  164. ENV ENDECA_MDEX_ROOT $ENDECA_MDEX_INSTALL_DIR
  165. ENV PATH $ENDECA_MDEX_ROOT/bin:$PATH
  166.  
  167. ###############################################################################
  168. #
  169. #
  170. # Install Platform and Services
  171. #
  172. #  Documents:
  173. #    - Guided Search Platform Services Installation Guide [1]
  174. #
  175. # 1. Guided Search Platform Services Installation Guide. (n.d.). Retrieved June 22, 2018, from https://docs.oracle.com/cd/E70265_01/mdex.11-3/Endecacasplatinstall/html
  176. #
  177. ###############################################################################
  178.  
  179. USER endeca
  180.  
  181. # Properties and values required for the PlatformServices installation.
  182. ENV USER_INSTALL_DIR=$ENDECA_HOME/
  183. ENV EAC_SERVICE_PORT 8888
  184. ENV EAC_SERVICE_SHUTDOWN_PORT 8090
  185. ENV MDEX_ROOT $ENDECA_MDEX_INSTALL_DIR
  186.  
  187. # PlatformService install script
  188. ENV PS_SILENT_PATH $TMP_FOLDER_ENDECA_INSTALL/
  189. ENV PS_SILENT_INSTALL_FILE $PS_SILENT_PATH/platformservices_silent_install.properties
  190.  
  191. # Compose the PlatformService silent install script (As per Oracle Documentation)
  192. RUN echo USER_INSTALL_DIR=$USER_INSTALL_DIR/ >> $PS_SILENT_INSTALL_FILE && \
  193.     echo ENDECA_USER_NAME=endeca >> $PS_SILENT_INSTALL_FILE && \
  194.     echo ETOOLS_HTTP_PORT=$EAC_SERVICE_PORT >> $PS_SILENT_INSTALL_FILE && \
  195.     echo ETOOLS_SERVER_PORT=$EAC_SERVICE_SHUTDOWN_PORT >> $PS_SILENT_INSTALL_FILE && \
  196.     echo EAC_MDEX_ROOT=$ENDECA_MDEX_INSTALL_DIR >> $PS_SILENT_INSTALL_FILE
  197.  
  198. # Run the install script in silent mode with the previously generated silent script properties.
  199. RUN $TMP_FOLDER_PACKAGE_INSTALL/OCplatformservices*-Linux64.bin -i silent -f $PS_SILENT_INSTALL_FILE -r platformservices_response.properties
  200.  
  201. # PlatformServices enviroment variables.
  202. ENV VERSION 11.3.0
  203. ENV BUILD_VERSION 11.3.0.1394436
  204. ENV ARCH_OS x86_64pc-linux
  205. ENV PRODUCT IAP
  206. ENV ENDECA_CONF $ENDECA_HOME/endeca/PlatformServices/workspace/
  207. ENV ENDECA_REFERENCE_DIR $ENDECA_HOME/endeca/PlatformServices/reference/
  208. ENV ENDECA_ROOT $ENDECA_HOME/endeca/PlatformServices/11.3.0/
  209. ENV PERL5LIB $ENDECA_HOME/endeca/PlatformServices/11.3.0/perl:/$ENDECA_HOME/endeca/PlatformServices/11.3.0/perl/lib/5.8.3/
  210. ENV UNIXUTILS $ENDECA_HOME/endeca/PlatformServices/11.3.0/utilities/
  211.  
  212. # Copy PlatformService environment variables into .bashrc (In order to be loaded whenever bash is started interactively)
  213. RUN cat $ENDECA_HOME/endeca/PlatformServices/workspace/setup/installer_sh.ini >> $USER_HOME_DIR/.bashrc
  214. # Pre-load variables mentioned above.
  215. RUN source $USER_HOME_DIR/.bashrc
  216.  
  217. # TODO: Why silent install is leaving binaries as read and write.
  218. # Workaround
  219. USER root
  220. RUN chmod -R 755 $ENDECA_HOME/endeca/PlatformServices/
  221.  
  222. ###############################################################################
  223. #
  224. #
  225. # Install Tools And Frameworks
  226. #
  227. #  Documents:
  228. #    - Guided Search Tools and Framework Installation Guide [1]
  229. #  
  230. # 1. Guided Search Platform Services Installation Guide. (n.d.). Retrieved June 22, 2018, from https://docs.oracle.com/cd/E70265_01/mdex.11-3/Endecacasplatinstall/html/
  231. #
  232. ###############################################################################
  233.  
  234. USER endeca
  235.  
  236. # Workbench port.
  237. ENV WORKBENCH_PORT 8006
  238.  
  239. # Tools and Frameworks directory paths.
  240. ENV ENDECA_TOOLS_ROOT $ENDECA_HOME/endeca/ToolsAndFrameworks/11.3.0/
  241. ENV ENDECA_TOOLS_CONF $ENDECA_TOOLS_ROOT/server/workspace/
  242.  
  243. # Tools and Frameworks silent install script location.
  244. ENV TF_SILENT_SH_PATH $TMP_FOLDER_PACKAGE_INSTALL/cd/Disk1/install/silent_install.sh
  245. ENV TF_SILENT_RSP_PATH $TMP_FOLDER_PACKAGE_INSTALL/cd/Disk1/install/silent_response.rsp
  246.  
  247. #
  248. # silent_install.sh
  249. #
  250. # Usage: silent_install.sh <FULL_PATH_TO_RESPONSE_FILE> <ORACLE_HOME_NAME> <ORACLE_HOME_LOCATION> [<ORACLE_INVENTORY_CONF_FILE>]
  251. #   FULL_PATH_TO_RESPONSE_FILE - The full path to response file which will be consumed by the silent installer
  252. #   ORACLE_HOME_NAME - A string value which represents your ORACLE_HOME
  253. #   ORACLE_HOME_LOCATION - The location where you would like to install the product
  254. #   ORACLE_INVENTORY_CONF_FILE (optional) - Full path to file "oraInst.loc". Create this file with a single line as follows(without quotes): "inventory_loc=<FULL_PATH_TO_FOLDER_USED_AS_INVENTORY>"
  255. #
  256.  
  257. # Perform replace operation inside silent install script.
  258. RUN sed -i 's/dba/root/g' $TF_SILENT_RSP_PATH
  259.  
  260. # Run the install script in silent mode, using the OOTB silent install script.
  261. RUN $TF_SILENT_SH_PATH $TF_SILENT_RSP_PATH ToolsAndFrameworks $ENDECA_HOME/endeca/ToolsAndFrameworks
  262.  
  263. # Set ToolsAndFrameworks environemnt varialbes.
  264. RUN echo ENDECA_TOOLS_ROOT=$ENDECA_TOOLS_ROOT >> $USER_HOME_DIR/.bashrc
  265. RUN echo ENDECA_TOOLS_CONF=$ENDECA_TOOLS_CONF >> $USER_HOME_DIR/.bashrc
  266.  
  267. # Update current context
  268. RUN source $USER_HOME_DIR/.bashrc
  269.  
  270. # As requested by the Tools and Frameworks installer, the orainstRoot script must be executed.
  271. USER root
  272. RUN $ORACLE_USER_MOUNT_POINT/oraInventory/orainstRoot.sh
  273.  
  274. #
  275. # TODO:
  276. # Perform the configuration in order to use JRE and JDK already contained in the ToolsAndFramworks package.
  277. # As of now, the Dockerfile is installing the JDK located at the software folder.
  278. #
  279.  
  280. # Set JDK
  281. #ENV JAVA_HOME $ENDECA_TOOLS_ROOT/server/jdk1.8.0_121/
  282. #RUN echo JAVA_HOME=$JAVA_HOME >> $USER_HOME_DIR/.bashrc
  283.  
  284. # Add Java alternatives
  285. #RUN export JAVA_HOME=$JAVA_HOME && \
  286. #    alternatives --install /usr/bin/java java $JAVA_HOME/bin/java 200000 && \
  287. #    alternatives --install /usr/bin/javaws javaws $JAVA_HOME/bin/javaws 200000 && \
  288. #    alternatives --install /usr/bin/javac javac $JAVA_HOME/bin/javac 200000 && \
  289. #    alternatives --install /usr/bin/jar jar $JAVA_HOME/bin/jar 200000
  290.  
  291. ###############################################################################
  292. #
  293. #
  294. # Install Content Adquisition System
  295. #  Documents:
  296. #    - Content Adquisition System Installation Guide [1]
  297. #
  298. # 1. Content Acquisition System Installation Guide. (n.d.). Retrieved June 22, 2018, from https://docs.oracle.com/cd/E70265_01/cas.11-3/Endecacasinstall/html/index.html
  299. #
  300. ###############################################################################
  301.  
  302. USER endeca
  303.  
  304. # Environment variables used to install and create response file for CAS installation.
  305. ENV USER_INSTALL_DIR $ENDECA_HOME
  306. ENV CAS_RSP_PATH $TMP_FOLDER_ENDECA_INSTALL/cas_silent_install.properties
  307.  
  308. # CAS related environment variables
  309. ENV CAS_PORT 8500
  310. ENV CAS_SHUTDOWN_PORT 8506
  311. ENV CAS_HOST localhost
  312.  
  313. # Build Content Adquisition System response file.
  314. RUN echo USER_INSTALL_DIR=$USER_INSTALL_DIR/ >> $CAS_RSP_PATH && \
  315.     echo CASPORT=$CAS_PORT >> $CAS_RSP_PATH && \
  316.     echo CASHOST=$CAS_HOST >> $CAS_RSP_PATH && \
  317.     echo CASSHUTDOWNPORT=$CAS_SHUTDOWN_PORT >> $CAS_RSP_PATH && \
  318.     echo ENDECA_TOOLS_ROOT=$ENDECA_TOOLS_ROOT >> $CAS_RSP_PATH && \
  319.     echo ENDECA_TOOLS_CONF=$ENDECA_TOOLS_CONF >> $CAS_RSP_PATH
  320.  
  321. # Run CAS installer.
  322. RUN $TMP_FOLDER_PACKAGE_INSTALL/OCcas11.3.0-Linux64.bin -i silent -f $CAS_RSP_PATH  -r cas_response.properties
  323.  
  324. # Set environment variables for CAS.
  325. RUN echo CAS_ROOT=$ENDECA_HOME/endeca/CAS/11.3.0 >> $USER_HOME_DIR/.bashrc
  326. RUN echo CAS_WORKSPACE=$ENDECA_HOME/endeca/CAS/workspace >> $USER_HOME_DIR/.bashrc
  327.  
  328. # Update the current context.
  329. RUN source $USER_HOME_DIR/.bashrc
  330.  
  331. # Add Stop Port to CAS service.
  332. RUN sed -i 's/-DSTOP.PORT=/-DSTOP.PORT=8506/g' $ENDECA_HOME/endeca/CAS/11.3.0/bin/cas-service.sh
  333.  
  334. ###############################################################################
  335. #
  336. #
  337. # Copy local files (script, configurations, and properties) into the container.
  338. #
  339. #
  340. ###############################################################################
  341.  
  342. USER root
  343.  
  344. # Create Script, Conf, and Properties directories.
  345. RUN mkdir -p $SCRIPT_DIR
  346. RUN mkdir -p $CONF_DIR
  347. RUN mkdir -p $PROP_DIR
  348.  
  349. # Copy Script and Config files into Endeca user.
  350. COPY $LOCAL_SCRIPTS/*.sh $SCRIPT_DIR/
  351. COPY $LOCAL_CONF/*.* $CONF_DIR/
  352. COPY $LOCAL_PROP/*.* $PROP_DIR/
  353.  
  354. # Change access permissions to the script files.
  355. RUN chmod -R 755 $SCRIPT_DIR && \
  356.     chmod +x $SCRIPT_DIR/*.sh
  357.  
  358. # Change access permissions to the configuration files.
  359. RUN chmod -R 755 $CONF_DIR && \
  360.     chmod +x $CONF_DIR/*.*
  361.  
  362. # Change access permissions to the properties files.
  363. RUN chmod -R 755 $PROP_DIR && \
  364.     chmod +x $PROP_DIR/*.*
  365.  
  366. ###############################################################################
  367. #
  368. #
  369. # Setup Services
  370. #
  371. #
  372. ###############################################################################
  373.  
  374. USER root
  375.  
  376. # Endeca Tools And Framworks Service
  377. RUN cp $SCRIPT_DIR/endeca_tools.sh /etc/init.d/endeca_tools
  378. RUN chkconfig --add endeca_tools
  379.  
  380. # Endeca Platform And Services Service
  381. RUN cp $SCRIPT_DIR/endeca_platform.sh /etc/init.d/endeca_platform
  382. RUN chkconfig --add endeca_platform
  383.  
  384. # Endeca Content Adquisition System Service
  385. RUN cp $SCRIPT_DIR/endeca_cas.sh /etc/init.d/endeca_cas
  386. RUN chkconfig --add endeca_cas
  387.  
  388. ###############################################################################
  389. #
  390. #
  391. # Update Workbench credentials in the credential store.
  392. #
  393. #
  394. ###############################################################################
  395.  
  396. USER endeca
  397. RUN cd $ENDECA_TOOLS_ROOT/credential_store/bin/ && \
  398.     cat $CONF_DIR/ifcr.txt | ./manage_credentials.sh add --key ifcr
  399.  
  400. ###############################################################################
  401. #
  402. #
  403. # Deploy Discovery Application (Using Content Adquisition System)
  404. #
  405. #
  406. ###############################################################################
  407.  
  408. USER endeca
  409. RUN mkdir -p /u01/app/oracle_atg/product/oracle_gs/endeca/apps
  410.  
  411. ###############################################################################
  412. #
  413. #
  414. # Remove installers, and packages.
  415. #
  416. #
  417. ###############################################################################
  418.  
  419. USER root
  420. RUN rm -rf $TMP_FOLDER_ENDECA_INSTALL
  421.  
  422. ###############################################################################
  423. #
  424. #
  425. # Entry Point
  426. #
  427. #
  428. ###############################################################################
  429.  
  430. RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' > /etc/nsswitch.conf
  431.  
  432. COPY docker-entrypoint.sh /usr/local/bin/
  433.  
  434. RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
  435. RUN ln -s usr/local/bin/docker-entrypoint.sh /
  436.  
  437. ENTRYPOINT ["docker-entrypoint.sh"]
  438.  
  439. ###############################################################################
  440. #
  441. #
  442. # Expose application ports (CAS, PS, T&F)
  443. #
  444. #
  445. ###############################################################################
  446.  
  447. EXPOSE 22 $CAS_PORT $EAC_SERVICE_PORT $WORKBENCH_PORT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement