Skip to content

Instantly share code, notes, and snippets.

@uilian
Forked from matthewtckr/Pentaho_BA_Dockerfile
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uilian/a42447dee78b46ade9f2 to your computer and use it in GitHub Desktop.
Save uilian/a42447dee78b46ade9f2 to your computer and use it in GitHub Desktop.
/home/pentaho/pentaho/biserver-ee/tomcat/logs/catalina.out
{
copytruncate
daily
dateext
rotate 14
compress
missingok
size 20M
}
############################################################
# Dockerfile to build Pentaho EE BA Server container images
# Based on Ubuntu 14.04
############################################################
FROM ubuntu:14.04
MAINTAINER Matt Tucker, matthewtckr@gmail.com
## Install Base Software
RUN apt-get update -y
RUN apt-get dist-upgrade -y
RUN apt-get install -y python-software-properties software-properties-common
RUN add-apt-repository -y ppa:webupd8team/java
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN apt-get update -y
RUN apt-get install -y apt-file curl dkms dos2unix expect libwebkitgtk-1.0-0 libxml2-utils ntp openssh-server telnet vim wget zip postgresql postgresql-client postgresql-contrib oracle-java7-installer oracle-java7-set-default
## Create Pentaho User
RUN useradd pentaho -m -s /bin/bash
RUN echo "pentaho ALL = NOPASSWD: ALL" > /etc/sudoers.d/pentaho && chmod 440 /etc/sudoers.d/pentaho
## Download and extract Pentaho BA Archive
ADD https://s3.amazonaws.com/pentaho-support-download/dist/5.1.0/biserver-ee-5.1.0.0-752-dist.zip /home/pentaho/
ADD https://s3.amazonaws.com/pentaho-support-download/dist/5.1.0/paz-plugin-ee-5.1.0.0-752-dist.zip /home/pentaho/
ADD https://s3.amazonaws.com/pentaho-support-download/dist/5.1.0/pir-plugin-ee-5.1.0.0-752-dist.zip /home/pentaho/
ADD https://s3.amazonaws.com/pentaho-support-download/dist/5.1.0/pdd-plugin-ee-5.1.0.0-752-dist.zip /home/pentaho/
ADD https://s3.amazonaws.com/pentaho-support-download/dist/5.1.0/pentaho-mobile-plugin-5.1.0.0-752-dist.zip /home/pentaho/
ADD https://gist.githubusercontent.com/matthewtckr/82e4fb5b0b68b09e6c15/raw/logrotate_pentaho-bi /etc/logrotate.d/
ADD https://gist.githubusercontent.com/matthewtckr/82e4fb5b0b68b09e6c15/raw/unpack.exp /home/pentaho/
ADD https://gist.githubusercontent.com/matthewtckr/82e4fb5b0b68b09e6c15/raw/start.sh /home/pentaho/
RUN find /home/pentaho -type f -name '*.zip' -exec unzip {} -d /home/pentaho \;
RUN chmod a+rx /home/pentaho/unpack.exp; chmod u+x /home/pentaho/start.sh
RUN su pentaho -c 'find /home/pentaho/* -type d -exec /home/pentaho/unpack.exp {} \;'
RUN rm -rf /home/pentaho/*-dist.zip /home/pentaho/unpack.exp
RUN find /home/pentaho -maxdepth 1 -type d -not -name 'pentaho' -exec rm -rf {} \;
RUN mv -t /home/pentaho/pentaho/biserver-ee/pentaho-solutions/system/ /home/pentaho/pentaho/analyzer /home/pentaho/pentaho/dashboards /home/pentaho/pentaho/pentaho-interactive-reporting /home/pentaho/pentaho/pentaho-mobile-plugin
RUN chown -R pentaho:pentaho /home/pentaho
## Create Pentaho Databases
RUN sed -i -r 's/local([\s]+)all([\s]+)postgres([\s]+)peer/local all all trust/' /etc/postgresql/9.3/main/pg_hba.conf; \
service postgresql start; \
if ! $(su postgres -c "psql template1 -c 'SHOW SERVER_ENCODING'" | grep -q UTF8); then \
su postgres -c "psql postgres -c \"update pg_database set datallowconn = TRUE where datname = 'template0';\""; \
su postgres -c "psql template0 -c \"update pg_database set datistemplate = FALSE where datname = 'template1';\""; \
su postgres -c "psql template0 -c \"drop database template1;\""; \
su postgres -c "psql template0 -c \"create database template1 with template = template0 encoding = 'UTF8';\""; \
su postgres -c "psql template0 -c \"update pg_database set datistemplate = TRUE where datname = 'template1';\""; \
su postgres -c "psql template1 -c \"update pg_database set datallowconn = FALSE where datname = 'template0';\""; \
fi; \
su postgres -c "psql -f /home/pentaho/pentaho/biserver-ee/data/postgresql/create_jcr_postgresql.sql"; \
su postgres -c "psql -f /home/pentaho/pentaho/biserver-ee/data/postgresql/create_repository_postgresql.sql"; \
su postgres -c "psql -f /home/pentaho/pentaho/biserver-ee/data/postgresql/create_quartz_postgresql.sql"; \
su postgres -c "psql -f /home/pentaho/pentaho/biserver-ee/data/postgresql/pentaho_mart_postgresql.sql"; \
service postgresql stop; \
sed -i -r 's/local([\s]+)all([\s]+)all([\s]+)trust/local all postgres peer/' /etc/postgresql/9.3/main/pg_hba.conf; \
service postgresql start
## Start Pentaho BA Server
EXPOSE 8080
USER pentaho
CMD /home/pentaho/start.sh
#!/bin/bash
sudo service postgresql start
echo -e '\n' | /home/pentaho/pentaho/biserver-ee/start-pentaho.sh && tail -F /dev/null
#!/usr/bin/expect
set timeout -1
set cwd [lindex $argv 0]
spawn java -jar $cwd/installer.jar
while {1} {
expect {
eof {break}
"Press Enter to continue" {send "\r"}
"Press 1 to accept" {send "1\r"}
"Select target path" {send "\r"}
"Press 1 to continue" {send "1\r"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment