Skip to content

Commit

Permalink
cleanup/bugfixing in jopr/jopr-agent init/preconfigure and spec files
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmann committed Sep 8, 2009
1 parent 6c4bace commit 2b3335d
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 19 deletions.
3 changes: 2 additions & 1 deletion specs/jopr-agent.spec
Expand Up @@ -20,7 +20,8 @@ Jopr is an enterprise management solution for JBoss middleware projects and othe

%install
install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
touch $RPM_BUILD_ROOT/etc/sysconfig/%{name}

echo "JOPR_AGENT_VERSION=%{version}" > $RPM_BUILD_ROOT/etc/sysconfig/%{name}

install -d -m 755 $RPM_BUILD_ROOT%{_initrddir}
install -m 755 %{SOURCE0} $RPM_BUILD_ROOT%{_initrddir}/%{name}
Expand Down
9 changes: 8 additions & 1 deletion specs/jopr.spec
Expand Up @@ -9,6 +9,8 @@ Source0: http://downloads.sourceforge.net/project/rhq/jopr/jopr-%{version
Source1: preconfigure-jopr-agent.sh
Source2: agent-configuration.xml
Source3: jopr.init
Source4: preconfigure-jopr.sh
Source5: rhq-server.properties
Requires: shadow-utils
Requires: java-1.6.0-openjdk
Requires: unzip
Expand All @@ -33,9 +35,14 @@ cp -R . $RPM_BUILD_ROOT/opt/%{name}
install -d -m 755 $RPM_BUILD_ROOT/usr/share/%{name}
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/usr/share/%{name}/preconfigure-jopr-agent.sh
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/usr/share/%{name}/agent-configuration.xml
install -m 755 %{SOURCE4} $RPM_BUILD_ROOT/usr/share/%{name}/preconfigure-jopr.sh
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/usr/share/%{name}/rhq-server.properties

install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
touch $RPM_BUILD_ROOT/etc/sysconfig/%{name}

echo "JOPR_VERSION=%{version}" > $RPM_BUILD_ROOT/etc/sysconfig/%{name}
echo "JOPR_HOME=/opt/jopr" >> $RPM_BUILD_ROOT/etc/sysconfig/%{name}


install -d -m 755 $RPM_BUILD_ROOT%{_initrddir}
install -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{_initrddir}/%{name}
Expand Down
14 changes: 3 additions & 11 deletions src/jopr-agent-install.sh
@@ -1,18 +1,14 @@
#!/bin/sh

JOPR_AGENT_HOME=/opt/jopr-agent
JOPR_AGENT_NAME=rhq-enterprise-agent
JOPR_AGENT_VERSION=1.2.1
JOPR_TMP_DIR=/tmp/jopr-2.2.1

[ -f /etc/sysconfig/jopr-agent ] && . /etc/sysconfig/jopr-agent

[ "x$JOPR_SERVER_IP" = "x" ] && exit 0

JOPR_AGENT_JAR_LOCATION=http://$JOPR_SERVER_IP:7080/agentupdate/download

rm -rf $JOPR_TMP_DIR
mkdir -p $JOPR_TMP_DIR
rm -rf $JOPR_AGENT_HOME
mkdir -p $JOPR_AGENT_HOME

sleep=0
Expand All @@ -25,15 +21,11 @@ while [ "$downloaded" = "0" ]; do

if [ $http_code -eq "200" ]
then
wget $JOPR_AGENT_JAR_LOCATION -O $JOPR_AGENT_HOME/$JOPR_AGENT_NAME-$JOPR_AGENT_VERSION.jar
wget $JOPR_AGENT_JAR_LOCATION -O $JOPR_AGENT_HOME/jopr-agent.jar
downloaded=1
fi
done

cd $JOPR_AGENT_HOME

java -jar $JOPR_AGENT_NAME-$JOPR_AGENT_VERSION.jar --install




java -jar jopr-agent.jar --install
2 changes: 1 addition & 1 deletion src/jopr-agent.init
Expand Up @@ -32,7 +32,7 @@ export RHQ_AGENT_HOME=/opt/jopr-agent/rhq-agent

