sso70-postgresql-persistent.json 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "description": "Application template for SSO 7.0 PostgreSQL applications with persistent storage",
  7. "iconClass" : "icon-jboss",
  8. "tags" : "sso,keycloak,postrgresql,java,database,jboss,xpaas",
  9. "version" : "1.3"
  10. },
  11. "name": "sso70-postgresql-persistent"
  12. },
  13. "labels": {
  14. "template": "sso70-postgresql-persistent",
  15. "xpaas" : "1.3.0"
  16. },
  17. "parameters": [
  18. {
  19. "description": "The name for the application.",
  20. "name": "APPLICATION_NAME",
  21. "value": "sso",
  22. "required": true
  23. },
  24. {
  25. "description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
  26. "name": "HOSTNAME_HTTP",
  27. "value": "",
  28. "required": false
  29. },
  30. {
  31. "description": "Custom hostname for https service route. Leave blank for default hostname, e.g.: <application-name>.<project>.<default-domain-suffix>",
  32. "name": "HOSTNAME_HTTPS",
  33. "value": "",
  34. "required": false
  35. },
  36. {
  37. "description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/postgresql",
  38. "name": "DB_JNDI",
  39. "value": "java:jboss/datasources/KeycloakDS",
  40. "required": false
  41. },
  42. {
  43. "description": "Database name",
  44. "name": "DB_DATABASE",
  45. "value": "root",
  46. "required": true
  47. },
  48. {
  49. "description": "The name of the secret containing the keystore file",
  50. "name": "HTTPS_SECRET",
  51. "value": "sso-app-secret",
  52. "required": false
  53. },
  54. {
  55. "description": "The name of the keystore file within the secret",
  56. "name": "HTTPS_KEYSTORE",
  57. "value": "keystore.jks",
  58. "required": false
  59. },
  60. {
  61. "description": "The name associated with the server certificate",
  62. "name": "HTTPS_NAME",
  63. "value": "jboss",
  64. "required": false
  65. },
  66. {
  67. "description": "The password for the keystore and certificate",
  68. "name": "HTTPS_PASSWORD",
  69. "value": "mykeystorepass",
  70. "required": false
  71. },
  72. {
  73. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  74. "name": "DB_MIN_POOL_SIZE",
  75. "required": false
  76. },
  77. {
  78. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  79. "name": "DB_MAX_POOL_SIZE",
  80. "required": false
  81. },
  82. {
  83. "description": "Sets transaction-isolation for the configured datasource.",
  84. "name": "DB_TX_ISOLATION",
  85. "required": false
  86. },
  87. {
  88. "description": "The maximum number of client connections allowed. This also sets the maximum number of prepared transactions.",
  89. "name": "POSTGRESQL_MAX_CONNECTIONS",
  90. "required": false
  91. },
  92. {
  93. "description": "Configures how much memory is dedicated to PostgreSQL for caching data.",
  94. "name": "POSTGRESQL_SHARED_BUFFERS",
  95. "required": false
  96. },
  97. {
  98. "description": "HornetQ cluster admin password",
  99. "name": "HORNETQ_CLUSTER_PASSWORD",
  100. "from": "[a-zA-Z0-9]{8}",
  101. "generate": "expression",
  102. "required": true
  103. },
  104. {
  105. "description": "Database user name",
  106. "name": "DB_USERNAME",
  107. "from": "user[a-zA-Z0-9]{3}",
  108. "generate": "expression",
  109. "required": true
  110. },
  111. {
  112. "description": "Database user password",
  113. "name": "DB_PASSWORD",
  114. "from": "[a-zA-Z0-9]{8}",
  115. "generate": "expression",
  116. "required": true
  117. },
  118. {
  119. "description": "Queue names",
  120. "name": "HORNETQ_QUEUES",
  121. "value": "",
  122. "required": false
  123. },
  124. {
  125. "description": "Topic names",
  126. "name": "HORNETQ_TOPICS",
  127. "value": "",
  128. "required": false
  129. },
  130. {
  131. "description": "Size of persistent storage for database volume.",
  132. "name": "VOLUME_CAPACITY",
  133. "value": "512Mi",
  134. "required": true
  135. },
  136. {
  137. "description": "The name of the secret containing the keystore file",
  138. "name": "JGROUPS_ENCRYPT_SECRET",
  139. "value": "eap-app-secret",
  140. "required": false
  141. },
  142. {
  143. "description": "The name of the keystore file within the secret",
  144. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  145. "value": "jgroups.jceks",
  146. "required": false
  147. },
  148. {
  149. "description": "The name associated with the server certificate",
  150. "name": "JGROUPS_ENCRYPT_NAME",
  151. "value": "",
  152. "required": false
  153. },
  154. {
  155. "description": "The password for the keystore and certificate",
  156. "name": "JGROUPS_ENCRYPT_PASSWORD",
  157. "value": "",
  158. "required": false
  159. },
  160. {
  161. "description": "JGroups cluster password",
  162. "name": "JGROUPS_CLUSTER_PASSWORD",
  163. "from": "[a-zA-Z0-9]{8}",
  164. "generate": "expression",
  165. "required": true
  166. },
  167. {
  168. "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.",
  169. "name": "IMAGE_STREAM_NAMESPACE",
  170. "value": "openshift",
  171. "required": true
  172. }
  173. ],
  174. "objects": [
  175. {
  176. "kind": "Service",
  177. "apiVersion": "v1",
  178. "spec": {
  179. "ports": [
  180. {
  181. "port": 8080,
  182. "targetPort": 8080
  183. }
  184. ],
  185. "selector": {
  186. "deploymentConfig": "${APPLICATION_NAME}"
  187. }
  188. },
  189. "metadata": {
  190. "name": "${APPLICATION_NAME}",
  191. "labels": {
  192. "application": "${APPLICATION_NAME}"
  193. },
  194. "annotations": {
  195. "description": "The web server's http port."
  196. }
  197. }
  198. },
  199. {
  200. "kind": "Service",
  201. "apiVersion": "v1",
  202. "spec": {
  203. "ports": [
  204. {
  205. "port": 8443,
  206. "targetPort": 8443
  207. }
  208. ],
  209. "selector": {
  210. "deploymentConfig": "${APPLICATION_NAME}"
  211. }
  212. },
  213. "metadata": {
  214. "name": "secure-${APPLICATION_NAME}",
  215. "labels": {
  216. "application": "${APPLICATION_NAME}"
  217. },
  218. "annotations": {
  219. "description": "The web server's https port."
  220. }
  221. }
  222. },
  223. {
  224. "kind": "Service",
  225. "apiVersion": "v1",
  226. "spec": {
  227. "ports": [
  228. {
  229. "port": 5432,
  230. "targetPort": 5432
  231. }
  232. ],
  233. "selector": {
  234. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  235. }
  236. },
  237. "metadata": {
  238. "name": "${APPLICATION_NAME}-postgresql",
  239. "labels": {
  240. "application": "${APPLICATION_NAME}"
  241. },
  242. "annotations": {
  243. "description": "The database server's port."
  244. }
  245. }
  246. },
  247. {
  248. "kind": "Route",
  249. "apiVersion": "v1",
  250. "id": "${APPLICATION_NAME}-http",
  251. "metadata": {
  252. "name": "${APPLICATION_NAME}",
  253. "labels": {
  254. "application": "${APPLICATION_NAME}"
  255. },
  256. "annotations": {
  257. "description": "Route for application's http service."
  258. }
  259. },
  260. "spec": {
  261. "host": "${HOSTNAME_HTTP}",
  262. "to": {
  263. "name": "${APPLICATION_NAME}"
  264. }
  265. }
  266. },
  267. {
  268. "kind": "Route",
  269. "apiVersion": "v1",
  270. "id": "${APPLICATION_NAME}-https",
  271. "metadata": {
  272. "name": "secure-${APPLICATION_NAME}",
  273. "labels": {
  274. "application": "${APPLICATION_NAME}"
  275. },
  276. "annotations": {
  277. "description": "Route for application's https service."
  278. }
  279. },
  280. "spec": {
  281. "host": "${HOSTNAME_HTTPS}",
  282. "to": {
  283. "name": "secure-${APPLICATION_NAME}"
  284. },
  285. "tls": {
  286. "termination": "passthrough"
  287. }
  288. }
  289. },
  290. {
  291. "kind": "DeploymentConfig",
  292. "apiVersion": "v1",
  293. "metadata": {
  294. "name": "${APPLICATION_NAME}",
  295. "labels": {
  296. "application": "${APPLICATION_NAME}"
  297. }
  298. },
  299. "spec": {
  300. "strategy": {
  301. "type": "Recreate"
  302. },
  303. "triggers": [
  304. {
  305. "type": "ImageChange",
  306. "imageChangeParams": {
  307. "automatic": true,
  308. "containerNames": [
  309. "${APPLICATION_NAME}"
  310. ],
  311. "from": {
  312. "kind": "ImageStreamTag",
  313. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  314. "name": "redhat-sso70-openshift:1.3-TP"
  315. }
  316. }
  317. },
  318. {
  319. "type": "ConfigChange"
  320. }
  321. ],
  322. "replicas": 1,
  323. "selector": {
  324. "deploymentConfig": "${APPLICATION_NAME}"
  325. },
  326. "template": {
  327. "metadata": {
  328. "name": "${APPLICATION_NAME}",
  329. "labels": {
  330. "deploymentConfig": "${APPLICATION_NAME}",
  331. "application": "${APPLICATION_NAME}"
  332. }
  333. },
  334. "spec": {
  335. "serviceAccountName": "sso-service-account",
  336. "terminationGracePeriodSeconds": 60,
  337. "containers": [
  338. {
  339. "name": "${APPLICATION_NAME}",
  340. "image": "${APPLICATION_NAME}",
  341. "imagePullPolicy": "Always",
  342. "volumeMounts": [
  343. {
  344. "name": "eap-keystore-volume",
  345. "mountPath": "/etc/eap-secret-volume",
  346. "readOnly": true
  347. },
  348. {
  349. "name": "eap-jgroups-keystore-volume",
  350. "mountPath": "/etc/jgroups-encrypt-secret-volume",
  351. "readOnly": true
  352. }
  353. ],
  354. "livenessProbe": {
  355. "exec": {
  356. "command": [
  357. "/bin/bash",
  358. "-c",
  359. "/opt/eap/bin/livenessProbe.sh"
  360. ]
  361. }
  362. },
  363. "readinessProbe": {
  364. "exec": {
  365. "command": [
  366. "/bin/bash",
  367. "-c",
  368. "/opt/eap/bin/readinessProbe.sh"
  369. ]
  370. }
  371. },
  372. "ports": [
  373. {
  374. "name": "jolokia",
  375. "containerPort": 8778,
  376. "protocol": "TCP"
  377. },
  378. {
  379. "name": "http",
  380. "containerPort": 8080,
  381. "protocol": "TCP"
  382. },
  383. {
  384. "name": "https",
  385. "containerPort": 8443,
  386. "protocol": "TCP"
  387. }
  388. ],
  389. "env": [
  390. {
  391. "name": "DB_SERVICE_PREFIX_MAPPING",
  392. "value": "${APPLICATION_NAME}-postgresql=DB"
  393. },
  394. {
  395. "name": "DB_JNDI",
  396. "value": "${DB_JNDI}"
  397. },
  398. {
  399. "name": "DB_USERNAME",
  400. "value": "${DB_USERNAME}"
  401. },
  402. {
  403. "name": "DB_PASSWORD",
  404. "value": "${DB_PASSWORD}"
  405. },
  406. {
  407. "name": "DB_DATABASE",
  408. "value": "${DB_DATABASE}"
  409. },
  410. {
  411. "name": "TX_DATABASE_PREFIX_MAPPING",
  412. "value": "${APPLICATION_NAME}-postgresql=DB"
  413. },
  414. {
  415. "name": "DB_MIN_POOL_SIZE",
  416. "value": "${DB_MIN_POOL_SIZE}"
  417. },
  418. {
  419. "name": "DB_MAX_POOL_SIZE",
  420. "value": "${DB_MAX_POOL_SIZE}"
  421. },
  422. {
  423. "name": "DB_TX_ISOLATION",
  424. "value": "${DB_TX_ISOLATION}"
  425. },
  426. {
  427. "name": "OPENSHIFT_KUBE_PING_LABELS",
  428. "value": "application=${APPLICATION_NAME}"
  429. },
  430. {
  431. "name": "OPENSHIFT_KUBE_PING_NAMESPACE",
  432. "valueFrom": {
  433. "fieldRef": {
  434. "fieldPath": "metadata.namespace"
  435. }
  436. }
  437. },
  438. {
  439. "name": "EAP_HTTPS_KEYSTORE_DIR",
  440. "value": "/etc/eap-secret-volume"
  441. },
  442. {
  443. "name": "EAP_HTTPS_KEYSTORE",
  444. "value": "${HTTPS_KEYSTORE}"
  445. },
  446. {
  447. "name": "EAP_HTTPS_NAME",
  448. "value": "${HTTPS_NAME}"
  449. },
  450. {
  451. "name": "EAP_HTTPS_PASSWORD",
  452. "value": "${HTTPS_PASSWORD}"
  453. },
  454. {
  455. "name": "HORNETQ_CLUSTER_PASSWORD",
  456. "value": "${HORNETQ_CLUSTER_PASSWORD}"
  457. },
  458. {
  459. "name": "HORNETQ_QUEUES",
  460. "value": "${HORNETQ_QUEUES}"
  461. },
  462. {
  463. "name": "HORNETQ_TOPICS",
  464. "value": "${HORNETQ_TOPICS}"
  465. },
  466. {
  467. "name": "JGROUPS_ENCRYPT_SECRET",
  468. "value": "${JGROUPS_ENCRYPT_SECRET}"
  469. },
  470. {
  471. "name": "JGROUPS_ENCRYPT_KEYSTORE_DIR",
  472. "value": "/etc/jgroups-encrypt-secret-volume"
  473. },
  474. {
  475. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  476. "value": "${JGROUPS_ENCRYPT_KEYSTORE}"
  477. },
  478. {
  479. "name": "JGROUPS_ENCRYPT_NAME",
  480. "value": "${JGROUPS_ENCRYPT_NAME}"
  481. },
  482. {
  483. "name": "JGROUPS_ENCRYPT_PASSWORD",
  484. "value": "${JGROUPS_ENCRYPT_PASSWORD}"
  485. },
  486. {
  487. "name": "JGROUPS_CLUSTER_PASSWORD",
  488. "value": "${JGROUPS_CLUSTER_PASSWORD}"
  489. }
  490. ]
  491. }
  492. ],
  493. "volumes": [
  494. {
  495. "name": "eap-keystore-volume",
  496. "secret": {
  497. "secretName": "${HTTPS_SECRET}"
  498. }
  499. },
  500. {
  501. "name": "eap-jgroups-keystore-volume",
  502. "secret": {
  503. "secretName": "${JGROUPS_ENCRYPT_SECRET}"
  504. }
  505. }
  506. ]
  507. }
  508. }
  509. }
  510. },
  511. {
  512. "kind": "DeploymentConfig",
  513. "apiVersion": "v1",
  514. "metadata": {
  515. "name": "${APPLICATION_NAME}-postgresql",
  516. "labels": {
  517. "application": "${APPLICATION_NAME}"
  518. }
  519. },
  520. "spec": {
  521. "strategy": {
  522. "type": "Recreate"
  523. },
  524. "triggers": [
  525. {
  526. "type": "ImageChange",
  527. "imageChangeParams": {
  528. "automatic": true,
  529. "containerNames": [
  530. "${APPLICATION_NAME}-postgresql"
  531. ],
  532. "from": {
  533. "kind": "ImageStreamTag",
  534. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  535. "name": "postgresql:latest"
  536. }
  537. }
  538. },
  539. {
  540. "type": "ConfigChange"
  541. }
  542. ],
  543. "replicas": 1,
  544. "selector": {
  545. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  546. },
  547. "template": {
  548. "metadata": {
  549. "name": "${APPLICATION_NAME}-postgresql",
  550. "labels": {
  551. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  552. "application": "${APPLICATION_NAME}"
  553. }
  554. },
  555. "spec": {
  556. "terminationGracePeriodSeconds": 60,
  557. "containers": [
  558. {
  559. "name": "${APPLICATION_NAME}-postgresql",
  560. "image": "postgresql",
  561. "imagePullPolicy": "Always",
  562. "ports": [
  563. {
  564. "containerPort": 5432,
  565. "protocol": "TCP"
  566. }
  567. ],
  568. "volumeMounts": [
  569. {
  570. "mountPath": "/var/lib/pgsql/data",
  571. "name": "${APPLICATION_NAME}-postgresql-pvol"
  572. }
  573. ],
  574. "env": [
  575. {
  576. "name": "POSTGRESQL_USER",
  577. "value": "${DB_USERNAME}"
  578. },
  579. {
  580. "name": "POSTGRESQL_PASSWORD",
  581. "value": "${DB_PASSWORD}"
  582. },
  583. {
  584. "name": "POSTGRESQL_DATABASE",
  585. "value": "${DB_DATABASE}"
  586. },
  587. {
  588. "name": "POSTGRESQL_MAX_CONNECTIONS",
  589. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  590. },
  591. {
  592. "name": "POSTGRESQL_SHARED_BUFFERS",
  593. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  594. }
  595. ]
  596. }
  597. ],
  598. "volumes": [
  599. {
  600. "name": "${APPLICATION_NAME}-postgresql-pvol",
  601. "persistentVolumeClaim": {
  602. "claimName": "${APPLICATION_NAME}-postgresql-claim"
  603. }
  604. }
  605. ]
  606. }
  607. }
  608. }
  609. },
  610. {
  611. "apiVersion": "v1",
  612. "kind": "PersistentVolumeClaim",
  613. "metadata": {
  614. "name": "${APPLICATION_NAME}-postgresql-claim",
  615. "labels": {
  616. "application": "${APPLICATION_NAME}"
  617. }
  618. },
  619. "spec": {
  620. "accessModes": [
  621. "ReadWriteOnce"
  622. ],
  623. "resources": {
  624. "requests": {
  625. "storage": "${VOLUME_CAPACITY}"
  626. }
  627. }
  628. }
  629. }
  630. ]
  631. }