Skip to content
Browse files

Adding the ACM to bosh.

New acm submodule pointer to the release repo.
Jobs and packages.
Discovery on nats.
Logging to syslog.
Uses a postgres db.

Change-Id: Ibe6bd0917aad564103ad95ee9ac6408698d76f2b
  • Loading branch information...
1 parent 5657c24 commit 8618d94eae9f95ccddcd5c708fb480a4f35e0d87 @joeldsa joeldsa committed Apr 6, 2012
View
3 .gitmodules
@@ -13,3 +13,6 @@
[submodule "src/vblob_src"]
path = src/vblob_src
url = git@github.com:cloudfoundry/vblob.git
+[submodule "src/acm"]
+ path = src/acm
+ url = git@github.com:cloudfoundry/acm.git
View
5 jobs/acm/monit
@@ -0,0 +1,5 @@
+check process acm
+ with pidfile /var/vcap/sys/run/acm/acm.pid
+ start program "/var/vcap/jobs/acm/bin/acm_ctl start"
+ stop program "/var/vcap/jobs/acm/bin/acm_ctl stop"
+ group vcap
View
12 jobs/acm/spec
@@ -0,0 +1,12 @@
+---
+name: acm
+templates:
+ acm_ctl.erb: bin/acm_ctl
+ acm.yml.erb: config/acm.yml
+ syslog_forwarder.conf.erb: config/syslog_forwarder.conf
+packages:
+ - libpq
+ - common
+ - ruby
+ - syslog_aggregator
+ - acm
View
16 jobs/acm/templates/acm.yml.erb
@@ -0,0 +1,16 @@
+---
+pid: /var/vcap/sys/run/acm/acm.pid
+name: ACM
+port: 9090
+mbus: nats://<%= properties.nats.user %>:<%= properties.nats.password %>@<%= properties.nats.address %>:<%= properties.nats.port %>/
+logging:
+ level: info
+ file: /var/vcap/sys/log/acm/acm.log
+ syslog: vcap.acm
+db:
+ database: postgres://<%= properties.acm.db.user %>:<%= properties.acm.db.password %>@<%= properties.acm.db.address %>:<%= properties.acm.db.port %>/<%= properties.acm.db.dbname %>
+ max_connections: 25
+ pool_timeout: 2000
+basic_auth:
+ user: <%= properties.acm.user %>
+ password: <%= properties.acm.password %>
View
44 jobs/acm/templates/acm_ctl.erb
@@ -0,0 +1,44 @@
+#!/bin/bash -e
+
+RUN_DIR=/var/vcap/sys/run/acm
+LOG_DIR=/var/vcap/sys/log/acm
+CONFIG_DIR=/var/vcap/jobs/acm/config
+PIDFILE=$RUN_DIR/acm.pid
+PACKAGE_DIR=/var/vcap/packages/acm
+export PATH=/var/vcap/packages/ruby/bin:$PATH
+
+source /var/vcap/packages/common/utils.sh
+
+case $1 in
+
+ start)
+ pid_guard $PIDFILE "ACM"
+
+ mkdir -p $RUN_DIR/acm
+ mkdir -p $LOG_DIR
+ echo $$ > $PIDFILE
+
+ chown -R vcap:vcap $RUN_DIR
+ chown -R vcap:vcap $LOG_DIR
+
+ <% if properties.syslog_aggregator %>
+ /var/vcap/packages/syslog_aggregator/setup_syslog_forwarder.sh $CONFIG_DIR
+ <% end %>
+
+ exec chpst -u vcap:vcap $PACKAGE_DIR/acm/bin/acm -c $CONFIG_DIR/acm.yml \
+ >>$LOG_DIR/acm.stdout.log \
+ 2>>$LOG_DIR/acm.stderr.log
+
+ ;;
+
+ stop)
+ kill_and_wait $PIDFILE
+
+ ;;
+
+ *)
+ echo "Usage: acm_ctl {start|stop}"
+
+ ;;
+
+esac
View
29 jobs/acm/templates/syslog_forwarder.conf.erb
@@ -0,0 +1,29 @@
+<% if properties.syslog_aggregator %>
+$ModLoad imuxsock # local message reception (rsyslog uses a datagram socket)
+$MaxMessageSize 4k # default is 2k
+
+$ModLoad imudp # the java log4j appender only works with udp
+$UDPServerRun 514
+
+$WorkDirectory /var/vcap/sys/rsyslog/buffered # where messages should be buffered on disk
+
+# Forward vcap messages to the aggregator
+#
+$ActionResumeRetryCount -1 # Try until the server becomes available
+$ActionQueueType LinkedList # Allocate on-demand
+$ActionQueueFileName agg_backlog # Spill to disk if queue is full
+$ActionQueueMaxDiskSpace 32m # Max size for disk queue
+$ActionQueueLowWaterMark 2000 # Num messages. Assuming avg size of 512B, this is 1MiB.
+$ActionQueueHighWaterMark 8000 # Num messages. Assuming avg size of 512B, this is 4MiB. (If this is reached, messages will spill to disk until the low watermark is reached).
+$ActionQueueTimeoutEnqueue 0 # Discard messages if the queue + disk is full
+$ActionQueueSaveOnShutdown on # Save in-memory data to disk if rsyslog shuts down
+:programname, startswith, "vcap." @@<%= properties.syslog_aggregator.address %>:<%= properties.syslog_aggregator.port %>
+
+# Log vcap messages locally, too
+#$template VcapComponentLogFile, "/var/log/%programname:6:$%/%programname:6:$%.log"
+#$template VcapComponentLogFormat, "%timegenerated% %syslogseverity-text% -- %msg%\n"
+#:programname, startswith, "vcap." -?VcapComponentLogFile;VcapComponentLogFormat
+
+# Prevent them from reaching anywhere else
+:programname, startswith, "vcap." ~
+<% end %>
View
14 packages/acm/packaging
@@ -0,0 +1,14 @@
+# abort script on any command that exit with a non zero value
+set -e
+
+cp -a * ${BOSH_INSTALL_TARGET}
+
+(
+ cd ${BOSH_INSTALL_TARGET}/acm
+
+ bundle_cmd=/var/vcap/packages/ruby/bin/bundle
+ libpq_dir=/var/vcap/packages/libpq
+
+ $bundle_cmd config build.pg --with-pg-lib=$libpq_dir/lib --with-pg-include=$libpq_dir/include
+ $bundle_cmd install --local --deployment --without development test
+)
View
8 packages/acm/spec
@@ -0,0 +1,8 @@
+---
+name: acm
+dependencies:
+- libpq
+- ruby
+files:
+- acm/**/*
+- core/common/**/*
1 src/acm
@@ -0,0 +1 @@
+Subproject commit b4ee416aab831acb4962993df006a3a6914c06ee

0 comments on commit 8618d94

Please sign in to comment.
Something went wrong with that request. Please try again.