summaryrefslogtreecommitdiffstats
path: root/OPENECOMP-DEMO/vm-templates/vm-postgresql.yaml
blob: 4c49eb756d695aa3ac5c1361d0b0c565ad5dde07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
### Description of VM itself
description: VM that runs PostgreSQL Data Base as a Service
short-name: pstg
number-vms-per-location: 1
application-ids: [ dcae ]
admin-id: ubuntu
dns-cnames: [ global ]
dns-service: 
  write: 
    dns-type : gss
    cluster-type : gss
    
lifecycle-management:
  use-dcae-manager: yes

installation-steps:

- step: shell
  command: cp /tmp/ecomp-nexus.crt /usr/local/share/ca-certificates/ ; update-ca-certificates
  application-id: root

- step: shell
  command: echo 162.242.254.138 ecomp-nexus >> /etc/hosts
  application-id: root

- step: shell
  command: |
    sed -i /`hostname`/d /etc/hosts
    cat /tmp/vm-*-hosts >> /etc/hosts
    while ! nslookup security.ubuntu.com; do
      echo DNS for security.ubuntu.com FAILED
      sleep 1m
    done
    apt-get update ; apt-get install -y maven openjdk-8-jdk unzip python-pip
    pip install pyyaml
  application-id: root
  
- step: shell
  command: |
    mkdir -p /opt/app
    (cd /opt/app ; curl -Lo apache-groovy-binary-2.4.6.zip https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.6.zip )
    (cd /opt/app ; unzip apache-groovy-binary-2.4.6.zip )
    mkdir -p /opt/app/java/jdk
    ln -s /usr /opt/app/java/jdk/jdk170
    mkdir -p /opt/app/groovy
    ln -s /opt/app/groovy-2.4.6 /opt/app/groovy/246
  application-id: root

- step: shell
  command: |
    echo nameserver 10.0.0.1 >>  /etc/resolv.conf
    echo "prepend domain-name-servers 10.0.0.1;" >> /etc/dhcp/dhclient.conf
    echo nameserver 10.0.0.1 >> /etc/resolvconf/resolv.conf.d/head  

- step: maven-artifact
  group-id: org.openecomp.dcae.controller
  artifact-id: dcae-controller-core-utils
  version: ${dcae.env('open-ecomp-demo.versions.controller')}
  type: zip
  assembly-id: runtime
  application-id: dcae

- step: shell
  command: |
    /opt/app/dcae-controller-core-utils/bin/fs-init.py

- step: maven-artifact
  group-id: org.openecomp.dcae.controller
  artifact-id: dcae-controller-service-common-vm-manager
  version: ${dcae.env('open-ecomp-demo.versions.controller')}
  type: zip
  assembly-id: runtime
  application-id: dcae

- step: maven-artifact
  group-id: org.openecomp.dcae.controller
  artifact-id: dcae-controller-service-storage-postgres-model
  version: ${dcae.env('open-ecomp-demo.versions.controller')}
  type: jar
  application-id: dcae
  
- step: shell
  command: |
    # prevent servers from starting
    echo  "exit 101" > /usr/sbin/policy-rc.d; chmod a+x /usr/sbin/policy-rc.d
    apt-get update ; apt-get install -y postgresql libpq5 repmgr python-psycopg2 python3-psycopg2 libgetopt-java
    rm -f /usr/sbin/policy-rc.d

  application-id: root

- step: http
  url: ${dcae.env('open-ecomp-demo.maven.rawurl')}/org.openecomp.dcae.pgaas/deb-releases/org.openecomp.dcae.storage.pgaas-cdf_${dcae.env('open-ecomp-demo.versions.postgres')}.deb
  type: deb

- step: http
  url: ${dcae.env('open-ecomp-demo.maven.rawurl')}/org.openecomp.dcae.pgaas/deb-releases/org.openecomp.dcae.storage.pgaas-postgresql-prep_${dcae.env('open-ecomp-demo.versions.postgres')}.deb
  type: deb

