sso72-x509-mysql-persistent.json 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  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 + MySQL (Persistent)",
  10. "openshift.io/provider-display-name": "Red Hat, Inc.",
  11. "description": "An example RH-SSO 7 application with a MySQL 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 MySQL 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-mysql-persistent"
  17. },
  18. "labels": {
  19. "template": "sso72-x509-mysql-persistent",
  20. "xpaas": "1.4.14"
  21. },
  22. "message": "A new persistent RH-SSO service (using MySQL) 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 MySQL 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/mysql",
  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": "MySQL Lower Case Table Names",
  73. "description": "Sets how the table names are stored and compared.",
  74. "name": "MYSQL_LOWER_CASE_TABLE_NAMES",
  75. "required": false
  76. },
  77. {
  78. "displayName": "MySQL Maximum number of connections",
  79. "description": "The maximum permitted number of simultaneous client connections.",
  80. "name": "MYSQL_MAX_CONNECTIONS",
  81. "required": false
  82. },
  83. {
  84. "displayName": "MySQL FullText Minimum Word Length",
  85. "description": "The minimum length of the word to be included in a FULLTEXT index.",
  86. "name": "MYSQL_FT_MIN_WORD_LEN",
  87. "required": false
  88. },
  89. {
  90. "displayName": "MySQL FullText Maximum Word Length",
  91. "description": "The maximum length of the word to be included in a FULLTEXT index.",
  92. "name": "MYSQL_FT_MAX_WORD_LEN",
  93. "required": false
  94. },
  95. {
  96. "displayName": "MySQL AIO",
  97. "description": "Controls the innodb_use_native_aio setting value if the native AIO is broken.",
  98. "name": "MYSQL_AIO",
  99. "required": false
  100. },
  101. {
  102. "displayName": "Database Username",
  103. "description": "Database user name",
  104. "name": "DB_USERNAME",
  105. "from": "user[a-zA-Z0-9]{3}",
  106. "generate": "expression",
  107. "required": true
  108. },
  109. {
  110. "displayName": "Database Password",
  111. "description": "Database user password",
  112. "name": "DB_PASSWORD",
  113. "from": "[a-zA-Z0-9]{32}",
  114. "generate": "expression",
  115. "required": true
  116. },
  117. {
  118. "displayName": "Database Volume Capacity",
  119. "description": "Size of persistent storage for database volume.",
  120. "name": "VOLUME_CAPACITY",
  121. "value": "1Gi",
  122. "required": true
  123. },
  124. {
  125. "displayName": "ImageStream Namespace",
  126. "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.",
  127. "name": "IMAGE_STREAM_NAMESPACE",
  128. "value": "openshift",
  129. "required": true
  130. },
  131. {
  132. "displayName": "RH-SSO Administrator Username",
  133. "description": "RH-SSO Server administrator username",
  134. "name": "SSO_ADMIN_USERNAME",
  135. "from": "[a-zA-Z0-9]{8}",
  136. "generate": "expression",
  137. "required": true
  138. },
  139. {
  140. "displayName": "RH_SSO Administrator Password",
  141. "description": "RH-SSO Server administrator password",
  142. "name": "SSO_ADMIN_PASSWORD",
  143. "from": "[a-zA-Z0-9]{32}",
  144. "generate": "expression",
  145. "required": true
  146. },
  147. {
  148. "displayName": "RH-SSO Realm",
  149. "description": "Realm to be created in the RH-SSO server (e.g. demorealm).",
  150. "name": "SSO_REALM",
  151. "value": "",
  152. "required": false
  153. },
  154. {
  155. "displayName": "RH-SSO Service Username",
  156. "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.",
  157. "name": "SSO_SERVICE_USERNAME",
  158. "value": "",
  159. "required": false
  160. },
  161. {
  162. "displayName": "RH-SSO Service Password",
  163. "description": "The password for the RH-SSO service user.",
  164. "name": "SSO_SERVICE_PASSWORD",
  165. "value": "",
  166. "required": false
  167. },
  168. {
  169. "displayName": "MySQL Image Stream Tag",
  170. "description": "The tag to use for the \"mysql\" image stream. Typically, this aligns with the major.minor version of MySQL.",
  171. "name": "MYSQL_IMAGE_STREAM_TAG",
  172. "value": "5.7",
  173. "required": true
  174. },
  175. {
  176. "displayName": "Container Memory Limit",
  177. "description": "Container memory limit.",
  178. "name": "MEMORY_LIMIT",
  179. "value": "1Gi",
  180. "required": false
  181. }
  182. ],
  183. "objects": [
  184. {
  185. "kind": "Service",
  186. "apiVersion": "v1",
  187. "spec": {
  188. "ports": [
  189. {
  190. "port": 8443,
  191. "targetPort": 8443
  192. }
  193. ],
  194. "selector": {
  195. "deploymentConfig": "${APPLICATION_NAME}"
  196. }
  197. },
  198. "metadata": {
  199. "name": "${APPLICATION_NAME}",
  200. "labels": {
  201. "application": "${APPLICATION_NAME}"
  202. },
  203. "annotations": {
  204. "description": "The web server's https port.",
  205. "service.alpha.openshift.io/serving-cert-secret-name": "sso-x509-https-secret",
  206. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-mysql\", \"kind\": \"Service\"}]"
  207. }
  208. }
  209. },
  210. {
  211. "kind": "Service",
  212. "apiVersion": "v1",
  213. "spec": {
  214. "ports": [
  215. {
  216. "port": 3306,
  217. "targetPort": 3306
  218. }
  219. ],
  220. "selector": {
  221. "deploymentConfig": "${APPLICATION_NAME}-mysql"
  222. }
  223. },
  224. "metadata": {
  225. "name": "${APPLICATION_NAME}-mysql",
  226. "labels": {
  227. "application": "${APPLICATION_NAME}"
  228. },
  229. "annotations": {
  230. "description": "The database server's port."
  231. }
  232. }
  233. },
  234. {
  235. "kind": "Service",
  236. "apiVersion": "v1",
  237. "spec": {
  238. "clusterIP": "None",
  239. "ports": [
  240. {
  241. "name": "ping",
  242. "port": 8888
  243. }
  244. ],
  245. "selector": {
  246. "deploymentConfig": "${APPLICATION_NAME}"
  247. }
  248. },
  249. "metadata": {
  250. "name": "${APPLICATION_NAME}-ping",
  251. "labels": {
  252. "application": "${APPLICATION_NAME}"
  253. },
  254. "annotations": {
  255. "service.alpha.kubernetes.io/tolerate-unready-endpoints": "true",
  256. "service.alpha.openshift.io/serving-cert-secret-name": "sso-x509-jgroups-secret",
  257. "description": "The JGroups ping port for clustering."
  258. }
  259. }
  260. },
  261. {
  262. "kind": "Route",
  263. "apiVersion": "v1",
  264. "id": "${APPLICATION_NAME}-https",
  265. "metadata": {
  266. "name": "${APPLICATION_NAME}",
  267. "labels": {
  268. "application": "${APPLICATION_NAME}"
  269. },
  270. "annotations": {
  271. "description": "Route for application's https service."
  272. }
  273. },
  274. "spec": {
  275. "to": {
  276. "name": "${APPLICATION_NAME}"
  277. },
  278. "tls": {
  279. "termination": "reencrypt"
  280. }
  281. }
  282. },
  283. {
  284. "kind": "DeploymentConfig",
  285. "apiVersion": "v1",
  286. "metadata": {
  287. "name": "${APPLICATION_NAME}",
  288. "labels": {
  289. "application": "${APPLICATION_NAME}"
  290. }
  291. },
  292. "spec": {
  293. "strategy": {
  294. "type": "Recreate"
  295. },
  296. "triggers": [
  297. {
  298. "type": "ImageChange",
  299. "imageChangeParams": {
  300. "automatic": true,
  301. "containerNames": [
  302. "${APPLICATION_NAME}"
  303. ],
  304. "from": {
  305. "kind": "ImageStreamTag",
  306. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  307. "name": "redhat-sso72-openshift:1.2"
  308. }
  309. }
  310. },
  311. {
  312. "type": "ConfigChange"
  313. }
  314. ],
  315. "replicas": 1,
  316. "selector": {
  317. "deploymentConfig": "${APPLICATION_NAME}"
  318. },
  319. "template": {
  320. "metadata": {
  321. "name": "${APPLICATION_NAME}",
  322. "labels": {
  323. "deploymentConfig": "${APPLICATION_NAME}",
  324. "application": "${APPLICATION_NAME}"
  325. }
  326. },
  327. "spec": {
  328. "terminationGracePeriodSeconds": 75,
  329. "containers": [
  330. {
  331. "name": "${APPLICATION_NAME}",
  332. "image": "${APPLICATION_NAME}",
  333. "imagePullPolicy": "Always",
  334. "resources": {
  335. "limits": {
  336. "memory": "${MEMORY_LIMIT}"
  337. }
  338. },
  339. "volumeMounts": [
  340. {
  341. "name": "sso-x509-https-volume",
  342. "mountPath": "/etc/x509/https",
  343. "readOnly": true
  344. },
  345. {
  346. "name": "sso-x509-jgroups-volume",
  347. "mountPath": "/etc/x509/jgroups",
  348. "readOnly": true
  349. }
  350. ],
  351. "livenessProbe": {
  352. "exec": {
  353. "command": [
  354. "/bin/bash",
  355. "-c",
  356. "/opt/eap/bin/livenessProbe.sh"
  357. ]
  358. },
  359. "initialDelaySeconds": 60
  360. },
  361. "readinessProbe": {
  362. "exec": {
  363. "command": [
  364. "/bin/bash",
  365. "-c",
  366. "/opt/eap/bin/readinessProbe.sh"
  367. ]
  368. }
  369. },
  370. "ports": [
  371. {
  372. "name": "jolokia",
  373. "containerPort": 8778,
  374. "protocol": "TCP"
  375. },
  376. {
  377. "name": "http",
  378. "containerPort": 8080,
  379. "protocol": "TCP"
  380. },
  381. {
  382. "name": "https",
  383. "containerPort": 8443,
  384. "protocol": "TCP"
  385. },
  386. {
  387. "name": "ping",
  388. "containerPort": 8888,
  389. "protocol": "TCP"
  390. }
  391. ],
  392. "env": [
  393. {
  394. "name": "DB_SERVICE_PREFIX_MAPPING",
  395. "value": "${APPLICATION_NAME}-mysql=DB"
  396. },
  397. {
  398. "name": "DB_JNDI",
  399. "value": "${DB_JNDI}"
  400. },
  401. {
  402. "name": "DB_USERNAME",
  403. "value": "${DB_USERNAME}"
  404. },
  405. {
  406. "name": "DB_PASSWORD",
  407. "value": "${DB_PASSWORD}"
  408. },
  409. {
  410. "name": "DB_DATABASE",
  411. "value": "${DB_DATABASE}"
  412. },
  413. {
  414. "name": "TX_DATABASE_PREFIX_MAPPING",
  415. "value": "${APPLICATION_NAME}-mysql=DB"
  416. },
  417. {
  418. "name": "DB_MIN_POOL_SIZE",
  419. "value": "${DB_MIN_POOL_SIZE}"
  420. },
  421. {
  422. "name": "DB_MAX_POOL_SIZE",
  423. "value": "${DB_MAX_POOL_SIZE}"
  424. },
  425. {
  426. "name": "DB_TX_ISOLATION",
  427. "value": "${DB_TX_ISOLATION}"
  428. },
  429. {
  430. "name": "JGROUPS_PING_PROTOCOL",
  431. "value": "openshift.DNS_PING"
  432. },
  433. {
  434. "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
  435. "value": "${APPLICATION_NAME}-ping"
  436. },
  437. {
  438. "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
  439. "value": "8888"
  440. },
  441. {
  442. "name": "X509_CA_BUNDLE",
  443. "value": "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"
  444. },
  445. {
  446. "name": "JGROUPS_CLUSTER_PASSWORD",
  447. "value": "${JGROUPS_CLUSTER_PASSWORD}"
  448. },
  449. {
  450. "name": "SSO_ADMIN_USERNAME",
  451. "value": "${SSO_ADMIN_USERNAME}"
  452. },
  453. {
  454. "name": "SSO_ADMIN_PASSWORD",
  455. "value": "${SSO_ADMIN_PASSWORD}"
  456. },
  457. {
  458. "name": "SSO_REALM",
  459. "value": "${SSO_REALM}"
  460. },
  461. {
  462. "name": "SSO_SERVICE_USERNAME",
  463. "value": "${SSO_SERVICE_USERNAME}"
  464. },
  465. {
  466. "name": "SSO_SERVICE_PASSWORD",
  467. "value": "${SSO_SERVICE_PASSWORD}"
  468. }
  469. ]
  470. }
  471. ],
  472. "volumes": [
  473. {
  474. "name": "sso-x509-https-volume",
  475. "secret": {
  476. "secretName": "sso-x509-https-secret"
  477. }
  478. },
  479. {
  480. "name": "sso-x509-jgroups-volume",
  481. "secret": {
  482. "secretName": "sso-x509-jgroups-secret"
  483. }
  484. }
  485. ]
  486. }
  487. }
  488. }
  489. },
  490. {
  491. "kind": "DeploymentConfig",
  492. "apiVersion": "v1",
  493. "metadata": {
  494. "name": "${APPLICATION_NAME}-mysql",
  495. "labels": {
  496. "application": "${APPLICATION_NAME}"
  497. }
  498. },
  499. "spec": {
  500. "strategy": {
  501. "type": "Recreate"
  502. },
  503. "triggers": [
  504. {
  505. "type": "ImageChange",
  506. "imageChangeParams": {
  507. "automatic": true,
  508. "containerNames": [
  509. "${APPLICATION_NAME}-mysql"
  510. ],
  511. "from": {
  512. "kind": "ImageStreamTag",
  513. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  514. "name": "mysql:${MYSQL_IMAGE_STREAM_TAG}"
  515. }
  516. }
  517. },
  518. {
  519. "type": "ConfigChange"
  520. }
  521. ],
  522. "replicas": 1,
  523. "selector": {
  524. "deploymentConfig": "${APPLICATION_NAME}-mysql"
  525. },
  526. "template": {
  527. "metadata": {
  528. "name": "${APPLICATION_NAME}-mysql",
  529. "labels": {
  530. "deploymentConfig": "${APPLICATION_NAME}-mysql",
  531. "application": "${APPLICATION_NAME}"
  532. }
  533. },
  534. "spec": {
  535. "terminationGracePeriodSeconds": 60,
  536. "containers": [
  537. {
  538. "name": "${APPLICATION_NAME}-mysql",
  539. "image": "mysql",
  540. "imagePullPolicy": "Always",
  541. "ports": [
  542. {
  543. "containerPort": 3306,
  544. "protocol": "TCP"
  545. }
  546. ],
  547. "readinessProbe": {
  548. "timeoutSeconds": 1,
  549. "initialDelaySeconds": 5,
  550. "exec": {
  551. "command": [ "/bin/sh", "-i", "-c",
  552. "MYSQL_PWD=\"$MYSQL_PASSWORD\" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE -e 'SELECT 1'"]
  553. }
  554. },
  555. "livenessProbe": {
  556. "timeoutSeconds": 1,
  557. "initialDelaySeconds": 30,
  558. "tcpSocket": {
  559. "port": 3306
  560. }
  561. },
  562. "volumeMounts": [
  563. {
  564. "mountPath": "/var/lib/mysql/data",
  565. "name": "${APPLICATION_NAME}-mysql-pvol"
  566. }
  567. ],
  568. "env": [
  569. {
  570. "name": "MYSQL_USER",
  571. "value": "${DB_USERNAME}"
  572. },
  573. {
  574. "name": "MYSQL_PASSWORD",
  575. "value": "${DB_PASSWORD}"
  576. },
  577. {
  578. "name": "MYSQL_DATABASE",
  579. "value": "${DB_DATABASE}"
  580. },
  581. {
  582. "name": "MYSQL_LOWER_CASE_TABLE_NAMES",
  583. "value": "${MYSQL_LOWER_CASE_TABLE_NAMES}"
  584. },
  585. {
  586. "name": "MYSQL_MAX_CONNECTIONS",
  587. "value": "${MYSQL_MAX_CONNECTIONS}"
  588. },
  589. {
  590. "name": "MYSQL_FT_MIN_WORD_LEN",
  591. "value": "${MYSQL_FT_MIN_WORD_LEN}"
  592. },
  593. {
  594. "name": "MYSQL_FT_MAX_WORD_LEN",
  595. "value": "${MYSQL_FT_MAX_WORD_LEN}"
  596. },
  597. {
  598. "name": "MYSQL_AIO",
  599. "value": "${MYSQL_AIO}"
  600. }
  601. ]
  602. }
  603. ],
  604. "volumes": [
  605. {
  606. "name": "${APPLICATION_NAME}-mysql-pvol",
  607. "persistentVolumeClaim": {
  608. "claimName": "${APPLICATION_NAME}-mysql-claim"
  609. }
  610. }
  611. ]
  612. }
  613. }
  614. }
  615. },
  616. {
  617. "apiVersion": "v1",
  618. "kind": "PersistentVolumeClaim",
  619. "metadata": {
  620. "name": "${APPLICATION_NAME}-mysql-claim",
  621. "labels": {
  622. "application": "${APPLICATION_NAME}"
  623. }
  624. },
  625. "spec": {
  626. "accessModes": [
  627. "ReadWriteOnce"
  628. ],
  629. "resources": {
  630. "requests": {
  631. "storage": "${VOLUME_CAPACITY}"
  632. }
  633. }
  634. }
  635. }
  636. ]
  637. }