Skip to content
This repository
Browse code

Add a mgmt proxy for services

git shortlog 106ad12..HEAD

Andrew Liu and Scott Calvert (1):
      add default cc_api_version to provisioner spec

David Stevenson (2):
      Merge pull request #30 from felixhoo/monit_user
      Merge pull request #32 from felixhoo/mgmt_proxy

David Stevenson and Ryan Tang (3):
      Jenkins build setup
      Updated mysql user info for CI
      Update mysql port for CI

Jesse Zhang and Scott Calvert (1):
      Integration tests fail if there are local changes to ccng and ENV['NO_CHECKOUT'] is undefined.

Matt Royal and Phan Le (4):
      Fix the test
      Run echo build on travis
      Add marketplace, service_broker and mysql builds back
      Integration tests don't clear changes in CCNG

Phan Le (1):
      Revert previous inadvertent commit

Phan Le and Ryan Tang (1):
      Supporting only mysql 5.5 on ng and should always be running in wardenized mode

Phan Le and Scott Calvert (1):
      Fixing our last attempt at making integration tests fail when uncommitted changes would be clobbered

felixhoo (2):
      Create monitoring user on provision
      Add a proxy to delegate traffic to service native UI
  • Loading branch information...
commit 8e65f85da4cb51dbdca3dae914a50799aac97542 1 parent 3bb2d0f
Felix Hu authored March 26, 2013 David Stevenson committed March 31, 2013
11  jobs/servicesmgmt/monit
... ...
@@ -0,0 +1,11 @@
  1
+check process servicesmgmt
  2
+  with pidfile /var/vcap/sys/run/servicesmgmt/servicesmgmt.pid
  3
+  start program "/var/vcap/jobs/servicesmgmt/bin/servicesmgmt_ctl start"
  4
+  stop program "/var/vcap/jobs/servicesmgmt/bin/servicesmgmt_ctl stop"
  5
+  group vcap
  6
+
  7
+check process vcap_registrar
  8
+  with pidfile /var/vcap/sys/run/vcap_registrar/vcap_registrar.pid
  9
+  start program "/var/vcap/jobs/servicesmgmt/bin/vcap_registrar_ctl start"
  10
+  stop program "/var/vcap/jobs/servicesmgmt/bin/vcap_registrar_ctl stop"
  11
+  group vcap
16  jobs/servicesmgmt/spec
... ...
@@ -0,0 +1,16 @@
  1
+---
  2
+name: servicesmgmt
  3
+templates:
  4
+  servicesmgmt_ctl.erb: bin/servicesmgmt_ctl
  5
+  vcap_registrar_ctl: bin/vcap_registrar_ctl
  6
+
  7
+  vcap_registrar.config.yml.erb: config/vcap_registrar/config.yml
  8
+  servicesmgmt.yml.erb: config/servicesmgmt.yml
  9
+  varz.yml.erb: config/varz.yml
  10
+  syslog_forwarder.conf.erb: config/syslog_forwarder.conf
  11
+
  12
+packages:
  13
+  - common
  14
+  - ruby
  15
+  - syslog_aggregator
  16
+  - servicesmgmt
13  jobs/servicesmgmt/templates/servicesmgmt.yml.erb
... ...
@@ -0,0 +1,13 @@
  1
+---
  2
+id: servicesmgmt
  3
+secret: <%= p("uaa.clients.servicesmgmt.secret") %>
  4
+token_server: http://uaa.<%= properties.domain %>
  5
+auth_server: http://login.<%= properties.domain %>
  6
+index: <%= spec.index %>
  7
+cloud_controller_uri: <%= properties.cc.srv_api_uri %>
  8
+logging:
  9
+  level: debug
  10
+  file: /var/vcap/sys/log/servicesmgmt/servicesmgmt.log
  11
+  <% if properties.syslog_aggregator %>
  12
+  syslog: vcap.servicesmgmt
  13
+  <% end %>
47  jobs/servicesmgmt/templates/servicesmgmt_ctl.erb
... ...
@@ -0,0 +1,47 @@
  1
+#!/bin/bash
  2
+export PATH=/var/vcap/packages/ruby/bin:$PATH
  3
+
  4
+RUN_DIR=/var/vcap/sys/run/servicesmgmt
  5
+LOG_DIR=/var/vcap/sys/log/servicesmgmt
  6
+PIDFILE=$RUN_DIR/servicesmgmt.pid
  7
