sso72-x509-postgresql-persistent.json 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass" : "icon-sso",
  7. "tags" : "sso,keycloak,jboss",
  8. "version": "1.4.14",
  9. "openshift.io/display-name": "Red Hat Single Sign-On 7.2 + PostgreSQL (Persistent)",
  10. "openshift.io/provider-display-name": "Red Hat, Inc.",
  11. "description": "An example RH-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.2 server based deployment, deployment configuration for PostgreSQL using persistence, and securing RH-SSO communication using re-encrypt TLS.",
  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": "sso72-x509-postgresql-persistent"
  17. },
  18. "labels": {
  19. "template": "sso72-x509-postgresql-persistent",
  20. "xpaas": "1.4.14"
  21. },
  22. "message": "A new persistent RH-SSO service (using PostgreSQL) has been created in your project. The admin username/password for accessing the master realm via the RH-SSO console is ${SSO_ADMIN_USERNAME}/${SSO_ADMIN_PASSWORD}. The username/password for accessing the PostgreSQL database \"${DB_DATABASE}\" is ${DB_USERNAME}/${DB_PASSWORD}. The HTTPS keystore used for serving secure content, the JGroups keystore used for securing JGroups communications, and server truststore used for securing RH-SSO requests were automatically created via OpenShift's service serving x509 certificate secrets.",
  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": "JGroups Cluster Password",
  33. "description": "The password for the JGroups cluster.",
  34. "name": "JGROUPS_CLUSTER_PASSWORD",
  35. "from": "[a-zA-Z0-9]{32}",
  36. "generate": "expression",
  37. "required": true
  38. },
  39. {
  40. "displayName": "Database JNDI Name",
  41. "description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/postgresql",
  42. "name": "DB_JNDI",
  43. "value": "java:jboss/datasources/KeycloakDS",
  44. "required": false
  45. },
  46. {
  47. "displayName": "Database Name",
  48. "description": "Database name",
  49. "name": "DB_DATABASE",
  50. "value": "root",
  51. "required": true
  52. },
  53. {
  54. "displayName": "Datasource Minimum Pool Size",
  55. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  56. "name": "DB_MIN_POOL_SIZE",
  57. "required": false
  58. },
  59. {
  60. "displayName": "Datasource Maximum Pool Size",
  61. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  62. "name": "DB_MAX_POOL_SIZE",
  63. "required": false
  64. },
  65. {
  66. "displayName": "Datasource Transaction Isolation",
  67. "description": "Sets transaction-isolation for the configured datasource.",
  68. "name": "DB_TX_ISOLATION",
  69. "required": false
  70. },
  71. {
  72. "displayName": "PostgreSQL Maximum number of connections",
  73. "description": "The maximum number of client connections allowed. This also sets the maximum number of prepared transactions.",
  74. "name": "POSTGRESQL_MAX_CONNECTIONS",
  75. "required": false
  76. },
  77. {
  78. "displayName": "PostgreSQL Shared Buffers",
  79. "description": "Configures how much memory is dedicated to PostgreSQL for caching data.",
  80. "name": "POSTGRESQL_SHARED_BUFFERS",
  81. "required": false
  82. },
  83. {
  84. "displayName": "Database Username",
  85. "description": "Database user name",
  86. "name": "DB_USERNAME",
  87. "from": "user[a-zA-Z0-9]{3}",
  88. "generate": "expression",
  89. "required": true
  90. },
  91. {
  92. "displayName": "Database Password",
  93. "description": "Database user password",
  94. "name": "DB_PASSWORD",
  95. "from": "[a-zA-Z0-9]{32}",
  96. "generate": "expression",
  97. "required": true
  98. },
  99. {
  100. "displayName": "Database Volume Capacity",
  101. "description": "Size of persistent storage for database volume.",
  102. "name": "VOLUME_CAPACITY",
  103. "value": "1Gi",
  104. "required": true
  105. },
  106. {
  107. "displayName": "ImageStream Namespace",
  108. "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.",
  109. "name": "IMAGE_STREAM_NAMESPACE",
  110. "value": "openshift",
  111. "required": true
  112. },
  113. {
  114. "displayName": "RH-SSO Administrator Username",
  115. "description": "RH-SSO Server administrator username",
  116. "name": "SSO_ADMIN_USERNAME",
  117. "from": "[a-zA-Z0-9]{8}",
  118. "generate": "expression",
  119. "required": true
  120. },
  121. {
  122. "displayName": "RH-SSO Administrator Password",
  123. "description": "RH-SSO Server administrator password",
  124. "name": "SSO_ADMIN_PASSWORD",
  125. "from": "[a-zA-Z0-9]{32}",
  126. "generate": "expression",
  127. "required": true
  128. },
  129. {
  130. "displayName": "RH-SSO Realm",
  131. "description": "Realm to be created in the RH-SSO server (e.g. demorealm).",
  132. "name": "SSO_REALM",
  133. "value": "",
  134. "required": false
  135. },
  136. {
  137. "displayName": "RH-SSO Service Username",
  138. "description": "The username used to access the RH-SSO service. This is used by clients to create the appliction client(s) within the specified RH-SSO realm.",
  139. "name": "SSO_SERVICE_USERNAME",
  140. "value": "",
  141. "required": false
  142. },
  143. {
  144. "displayName": "RH-SSO Service Password",
  145. "description": "The password for the RH-SSO service user.",
  146. "name": "SSO_SERVICE_PASSWORD",
  147. "value": "",
  148. "required": false
  149. },
  150. {
  151. "displayName": "PostgreSQL Image Stream Tag",
  152. "description": "The tag to use for the \"postgresql\" image stream. Typically, this aligns with the major.minor version of PostgreSQL.",
  153. "name": "POSTGRESQL_IMAGE_STREAM_TAG",
  154. "value": "9.5",
  155. "required": true
  156. },
  157. {
  158. "displayName": "Container Memory Limit",
  159. "description": "Container memory limit.",
  160. "name": "MEMORY_LIMIT",
  161. "value": "1Gi",
  162. "required": false
  163. }
  164. ],
  165. "objects": [
  166. {
  167. "kind": "Service",
  168. "apiVersion": "v1",
  169. "spec": {
  170. "ports": [
  171. {
  172. "port": 8443,
  173. "targetPort": 8443
  174. }
  175. ],
  176. "selector": {
  177. "deploymentConfig": "${APPLICATION_NAME}"
  178. }
  179. },
  180. "metadata": {
  181. "name": "${APPLICATION_NAME}",
  182. "labels": {
  183. "application": "${APPLICATION_NAME}"
  184. },
  185. "annotations": {
  186. "description": "The web server's https port.",
  187. "service.alpha.openshift.io/serving-cert-secret-name": "sso-x509-https-secret",
  188. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  189. }
  190. }
  191. },
  192. {
  193. "kind": "Service",
  194. "apiVersion": "v1",
  195. "spec": {
  196. "ports": [
  197. {
  198. "port": 5432,
  199. "targetPort": 5432
  200. }
  201. ],
  202. "selector": {
  203. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  204. }
  205. },
  206. "metadata": {
  207. "name": "${APPLICATION_NAME}-postgresql",
  208. "labels": {
  209. "application": "${APPLICATION_NAME}"
  210. },
  211. "annotations": {
  212. "description": "The database server's port."
  213. }
  214. }
  215. },
  216. {
  217. "kind": "Service",
  218. "apiVersion": "v1",
  219. "spec": {
  220. "clusterIP": "None",
  221. "ports": [
  222. {
  223. "name": "ping",
  224. "port": 8888
  225. }
  226. ],
  227. "selector": {
  228. "deploymentConfig": "${APPLICATION_NAME}"
  229. }
  230. },
  231. "metadata": {
  232. "name": "${APPLICATION_NAME}-ping",
  233. "labels": {
  234. "application": "${APPLICATION_NAME}"
  235. },
  236. "annotations": {
  237. "service.alpha.kubernetes.io/tolerate-unready-endpoints": "true",
  238. "service.alpha.openshift.io/serving-cert-secret-name": "sso-x509-jgroups-secret",
  239. "description": "The JGroups ping port for clustering."
  240. }
  241. }
  242. },
  243. {
  244. "kind": "Route",
  245. "apiVersion": "v1",
  246. "id": "${APPLICATION_NAME}-https",
  247. "metadata": {
  248. "name": "${APPLICATION_NAME}",
  249. "labels": {
  250. "application": "${APPLICATION_NAME}"
  251. },
  252. "annotations": {
  253. "description": "Route for application's https service."
  254. }
  255. },
  256. "spec": {
  257. "to": {
  258. "name": "${APPLICATION_NAME}"
  259. },
  260. "tls": {
  261. "termination": "reencrypt"
  262. }
  263. }
  264. },
  265. {
  266. "kind": "DeploymentConfig",
  267. "apiVersion": "v1",
  268. "metadata": {
  269. "name": "${APPLICATION_NAME}",
  270. "labels": {
  271. "application": "${APPLICATION_NAME}"
  272. }
  273. },
  274. "spec": {
  275. "strategy": {
  276. "type": "Recreate"
  277. },
  278. "triggers": [
  279. {
  280. "type": "ImageChange",
  281. "imageChangeParams": {
  282. "automatic": true,
  283. "containerNames": [
  284. "${APPLICATION_NAME}"
  285. ],
  286. "from": {
  287. "kind": "ImageStreamTag",
  288. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  289. "name": "redhat-sso72-openshift:1.2"
  290. }
  291. }
  292. },
  293. {
  294. "type": "ConfigChange"
  295. }
  296. ],
  297. "replicas": 1,
  298. "selector": {
  299. "deploymentConfig": "${APPLICATION_NAME}"
  300. },
  301. "template": {
  302. "metadata": {
  303. "name": "${APPLICATION_NAME}",
  304. "labels": {
  305. "deploymentConfig": "${APPLICATION_NAME}",
  306. "application": "${APPLICATION_NAME}"
  307. }
  308. },
  309. "spec": {
  310. "terminationGracePeriodSeconds": 75,
  311. "containers": [
  312. {
  313. "name": "${APPLICATION_NAME}",
  314. "image": "${APPLICATION_NAME}",
  315. "imagePullPolicy": "Always",
  316. "resources": {
  317. "limits": {
  318. "memory": "${MEMORY_LIMIT}"
  319. }
  320. },
  321. "volumeMounts": [
  322. {
  323. "name": "sso-x509-https-volume",
  324. "mountPath": "/etc/x509/https",
  325. "readOnly": true
  326. },
  327. {
  328. "name": "sso-x509-jgroups-volume",
  329. "mountPath": "/etc/x509/jgroups",
  330. "readOnly": true
  331. }
  332. ],
  333. "livenessProbe": {
  334. "exec": {
  335. "command": [
  336. "/bin/bash",
  337. "-c",
  338. "/opt/eap/bin/livenessProbe.sh"
  339. ]
  340. },
  341. "initialDelaySeconds": 60
  342. },
  343. "readinessProbe": {
  344. "exec": {
  345. "command": [
  346. "/bin/bash",
  347. "-c",
  348. "/opt/eap/bin/readinessProbe.sh"
  349. ]
  350. }
  351. },
  352. "ports": [
  353. {
  354. "name": "jolokia",
  355. "containerPort": 8778,
  356. "protocol": "TCP"
  357. },
  358. {
  359. "name": "http",
  360. "containerPort": 8080,
  361. "protocol": "TCP"
  362. },
  363. {
  364. "name": "https",
  365. "containerPort": 8443,
  366. "protocol": "TCP"
  367. },
  368. {
  369. "name": "ping",
  370. "containerPort": 8888,
  371. "protocol": "TCP"
  372. }
  373. ],
  374. "env": [
  375. {
  376. "name": "DB_SERVICE_PREFIX_MAPPING",
  377. "value": "${APPLICATION_NAME}-postgresql=DB"
  378. },
  379. {
  380. "name": "DB_JNDI",
  381. "value": "${DB_JNDI}"
  382. },
  383. {
  384. "name": "DB_USERNAME",
  385. "value": "${DB_USERNAME}"
  386. },
  387. {
  388. "name": "DB_PASSWORD",
  389. "value": "${DB_PASSWORD}"
  390. },
  391. {
  392. "name": "DB_DATABASE",
  393. "value": "${DB_DATABASE}"
  394. },
  395. {
  396. "name": "TX_DATABASE_PREFIX_MAPPING",
  397. "value": "${APPLICATION_NAME}-postgresql=DB"
  398. },
  399. {
  400. "name": "DB_MIN_POOL_SIZE",
  401. "value": "${DB_MIN_POOL_SIZE}"
  402. },
  403. {
  404. "name": "DB_MAX_POOL_SIZE",
  405. "value": "${DB_MAX_POOL_SIZE}"
  406. },
  407. {
  408. "name": "DB_TX_ISOLATION",
  409. "value": "${DB_TX_ISOLATION}"
  410. },
  411. {
  412. "name": "JGROUPS_PING_PROTOCOL",
  413. "value": "openshift.DNS_PING"
  414. },
  415. {
  416. "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
  417. "value": "${APPLICATION_NAME}-ping"
  418. },
  419. {
  420. "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
  421. "value": "8888"
  422. },
  423. {
  424. "name": "X509_CA_BUNDLE",
  425. "value": "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"
  426. },
  427. {
  428. "name": "JGROUPS_CLUSTER_PASSWORD",
  429. "value": "${JGROUPS_CLUSTER_PASSWORD}"
  430. },
  431. {
  432. "name": "SSO_ADMIN_USERNAME",
  433. "value": "${SSO_ADMIN_USERNAME}"
  434. },
  435. {
  436. "name": "SSO_ADMIN_PASSWORD",
  437. "value": "${SSO_ADMIN_PASSWORD}"
  438. },
  439. {
  440. "name": "SSO_REALM",
  441. "value": "${SSO_REALM}"
  442. },
  443. {
  444. "name": "SSO_SERVICE_USERNAME",
  445. "value": "${SSO_SERVICE_USERNAME}"
  446. },
  447. {
  448. "name": "SSO_SERVICE_PASSWORD",
  449. "value": "${SSO_SERVICE_PASSWORD}"
  450. }
  451. ]
  452. }
  453. ],
  454. "volumes": [
  455. {
  456. "name": "sso-x509-https-volume",
  457. "secret": {
  458. "secretName": "sso-x509-https-secret"
  459. }
  460. },
  461. {
  462. "name": "sso-x509-jgroups-volume",
  463. "secret": {
  464. "secretName": "sso-x509-jgroups-secret"
  465. }
  466. }
  467. ]
  468. }
  469. }
  470. }
  471. },
  472. {
  473. "kind": "DeploymentConfig",
  474. "apiVersion": "v1",
  475. "metadata": {
  476. "name": "${APPLICATION_NAME}-postgresql",
  477. "labels": {
  478. "application": "${APPLICATION_NAME}"
  479. }
  480. },
  481. "spec": {
  482. "strategy": {
  483. "type": "Recreate"
  484. },
  485. "triggers": [
  486. {
  487. "type": "ImageChange",
  488. "imageChangeParams": {
  489. "automatic": true,
  490. "containerNames": [
  491. "${APPLICATION_NAME}-postgresql"
  492. ],
  493. "from": {
  494. "kind": "ImageStreamTag",
  495. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  496. "name": "postgresql:${POSTGRESQL_IMAGE_STREAM_TAG}"
  497. }
  498. }
  499. },
  500. {
  501. "type": "ConfigChange"
  502. }
  503. ],
  504. "replicas": 1,
  505. "selector": {
  506. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  507. },
  508. "template": {
  509. "metadata": {
  510. "name": "${APPLICATION_NAME}-postgresql",
  511. "labels": {
  512. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  513. "application": "${APPLICATION_NAME}"
  514. }
  515. },
  516. "spec": {
  517. "terminationGracePeriodSeconds": 60,
  518. "containers": [
  519. {
  520. "name": "${APPLICATION_NAME}-postgresql",
  521. "image": "postgresql",
  522. "imagePullPolicy": "Always",
  523. "ports": [
  524. {
  525. "containerPort": 5432,
  526. "protocol": "TCP"
  527. }
  528. ],
  529. "readinessProbe": {
  530. "timeoutSeconds": 1,
  531. "initialDelaySeconds": 5,
  532. "exec": {
  533. "command": [ "/bin/sh", "-i", "-c", "psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'"]
  534. }
  535. },
  536. "livenessProbe": {
  537. "timeoutSeconds": 1,
  538. "initialDelaySeconds": 30,
  539. "tcpSocket": {
  540. "port": 5432
  541. }
  542. },
  543. "volumeMounts": [
  544. {
  545. "mountPath": "/var/lib/pgsql/data",
  546. "name": "${APPLICATION_NAME}-postgresql-pvol"
  547. }
  548. ],
  549. "env": [
  550. {
  551. "name": "POSTGRESQL_USER",
  552. "value": "${DB_USERNAME}"
  553. },
  554. {
  555. "name": "POSTGRESQL_PASSWORD",
  556. "value": "${DB_PASSWORD}"
  557. },
  558. {
  559. "name": "POSTGRESQL_DATABASE",
  560. "value": "${DB_DATABASE}"
  561. },
  562. {
  563. "name": "POSTGRESQL_MAX_CONNECTIONS",
  564. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  565. },
  566. {
  567. "name": "POSTGRESQL_MAX_PREPARED_TRANSACTIONS",
  568. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  569. },
  570. {
  571. "name": "POSTGRESQL_SHARED_BUFFERS",
  572. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  573. }
  574. ]
  575. }
  576. ],
  577. "volumes": [
  578. {
  579. "name": "${APPLICATION_NAME}-postgresql-pvol",
  580. "persistentVolumeClaim": {
  581. "claimName": "${APPLICATION_NAME}-postgresql-claim"
  582. }
  583. }
  584. ]
  585. }
  586. }
  587. }
  588. },
  589. {
  590. "apiVersion": "v1",
  591. "kind": "PersistentVolumeClaim",
  592. "metadata": {
  593. "name": "${APPLICATION_NAME}-postgresql-claim",
  594. "labels": {
  595. "application": "${APPLICATION_NAME}"
  596. }
  597. },
  598. "spec": {
  599. "accessModes": [
  600. "ReadWriteOnce"
  601. ],
  602. "resources": {
  603. "requests": {
  604. "storage": "${VOLUME_CAPACITY}"
  605. }
  606. }
  607. }
  608. }
  609. ]
  610. }