# if Jopr server ip isn't injected, don't start the agent
if [ "x$JOPR_SERVER_IP" = "x" ]; then
echo "No JOPR_SERVER_IP specified..."
echo "No JOPR_SERVER_IP specified..." > $RHQ_AGENT_HOME/agent-error.log
exit 0
fi

Expand Down
10 changes: 7 additions & 3 deletions src/jopr.init
Expand Up @@ -81,12 +81,16 @@
# RHQ_SERVER_ADDITIONAL_JAVA_OPTS=additional VM options
# RHQ_SERVER_CMDLINE_OPTS=additional run.sh options

RHQ_AGENT_VERSION=1.2.1
RHQ_SERVER_HOME=/opt/jopr
[ -f /etc/sysconfig/jopr ] && . /etc/sysconfig/jopr

RHQ_SERVER_HOME=$JOPR_HOME
RHQ_SERVER_JAVA_HOME=/usr/lib/jvm/java-1.6.0/

# Configure Jopr so we don't need to use web configuration wizard
/usr/share/jopr/preconfigure-jopr.sh

# preconfigure Jopr Agent
[ -f $RHQ_SERVER_HOME/jbossas/server/default/deploy/rhq.ear.rej/rhq-downloads/rhq-agent/rhq-enterprise-agent-$RHQ_AGENT_VERSION.jar ] && /usr/share/jopr/preconfigure-jopr-agent.sh > /opt/jopr/agent-preconfigure.log
[ -d $RHQ_SERVER_HOME/jbossas/server/default/deploy/rhq.ear.rej ] && /usr/share/jopr/preconfigure-jopr-agent.sh > /opt/jopr/agent-preconfigure.log

# ----------------------------------------------------------------------
# Make sure we unset any lingering JBossAS environment variables that
Expand Down
4 changes: 2 additions & 2 deletions src/preconfigure-jopr-agent.sh
@@ -1,7 +1,7 @@
#!/bin/sh

JOPR_HOME=/opt/jopr
JOPR_VERSION=2.3.0
[ -f /etc/sysconfig/jopr ] && . /etc/sysconfig/jopr

JOPR_AGENT_NAME=rhq-enterprise-agent
JOPR_AGENT_VERSION=1.3.0
JOPR_CONFIG=/usr/share/jopr/agent-configuration.xml
Expand Down
22 changes: 22 additions & 0 deletions src/preconfigure-jopr.sh
@@ -0,0 +1,22 @@
#!/bin/sh

[ -f /etc/sysconfig/jboss-cloud ] && . /etc/sysconfig/jboss-cloud
[ -f /etc/sysconfig/jopr ] && . /etc/sysconfig/jopr

IP_ADDRESS=`ip addr list eth0 | grep "inet " | cut -d' ' -f6 | cut -d/ -f1`

status_code=`curl -o /dev/null -s -m 5 -w '%{http_code}' http://169.254.169.254/latest/meta-data/local-ipv4`

if [ $status_code -eq "200" ]
then
LOCAL_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
else
LOCAL_IP=$IP_ADDRESS
# this is intentional
PUBLIC_IP=$IP_ADDRESS
fi

sed s/#LOCAL_IP#/$LOCAL_IP/g /usr/share/jopr/rhq-server.properties | sed s/#PUBLIC_IP#/$PUBLIC_IP/g > $JOPR_HOME/bin/rhq-server.properties

chown jopr:jopr /opt/jopr/ -R
173 changes: 173 additions & 0 deletions src/rhq-server.properties
@@ -0,0 +1,173 @@
### RHQ Server Configuration Properties

# Database
rhq.server.database.connection-url=jdbc:h2:/opt/jopr/jbossas/server/default/data/rhq;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOG=2
rhq.server.database.driver-class=org.h2.Driver
rhq.server.database.xa-datasource-class=org.h2.jdbcx.JdbcDataSource
rhq.server.database.user-name=rhqadmin
rhq.server.database.password=rhqadmin
rhq.server.database.type-mapping=H2
rhq.server.database.server-name=
rhq.server.database.port=
rhq.server.database.db-name=
hibernate.dialect=org.rhq.core.domain.dialect.H2CustomDialect

