sso71-postgresql-persistent.json 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass" : "icon-sso",
  7. "tags" : "sso,keycloak,jboss",
  8. "version": "1.4.7",
  9. "openshift.io/display-name": "Single Sign-On 7.1 + PostgreSQL",
  10. "openshift.io/provider-display-name": "Red Hat, Inc.",
  11. "description": "An example SSO 7 application with a PostgreSQL database. For more information about using this template, see https://github.com/jboss-openshift/application-templates.",
  12. "template.openshift.io/long-description": "This template defines resources needed to develop Red Hat Single Sign-On 7.1 server based deployment and deployment configuration for PostgreSQL using persistence.",
  13. "template.openshift.io/documentation-url": "https://access.redhat.com/documentation/en/red-hat-single-sign-on/",
  14. "template.openshift.io/support-url": "https://access.redhat.com"
  15. },
  16. "name": "sso71-postgresql-persistent"
  17. },
  18. "labels": {
  19. "template": "sso71-postgresql-persistent",
  20. "xpaas": "1.4.7"
  21. },
  22. "message": "A new persistent SSO service (using PostgreSQL) has been created in your project. The admin username/password for accessing the master realm via the SSO console is ${SSO_ADMIN_USERNAME}/${SSO_ADMIN_PASSWORD}. The username/password for accessing the PostgreSQL database \"${DB_DATABASE}\" is ${DB_USERNAME}/${DB_PASSWORD}. Please be sure to create the \"${SERVICE_ACCOUNT_NAME}\" service account and the following secrets: \"${HTTPS_SECRET}\" containing the ${HTTPS_KEYSTORE} file used for serving secure content; \"${JGROUPS_ENCRYPT_SECRET}\" containing the ${JGROUPS_ENCRYPT_KEYSTORE} file used for securing JGroups communications; \"${SSO_TRUSTSTORE_SECRET}\" containing the ${SSO_TRUSTSTORE} file used for securing SSO requests.",
  23. "parameters": [
  24. {
  25. "displayName": "Application Name",
  26. "description": "The name for the application.",
  27. "name": "APPLICATION_NAME",
  28. "value": "sso",
  29. "required": true
  30. },
  31. {
  32. "displayName": "Custom http Route Hostname",
  33. "description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
  34. "name": "HOSTNAME_HTTP",
  35. "value": "",
  36. "required": false
  37. },
  38. {
  39. "displayName": "Custom https Route Hostname",
  40. "description": "Custom hostname for https service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
  41. "name": "HOSTNAME_HTTPS",
  42. "value": "",
  43. "required": false
  44. },
  45. {
  46. "displayName": "Database JNDI Name",
  47. "description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/postgresql",
  48. "name": "DB_JNDI",
  49. "value": "java:jboss/datasources/KeycloakDS",
  50. "required": false
  51. },
  52. {
  53. "displayName": "Database Name",
  54. "description": "Database name",
  55. "name": "DB_DATABASE",
  56. "value": "root",
  57. "required": true
  58. },
  59. {
  60. "displayName": "Service Account Name",
  61. "description": "The name of the service account to use for the deployment. The service account should be configured to allow useage of the secret(s) specified by HTTPS_SECRET and JGROUPS_ENCRYPT_SECRET.",
  62. "name": "SERVICE_ACCOUNT_NAME",
  63. "value": "sso-service-account",
  64. "required": true
  65. },
  66. {
  67. "displayName": "Server Keystore Secret Name",
  68. "description": "The name of the secret containing the keystore file",
  69. "name": "HTTPS_SECRET",
  70. "value": "sso-app-secret",
  71. "required": false
  72. },
  73. {
  74. "displayName": "Server Keystore Filename",
  75. "description": "The name of the keystore file within the secret",
  76. "name": "HTTPS_KEYSTORE",
  77. "value": "keystore.jks",
  78. "required": false
  79. },
  80. {
  81. "displayName": "Server Keystore Type",
  82. "description": "The type of the keystore file (JKS or JCEKS)",
  83. "name": "HTTPS_KEYSTORE_TYPE",
  84. "value": "",
  85. "required": false
  86. },
  87. {
  88. "displayName": "Server Certificate Name",
  89. "description": "The name associated with the server certificate (e.g. jboss)",
  90. "name": "HTTPS_NAME",
  91. "value": "",
  92. "required": false
  93. },
  94. {
  95. "displayName": "Server Keystore Password",
  96. "description": "The password for the keystore and certificate (e.g. mykeystorepass)",
  97. "name": "HTTPS_PASSWORD",
  98. "value": "",
  99. "required": false
  100. },
  101. {
  102. "displayName": "Datasource Minimum Pool Size",
  103. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  104. "name": "DB_MIN_POOL_SIZE",
  105. "required": false
  106. },
  107. {
  108. "displayName": "Datasource Maximum Pool Size",
  109. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  110. "name": "DB_MAX_POOL_SIZE",
  111. "required": false
  112. },
  113. {
  114. "displayName": "Datasource Transaction Isolation",
  115. "description": "Sets transaction-isolation for the configured datasource.",
  116. "name": "DB_TX_ISOLATION",
  117. "required": false
  118. },
  119. {
  120. "displayName": "PostgreSQL Maximum number of connections",
  121. "description": "The maximum number of client connections allowed. This also sets the maximum number of prepared transactions.",
  122. "name": "POSTGRESQL_MAX_CONNECTIONS",
  123. "required": false
  124. },
  125. {
  126. "displayName": "PostgreSQL Shared Buffers",
  127. "description": "Configures how much memory is dedicated to PostgreSQL for caching data.",
  128. "name": "POSTGRESQL_SHARED_BUFFERS",
  129. "required": false
  130. },
  131. {
  132. "displayName": "Database Username",
  133. "description": "Database user name",
  134. "name": "DB_USERNAME",
  135. "from": "user[a-zA-Z0-9]{3}",
  136. "generate": "expression",
  137. "required": true
  138. },
  139. {
  140. "displayName": "Database Password",
  141. "description": "Database user password",
  142. "name": "DB_PASSWORD",
  143. "from": "[a-zA-Z0-9]{8}",
  144. "generate": "expression",
  145. "required": true
  146. },
  147. {
  148. "displayName": "Database Volume Capacity",
  149. "description": "Size of persistent storage for database volume.",
  150. "name": "VOLUME_CAPACITY",
  151. "value": "512Mi",
  152. "required": true
  153. },
  154. {
  155. "displayName": "JGroups Secret Name",
  156. "description": "The name of the secret containing the keystore file",
  157. "name": "JGROUPS_ENCRYPT_SECRET",
  158. "value": "sso-app-secret",
  159. "required": false
  160. },
  161. {
  162. "displayName": "JGroups Keystore Filename",
  163. "description": "The name of the keystore file within the secret",
  164. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  165. "value": "jgroups.jceks",
  166. "required": false
  167. },
  168. {
  169. "displayName": "JGroups Certificate Name",
  170. "description": "The name associated with the server certificate (e.g. secret-key)",
  171. "name": "JGROUPS_ENCRYPT_NAME",
  172. "value": "",
  173. "required": false
  174. },
  175. {
  176. "displayName": "JGroups Keystore Password",
  177. "description": "The password for the keystore and certificate (e.g. password)",
  178. "name": "JGROUPS_ENCRYPT_PASSWORD",
  179. "value": "",
  180. "required": false
  181. },
  182. {
  183. "displayName": "JGroups Cluster Password",
  184. "description": "JGroups cluster password",
  185. "name": "JGROUPS_CLUSTER_PASSWORD",
  186. "from": "[a-zA-Z0-9]{8}",
  187. "generate": "expression",
  188. "required": true
  189. },
  190. {
  191. "displayName": "ImageStream Namespace",
  192. "description": "Namespace in which the ImageStreams for Red Hat Middleware images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.",
  193. "name": "IMAGE_STREAM_NAMESPACE",
  194. "value": "openshift",
  195. "required": true
  196. },
  197. {
  198. "displayName": "SSO Admin Username",
  199. "description": "SSO Server admin username",
  200. "name": "SSO_ADMIN_USERNAME",
  201. "from": "[a-zA-Z0-9]{8}",
  202. "generate": "expression",
  203. "required": true
  204. },
  205. {
  206. "displayName": "SSO Admin Password",
  207. "description": "SSO Server admin password",
  208. "name": "SSO_ADMIN_PASSWORD",
  209. "from": "[a-zA-Z0-9]{8}",
  210. "generate": "expression",
  211. "required": true
  212. },
  213. {
  214. "displayName": "SSO Realm",
  215. "description": "Realm to be created in the SSO server (e.g. demo).",
  216. "name": "SSO_REALM",
  217. "value": "",
  218. "required": false
  219. },
  220. {
  221. "displayName": "SSO Service Username",
  222. "description": "The username used to access the SSO service. This is used by clients to create the appliction client(s) within the specified SSO realm.",
  223. "name": "SSO_SERVICE_USERNAME",
  224. "value": "",
  225. "required": false
  226. },
  227. {
  228. "displayName": "SSO Service Password",
  229. "description": "The password for the SSO service user.",
  230. "name": "SSO_SERVICE_PASSWORD",
  231. "value": "",
  232. "required": false
  233. },
  234. {
  235. "displayName": "SSO Trust Store",
  236. "description": "The name of the truststore file within the secret (e.g. truststore.jks)",
  237. "name": "SSO_TRUSTSTORE",
  238. "value": "",
  239. "required": false
  240. },
  241. {
  242. "displayName": "SSO Trust Store Password",
  243. "description": "The password for the truststore and certificate (e.g. mykeystorepass)",
  244. "name": "SSO_TRUSTSTORE_PASSWORD",
  245. "value": "",
  246. "required": false
  247. },
  248. {
  249. "displayName": "SSO Trust Store Secret",
  250. "description": "The name of the secret containing the truststore file (e.g. truststore-secret). Used for volume secretName",
  251. "name": "SSO_TRUSTSTORE_SECRET",
  252. "value": "sso-app-secret",
  253. "required": false
  254. },
  255. {
  256. "displayName": "PostgreSQL Image Stream Tag",
  257. "description": "The tag to use for the \"postgresql\" image stream. Typically, this aligns with the major.minor version of PostgreSQL.",
  258. "name": "POSTGRESQL_IMAGE_STREAM_TAG",
  259. "value": "9.5",
  260. "required": true
  261. }
  262. ],
  263. "objects": [
  264. {
  265. "kind": "Service",
  266. "apiVersion": "v1",
  267. "spec": {
  268. "ports": [
  269. {
  270. "port": 8080,
  271. "targetPort": 8080
  272. }
  273. ],
  274. "selector": {
  275. "deploymentConfig": "${APPLICATION_NAME}"
  276. }
  277. },
  278. "metadata": {
  279. "name": "${APPLICATION_NAME}",
  280. "labels": {
  281. "application": "${APPLICATION_NAME}"
  282. },
  283. "annotations": {
  284. "description": "The web server's http port.",
  285. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  286. }
  287. }
  288. },
  289. {
  290. "kind": "Service",
  291. "apiVersion": "v1",
  292. "spec": {
  293. "ports": [
  294. {
  295. "port": 8443,
  296. "targetPort": 8443
  297. }
  298. ],
  299. "selector": {
  300. "deploymentConfig": "${APPLICATION_NAME}"
  301. }
  302. },
  303. "metadata": {
  304. "name": "secure-${APPLICATION_NAME}",
  305. "labels": {
  306. "application": "${APPLICATION_NAME}"
  307. },
  308. "annotations": {
  309. "description": "The web server's https port.",
  310. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  311. }
  312. }
  313. },
  314. {
  315. "kind": "Service",
  316. "apiVersion": "v1",
  317. "spec": {
  318. "ports": [
  319. {
  320. "port": 5432,
  321. "targetPort": 5432
  322. }
  323. ],
  324. "selector": {
  325. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  326. }
  327. },
  328. "metadata": {
  329. "name": "${APPLICATION_NAME}-postgresql",
  330. "labels": {
  331. "application": "${APPLICATION_NAME}"
  332. },
  333. "annotations": {
  334. "description": "The database server's port."
  335. }
  336. }
  337. },
  338. {
  339. "kind": "Route",
  340. "apiVersion": "v1",
  341. "id": "${APPLICATION_NAME}-http",
  342. "metadata": {
  343. "name": "${APPLICATION_NAME}",
  344. "labels": {
  345. "application": "${APPLICATION_NAME}"
  346. },
  347. "annotations": {
  348. "description": "Route for application's http service."
  349. }
  350. },
  351. "spec": {
  352. "host": "${HOSTNAME_HTTP}",
  353. "to": {
  354. "name": "${APPLICATION_NAME}"
  355. }
  356. }
  357. },
  358. {
  359. "kind": "Route",
  360. "apiVersion": "v1",
  361. "id": "${APPLICATION_NAME}-https",
  362. "metadata": {
  363. "name": "secure-${APPLICATION_NAME}",
  364. "labels": {
  365. "application": "${APPLICATION_NAME}"
  366. },
  367. "annotations": {
  368. "description": "Route for application's https service."
  369. }
  370. },
  371. "spec": {
  372. "host": "${HOSTNAME_HTTPS}",
  373. "to": {
  374. "name": "secure-${APPLICATION_NAME}"
  375. },
  376. "tls": {
  377. "termination": "passthrough"
  378. }
  379. }
  380. },
  381. {
  382. "kind": "DeploymentConfig",
  383. "apiVersion": "v1",
  384. "metadata": {
  385. "name": "${APPLICATION_NAME}",
  386. "labels": {
  387. "application": "${APPLICATION_NAME}"
  388. }
  389. },
  390. "spec": {
  391. "strategy": {
  392. "type": "Recreate"
  393. },
  394. "triggers": [
  395. {
  396. "type": "ImageChange",
  397. "imageChangeParams": {
  398. "automatic": true,
  399. "containerNames": [
  400. "${APPLICATION_NAME}"
  401. ],
  402. "from": {
  403. "kind": "ImageStreamTag",
  404. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  405. "name": "redhat-sso71-openshift:1.2"
  406. }
  407. }
  408. },
  409. {
  410. "type": "ConfigChange"
  411. }
  412. ],
  413. "replicas": 1,
  414. "selector": {
  415. "deploymentConfig": "${APPLICATION_NAME}"
  416. },
  417. "template": {
  418. "metadata": {
  419. "name": "${APPLICATION_NAME}",
  420. "labels": {
  421. "deploymentConfig": "${APPLICATION_NAME}",
  422. "application": "${APPLICATION_NAME}"
  423. }
  424. },
  425. "spec": {
  426. "serviceAccountName": "${SERVICE_ACCOUNT_NAME}",
  427. "terminationGracePeriodSeconds": 75,
  428. "containers": [
  429. {
  430. "name": "${APPLICATION_NAME}",
  431. "image": "${APPLICATION_NAME}",
  432. "imagePullPolicy": "Always",
  433. "volumeMounts": [
  434. {
  435. "name": "eap-keystore-volume",
  436. "mountPath": "/etc/eap-secret-volume",
  437. "readOnly": true
  438. },
  439. {
  440. "name": "eap-jgroups-keystore-volume",
  441. "mountPath": "/etc/jgroups-encrypt-secret-volume",
  442. "readOnly": true
  443. },
  444. {
  445. "name": "sso-truststore-volume",
  446. "mountPath": "/etc/sso-secret-volume",
  447. "readOnly": true
  448. }
  449. ],
  450. "lifecycle": {
  451. "preStop": {
  452. "exec": {
  453. "command": [
  454. "/opt/eap/bin/jboss-cli.sh",
  455. "-c",
  456. ":shutdown(timeout=60)"
  457. ]
  458. }
  459. }
  460. },
  461. "livenessProbe": {
  462. "exec": {
  463. "command": [
  464. "/bin/bash",
  465. "-c",
  466. "/opt/eap/bin/livenessProbe.sh"
  467. ]
  468. },
  469. "initialDelaySeconds": 10
  470. },
  471. "readinessProbe": {
  472. "exec": {
  473. "command": [
  474. "/bin/bash",
  475. "-c",
  476. "/opt/eap/bin/readinessProbe.sh"
  477. ]
  478. }
  479. },
  480. "ports": [
  481. {
  482. "name": "jolokia",
  483. "containerPort": 8778,
  484. "protocol": "TCP"
  485. },
  486. {
  487. "name": "http",
  488. "containerPort": 8080,
  489. "protocol": "TCP"
  490. },
  491. {
  492. "name": "https",
  493. "containerPort": 8443,
  494. "protocol": "TCP"
  495. },
  496. {
  497. "name": "ping",
  498. "containerPort": 8888,
  499. "protocol": "TCP"
  500. }
  501. ],
  502. "env": [
  503. {
  504. "name": "DB_SERVICE_PREFIX_MAPPING",
  505. "value": "${APPLICATION_NAME}-postgresql=DB"
  506. },
  507. {
  508. "name": "DB_JNDI",
  509. "value": "${DB_JNDI}"
  510. },
  511. {
  512. "name": "DB_USERNAME",
  513. "value": "${DB_USERNAME}"
  514. },
  515. {
  516. "name": "DB_PASSWORD",
  517. "value": "${DB_PASSWORD}"
  518. },
  519. {
  520. "name": "DB_DATABASE",
  521. "value": "${DB_DATABASE}"
  522. },
  523. {
  524. "name": "TX_DATABASE_PREFIX_MAPPING",
  525. "value": "${APPLICATION_NAME}-postgresql=DB"
  526. },
  527. {
  528. "name": "DB_MIN_POOL_SIZE",
  529. "value": "${DB_MIN_POOL_SIZE}"
  530. },
  531. {
  532. "name": "DB_MAX_POOL_SIZE",
  533. "value": "${DB_MAX_POOL_SIZE}"
  534. },
  535. {
  536. "name": "DB_TX_ISOLATION",
  537. "value": "${DB_TX_ISOLATION}"
  538. },
  539. {
  540. "name": "OPENSHIFT_KUBE_PING_LABELS",
  541. "value": "application=${APPLICATION_NAME}"
  542. },
  543. {
  544. "name": "OPENSHIFT_KUBE_PING_NAMESPACE",
  545. "valueFrom": {
  546. "fieldRef": {
  547. "fieldPath": "metadata.namespace"
  548. }
  549. }
  550. },
  551. {
  552. "name": "HTTPS_KEYSTORE_DIR",
  553. "value": "/etc/eap-secret-volume"
  554. },
  555. {
  556. "name": "HTTPS_KEYSTORE",
  557. "value": "${HTTPS_KEYSTORE}"
  558. },
  559. {
  560. "name": "HTTPS_KEYSTORE_TYPE",
  561. "value": "${HTTPS_KEYSTORE_TYPE}"
  562. },
  563. {
  564. "name": "HTTPS_NAME",
  565. "value": "${HTTPS_NAME}"
  566. },
  567. {
  568. "name": "HTTPS_PASSWORD",
  569. "value": "${HTTPS_PASSWORD}"
  570. },
  571. {
  572. "name": "JGROUPS_ENCRYPT_SECRET",
  573. "value": "${JGROUPS_ENCRYPT_SECRET}"
  574. },
  575. {
  576. "name": "JGROUPS_ENCRYPT_KEYSTORE_DIR",
  577. "value": "/etc/jgroups-encrypt-secret-volume"
  578. },
  579. {
  580. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  581. "value": "${JGROUPS_ENCRYPT_KEYSTORE}"
  582. },
  583. {
  584. "name": "JGROUPS_ENCRYPT_NAME",
  585. "value": "${JGROUPS_ENCRYPT_NAME}"
  586. },
  587. {
  588. "name": "JGROUPS_ENCRYPT_PASSWORD",
  589. "value": "${JGROUPS_ENCRYPT_PASSWORD}"
  590. },
  591. {
  592. "name": "JGROUPS_CLUSTER_PASSWORD",
  593. "value": "${JGROUPS_CLUSTER_PASSWORD}"
  594. },
  595. {
  596. "name": "SSO_ADMIN_USERNAME",
  597. "value": "${SSO_ADMIN_USERNAME}"
  598. },
  599. {
  600. "name": "SSO_ADMIN_PASSWORD",
  601. "value": "${SSO_ADMIN_PASSWORD}"
  602. },
  603. {
  604. "name": "SSO_REALM",
  605. "value": "${SSO_REALM}"
  606. },
  607. {
  608. "name": "SSO_SERVICE_USERNAME",
  609. "value": "${SSO_SERVICE_USERNAME}"
  610. },
  611. {
  612. "name": "SSO_SERVICE_PASSWORD",
  613. "value": "${SSO_SERVICE_PASSWORD}"
  614. },
  615. {
  616. "name": "SSO_TRUSTSTORE",
  617. "value": "${SSO_TRUSTSTORE}"
  618. },
  619. {
  620. "name": "SSO_TRUSTSTORE_DIR",
  621. "value": "/etc/sso-secret-volume"
  622. },
  623. {
  624. "name": "SSO_TRUSTSTORE_PASSWORD",
  625. "value": "${SSO_TRUSTSTORE_PASSWORD}"
  626. }
  627. ]
  628. }
  629. ],
  630. "volumes": [
  631. {
  632. "name": "eap-keystore-volume",
  633. "secret": {
  634. "secretName": "${HTTPS_SECRET}"
  635. }
  636. },
  637. {
  638. "name": "eap-jgroups-keystore-volume",
  639. "secret": {
  640. "secretName": "${JGROUPS_ENCRYPT_SECRET}"
  641. }
  642. },
  643. {
  644. "name": "sso-truststore-volume",
  645. "secret": {
  646. "secretName": "${SSO_TRUSTSTORE_SECRET}"
  647. }
  648. }
  649. ]
  650. }
  651. }
  652. }
  653. },
  654. {
  655. "kind": "DeploymentConfig",
  656. "apiVersion": "v1",
  657. "metadata": {
  658. "name": "${APPLICATION_NAME}-postgresql",
  659. "labels": {
  660. "application": "${APPLICATION_NAME}"
  661. }
  662. },
  663. "spec": {
  664. "strategy": {
  665. "type": "Recreate"
  666. },
  667. "triggers": [
  668. {
  669. "type": "ImageChange",
  670. "imageChangeParams": {
  671. "automatic": true,
  672. "containerNames": [
  673. "${APPLICATION_NAME}-postgresql"
  674. ],
  675. "from": {
  676. "kind": "ImageStreamTag",
  677. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  678. "name": "postgresql:${POSTGRESQL_IMAGE_STREAM_TAG}"
  679. }
  680. }
  681. },
  682. {
  683. "type": "ConfigChange"
  684. }
  685. ],
  686. "replicas": 1,
  687. "selector": {
  688. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  689. },
  690. "template": {
  691. "metadata": {
  692. "name": "${APPLICATION_NAME}-postgresql",
  693. "labels": {
  694. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  695. "application": "${APPLICATION_NAME}"
  696. }
  697. },
  698. "spec": {
  699. "terminationGracePeriodSeconds": 60,
  700. "containers": [
  701. {
  702. "name": "${APPLICATION_NAME}-postgresql",
  703. "image": "postgresql",
  704. "imagePullPolicy": "Always",
  705. "ports": [
  706. {
  707. "containerPort": 5432,
  708. "protocol": "TCP"
  709. }
  710. ],
  711. "volumeMounts": [
  712. {
  713. "mountPath": "/var/lib/pgsql/data",
  714. "name": "${APPLICATION_NAME}-postgresql-pvol"
  715. }
  716. ],
  717. "env": [
  718. {
  719. "name": "POSTGRESQL_USER",
  720. "value": "${DB_USERNAME}"
  721. },
  722. {
  723. "name": "POSTGRESQL_PASSWORD",
  724. "value": "${DB_PASSWORD}"
  725. },
  726. {
  727. "name": "POSTGRESQL_DATABASE",
  728. "value": "${DB_DATABASE}"
  729. },
  730. {
  731. "name": "POSTGRESQL_MAX_CONNECTIONS",
  732. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  733. },
  734. {
  735. "name": "POSTGRESQL_MAX_PREPARED_TRANSACTIONS",
  736. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  737. },
  738. {
  739. "name": "POSTGRESQL_SHARED_BUFFERS",
  740. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  741. }
  742. ]
  743. }
  744. ],
  745. "volumes": [
  746. {
  747. "name": "${APPLICATION_NAME}-postgresql-pvol",
  748. "persistentVolumeClaim": {
  749. "claimName": "${APPLICATION_NAME}-postgresql-claim"
  750. }
  751. }
  752. ]
  753. }
  754. }
  755. }
  756. },
  757. {
  758. "apiVersion": "v1",
  759. "kind": "PersistentVolumeClaim",
  760. "metadata": {
  761. "name": "${APPLICATION_NAME}-postgresql-claim",
  762. "labels": {
  763. "application": "${APPLICATION_NAME}"
  764. }
  765. },
  766. "spec": {
  767. "accessModes": [
  768. "ReadWriteOnce"
  769. ],
  770. "resources": {
  771. "requests": {
  772. "storage": "${VOLUME_CAPACITY}"
  773. }
  774. }
  775. }
  776. }
  777. ]
  778. }