sso70-postgresql.json 28 KB

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