eap64-postgresql-persistent-s2i.json 24 KB

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