Changes to use monasca instead of mon

Changed to use monasca_api instead of mon_api. Added monasca_api
user to group monasca so the api can write to /var/log/monasca and
read the config file in /etc/monasca

Change data bag names to monasca_api instead of mon_api

Place jar file in /opt/monasca

Change service name from mon-api to monasca-api

Change-Id: Ic2a8db0b6b1451872f42373077cf5f2911de3652
This commit is contained in:
Craig Bryant 2014-09-03 21:49:02 -06:00
parent eb7b56fc50
commit 12671c255d
7 changed files with 33 additions and 44 deletions

View File

@ -4,4 +4,4 @@ Also included is an icinga check for the service health check.
Using Vertica
------------
If Vertica is used as the database for Monasca, the Vertica JDBC jar that matches the Vertica version must be placed in /opt/mon/vertica. The jar from Vertica will be named like vertica-jdbc-7.0.1-0.jar and must be renamed to vertica_jdbc.jar when placed in /opt/mon/vertica. You can find the Vertica JDBC jar in /opt/vertica/java on a system with the Vertica database installed. This cookbook will copy the Vertica JDBC Jar from /vagrant and place it in /opt/mon/vertica if run using Chef Solo.
If Vertica is used as the database for Monasca, the Vertica JDBC jar that matches the Vertica version must be placed in /opt/monasca/vertica. The jar from Vertica will be named like vertica-jdbc-7.0.1-0.jar and must be renamed to vertica_jdbc.jar when placed in /opt/monasca/vertica. You can find the Vertica JDBC jar in /opt/vertica/java on a system with the Vertica database installed. This cookbook will copy the Vertica JDBC Jar from /vagrant and place it in /opt/monasca/vertica if run using Chef Solo.

View File

@ -1,4 +0,0 @@
# encoding: UTF-8#
#
# Logs to backup
node.default[:mon_log_backup][:logs][:som_api] = ['/var/log/som-api/']

View File

@ -1,5 +1,5 @@
# encoding: UTF-8#
#
node.default[:mon_api][:group] = 'mon_api'
node.default[:mon_api][:owner] = 'mon_api'
node.default[:mon_api][:data_bag] = 'mon_api'
node.default[:monasca_api][:group] = 'monasca'
node.default[:monasca_api][:owner] = 'monasca_api'
node.default[:monasca_api][:data_bag] = 'monasca_api'

View File

@ -1,16 +0,0 @@
# encoding: UTF-8#
#
default[:som_api][:firewall][:rules] = [
https: {
port: '443',
protocol: 'tcp'
},
https_8080: {
port: '8080',
protocol: 'tcp'
},
http_8081: {
port: '8081',
protocol: 'tcp'
}
]

View File

@ -1,9 +1,9 @@
# encoding: UTF-8#
#
name 'mon_api'
name 'monasca_api'
maintainer 'Monasca Team'
maintainer_email 'monasca@lists.launchpad.net'
license 'All rights reserved'
description 'Installs/Configures mon_api'
description 'Installs/Configures the Monasca API'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.0.13'
version '0.0.14'

View File

@ -1,44 +1,53 @@
# encoding: UTF-8#
#
package 'mon-api' do
group node[:monasca_api][:group] do
action :create
end
user node[:monasca_api][:owner] do
action :create
system true
gid node[:monasca_api][:group]
end
package 'monasca-api' do
action :upgrade
end
service 'mon-api' do
service 'monasca-api' do
action :enable
provider Chef::Provider::Service::Upstart
end
directory '/var/log/mon-api' do
directory '/var/log/monasca' do
recursive true
owner node[:mon_api][:owner]
group node[:mon_api][:group]
mode 0755
owner node[:monasca_api][:owner]
group node[:monasca_api][:group]
mode 0775
action :create
end
creds = data_bag_item(node[:mon_api][:data_bag], 'mon_credentials')
setting = data_bag_item(node[:mon_api][:data_bag], 'mon_api')
creds = data_bag_item(node[:monasca_api][:data_bag], 'credentials')
setting = data_bag_item(node[:monasca_api][:data_bag], 'monasca_api')
# Create the config file
template '/etc/mon/mon-api-config.yml' do
template '/etc/monasca/api-config.yml' do
action :create
owner 'root'
group node[:mon_api][:group]
group node[:monasca_api][:group]
mode '640'
source 'mon-service-config.yml.erb'
source 'api-config.yml.erb'
variables(
creds: creds,
setting: setting
)
notifies :restart, 'service[mon-api]'
notifies :restart, 'service[monasca-api]'
end
if setting['database-configuration']['database-type'] == 'vertica'
# Create the directory for the vertica JDBC jar
directory '/opt/mon/vertica' do
directory '/opt/monasca/vertica' do
recursive true
owner 'root'
group 'root'
@ -50,7 +59,7 @@ if setting['database-configuration']['database-type'] == 'vertica'
bash 'vertica_jdbc.jar' do
action :run
code <<-EOL
DEST=/opt/mon/vertica/vertica_jdbc.jar
DEST=/opt/monasca/vertica/vertica_jdbc.jar
if [ ! -s ${DEST} ]; then
SRC=`ls /vagrant/vertica-jdbc-*.jar`
if [ $? != 0 ]; then

View File

@ -70,7 +70,7 @@ influxDB:
password: <%=@creds['influxdb']['password'] %>
# Uncomment if databaseType is vertica
# As of 7/10 there is a bug in the mon-api that requires this section even if databaseType is set to influxdb
# As of 7/10 there is a bug in the monasca-api that requires this section even if databaseType is set to influxdb
vertica:
driverClass: com.vertica.jdbc.Driver
url: jdbc:vertica://localhost/mon
@ -131,10 +131,10 @@ logging:
logFormat: # TODO
- type: file
currentLogFilename: /var/log/mon-api/mon-api.log
currentLogFilename: /var/log/monasca/monasca-api.log
threshold: ALL
archive: true
archivedLogFilenamePattern: /var/log/mon-api/mon-api-%d.log.gz
archivedLogFilenamePattern: /var/log/monasca/monasca-api-%d.log.gz
archivedFileCount: 5
timeZone: UTC
logFormat: # TODO