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. "name": "${APPLICATION_NAME}"
  317. }
  318. },
  319. "triggers": [
  320. {
  321. "type": "github",
  322. "github": {
  323. "secret": "${GITHUB_TRIGGER_SECRET}"
  324. }
  325. },
  326. {
  327. "type": "generic",
  328. "generic": {
  329. "secret": "${GENERIC_TRIGGER_SECRET}"
  330. }
  331. },
  332. {
  333. "type": "imageChange",
  334. "imageChange": {}
  335. }
  336. ]
  337. }
  338. },
  339. {
  340. "kind": "DeploymentConfig",
  341. "apiVersion": "v1",
  342. "metadata": {
  343. "name": "${APPLICATION_NAME}",
  344. "labels": {
  345. "application": "${APPLICATION_NAME}"
  346. }
  347. },
  348. "spec": {
  349. "strategy": {
  350. "type": "Recreate"
  351. },
  352. "triggers": [
  353. {
  354. "type": "ImageChange",
  355. "imageChangeParams": {
  356. "automatic": true,
  357. "containerNames": [
  358. "${APPLICATION_NAME}"
  359. ],
  360. "from": {
  361. "kind": "ImageStream",
  362. "name": "${APPLICATION_NAME}"
  363. }
  364. }
  365. }
  366. ],
  367. "replicas": 1,
  368. "selector": {
  369. "deploymentConfig": "${APPLICATION_NAME}"
  370. },
  371. "template": {
  372. "metadata": {
  373. "name": "${APPLICATION_NAME}",
  374. "labels": {
  375. "deploymentConfig": "${APPLICATION_NAME}",
  376. "application": "${APPLICATION_NAME}"
  377. }
  378. },
  379. "spec": {
  380. "serviceAccount": "eap-service-account",
  381. "containers": [
  382. {
  383. "name": "${APPLICATION_NAME}",
  384. "image": "${APPLICATION_NAME}",
  385. "imagePullPolicy": "Always",
  386. "volumeMounts": [
  387. {
  388. "name": "eap-keystore-volume",
  389. "mountPath": "/etc/eap-secret-volume",
  390. "readOnly": true
  391. }
  392. ],
  393. "readinessProbe": {
  394. "exec": {
  395. "command": [
  396. "/bin/bash",
  397. "-c",
  398. "/opt/eap/bin/readinessProbe.sh"
  399. ]
  400. }
  401. },
  402. "ports": [
  403. {
  404. "name": "${APPLICATION_NAME}-tcp-8080",
  405. "containerPort": 8080,
  406. "protocol": "TCP"
  407. },
  408. {
  409. "name": "${APPLICATION_NAME}-tcp-8443",
  410. "containerPort": 8443,
  411. "protocol": "TCP"
  412. },
  413. {
  414. "name": "${APPLICATION_NAME}-ping-8888",
  415. "containerPort": 8888,
  416. "protocol": "TCP"
  417. }
  418. ],
  419. "env": [
  420. {
  421. "name": "DB_SERVICE_PREFIX_MAPPING",
  422. "value": "${APPLICATION_NAME}-postgresql=DB"
  423. },
  424. {
  425. "name": "DB_JNDI",
  426. "value": "${DB_JNDI}"
  427. },
  428. {
  429. "name": "DB_USERNAME",
  430. "value": "${DB_USERNAME}"
  431. },
  432. {
  433. "name": "DB_PASSWORD",
  434. "value": "${DB_PASSWORD}"
  435. },
  436. {
  437. "name": "DB_DATABASE",
  438. "value": "${DB_DATABASE}"
  439. },
  440. {
  441. "name": "TX_DATABASE_PREFIX_MAPPING",
  442. "value": "${APPLICATION_NAME}-postgresql=DB"
  443. },
  444. {
  445. "name": "DB_MIN_POOL_SIZE",
  446. "value": "${DB_MIN_POOL_SIZE}"
  447. },
  448. {
  449. "name": "DB_MAX_POOL_SIZE",
  450. "value": "${DB_MAX_POOL_SIZE}"
  451. },
  452. {
  453. "name": "DB_TX_ISOLATION",
  454. "value": "${DB_TX_ISOLATION}"
  455. },
  456. {
  457. "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
  458. "value": "${APPLICATION_NAME}-ping"
  459. },
  460. {
  461. "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
  462. "value": "8888"
  463. },
  464. {
  465. "name": "EAP_HTTPS_KEYSTORE_DIR",
  466. "value": "/etc/eap-secret-volume"
  467. },
  468. {
  469. "name": "EAP_HTTPS_KEYSTORE",
  470. "value": "${EAP_HTTPS_KEYSTORE}"
  471. },
  472. {
  473. "name": "EAP_HTTPS_NAME",
  474. "value": "${EAP_HTTPS_NAME}"
  475. },
  476. {
  477. "name": "EAP_HTTPS_PASSWORD",
  478. "value": "${EAP_HTTPS_PASSWORD}"
  479. },
  480. {
  481. "name": "HORNETQ_CLUSTER_PASSWORD",
  482. "value": "${HORNETQ_CLUSTER_PASSWORD}"
  483. },
  484. {
  485. "name": "HORNETQ_QUEUES",
  486. "value": "${HORNETQ_QUEUES}"
  487. },
  488. {
  489. "name": "HORNETQ_TOPICS",
  490. "value": "${HORNETQ_TOPICS}"
  491. }
  492. ]
  493. }
  494. ],
  495. "volumes": [
  496. {
  497. "name": "eap-keystore-volume",
  498. "secret": {
  499. "secretName": "${EAP_HTTPS_SECRET}"
  500. }
  501. }
  502. ]
  503. }
  504. }
  505. }
  506. },
  507. {
  508. "kind": "DeploymentConfig",
  509. "apiVersion": "v1",
  510. "metadata": {
  511. "name": "${APPLICATION_NAME}-postgresql",
  512. "labels": {
  513. "application": "${APPLICATION_NAME}"
  514. }
  515. },
  516. "spec": {
  517. "strategy": {
  518. "type": "Recreate"
  519. },
  520. "triggers": [
  521. {
  522. "type": "ImageChange",
  523. "imageChangeParams": {
  524. "automatic": true,
  525. "containerNames": [
  526. "${APPLICATION_NAME}-postgresql"
  527. ],
  528. "from": {
  529. "kind": "ImageStreamTag",
  530. "namespace": "openshift",
  531. "name": "postgresql:latest"
  532. }
  533. }
  534. }
  535. ],
  536. "replicas": 1,
  537. "selector": {
  538. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  539. },
  540. "template": {
  541. "metadata": {
  542. "name": "${APPLICATION_NAME}-postgresql",
  543. "labels": {
  544. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  545. "application": "${APPLICATION_NAME}"
  546. }
  547. },
  548. "spec": {
  549. "containers": [
  550. {
  551. "name": "${APPLICATION_NAME}-postgresql",
  552. "image": "postgresql",
  553. "imagePullPolicy": "Always",
  554. "ports": [
  555. {
  556. "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
  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. }