diff --git a/debian/cloudstack-usage.postinst b/debian/cloudstack-usage.postinst new file mode 100644 index 00000000000..2e15d5d3a43 --- /dev/null +++ b/debian/cloudstack-usage.postinst @@ -0,0 +1,37 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# 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, +# 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. + +set -e + +case "$1" in + configure) + # We copy the db.properties file from the management server to the usage server + # This used to be a symlink, but we don't do that anymore + if [ -f "/etc/cloud/management/db.properties" ]; then + cp -a /etc/cloud/management/db.properties /etc/cloudstack/usage/db.properties + fi + + # We also retain the log4j configuration + if [ -f "/etc/cloud/usage/log4j-cloud_usage.xml" ]; then + cp -a /etc/cloud/usage/log4j-cloud_usage.xml /etc/cloudstack/usage/log4j-cloud_usage.xml + fi + ;; +esac + +exit 0 \ No newline at end of file diff --git a/debian/rules b/debian/rules index 7fc6425b34f..a1356018eba 100755 --- a/debian/rules +++ b/debian/rules @@ -129,7 +129,6 @@ install: install -D usage/target/cloud-usage-$(VERSION)-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/$(PACKAGE)-usage.jar install -D usage/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/ cp usage/target/transformed/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/ - ln -s ../management/db.properties $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/db.properties install -D packaging/debian/init/cloud-usage $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage # cloudstack-awsapi diff --git a/usage/conf/db.properties.in b/usage/conf/db.properties.in new file mode 100644 index 00000000000..21e67c6d4cb --- /dev/null +++ b/usage/conf/db.properties.in @@ -0,0 +1,12 @@ +# usage database settings +db.usage.username=@DBUSER@ +db.usage.password=@DBPW@ +db.usage.host=@DBHOST@ +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.autoReconnect=true