eap6-postgresql-sti.json 22 KB

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