packaging: Build and run with Fedora 17 jboss-as
This patch includes changes to build and run the engine with the jboss-as package included in Fedora 17. A private instance of jboss-as is created so that there is no interference with other applications running on top of the application server. This private instance will be executed by the user and group "ovirt" and uses the following files and directories: /usr/share/ovirt-engine A new "modules" subdirectory has been added that holds the JBoss modules that are missing in the current jboss-as package in Fedora 17. Also some modules that require fixes. The application server will be started using a module path that contains first this "modules" directory and then the "modules" directory of JBoss itself. All the content here should be owned by root to prevent writes by the engine. /etc/ovirt-engine This directory stores most of the configuration files. In the future it should store *all* the configurationfiles. It is owned by the ovirt user becase the application server will store here backup copies of the main configuration file. /etc/ovirt-engine/engine-service.xml This is the main configuration file of the application server, copied from standalone-web.xml and modified to fit the needs of the engine. My expectation is that maintaining this configuration file will be easier than maintaing the parts of the engine-setup script that modify the configuration. However, at the moment both things are needed. It is owned by the ovirt user because the application server reads and then writes it during each run. /etc/ovirt-engine/engine-service-logging.properties This contains the log4j configuration used by the application server using during boot, mostly copied from "logging.properties". /etc/ovirt-engine/engine-service-users.properties This file should contain the user names and passwords of the application server management users. It is empty at the moment. /var/log/ovirt-engine This directory holds the log files of the engine: boot.log for the boot messages, server.log for the application server messages, engine.log for the engine messages and console.log for the standard output and errors of the java virtual machine. The directory is owned by the ovirt user so that the application server can create/rotate log files. /var/lib/ovirt-engine This is the directory where the application server will store variable data. The "deployments" subdirectory is created during installation and it will contain a symlink to the "engine.ear" directory and the "engine.ear.dodeploy" marker file. The "content", "timer-service-data" and "tx-object-store" subdirectories are created by the application server as needed and should't be removed. This directory is owned by the "ovirt" user, as the application server needs to create subdirectories. /var/cache/ovirt-engine This is where the application server stores temporary content like "auth", "vfs" and "work". It is safe to remove this when the application server is stopped. This directory is also owned by the "ovirt" user. The private instance of the application server works as a systemd service started and stopped with the "engine-service.py" script. This script gets some configuration variables (heap space, debug flags, directory names, etc) from the "engine-service" sysconfig file. The makefile, spec and engine-setup script have been adjusted to build and install with the private instance of jboss-as. Change-Id: I5cda15e5219d1b6c8e8306fc7b4f196e6afc66b1 Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
This commit is contained in:
25
basedefs.py
25
basedefs.py
@@ -13,9 +13,9 @@ DB_PASS_FILE="/root/.pgpass"
|
||||
PGPASS_FILE_TEMPLATE="hostname:port:database:username:password"
|
||||
JBOSS_SECURITY_DOMAIN="EncryptDBPassword"
|
||||
JBOSS_KERB_AUTH="EngineKerberosAuth"
|
||||
JBOSS_SERVICE_NAME="jboss-as"
|
||||
JBOSS_USER_NAME="jboss-as"
|
||||
JBOSS_GROUP_NAME="jboss-as"
|
||||
JBOSS_SERVICE_NAME="ovirt-engine"
|
||||
JBOSS_USER_NAME="ovirt"
|
||||
JBOSS_GROUP_NAME="ovirt"
|
||||
HTTPD_SERVICE_NAME="httpd"
|
||||
HTTP_PORT_POLICY="http_port_t"
|
||||
NFS_SERVICE_NAME="nfs-server"
|
||||
@@ -48,8 +48,6 @@ DIR_DB_BACKUPS="%s/ovirt-engine/db-backups" % DIR_USR_SHARE
|
||||
DIR_ENGINE_CONFIG="%s/ovirt-engine/engine-config/" % DIR_USR_SHARE
|
||||
DIR_RHEVM_CONFIG_CONF="/etc/ovirt-engine/engine-config/"
|
||||
DIR_OVIRT_PKI="/etc/pki/ovirt-engine"
|
||||
DIR_MODULES_SRC="%s/ovirt-engine/resources/jboss/modules" % DIR_USR_SHARE
|
||||
DIR_MODULES_DEST="%s/modules" % DIR_JBOSS
|
||||
|
||||
|
||||
FILE_INSTALLER_LOG="engine-setup.log"
|
||||
@@ -63,7 +61,7 @@ FILE_CA_CRT_TEMPLATE="%s/cacert.template"%(DIR_OVIRT_PKI)
|
||||
FILE_CERT_TEMPLATE="%s/cert.template"%(DIR_OVIRT_PKI)
|
||||
FILE_ENGINE_CERT="%s/certs/engine.cer"%(DIR_OVIRT_PKI)
|
||||
FILE_JBOSSAS_CONF="/etc/%s/%s.conf" % (JBOSS_SERVICE_NAME, JBOSS_SERVICE_NAME)
|
||||
FILE_JBOSS_STANDALONE="%s/standalone/configuration/standalone.xml" % DIR_JBOSS
|
||||
FILE_JBOSS_STANDALONE="/etc/ovirt-engine/engine-service.xml"
|
||||
FILE_DB_INSTALL_SCRIPT="engine-db-install.sh"
|
||||
FILE_DB_UPGRADE_SCRIPT="upgrade.sh"
|
||||
FILE_RHEVM_CONFIG_BIN=os.path.join(DIR_ENGINE_CONFIG, "engine-config")
|
||||
@@ -84,7 +82,6 @@ FILE_ISOUPLOADER_CONF="/etc/ovirt-engine/isouploader.conf"
|
||||
FILE_LOGCOLLECTOR_CONF="/etc/ovirt-engine/logcollector.conf"
|
||||
FILE_PSQL_CONF="/var/lib/pgsql/data/postgresql.conf"
|
||||
FILE_LIMITS_CONF="/etc/security/limits.conf"
|
||||
FILE_JDK_MODULE_XML="%s/modules/sun/jdk/main/module.xml" % DIR_JBOSS
|
||||
FILE_OVIRT_HTTPD_CONF="/etc/httpd/conf.d/ovirt-engine.conf"
|
||||
FILE_HTTPD_SSL_CONFIG="/etc/httpd/conf.d/ssl.conf"
|
||||
FILE_HTTPD_CONF="/etc/httpd/conf/httpd.conf"
|
||||
@@ -159,6 +156,14 @@ COLORS = (RED, GREEN, BLUE, YELLOW, NO_COLOR)
|
||||
#space len size for color print
|
||||
SPACE_LEN=70
|
||||
|
||||
RPM_LOCK_LIST = "ovirt-engine-genericapi ovirt-engine ovirt-engine-backend \
|
||||
ovirt-engine-jboss-deps ovirt-engine-webadmin-portal ovirt-engine-userportal \
|
||||
ovirt-engine-restapi ovirt-engine-config ovirt-engine-tools-common ovirt-engine-notification-service"
|
||||
RPM_LOCK_LIST = """
|
||||
ovirt-engine
|
||||
ovirt-engine-backend
|
||||
ovirt-engine-config
|
||||
ovirt-engine-genericapi
|
||||
ovirt-engine-notification-service
|
||||
ovirt-engine-restapi
|
||||
ovirt-engine-tools-common
|
||||
ovirt-engine-userportal
|
||||
ovirt-engine-webadmin-portal
|
||||
"""
|
||||
|
||||
143
engine-setup.py
143
engine-setup.py
@@ -96,11 +96,11 @@ def initSequences():
|
||||
'condition' : [],
|
||||
'condition_match' : [],
|
||||
'steps' : [ { 'title' : output_messages.INFO_CONFIG_OVIRT_ENGINE,
|
||||
'functions' : [_createJbossProfile, setMaxSharedMemory] },
|
||||
'functions' : [setMaxSharedMemory] },
|
||||
{ 'title' : output_messages.INFO_CREATE_CA,
|
||||
'functions' : [_createCA]},
|
||||
{ 'title' : output_messages.INFO_UPD_JBOSS_CONF,
|
||||
'functions' : [configJbossXml, deployJbossModules, _editWebConf] },
|
||||
'functions' : [configJbossXml, _editWebConf] },
|
||||
{ 'title' : output_messages.INFO_SET_DB_CONFIGURATION,
|
||||
'functions' : [_updatePgPassFile]}]
|
||||
},
|
||||
@@ -944,31 +944,6 @@ def _configIptables():
|
||||
logging.error(traceback.format_exc())
|
||||
raise Exception(output_messages.ERR_EXP_FAILED_CFG_IPTABLES)
|
||||
|
||||
def _createJbossProfile():
|
||||
logging.debug("creating jboss profile")
|
||||
try:
|
||||
dirs = [
|
||||
{'src' : basedefs.DIR_ENGINE_EAR,
|
||||
'dest' : os.path.join(basedefs.DIR_JBOSS, "standalone", "deployments", "engine.ear")}
|
||||
]
|
||||
|
||||
for item in dirs:
|
||||
if not os.path.exists(item['dest']):
|
||||
if os.path.islink(item['dest']) and os.readlink(item['dest']) != item['src']:
|
||||
os.remove(item['dest'])
|
||||
os.symlink(item['src'], item['dest'])
|
||||
|
||||
logging.debug("Successfully created JBoss profile")
|
||||
else:
|
||||
logging.debug("JBoss profile already exists, doing nothing")
|
||||
|
||||
logging.debug("touching .dodeploy file for %s" % item['dest'])
|
||||
open("%s.dodeploy" % item['dest'], 'w').close()
|
||||
|
||||
except:
|
||||
logging.error(traceback.format_exc())
|
||||
raise Exception("Failed to create JBoss profile")
|
||||
|
||||
def _createDB():
|
||||
"""
|
||||
create fresh engine db
|
||||
@@ -1890,43 +1865,6 @@ def stopRhevmDbRelatedServices():
|
||||
logging.warn("Failed to start rhevm-notifierd")
|
||||
controller.MESSAGES.append(output_messages.ERR_FAILED_START_SERVICE % "rhevm-notifierd")
|
||||
|
||||
|
||||
def deployJbossModules():
|
||||
"""
|
||||
deploy the postgres module and edit the xml for the jdk module
|
||||
"""
|
||||
try:
|
||||
|
||||
# edit module.xml for the jdk module
|
||||
backupFile = "%s.%i" % (basedefs.FILE_JDK_MODULE_XML, random.randint(1000000,9999999))
|
||||
editFile = "%s.%s.%i" % (basedefs.FILE_JDK_MODULE_XML, "EDIT", random.randint(1000000,9999999))
|
||||
logging.debug("Backing up %s into %s", basedefs.FILE_JDK_MODULE_XML, backupFile)
|
||||
utils.copyFile(basedefs.FILE_JDK_MODULE_XML, backupFile)
|
||||
utils.copyFile(basedefs.FILE_JDK_MODULE_XML, editFile)
|
||||
|
||||
logging.debug("loading xml file handler")
|
||||
xmlObj = utils.XMLConfigFileHandler(editFile)
|
||||
xmlObj.open()
|
||||
|
||||
logging.debug("registering name space")
|
||||
xmlObj.registerNs('module', xmlObj.getNs('urn:jboss:module'))
|
||||
|
||||
paths = ['''<path name="sun/security"/>''', '''<path name="sun/security/krb5"/>''', '''<path name="com/sun/jndi/url"/>''', '''<path name="com/sun/jndi/url/dns"/>''' ]
|
||||
|
||||
for path in paths:
|
||||
logging.debug("adding %s as node", path)
|
||||
xmlObj.addNodes("//module:module/module:dependencies/module:system/module:paths", path)
|
||||
|
||||
xmlObj.close()
|
||||
|
||||
shutil.move(editFile, basedefs.FILE_JDK_MODULE_XML)
|
||||
logging.debug("JDK module configuration has been saved")
|
||||
|
||||
except:
|
||||
logging.error("Failed to deploy modules into jboss")
|
||||
logging.error(traceback.format_exc())
|
||||
raise Exception(output_messages.ERR_EXP_FAILED_DEPLOY_MODULES)
|
||||
|
||||
def configEncryptedPass():
|
||||
"""
|
||||
push the encrypted password into standalone.xml
|
||||
@@ -1982,7 +1920,6 @@ def configJbossXml():
|
||||
xmlObj.registerNs('domain', xmlObj.getNs('urn:jboss:domain'))
|
||||
|
||||
logging.debug("Configuring Jboss")
|
||||
configJbossLogging(xmlObj)
|
||||
configJbossDatasource(xmlObj)
|
||||
configJbossNetwork(xmlObj)
|
||||
configJbossSSL(xmlObj)
|
||||
@@ -2021,75 +1958,6 @@ def configJbossAjpConnector(xmlObj):
|
||||
|
||||
logging.debug("AJP has been configured for jboss")
|
||||
|
||||
def configJbossLogging(xmlObj):
|
||||
"""
|
||||
Configure the Logging for jboss
|
||||
"""
|
||||
logging.debug("Configuring logging for jboss")
|
||||
|
||||
logging.debug("Registering logging namespace")
|
||||
xmlObj.registerNs('logging', xmlObj.getNs('urn:jboss:domain:logging'))
|
||||
|
||||
logging.debug("setting attributes")
|
||||
nodes = xmlObj.xpathEval("//logging:subsystem/logging:console-handler[@name='CONSOLE']")
|
||||
nodes[0].setProp("autoflush", "true")
|
||||
|
||||
logging.debug("Adding level node with attribute: name, value: INFO")
|
||||
nodes = xmlObj.xpathEval("//logging:subsystem/logging:periodic-rotating-file-handler[@name='FILE']")
|
||||
nodes[0].setProp("autoflush", "true")
|
||||
|
||||
|
||||
xmlObj.removeNodes("//logging:subsystem/logging:periodic-rotating-file-handler[@name='FILE']/logging:level")
|
||||
levelStr = '''<level name="INFO" />'''
|
||||
xmlObj.addNodes("//logging:subsystem/logging:periodic-rotating-file-handler[@name='FILE']", levelStr)
|
||||
|
||||
xmlObj.removeNodes("//logging:subsystem/logging:size-rotating-file-handler[@name='ENGINE_LOG']")
|
||||
logging.debug("Adding file handler for ENGINE_LOG")
|
||||
fileHandlerStr = '''
|
||||
<size-rotating-file-handler name="ENGINE_LOG" autoflush="true">
|
||||
<level name="INFO"/>
|
||||
<formatter>
|
||||
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
|
||||
</formatter>
|
||||
<file path="/var/log/ovirt-engine/engine.log"/>
|
||||
<rotate-size value="1M"/>
|
||||
<max-backup-index value="30"/>
|
||||
<append value="true"/>
|
||||
</size-rotating-file-handler>
|
||||
'''
|
||||
xmlObj.addNodes("//logging:subsystem", fileHandlerStr)
|
||||
|
||||
logging.debug("Adding Loggers for ovirt-engine")
|
||||
loggerCats = ["org.ovirt", "org.ovirt.engine.core.bll", "org.ovirt.engine.core.dal.dbbroker.PostgresDbEngineDialect$PostgresJdbcTemplate","org.springframework.ldap"]
|
||||
for loggerCat in loggerCats:
|
||||
xmlObj.removeNodes("//logging:subsystem/logging:logger[@category='%s']" % loggerCat)
|
||||
|
||||
loggers = ['''
|
||||
<logger category="org.ovirt">
|
||||
<level name="INFO"/>
|
||||
<handlers>
|
||||
<handler name="ENGINE_LOG"/>
|
||||
</handlers>
|
||||
</logger>
|
||||
''','''
|
||||
<logger category="org.ovirt.engine.core.bll">
|
||||
<level name="INFO"/>
|
||||
</logger>
|
||||
''','''
|
||||
<logger category="org.ovirt.engine.core.dal.dbbroker.PostgresDbEngineDialect$PostgresJdbcTemplate">
|
||||
<level name="WARN"/>
|
||||
</logger>
|
||||
''','''
|
||||
<logger category="org.springframework.ldap">
|
||||
<level name="ERROR"/>
|
||||
</logger>
|
||||
''']
|
||||
|
||||
for logger in loggers:
|
||||
xmlObj.addNodes("//logging:subsystem", logger)
|
||||
|
||||
logging.debug("Logging is enabled and configured in jboss's configuration")
|
||||
|
||||
def configJbossDatasource(xmlObj):
|
||||
"""
|
||||
configure the datasource for jboss
|
||||
@@ -2098,7 +1966,6 @@ def configJbossDatasource(xmlObj):
|
||||
|
||||
logging.debug("Registering datasource namespaces")
|
||||
xmlObj.registerNs('datasource', xmlObj.getNs('urn:jboss:domain:datasources'))
|
||||
xmlObj.registerNs('deployment-scanner', xmlObj.getNs('urn:jboss:domain:deployment-scanner'))
|
||||
|
||||
logging.debug("looking for ENGINEDatasource datasource")
|
||||
|
||||
@@ -2170,12 +2037,6 @@ def configJbossDatasource(xmlObj):
|
||||
'''
|
||||
xmlObj.addNodes("//datasource:subsystem/datasource:datasources", driversStr)
|
||||
|
||||
logging.debug("configuring deployment-scanner")
|
||||
node = xmlObj.xpathEval("//deployment-scanner:subsystem/deployment-scanner:deployment-scanner")[0]
|
||||
node.setProp("name","default")
|
||||
node.setProp("path","deployments")
|
||||
node.setProp("scan-enabled","true")
|
||||
node.setProp("deployment-timeout","60")
|
||||
logging.debug("Datasource has been added into jboss's configuration")
|
||||
|
||||
def configJbossSecurity(xmlObj):
|
||||
|
||||
@@ -16,11 +16,23 @@ import basedefs
|
||||
# Consts
|
||||
PRODUCT_NAME="oVirt-Engine"
|
||||
#TODO: Work with a real list here
|
||||
RPM_LIST = "ovirt-engine-notification-service ovirt-engine-genericapi ovirt-engine \
|
||||
ovirt-engine-tools-common ovirt-engine-backend \
|
||||
ovirt-engine-iso-uploader ovirt-engine-jboss-deps ovirt-engine-log-collector ovirt-image-uploader \
|
||||
ovirt-engine-userportal ovirt-engine-restapi ovirt-engine-config ovirt-engine-setup \
|
||||
ovirt-engine-dbscripts vdsm-bootstrap ovirt-engine-webadmin-portal"
|
||||
RPM_LIST = """
|
||||
ovirt-engine
|
||||
ovirt-engine-backend
|
||||
ovirt-engine-config
|
||||
ovirt-engine-dbscripts
|
||||
ovirt-engine-genericapi
|
||||
ovirt-engine-notification-service
|
||||
ovirt-engine-restapi
|
||||
ovirt-engine-setup
|
||||
ovirt-engine-tools-common
|
||||
ovirt-engine-userportal
|
||||
ovirt-engine-webadmin-portal
|
||||
ovirt-image-uploader
|
||||
ovirt-iso-uploader
|
||||
ovirt-log-collector
|
||||
vdsm-bootstrap
|
||||
"""
|
||||
|
||||
RPM_BACKEND = "ovirt-engine-backend"
|
||||
RPM_DBSCRIPTS = "ovirt-engine-dbscripts"
|
||||
|
||||
@@ -372,9 +372,6 @@ ERR_EXP_NOT_EMOUGH_MEMORY="Error: Not enough available memory on the Host\n(the
|
||||
#import iso files
|
||||
ERR_FAILED_TO_COPY_FILE_TO_ISO_DOMAIN="Failed to copy files to iso domain"
|
||||
|
||||
ERR_FAILED_TO_COPY_MODULE="Failed to copy modules into Jboss"
|
||||
ERR_EXP_FAILED_DEPLOY_MODULES="Failed to deploy modules into Jboss"
|
||||
|
||||
#copy file
|
||||
ERR_SOURCE_DIR_NOT_SUPPORTED="Error: function supports copy of files only and not directories"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user