Merge pull request #1052 from davidamorimfaria/centos7-packaging

CLOUDSTACK-9049: fix Centos7 with Tomcat7 packaging and python libsCLOUDSTACK-9049: Fix Centos7 with Tomcat7 packaging and python libs

* pr/1052:
  CLOUDSTACK-9049: fix Centos7 with Tomcat7 packaging and python libs * adjust library to support tomcat7 config files * adjust centos7 spec to use tomcat7 config files from deployment * add option to use tomcat7 files in management server setup
  reorder content to match original

Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
Remi Bergsma 2015-11-10 13:30:55 +01:00
commit ee639cffe4
5 changed files with 126 additions and 102 deletions

View File

@ -29,9 +29,12 @@ if __name__ == '__main__':
parser = OptionParser()
parser.add_option("--https", action="store_true", dest="https", help="Enable HTTPs connection of management server")
parser.add_option("--tomcat7", action="store_true", dest="tomcat7", help="Use Tomcat7 configuration files in Management Server")
(options, args) = parser.parse_args()
if options.https:
glbEnv.svrMode = "HttpsServer"
if options.tomcat7:
glbEnv.svrConf = "Tomcat7"
glbEnv.mode = "Server"

View File

@ -249,16 +249,16 @@ cp -r client/target/cloud-client-ui-%{_maventag}/* ${RPM_BUILD_ROOT}%{_datadir}/
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/scripts
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/vms
for name in catalina.properties db.properties log4j-cloud.xml web.xml \
server.xml commons-logging.properties environment.properties java.security.ciphers tomcat-users.xml
for name in db.properties log4j-cloud.xml server7-nonssl.xml server7-ssl.xml \
commons-logging.properties catalina.policy catalina.properties classpath.conf \
tomcat-users.xml web.xml environment.properties java.security.ciphers
do
cp packaging/centos7/tomcat7/$name \
mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/$name \
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name
rm -f ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/$name
done
#ln -s %{_sysconfdir}/%{name}/management/log4j-cloud.xml \
# ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/log4j-cloud.xml
ln -s %{_sysconfdir}/%{name}/management/log4j-cloud.xml \
${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/log4j-cloud.xml
mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/context.xml \
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client
@ -438,10 +438,13 @@ fi
%config(noreplace) %attr(0640,root,cloud) %{_sysconfdir}/%{name}/management/db.properties
%config(noreplace) %{_sysconfdir}/%{name}/management/log4j-cloud.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/Catalina/localhost/client/context.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/catalina.policy
%config(noreplace) %{_sysconfdir}/%{name}/management/catalina.properties
%config(noreplace) %{_sysconfdir}/%{name}/management/classpath.conf
%config(noreplace) %{_sysconfdir}/%{name}/management/server7-nonssl.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/server7-ssl.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/tomcat-users.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/web.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/server.xml
%config(noreplace) %{_sysconfdir}/%{name}/management/environment.properties
%config(noreplace) %{_sysconfdir}/%{name}/management/java.security.ciphers
%config(noreplace) %{_sysconfdir}/%{name}/management/commons-logging.properties

View File

@ -1,101 +1,101 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
db.usage.maxActive=100
# distributed with this work for additional information
# to you under the Apache License, Version 2.0 (the
# with the License. You may obtain a copy of the License at
# "License"); you may not use this file except in compliance
# http://www.apache.org/licenses/LICENSE-2.0
# software distributed under the License is distributed on an
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
db.cloud.name=cloud
db.cloud.password=ENC(vlzQjmqOV4s5q7n+S1OMbA==)
# specific language governing permissions and limitations
# KIND, either express or implied. See the License for the
#
# in which the management server(Tomcat) is running
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# management server clustering parameters, change cluster.node.IP to the machine IP address
# usage database tuning parameters
db.usage.maxWait=10000
db.cloud.port=3306
# High Availability And Cluster Properties
db.usage.maxIdle=30
# CloudStack database settings
# in which the management server(Tomcat) is running
cluster.node.IP=127.0.0.1
db.cloud.testOnBorrow=true
db.cloud.maxIdle=30
db.cloud.autoReconnectForPools=true
db.cloud.trustStore=
region.id=1
cluster.servlet.port=9090
db.cloud.host=localhost
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true
# CloudStack database tuning parameters
db.usage.name=cloud_usage
db.cloud.poolPreparedStatements=false
db.ha.enabled=false
db.cloud.keyStorePassphrase=vmops.com
db.simulator.maxActive=250
region.id=1
# CloudStack database settings
db.cloud.username=cloud
db.usage.port=3306
db.cloud.maxWait=10000
db.cloud.timeBetweenEvictionRunsMillis=40000
db.cloud.keyStorePassword=
# usage database settings
db.cloud.queriesBeforeRetryMaster=5000
db.cloud.validationQuery=SELECT 1
db.usage.failOverReadOnly=false
db.cloud.password=ENC(vlzQjmqOV4s5q7n+S1OMbA==)
db.cloud.host=localhost
db.cloud.port=3306
db.cloud.name=cloud
# CloudStack database tuning parameters
db.cloud.maxActive=250
db.cloud.useSSL=false
db.usage.host=localhost
db.cloud.initialTimeout=3600
# Encryption Settings
db.cloud.minEvictableIdleTimeMillis=240000
db.cloud.maxIdle=30
db.cloud.maxWait=10000
db.cloud.validationQuery=SELECT 1
db.cloud.testOnBorrow=true
db.cloud.testWhileIdle=true
# CloudStack database SSL settings
db.cloud.slaves=localhost,localhost
db.simulator.maxIdle=30
db.cloud.keyStore=
db.cloud.encrypt.secret=ENC(zaGuSF5a4KyWayn2t0yyjDa0HjdToVtZ)
db.cloud.encryption.type=file
db.cloud.failOverReadOnly=false
db.cloud.timeBetweenEvictionRunsMillis=40000
db.cloud.minEvictableIdleTimeMillis=240000
db.cloud.poolPreparedStatements=false
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true
db.simulator.port=3306
# CloudStack database SSL settings
db.cloud.useSSL=false
db.cloud.keyStore=
db.cloud.keyStorePassword=
db.cloud.trustStore=
db.cloud.trustStorePassword=
db.cloud.keyStorePassphrase=vmops.com
# Encryption Settings
db.cloud.encryption.type=file
db.cloud.encrypt.secret=ENC(zaGuSF5a4KyWayn2t0yyjDa0HjdToVtZ)
# usage database settings
db.usage.password=ENC(cQEcN5aVucSYK+WUkPjDcw==)
db.usage.username=cloud
db.cloud.trustStorePassword=
db.simulator.username=cloud
db.usage.host=localhost
db.usage.port=3306
db.usage.name=cloud_usage
# usage database tuning parameters
db.usage.maxActive=100
db.usage.maxIdle=30
db.usage.maxWait=10000
db.usage.url.params=
db.usage.initialTimeout=3600
# Simulator database settings
db.cloud.reconnectAtTxEnd=true
db.usage.autoReconnect=true
#usage Database
db.simulator.maxWait=10000
# cloud stack Database
db.simulator.username=cloud
db.simulator.password=cloud
db.usage.reconnectAtTxEnd=true
db.simulator.host=localhost
db.simulator.port=3306
db.simulator.name=simulator
db.simulator.maxActive=250
db.simulator.maxIdle=30
db.simulator.maxWait=10000
db.simulator.autoReconnect=true
# High Availability And Cluster Properties
db.ha.enabled=false
db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy
# cloud stack Database
db.cloud.slaves=localhost,localhost
db.cloud.autoReconnect=true
db.simulator.host=localhost
db.simulator.name=simulator
db.usage.queriesBeforeRetryMaster=5000
db.usage.slaves=localhost,localhost
db.usage.secondsBeforeRetryMaster=3600
db.usage.autoReconnectForPools=true
db.cloud.failOverReadOnly=false
db.cloud.reconnectAtTxEnd=true
db.cloud.autoReconnectForPools=true
db.cloud.secondsBeforeRetryMaster=3600
db.cloud.queriesBeforeRetryMaster=5000
db.cloud.initialTimeout=3600
#usage Database
db.usage.slaves=localhost,localhost
db.usage.autoReconnect=true
db.usage.failOverReadOnly=false
db.usage.reconnectAtTxEnd=true
db.usage.autoReconnectForPools=true
db.usage.secondsBeforeRetryMaster=3600
db.usage.queriesBeforeRetryMaster=5000
db.usage.initialTimeout=3600

View File

@ -22,6 +22,8 @@ class globalEnv:
self.svrMode = None
#myCloud/Agent/Console
self.agentMode = None
#Tomcat6/Tomcat7
self.svrConf = None
#debug
self.debug = False
#management server IP

View File

@ -79,30 +79,43 @@ class cloudManagementConfig(serviceCfgBase):
if not cmd.isSuccess():
raise CloudInternalException(cmd.getErrMsg())
if not self.syscfg.env.svrConf == "Tomcat7":
cfo = configFileOps("/etc/cloudstack/management/tomcat6.conf", self)
cfo.add_lines("JAVA_OPTS+=\" -Djavax.net.ssl.trustStore=%s \""%keyPath)
elif self.syscfg.env.svrMode == "HttpsServer":
if not os.path.exists("/etc/cloudstack/management/server-ssl.xml") or not os.path.exists("/etc/cloudstack/management/tomcat6-ssl.conf"):
raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server-ssl.xml or /etc/cloudstack/management/tomcat6-ssl.conf, https enables failed")
if os.path.exists("/etc/cloudstack/management/server.xml"):
bash("rm -f /etc/cloudstack/management/server.xml")
if os.path.exists("/etc/cloudstack/management/tomcat6.conf"):
bash("rm -f /etc/cloudstack/management/tomcat6.conf")
bash("ln -s /etc/cloudstack/management/server-ssl.xml /etc/cloudstack/management/server.xml")
bash("ln -s /etc/cloudstack/management/tomcat6-ssl.conf /etc/cloudstack/management/tomcat6.conf")
if self.syscfg.env.svrConf == "Tomcat7":
if not os.path.exists("/etc/cloudstack/management/server7-ssl.xml"):
raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server7-ssl.xml, https enable failed")
if os.path.exists("/etc/cloudstack/management/server.xml"):
bash("rm -f /etc/cloudstack/management/server.xml")
bash("ln -s /etc/cloudstack/management/server7-ssl.xml /etc/cloudstack/management/server.xml")
else:
if not os.path.exists("/etc/cloudstack/management/server-ssl.xml") or not os.path.exists("/etc/cloudstack/management/tomcat6-ssl.conf"):
raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server-ssl.xml or /etc/cloudstack/management/tomcat6-ssl.conf, https enable failed")
if os.path.exists("/etc/cloudstack/management/server.xml"):
bash("rm -f /etc/cloudstack/management/server.xml")
if os.path.exists("/etc/cloudstack/management/tomcat6.conf"):
bash("rm -f /etc/cloudstack/management/tomcat6.conf")
bash("ln -s /etc/cloudstack/management/server-ssl.xml /etc/cloudstack/management/server.xml")
bash("ln -s /etc/cloudstack/management/tomcat6-ssl.conf /etc/cloudstack/management/tomcat6.conf")
if not bash("iptables-save |grep PREROUTING | grep 6443").isSuccess():
bash("iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 6443")
else:
if not os.path.exists("/etc/cloudstack/management/server-nonssl.xml") or not os.path.exists("/etc/cloudstack/management/tomcat6-nonssl.conf"):
raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server-nonssl.xml or /etc/cloudstack/management/tomcat6-nonssl.conf, https enables failed")
if os.path.exists("/etc/cloudstack/management/server.xml"):
bash("rm -f /etc/cloudstack/management/server.xml")
if os.path.exists("/etc/cloudstack/management/tomcat6.conf"):
bash("rm -f /etc/cloudstack/management/tomcat6.conf")
bash("ln -s /etc/cloudstack/management/server-nonssl.xml /etc/cloudstack/management/server.xml")
bash("ln -s /etc/cloudstack/management/tomcat6-nonssl.conf /etc/cloudstack/management/tomcat6.conf")
if self.syscfg.env.svrConf == "Tomcat7":
if not os.path.exists("/etc/cloudstack/management/server7-nonssl.xml"):
raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server7-nonssl.xml, https enable failed")
if os.path.exists("/etc/cloudstack/management/server.xml"):
bash("rm -f /etc/cloudstack/management/server.xml")
bash("ln -s /etc/cloudstack/management/server7-nonssl.xml /etc/cloudstack/management/server.xml")
else:
if not os.path.exists("/etc/cloudstack/management/server-nonssl.xml") or not os.path.exists("/etc/cloudstack/management/tomcat6-nonssl.conf"):
raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server-nonssl.xml or /etc/cloudstack/management/tomcat6-nonssl.conf, https enable failed")
if os.path.exists("/etc/cloudstack/management/server.xml"):
bash("rm -f /etc/cloudstack/management/server.xml")
if os.path.exists("/etc/cloudstack/management/tomcat6.conf"):
bash("rm -f /etc/cloudstack/management/tomcat6.conf")
bash("ln -s /etc/cloudstack/management/server-nonssl.xml /etc/cloudstack/management/server.xml")
bash("ln -s /etc/cloudstack/management/tomcat6-nonssl.conf /etc/cloudstack/management/tomcat6.conf")
bash("touch /var/run/cloudstack-management.pid")
bash("chown cloud.cloud /var/run/cloudstack-management.pid")
#distro like sl 6.1 needs this folder, or tomcat6 failed to start
@ -116,7 +129,10 @@ class cloudManagementConfig(serviceCfgBase):
cfo.save()
try:
self.syscfg.svo.disableService("tomcat6")
if self.syscfg.env.svrConf == "Tomcat7":
self.syscfg.svo.disableService("tomcat")
else:
self.syscfg.svo.disableService("tomcat6")
except:
pass