-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·53 lines (35 loc) · 2.09 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#Dockerfile for RHQ 4.12.0
FROM mattdm/fedora
MAINTAINER Matt Mahoney <[email protected]>
# install missing commands
#RUN yum -y update --skip-broken
RUN yum -y install wget unzip expect spawn
# Install java
RUN yum -y install java-1.7.0-openjdk-devel
# Install postgresql
RUN yum -y install postgresql-server
# Init postgres service
RUN su -l postgres -c "/usr/bin/initdb --pgdata='/var/lib/pgsql/data' --auth='ident'" \ >> "/var/lib/pgsql/initdb.log" 2>&1 < /dev/null
# Edit postgres config
RUN sed 's/ident/trust/' /var/lib/pgsql/data/pg_hba.conf > pg_hba.conf
# Replace old properties file with the new one
RUN cp -u pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
# Start postgres service, create rhqadmin role and rhq db
RUN expect -c ' spawn su -l postgres -c " pg_ctl start " ; expect -re "pg_log" {send \"\r\"; exp_continue } }';\
ps -aux; expect -c ' spawn createuser -h 127.0.0.1 -p 5432 -U postgres -S -D -R -P rhqadmin; expect -re "Enter" { send \"\r\"; exp_continue } "Enter" { send \"\r\"; exp_continue } ';\
createdb -h 127.0.0.1 -p 5432 -U postgres -O rhqadmin rhq;
# Download rhq-server-4.12.0.zip from sourceforge
RUN wget http://sourceforge.net/projects/rhq/files/rhq/rhq-4.12/rhq-server-4.12.0.zip -O /opt/rhq-server-4.12.0.zip
# Go to opt directory
RUN cd /opt
# Unzip rhq-server-4.12.0.zip
RUN unzip /opt/rhq-server-4.12.0.zip -d /opt
# Change jboss.bind.address
RUN sed 's/rhq.server.management.password=/rhq.server.management.password=35c160c1f841a889d4cda53f0bfc94b6/;s/jboss.bind.address=/jboss.bind.address=0.0.0.0/;s/rhq.storage.nodes=/rhq.storage.nodes=127.0.0.1/' /opt/rhq-server-4.12.0/bin/rhq-server.properties > rhq-server.properties
# Replace old properties file with the new one
RUN cp -u rhq-server.properties /opt/rhq-server-4.12.0/bin/rhq-server.properties
ENV RHQ_SERVER_JAVA_EXE_FILE_PATH /usr/bin/java
ENTRYPOINT expect -c ' spawn su -l postgres -c " pg_ctl start " ; expect -re "pg_log" {send \"\r\"; exp_continue } }' ;\
su root -c ' ./opt/rhq-server-4.12.0/bin/rhqctl install --agent-preference="127.0.0.1" ';\
su root -c ' ./opt/rhq-server-4.12.0/bin/rhqctl start ';\
/bin/bash