# Quartz
rhq.server.quartz.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
rhq.server.quartz.selectWithLockSQL=SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE
rhq.server.quartz.lockHandlerClass=org.quartz.impl.jdbcjobstore.StdRowLockSemaphore

# Container configuration
# ********************************** NOTE ************************************
# If the jboss.bind.address property is set to anything besides 0.0.0.0,
# uncomment the java.rmi.server.hostname property below and set it to the same
# value - setting it to ${jboss.bind.address} will *not* work.
jboss.bind.address=0.0.0.0
#java.rmi.server.hostname=0.0.0.0

# High Availability (HA)
rhq.server.high-availability.name=#LOCAL_IP#
rhq.server.maintenance-mode-at-startup=false

# General Properties
rhq.server.startup.web.http.port=7080
rhq.server.startup.web.https.port=7443
rhq.server.startup.webservice.port=9093
rhq.server.startup.namingservice.port=2099
rhq.server.startup.namingservice.rmiport=2098
rhq.server.startup.jrmpinvoker.rmiport=7444
rhq.server.startup.pooledinvoker.rmiport=7445
rhq.server.startup.ajp.port=9009
rhq.server.startup.unifiedinvoker.port=5446
rhq.server.startup.aspectdeployer.bind-port=4873
rhq.server.plugin-deployer-threads=5

# Cluster configuration
# The cluster service has been disabled in 1.1. It will be revisited when we look at cluster management support.
#jboss.partition.name=RHQPartition
#jgroups.bind_addr=127.0.0.1
#jgroups.udp.mcast_addr=228.1.2.4
#jboss.hapartition.mcast_port=55566
#jboss.ejb3entitypartition.mcast_port=53333
#jboss.alertcachepartition.mcast_port=58899
#rhq.server.startup.partition.udpLoopback=false
#rhq.server.startup.hajndi.port=2100
#rhq.server.startup.hajndi.rmiport=2101
#rhq.server.startup.hajndi.autodiscoverygroupport=2102
#rhq.server.startup.hajrmpinvoker.rmiport=5447
#rhq.server.startup.hapooledinvoker.port=5448
#jgroups.udp.ip_ttl=2

# RHQ Server's remote endpoint for agents to talk to
# bind-address and bind-port are derived from the HA server definition,
# if you set the address/port here, they will override the HA server definition found in the database
rhq.communications.connector.transport=servlet
rhq.communications.connector.bind-address=
rhq.communications.connector.bind-port=
rhq.communications.connector.transport-params=/jboss-remoting-servlet-invoker/ServerInvokerServlet

# Multicast detector configuration for auto-discovery
rhq.communications.multicast-detector.enabled=false
rhq.communications.multicast-detector.bind-address=${jboss.bind.address}
rhq.communications.multicast-detector.multicast-address=224.16.16.16
rhq.communications.multicast-detector.port=16162

# Server-side SSL Security Configuration for HTTPS thru Tomcat
# These are used for browser https: access and for incoming messages from agents over sslservlet transport
# [you cannot use ${x} variables - see https://jira.jboss.org/jira/browse/JBWEB-74]
rhq.server.tomcat.security.client-auth-mode=false
rhq.server.tomcat.security.secure-socket-protocol=TLS
rhq.server.tomcat.security.algorithm=SunX509
rhq.server.tomcat.security.keystore.alias=RHQ
rhq.server.tomcat.security.keystore.file=conf/rhq.keystore
rhq.server.tomcat.security.keystore.password=RHQManagement
rhq.server.tomcat.security.keystore.type=JKS
rhq.server.tomcat.security.truststore.file=conf/rhq.truststore
rhq.server.tomcat.security.truststore.password=RHQManagement
rhq.server.tomcat.security.truststore.type=JKS