- step: http
  url: ${dcae.env('open-ecomp-demo.maven.rawurl')}/org.openecomp.dcae.pgaas/deb-releases/org.openecomp.dcae.storage.pgaas-postgresql-config_${dcae.env('open-ecomp-demo.versions.postgres')}.deb
  type: deb

- step: http
  url: ${dcae.env('open-ecomp-demo.maven.rawurl')}/org.openecomp.dcae.pgaas/deb-snapshots/org.openecomp.dcae.storage.pgaas-pgaas_${dcae.env('open-ecomp-demo.versions.postgres')}.deb
  type: deb

- step: http
  url: ${dcae.env('open-ecomp-demo.maven.rawurl')}/org.openecomp.dcae.pgaas/deb-snapshots/org.openecomp.dcae.storage.pgaas-pgaas-post_${dcae.env('open-ecomp-demo.versions.postgres')}.deb
  type: deb

- step: shell
  command: |
    echo "dcae ALL=(postgres) NOPASSWD: ALL" > /etc/sudoers.d/dcae-postgres
    sudo su dcae -c "/opt/app/dcae-controller-service-common-vm-manager/bin/manager.sh config"
    sudo su dcae -c "/opt/app/dcae-controller-service-common-vm-manager/bin/manager.sh restart"
   

openstack-vm-type:  
  volumeSizeGB: 75
  memorySizeGB: 8
  needPublicIp: true
  numberOfCores: 8
  rootDiskSizeGB: 40
  diskSizeGB: 80
  imageName: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
  openstack-flavor-name: 8 GB Performance
  disk-partitions:
    osType: ubuntu
    volumes:
      opt:
        uuid: ephemeral
        size: 80
        filesystems:
          "/opt/tools" :
            size: 80
            type: ext4
            mount_opts: ""
      dbroot:
        uuid: cinder
        size: 75
        filesystems:
          "/dbroot/pgdata" :
            size: 50
            type: ext4
            mount_opts: ""
          "/dbroot/pglogs" :
            size: 25
            type: ext4
            mount_opts: ""

controller-instance-configuration: 
  "$class": org.openecomp.dcae.controller.service.common.vm.service.CommonVmServiceInstance
  script: sudo -u postgres /opt/app/pgaas/bin/dcae_admin_db
  vmConfiguration: 
    "$class": org.openecomp.dcae.controller.service.storage.postgres.service.PostgresServiceConfiguration
    state: master
    databases:
      dmaap:
        description: DMAAP Databus Configuration
        ownerRole: dmaap_admin
        roles:
          dmaap_admin:
            password: ${dcae.password('postgres.dmaap.admin')}
            role: admin
            roleComment: [ admin writer reader]
          dmaap_user:
            password: ${dcae.password('postgres.dmaap.user')}
            role: writer
            roleComment: [ admin writer reader]
          dmaap_viewer:
            password: ${dcae.password('postgres.dmaap.viewer')}
            role: reader
            roleComment: [ admin writer reader]
vm-setup:
  configuration-files:
    main:
      destination: /tmp/postgres.conf
      content: |-
        master:  ${ENV.PGAASMASTER ?: "TDB env.yaml@vm-templates.vm-postgresql.PGAASMASTER"}
        secondmaster: ${ENV.PGAASMASTER2 ?: "TDB env.yaml@vm-templates.vm-postgresql.PGAASMASTER2"}
        DRTR_NODE_KSTOREFILE: /opt/app/dcae-certificate/keystore.jks
        DRTR_NODE_KSTOREPASS: "%{certPassword}"
        DRTR_NODE_PVTKEYPASS: "%{certPassword}"
        PG_NODES : ${dcae.allServersFqdn().join('|')}
        PG_JAVA_HOME : /opt/app/java/jdk/jdk170
        PG_CLUSTER : site