eap6-postgresql-persistent-sti.json 23 KB

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