# Server-side SSL Security Configuration (for incoming messages from agents)
# These are used when secure transports other than sslservlet are used
rhq.communications.connector.security.secure-socket-protocol=TLS
rhq.communications.connector.security.keystore.file=${jboss.server.home.dir}/conf/rhq.keystore
rhq.communications.connector.security.keystore.algorithm=SunX509
rhq.communications.connector.security.keystore.type=JKS
rhq.communications.connector.security.keystore.password=RHQManagement
rhq.communications.connector.security.keystore.key-password=RHQManagement
rhq.communications.connector.security.keystore.alias=RHQ
rhq.communications.connector.security.truststore.file=${jboss.server.home.dir}/conf/rhq.truststore
rhq.communications.connector.security.truststore.algorithm=SunX509
rhq.communications.connector.security.truststore.type=JKS
rhq.communications.connector.security.truststore.password=RHQManagement
rhq.communications.connector.security.client-auth-mode=none

# Client-side SSL Security Configuration (for outgoing messages to agents)
rhq.server.client.security.secure-socket-protocol=TLS
rhq.server.client.security.keystore.file=${jboss.server.home.dir}/conf/rhq.keystore
rhq.server.client.security.keystore.algorithm=SunX509
rhq.server.client.security.keystore.type=JKS
rhq.server.client.security.keystore.password=RHQManagement
rhq.server.client.security.keystore.key-password=RHQManagement
rhq.server.client.security.keystore.alias=RHQ
rhq.server.client.security.truststore.file=${jboss.server.home.dir}/conf/rhq.truststore
rhq.server.client.security.truststore.algorithm=SunX509
rhq.server.client.security.truststore.type=JKS
rhq.server.client.security.truststore.password=RHQManagement
rhq.server.client.security.server-auth-mode-enabled=false

# Embedded RHQ Agent
rhq.server.embedded-agent.enabled=false
rhq.server.embedded-agent.name=
rhq.server.embedded-agent.reset-configuration=true
rhq.server.embedded-agent.disable-native-system=false

# Email
rhq.server.email.smtp-host=localhost
rhq.server.email.smtp-port=25
rhq.server.email.from-address=rhqadmin@localhost

# Operations/controls timeout
# Defines the default timeout for all operations (specified in seconds)
rhq.server.operation-timeout=600

# Concurrency limits for incoming UI and agent messages
rhq.server.startup.web.max-connections=200
rhq.server.agent-downloads-limit=45
rhq.server.client-downloads-limit=5
rhq.communications.global-concurrency-limit=30
rhq.server.concurrency-limit.inventory-report=5
rhq.server.concurrency-limit.availability-report=30
rhq.server.concurrency-limit.inventory-sync=30
rhq.server.concurrency-limit.content-report=5
rhq.server.concurrency-limit.content-download=5
rhq.server.concurrency-limit.measurement-report=30
rhq.server.concurrency-limit.measurement-schedule-request=30

# Content Local Filesystem Repository
rhq.server.content.filesystem=${jboss.server.data.dir}/packagebits

# The frequency (in millis) the server checks for updated agent plugins
rhq.server.agent-plugin-scan-period-ms=300000

# Auto-Install Pre-Configuration Settings
# If you wish to circumvent the installer webapp and auto-install the server
# immediately upon first startup, make sure all of the settings above are
# correctly set for your server's deployment environment. Then make sure the
# following rhq.autoinstall properties are defined appropriately:
# rhq.autoinstall.enabled: must be true to trigger the automatic install
# rhq.autoinstall.database: allowed values: auto, overwrite, skip
# "auto" will create a new schema if one does not
# yet exist or, if a schema does exist, will simply
# upgrade it as needed (which keeps existing data).
# "overwrite" if you want to create an empty schema,
# even if one already exists (loses existing data).
# "skip" if you don't want to do any database
# upgrade or creation. WARNING! You must ensure your
# database schema already exists and is up to date.
# rhq.autoinstall.public-endpoint-address: public IP/hostname that all agents
# will use to talk to this server.
# If not set, a value to use is
# determined at auto-install time.
rhq.autoinstall.enabled=true
rhq.autoinstall.database=auto
rhq.autoinstall.public-endpoint-address=#PUBLIC_IP#

0 comments on commit 2b3335d

Please sign in to comment.