Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Migrate ccdb_postgres -> new postgres template

New postgres template is more generic and can be used
by all of ccdb, uaadb and acmdb jobs. Deployment manifest
should be updated in order to pick that change up.

Manifest changes:

1. use 'postgres' template in place of 'ccdb_postgres'

2. add property called 'db' to job-specific properties of every
   job using 'postgres' template. Property value should be a valid
   property name defined in the manifest, e.g.

   jobs:
   - template: postgres
     properties:
       db: ccdb
   ...
   properties
     ccdb: ...

3. use well-formed properties section that can be picked up by
   'postgres' template, e.g.

    ccdb:
      address: 172.23.242.12
      port: 5524
      roles:
      - tag: admin
        name: ccadmin
        password: tauBauWauZZb2
      databases:
      - tag: cc
        name: appcloud

   Please note that jobs consuming these properties should be able
   to locate role and database they need by traversing these properties
   and picking appropriate tags.

Change-Id: Ia1ff451bbcf3bb33ac35e3b7410323d0d7a7e65d
  • Loading branch information...
commit 3a1abefe7352c22b4fff70dee9ae27c111ba75c8 1 parent 1a89b14
Oleg Shaldybin olegshaldybin authored
5 jobs/acm/templates/acm.yml.erb
View
@@ -1,4 +1,7 @@
---
+<% db = properties.acmdb.databases.find { |db| db.tag == "acm" } %>
+<% role = properties.acmdb.roles.find { |role| role.tag == "admin" } %>
+
pid: /var/vcap/sys/run/acm/acm.pid
name: ACM
port: 9090
@@ -8,7 +11,7 @@ logging:
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 %>
+ database: postgres://<%= role.name %>:<%= role.password %>@<%= properties.acmdb.address %>:<%= properties.acmdb.port %>/<%= db.name %>
max_connections: 25
pool_timeout: 2000
basic_auth:
9 jobs/cloud_controller/templates/cloud_controller.yml.erb
View
@@ -1,4 +1,7 @@
---
+<% db = properties.ccdb.databases.find { |db| db.tag == "cc" } %>
+<% db_role = properties.ccdb.roles.find { |role| role.tag == "admin" } %>
+
external_uri: api.<%= properties.domain %>
description: <%= properties.description || "VMware's Cloud Application Platform" %>
support_address: <%= properties.support_address || "http://support.cloudfoundry.com" %>
@@ -76,12 +79,12 @@ new_initial_placement: false
database_environment:
production:
- database: <%= properties.ccdb.dbname %>
+ database: <%= db.name %>
host: <%= properties.ccdb.address %>
port: <%= properties.ccdb.port %>
encoding: utf8
- username: <%= properties.ccdb.user %>
- password: <%= properties.ccdb.password %>
+ username: <%= db_role.name %>
+ password: <%= db_role.password %>
pool: <%= properties.ccdb.pool_size %>
timeout: 2000
template: template0 # Required for utf8 encoding
9 jobs/health_manager/templates/cloud_controller.yml.erb
View
@@ -1,4 +1,7 @@
---
+<% db = properties.ccdb.databases.find { |db| db.tag == "cc" } %>
+<% db_role = properties.ccdb.roles.find { |role| role.tag == "admin" } %>
+
external_uri: api.<%= properties.domain %>
local_route: <%= spec.networks.send(properties.networks.apps).ip %>
allow_external_app_uris: false
@@ -24,12 +27,12 @@ mbus: nats://<%= properties.nats.user %>:<%= properties.nats.password %>@<%= pro
rails_environment: production
database_environment:
production:
- database: <%= properties.ccdb.dbname %>
+ database: <%= db.dbname %>
host: <%= properties.ccdb.address %>
port: <%= properties.ccdb.port %>
encoding: utf8
- username: <%= properties.ccdb.user %>
- password: <%= properties.ccdb.password %>
+ username: <%= db_role.name %>
+ password: <%= db_role.password %>
pool: <%= properties.ccdb.pool_size %>
timeout: 2000
template: template0 # Required for utf8 encoding
15 jobs/health_manager/templates/health_manager.yml.erb
View
@@ -1,6 +1,11 @@
---
-local_route: <%= spec.networks.send(properties.networks.apps).ip %>
-mbus: nats://<%= properties.nats.user %>:<%= properties.nats.password %>@<%= properties.nats.address %>:<%= properties.nats.port %>
+<% db = properties.ccdb.databases.find { |db| db.tag == "cc" } %>
+<% db_role = properties.ccdb.roles.find { |role| role.tag == "admin" } %>
+<% network = spec.networks.send(properties.networks.apps) %>
+<% nats = properties.nats %>
+
+local_route: <%= network.ip %>
+mbus: nats://<%= nats.user %>:<%= nats.password %>@<%= nats.address %>:<%= nats.port %>
logging:
file: /var/vcap/sys/log/health_manager/health_manager.log
<% if properties.syslog_aggregator %>
@@ -12,12 +17,12 @@ rails_environment: production
index: <%= spec.index %>
database_environment:
production:
- database: <%= properties.ccdb.dbname %>
+ database: <%= db.name %>
host: <%= properties.ccdb.address %>
port: <%= properties.ccdb.port %>
encoding: utf8
- username: <%= properties.ccdb.user %>
- password: <%= properties.ccdb.password %>
+ username: <%= db_role.name %>
+ password: <%= db_role.password %>
pool: <%= properties.ccdb.pool_size %>
timeout: 2000
template: template0 # Required for utf8 encoding
18 jobs/uaa/templates/uaa.yml.erb
View
@@ -1,4 +1,10 @@
---
+<% uaa_db = properties.uaadb.databases.find { |db| db.tag == "uaa" } %>
+<% uaa_role = properties.uaadb.roles.find { |role| role.tag == "admin" } %>
+
+<% cc_db = properties.ccdb.databases.find { |db| db.tag == "cc" } %>
+<% cc_role = properties.ccdb.roles.find { |role| role.tag == "admin" } %>
+
pid: /var/vcap/sys/run/uaa.pid
# nats message bus uri
mbus: nats://<%= properties.nats.user %>:<%= properties.nats.password %>@<%= properties.nats.address %>:<%= properties.nats.port %>/
@@ -7,18 +13,18 @@ name: uaa
database:
driverClassName: org.postgresql.Driver
- url: jdbc:postgresql://<%= properties.uaa.db.address %>:<%= properties.uaa.db.port %>/<%= properties.uaa.db.dbname %>
- username: <%= properties.uaa.db.user %>
- password: <%= properties.uaa.db.password %>
+ url: jdbc:postgresql://<%= properties.uaadb.address %>:<%= properties.uaadb.port %>/<%= uaa_db.name %>
+ username: <%= uaa_role.name %>
+ password: <%= uaa_role.password %>
jvm_args: -Xmx512m
spring_profiles: postgresql
cloud_controller:
database:
- url: jdbc:postgresql://<%= properties.ccdb.address %>:<%= properties.ccdb.port %>/<%= properties.ccdb.dbname %>
- username: <%= properties.ccdb.user %>
- password: <%= properties.ccdb.password %>
+ url: jdbc:postgresql://<%= properties.ccdb.address %>:<%= properties.ccdb.port %>/<%= cc_db.name %>
+ username: <%= cc_role.name %>
+ password: <%= cc_role.password %>
logging:
config: /var/vcap/jobs/uaa/config/log4j.properties
Please sign in to comment.
Something went wrong with that request. Please try again.