Merge "Prepare ELK TOSCA Template for Translation into HOT"

This commit is contained in:
Jenkins 2015-06-08 13:27:16 +00:00 committed by Gerrit Code Review
commit 4f900d6097
5 changed files with 41 additions and 15 deletions

View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "conn = new Mongo();" > setup.js
echo "db = conn.getDB('paypal_pizza');" >> setup.js
echo "db.about.insert({'name': 'PayPal Pizza Store'});" >> setup.js
mongo setup.js

View File

@ -1,3 +1,5 @@
#!/bin/sh -x
# This script starts mongodb
restart mongodb
/etc/init.d/mongodb stop
rm /var/lib/mongod.lock
mongod --dbpath /var/lib/mongodb &

View File

@ -0,0 +1,21 @@
# Licensed 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.
# This script configures the output for rsyslogd to send logs to the
# logstash server port 2514 using the RELP protocol
# The environment variable logstash_ip is expected to be set up
import os
with open("/etc/rsyslog.d/tosca_elk.conf", "w") as fh:
fh.write("""
module(load="omrelp")
action(type="omrelp" target="%s" port="2514")
""" % (os.environ['logstash_ip']))

View File

@ -1,10 +0,0 @@
#!/usr/bin/python
# This script configures the output for rsyslogd to send logs to the
# logstash server port 2514 using the RELP protocol
# The environment variable logstash_ip is expected to be set up
import os
with open("/etc/rsyslog.d/tosca_elk.conf", "w") as fh:
fh.write("""
module(load="omrelp")
action(type="omrelp" target="%s" port="2514")
""" % (os.environ['logstash_ip']))

View File

@ -17,7 +17,7 @@ imports:
dsl_definitions:
host_capabilities: &host_capabilities
disk_size: 10 GB
num_cpus: 1
num_cpus: { get_input: my_cpus }
mem_size: 4096 MB
os_capabilities: &os_capabilities
architecture: x86_64
@ -47,13 +47,13 @@ topology_template:
- host:
node: nodejs
- database_connection:
node: mongo_dbms
node: mongo_db
interfaces:
tosca.interfaces.node.lifecycle.Standard:
configure:
implementation: nodejs/config.sh
inputs:
github_url: { get_property: [ SELF, github_url ] }
github_url: http://github.com/paypal/rest-api-sample-app-nodejs.git
mongodb_ip: { get_attribute: [mongo_server, private_address] }
start: nodejs/start.sh
nodejs:
@ -64,6 +64,14 @@ topology_template:
interfaces:
tosca.interfaces.node.lifecycle.Standard:
create: nodejs/create.sh
mongo_db:
type: tosca.nodes.Database
requirements:
- host:
node: mongo_dbms
interfaces:
tosca.interfaces.node.lifecycle.Standard:
create: mongodb/create_database.sh
mongo_dbms:
type: tosca.nodes.DBMS
requirements:
@ -163,7 +171,7 @@ topology_template:
tosca.interfaces.node.lifecycle.Standard:
create: rsyslog/create.sh
configure:
implementation: rsyslog/config.sh
implementation: rsyslog/config.py
inputs:
logstash_ip: { get_attribute: [logstash_server, private_address] }
start: rsyslog/start.sh