|
| 1 | + |
| 2 | +--- |
| 3 | + |
| 4 | +apiVersion: v1 |
| 5 | +kind: Template |
| 6 | +labels: |
| 7 | + template: aerogear-chatapp |
| 8 | +metadata: |
| 9 | + name: aerogear-chatapp |
| 10 | + annotations: |
| 11 | + openshift.io/display-name: Aerogear Chat App |
| 12 | + description: |- |
| 13 | + Deplots the Aerogear Chat App Server and Client |
| 14 | + tags: mobile, nodejs |
| 15 | + iconClass: icon-nodejs |
| 16 | + openshift.io/provider-display-name: Red Hat, Inc. |
| 17 | + openshift.io/documentation-url: https://docs.aerogear.org/aerogear/latest/data-sync.html#sync-server-openshift |
| 18 | + openshift.io/support-url: https://access.redhat.com |
| 19 | + template.openshift.io/bindable: 'false' |
| 20 | +objects: |
| 21 | + |
| 22 | +- apiVersion: v1 |
| 23 | + kind: Secret |
| 24 | + metadata: |
| 25 | + annotations: |
| 26 | + template.openshift.io/expose-database_name: "{.data['database-name']}" |
| 27 | + template.openshift.io/expose-password: "{.data['database-password']}" |
| 28 | + template.openshift.io/expose-username: "{.data['database-user']}" |
| 29 | + name: postgresql-credentials |
| 30 | + stringData: |
| 31 | + database-name: "${POSTGRESQL_DATABASE}" |
| 32 | + database-password: "${POSTGRESQL_PASSWORD}" |
| 33 | + database-user: "${POSTGRESQL_USER}" |
| 34 | + |
| 35 | + |
| 36 | +- apiVersion: v1 |
| 37 | + kind: Service |
| 38 | + metadata: |
| 39 | + annotations: |
| 40 | + template.openshift.io/expose-uri: postgres://{.spec.clusterIP}:{.spec.ports[?(.name=="postgresql")].port} |
| 41 | + name: postgresql |
| 42 | + spec: |
| 43 | + ports: |
| 44 | + - name: postgresql |
| 45 | + nodePort: 0 |
| 46 | + port: 5432 |
| 47 | + protocol: TCP |
| 48 | + targetPort: 5432 |
| 49 | + selector: |
| 50 | + name: postgresql |
| 51 | + sessionAffinity: None |
| 52 | + type: ClusterIP |
| 53 | + status: |
| 54 | + loadBalancer: {} |
| 55 | + |
| 56 | +- apiVersion: v1 |
| 57 | + kind: PersistentVolumeClaim |
| 58 | + metadata: |
| 59 | + name: postgresql |
| 60 | + spec: |
| 61 | + accessModes: |
| 62 | + - ReadWriteOnce |
| 63 | + resources: |
| 64 | + requests: |
| 65 | + storage: "${VOLUME_CAPACITY}" |
| 66 | + |
| 67 | +- apiVersion: v1 |
| 68 | + kind: DeploymentConfig |
| 69 | + metadata: |
| 70 | + annotations: |
| 71 | + template.alpha.openshift.io/wait-for-ready: 'true' |
| 72 | + name: postgresql |
| 73 | + spec: |
| 74 | + replicas: 1 |
| 75 | + selector: |
| 76 | + name: postgresql |
| 77 | + strategy: |
| 78 | + type: Recreate |
| 79 | + template: |
| 80 | + metadata: |
| 81 | + labels: |
| 82 | + name: postgresql |
| 83 | + spec: |
| 84 | + containers: |
| 85 | + - capabilities: {} |
| 86 | + env: |
| 87 | + - name: POSTGRESQL_USER |
| 88 | + valueFrom: |
| 89 | + secretKeyRef: |
| 90 | + key: database-user |
| 91 | + name: postgresql-credentials |
| 92 | + - name: POSTGRESQL_PASSWORD |
| 93 | + valueFrom: |
| 94 | + secretKeyRef: |
| 95 | + key: database-password |
| 96 | + name: postgresql-credentials |
| 97 | + - name: POSTGRESQL_DATABASE |
| 98 | + valueFrom: |
| 99 | + secretKeyRef: |
| 100 | + key: database-name |
| 101 | + name: postgresql-credentials |
| 102 | + image: " " |
| 103 | + imagePullPolicy: IfNotPresent |
| 104 | + livenessProbe: |
| 105 | + exec: |
| 106 | + command: |
| 107 | + - "/usr/libexec/check-container" |
| 108 | + - "--live" |
| 109 | + initialDelaySeconds: 120 |
| 110 | + timeoutSeconds: 10 |
| 111 | + name: postgresql |
| 112 | + ports: |
| 113 | + - containerPort: 5432 |
| 114 | + protocol: TCP |
| 115 | + readinessProbe: |
| 116 | + exec: |
| 117 | + command: |
| 118 | + - "/usr/libexec/check-container" |
| 119 | + initialDelaySeconds: 5 |
| 120 | + timeoutSeconds: 1 |
| 121 | + resources: |
| 122 | + limits: |
| 123 | + memory: 512Mi |
| 124 | + securityContext: |
| 125 | + capabilities: {} |
| 126 | + privileged: false |
| 127 | + terminationMessagePath: "/dev/termination-log" |
| 128 | + volumeMounts: |
| 129 | + - mountPath: "/var/lib/pgsql/data" |
| 130 | + name: "postgresql-data" |
| 131 | + dnsPolicy: ClusterFirst |
| 132 | + restartPolicy: Always |
| 133 | + volumes: |
| 134 | + - name: "postgresql-data" |
| 135 | + persistentVolumeClaim: |
| 136 | + claimName: postgresql |
| 137 | + triggers: |
| 138 | + - imageChangeParams: |
| 139 | + automatic: true |
| 140 | + containerNames: |
| 141 | + - postgresql |
| 142 | + from: |
| 143 | + kind: ImageStreamTag |
| 144 | + name: postgresql:${POSTGRESQL_VERSION} |
| 145 | + namespace: openshift |
| 146 | + lastTriggeredImage: '' |
| 147 | + type: ImageChange |
| 148 | + - type: ConfigChange |
| 149 | + status: {} |
| 150 | + |
| 151 | +- apiVersion: v1 |
| 152 | + kind: ImageStream |
| 153 | + metadata: |
| 154 | + name: chatapp-server |
| 155 | + spec: |
| 156 | + tags: |
| 157 | + - from: |
| 158 | + kind: DockerImage |
| 159 | + name: aerogear/chatapp-server |
| 160 | + name: latest |
| 161 | + importPolicy: |
| 162 | + scheduled: true |
| 163 | + |
| 164 | +- apiVersion: v1 |
| 165 | + kind: ImageStream |
| 166 | + metadata: |
| 167 | + name: chatapp-client |
| 168 | + spec: |
| 169 | + tags: |
| 170 | + - from: |
| 171 | + kind: DockerImage |
| 172 | + name: aerogear/chatapp-client |
| 173 | + name: latest |
| 174 | + importPolicy: |
| 175 | + scheduled: true |
| 176 | + |
| 177 | +- apiVersion: v1 |
| 178 | + kind: DeploymentConfig |
| 179 | + metadata: |
| 180 | + name: chatapp-server |
| 181 | + spec: |
| 182 | + replicas: 1 |
| 183 | + selector: |
| 184 | + deploymentconfig: chatapp-server |
| 185 | + strategy: |
| 186 | + resources: {} |
| 187 | + template: |
| 188 | + metadata: |
| 189 | + labels: |
| 190 | + deploymentconfig: chatapp-server |
| 191 | + spec: |
| 192 | + containers: |
| 193 | + - name: chatapp-server |
| 194 | + image: chatapp-server:latest |
| 195 | + imagePullPolicy: Always |
| 196 | + env: |
| 197 | + - name: DB_HOST |
| 198 | + value: postgresql |
| 199 | + - name: MQTT_HOST |
| 200 | + value: mosquitto-mqtt-broker |
| 201 | + - name: RESET_DB |
| 202 | + value: "true" |
| 203 | + ports: |
| 204 | + - containerPort: 4000 |
| 205 | + protocol: TCP |
| 206 | + triggers: |
| 207 | + - type: ConfigChange |
| 208 | + - imageChangeParams: |
| 209 | + automatic: true |
| 210 | + containerNames: |
| 211 | + - chatapp-server |
| 212 | + from: |
| 213 | + kind: ImageStreamTag |
| 214 | + name: chatapp-server:latest |
| 215 | + type: ImageChange |
| 216 | + |
| 217 | +- apiVersion: v1 |
| 218 | + kind: DeploymentConfig |
| 219 | + metadata: |
| 220 | + name: chatapp-client |
| 221 | + spec: |
| 222 | + replicas: 1 |
| 223 | + selector: |
| 224 | + deploymentconfig: chatapp-client |
| 225 | + strategy: |
| 226 | + resources: {} |
| 227 | + template: |
| 228 | + metadata: |
| 229 | + labels: |
| 230 | + deploymentconfig: chatapp-client |
| 231 | + spec: |
| 232 | + containers: |
| 233 | + - name: chatapp-client |
| 234 | + imagePullPolicy: Always |
| 235 | + image: chatapp-client:latest |
| 236 | + ports: |
| 237 | + - containerPort: 8080 |
| 238 | + protocol: TCP |
| 239 | + triggers: |
| 240 | + - type: ConfigChange |
| 241 | + - imageChangeParams: |
| 242 | + automatic: true |
| 243 | + containerNames: |
| 244 | + - chatapp-client |
| 245 | + from: |
| 246 | + kind: ImageStreamTag |
| 247 | + name: chatapp-client:latest |
| 248 | + type: ImageChange |
| 249 | + |
| 250 | +- apiVersion: v1 |
| 251 | + kind: Service |
| 252 | + metadata: |
| 253 | + name: chatapp-server |
| 254 | + spec: |
| 255 | + ports: |
| 256 | + - name: 4000-tcp |
| 257 | + port: 4000 |
| 258 | + protocol: TCP |
| 259 | + targetPort: 4000 |
| 260 | + selector: |
| 261 | + deploymentconfig: chatapp-server |
| 262 | + status: |
| 263 | + loadBalancer: {} |
| 264 | + |
| 265 | +- apiVersion: v1 |
| 266 | + kind: Service |
| 267 | + metadata: |
| 268 | + name: chatapp-client |
| 269 | + spec: |
| 270 | + ports: |
| 271 | + - name: 4000-tcp |
| 272 | + port: 4000 |
| 273 | + protocol: TCP |
| 274 | + targetPort: 8080 |
| 275 | + selector: |
| 276 | + deploymentconfig: chatapp-client |
| 277 | + status: |
| 278 | + loadBalancer: {} |
| 279 | + |
| 280 | +- apiVersion: v1 |
| 281 | + kind: Route |
| 282 | + metadata: |
| 283 | + labels: |
| 284 | + app: aerogear-chatapp |
| 285 | + name: chatapp-server |
| 286 | + spec: |
| 287 | + host: "" |
| 288 | + to: |
| 289 | + kind: Service |
| 290 | + name: chatapp-server |
| 291 | + tls: |
| 292 | + termination: edge |
| 293 | + insecureEdgeTerminationPolicy: Allow |
| 294 | + |
| 295 | +- apiVersion: v1 |
| 296 | + kind: Route |
| 297 | + metadata: |
| 298 | + labels: |
| 299 | + app: aerogear-chatapp |
| 300 | + name: chatapp-client |
| 301 | + spec: |
| 302 | + host: "" |
| 303 | + to: |
| 304 | + kind: Service |
| 305 | + name: chatapp-client |
| 306 | + tls: |
| 307 | + termination: edge |
| 308 | + insecureEdgeTerminationPolicy: Allow |
| 309 | + |
| 310 | +- kind: DeploymentConfig |
| 311 | + apiVersion: v1 |
| 312 | + name: mosquitto-mqtt-broker |
| 313 | + metadata: |
| 314 | + name: mosquitto-mqtt-broker |
| 315 | + spec: |
| 316 | + replicas: 1 |
| 317 | + selector: |
| 318 | + deploymentconfig: mosquitto-mqtt-broker |
| 319 | + strategy: |
| 320 | + resources: {} |
| 321 | + template: |
| 322 | + metadata: |
| 323 | + labels: |
| 324 | + deploymentconfig: mosquitto-mqtt-broker |
| 325 | + spec: |
| 326 | + containers: |
| 327 | + - name: mosquitto-mqtt-broker |
| 328 | + image: eclipse-mosquitto:latest |
| 329 | + ports: |
| 330 | + - containerPort: 1883 |
| 331 | + protocol: TCP |
| 332 | + strategy: |
| 333 | + type: Rolling |
| 334 | + revisionHistoryLimit: 2 |
| 335 | + minReadySeconds: 0 |
| 336 | + |
| 337 | +- apiVersion: v1 |
| 338 | + kind: Service |
| 339 | + metadata: |
| 340 | + name: mosquitto-mqtt-broker |
| 341 | + spec: |
| 342 | + ports: |
| 343 | + - name: 1883-tcp |
| 344 | + port: 1883 |
| 345 | + protocol: TCP |
| 346 | + targetPort: 1883 |
| 347 | + selector: |
| 348 | + deploymentconfig: mosquitto-mqtt-broker |
| 349 | + status: |
| 350 | + loadBalancer: {} |
| 351 | + |
| 352 | +parameters: |
| 353 | + |
| 354 | +- description: Username for PostgreSQL user that will be used for accessing the database. |
| 355 | + displayName: PostgreSQL Connection Username |
| 356 | + name: POSTGRESQL_USER |
| 357 | + value: testuser |
| 358 | + |
| 359 | +- description: Password for the PostgreSQL connection user. |
| 360 | + displayName: PostgreSQL Connection Password |
| 361 | + name: POSTGRESQL_PASSWORD |
| 362 | + value: testpassword |
| 363 | + |
| 364 | +- description: Name of the PostgreSQL database accessed. |
| 365 | + displayName: PostgreSQL Database Name |
| 366 | + name: POSTGRESQL_DATABASE |
| 367 | + value: whatsapp |
| 368 | + |
| 369 | +- description: Volume space available for data, e.g. 512Mi, 2Gi. |
| 370 | + displayName: Volume Capacity |
| 371 | + name: VOLUME_CAPACITY |
| 372 | + value: 1Gi |
| 373 | + |
| 374 | +- description: Version of PostgreSQL image to be used (10 or latest). |
| 375 | + displayName: Version of PostgreSQL Image |
| 376 | + name: POSTGRESQL_VERSION |
| 377 | + value: '10' |
0 commit comments