This repository has been archived by the owner on Jan 21, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
9 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
name: acm | ||
dependencies: | ||
- libpq | ||
- ruby | ||
files: | ||
- acm/**/* | ||
- core/common/**/* |