+JOB_DIR=/var/vcap/jobs/servicesmgmt
  8
+
  9
+source /var/vcap/packages/common/utils.sh
  10
+
  11
+case $1 in
  12
+
  13
+  start)
  14
+    pid_guard $PIDFILE "Services Mgmt"
  15
+
  16
+    mkdir -p $RUN_DIR
  17
+    mkdir -p $LOG_DIR
  18
+
  19
+    # Generate a random usernames and passwords
  20
+    username=$RANDOM-$RANDOM-$RANDOM-$RANDOM
  21
+    password=$RANDOM-$RANDOM-$RANDOM-$RANDOM
  22
+
  23
+    sed -i "s/_random_username_replaced_by_a_script_/${username}/g" $JOB_DIR/config/varz.yml
  24
+    sed -i "s/_random_password_replaced_by_a_script_/${password}/g" $JOB_DIR/config/varz.yml
  25
+
  26
+    export CLOUD_FOUNDRY_CONFIG_PATH=$JOB_DIR/config/
  27
+    export PIDFILE=$PIDFILE
  28
+    export CONFIG_FILE=$JOB_DIR/config/servicesmgmt.yml
  29
+
  30
+    cd /var/vcap/packages/servicesmgmt/services/tools/servicesmgmt/
  31
+    bundle exec rackup -D -p <%= p("servicesmgmt.port", "80") %> -P $PIDFILE \
  32
+        >>$LOG_DIR/servicesmgmt.stdout.log \
  33
+        2>>$LOG_DIR/servicesmgmt.stderr.log
  34
+
  35
+    ;;
  36
+
  37
+  stop)
  38
+    kill_and_wait $PIDFILE
  39
+
  40
+    ;;
  41
+
  42
+  *)
  43
+    echo "Usage: servicesmgmt_ctl {start|stop}"
  44
+
  45
+    ;;
  46
+
  47
+esac
29  jobs/servicesmgmt/templates/syslog_forwarder.conf.erb
... ...
@@ -0,0 +1,29 @@
  1
+<% if properties.syslog_aggregator %>
  2
+$ModLoad imuxsock                       # local message reception (rsyslog uses a datagram socket)
  3
+$MaxMessageSize 4k                      # default is 2k
  4
+
  5
+$ModLoad imudp                          # the java log4j appender only works with udp
  6
+$UDPServerRun 514
  7
+
  8
+$WorkDirectory /var/vcap/sys/rsyslog/buffered  # where messages should be buffered on disk
  9
+
  10
+# Forward vcap messages to the aggregator
  11
+#
  12
+$ActionResumeRetryCount -1              # Try until the server becomes available
  13
+$ActionQueueType LinkedList             # Allocate on-demand
  14
+$ActionQueueFileName agg_backlog        # Spill to disk if queue is full
  15
+$ActionQueueMaxDiskSpace 32m            # Max size for disk queue
  16
+$ActionQueueLowWaterMark 2000           # Num messages. Assuming avg size of 512B, this is 1MiB.
  17
+$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).
  18
+$ActionQueueTimeoutEnqueue 0            # Discard messages if the queue + disk is full
  19
+$ActionQueueSaveOnShutdown on           # Save in-memory data to disk if rsyslog shuts down
  20
+:programname, startswith, "vcap." @@<%= properties.syslog_aggregator.address %>:<%= properties.syslog_aggregator.port %>
  21
+
  22
+# Log vcap messages locally, too
  23
+#$template VcapComponentLogFile, "/var/log/%programname:6:$%/%programname:6:$%.log"
  24
+#$template VcapComponentLogFormat, "%timegenerated% %syslogseverity-text% -- %msg%\n"
  25
+#:programname, startswith, "vcap." -?VcapComponentLogFile;VcapComponentLogFormat
  26
+
  27
+# Prevent them from reaching anywhere else
  28
+:programname, startswith, "vcap." ~
  29
+<% end %>
5  jobs/servicesmgmt/templates/varz.yml.erb
... ...
@@ -0,0 +1,5 @@
  1
+---
  2
+varz:
  3
+  username: _random_username_replaced_by_a_script_
  4
+  password: _random_password_replaced_by_a_script_
  5
+  type: servicesmgmt
17  jobs/servicesmgmt/templates/vcap_registrar.config.yml.erb
... ...
@@ -0,0 +1,17 @@
  1
+---
  2
+logging:
  3
+  file: /var/vcap/sys/log/vcap_registrar/vcap_registrar.log
  4
+  <% if properties.syslog_aggregator %>
  5
+  syslog: vcap.servicesmgmt_vcap_registrar
  6
+  <% end %>
  7
+  level: info
  8
+mbus: nats://<%= properties.nats.user %>:<%= properties.nats.password %>@<%= properties.nats.address %>:<%= properties.nats.port %>
  9
+uri:
  10
+  - servicesmgmt.<%= properties.domain %>
  11
+host: <%= spec.networks.send(properties.networks.apps).ip %>
  12
+index: <%= spec.index %>
  13
+port: <%= p("servicesmgmt.port", "80") %>
  14
+tags:
  15
+  component: servicesmgmt
  16
+varz:
  17
+  file: /var/vcap/jobs/servicesmgmt/config/varz.yml
41  jobs/servicesmgmt/templates/vcap_registrar_ctl
... ...
@@ -0,0 +1,41 @@
  1
+#!/bin/bash -e
  2
+
  3
+export PATH=/var/vcap/packages/ruby/bin:$PATH
  4
+RUN_DIR=/var/vcap/sys/run/vcap_registrar
  5
+LOG_DIR=/var/vcap/sys/log/vcap_registrar
  6
+PIDFILE=$RUN_DIR/vcap_registrar.pid
  7
+
  8
+source /var/vcap/packages/common/utils.sh
  9
+
  10
+case $1 in
  11
+
  12
+  start)
  13
+    pid_guard $PIDFILE "VCAP registrar"
  14
+
  15
+    mkdir -p $RUN_DIR
  16
+    mkdir -p $LOG_DIR
  17
+
  18
+    echo $$ > $PIDFILE
  19
+
  20
+    export CONFIG_FILE=/var/vcap/jobs/servicesmgmt/config/vcap_registrar/config.yml
  21
+
  22
+    cd /var/vcap/packages/servicesmgmt/tools/vcap_registrar
  23
+    exec /var/vcap/packages/ruby/bin/ruby \
  24
+         /var/vcap/packages/servicesmgmt/tools/vcap_registrar/bin/vcap_registrar \
  25
+         --register_with_router \
  26
+         --register_varz_credentials \
  27
+         >>$LOG_DIR/vcap_registrar.stdout.log \
  28
+         2>>$LOG_DIR/vcap_registrar.stderr.log
  29
+
  30
+    ;;
  31
+
  32
+  stop)
  33
+    kill_and_wait $PIDFILE
  34
+
  35
+    ;;
  36
+
  37
+  *)
  38
+    echo "Usage: vcap_registrar_ctl {start|stop}" ;;
  39
+
  40
+esac
  41
+exit 0
14  packages/servicesmgmt/packaging
... ...
@@ -0,0 +1,14 @@
  1
+# abort script on any command that exit with a non zero value
  2
+set -e
  3
+
  4
+cp -a * ${BOSH_INSTALL_TARGET}
  5
+
  6
+(
  7
+  bundle_cmd=/var/vcap/packages/ruby/bin/bundle
  8
+
  9
+  cd ${BOSH_INSTALL_TARGET}/services/tools/servicesmgmt
  10
+  $bundle_cmd install --local --deployment
  11
+
  12
+  cd ${BOSH_INSTALL_TARGET}/tools/vcap_registrar
  13
+  $bundle_cmd install --local --deployment --without=development test
  14
+)
6  packages/servicesmgmt/pre_packaging
... ...
@@ -0,0 +1,6 @@
  1
+# abort script on any command that exit with a non zero value
  2
+set -e
  3
+
  4
+cd ${BUILD_DIR}
  5
+
  6
+pkg_utils/vendor.sh services/tools/servicesmgmt
9  packages/servicesmgmt/spec
... ...
@@ -0,0 +1,9 @@
  1
+---
  2
+name: servicesmgmt
  3
+dependencies:
  4
+- ruby
  5
+files:
  6
+- services/tools/servicesmgmt/**/*
  7
+- pkg_utils/*
  8
+- common/services/utils.sh
  9
+- tools/vcap_registrar/**/*
2  src/services
... ...
@@ -1 +1 @@
1  
-Subproject commit 106ad12b8d21b72ae46379608df2efc8c43f3563
  1
+Subproject commit f87b317f6fb5d627cee8ed48b7b49c478befb2f4

0 notes on commit 8e65f85

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