eap6-mongodb-persistent-sti.json 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "description": "Application template for EAP 6 MongDB applications with persistent storage built using STI.",
  7. "iconClass" : "icon-jboss"
  8. },
  9. "name": "eap6-mongodb-persistent-sti"
  10. },
  11. "labels": {
  12. "template": "eap6-mongodb-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/mongodb",
  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": "Disable data file preallocation.",
  103. "name": "MONGODB_NOPREALLOC"
  104. },
  105. {
  106. "description": "Set MongoDB to use a smaller default data file size.",
  107. "name": "MONGODB_SMALLFILES"
  108. },
  109. {
  110. "description": "Runs MongoDB in a quiet mode that attempts to limit the amount of output.",
  111. "name": "MONGODB_QUIET"
  112. },
  113. {
  114. "description": "HornetQ cluster admin password",
  115. "name": "HORNETQ_CLUSTER_PASSWORD",
  116. "from": "[a-zA-Z0-9]{8}",
  117. "generate": "expression"
  118. },
  119. {
  120. "description": "Database user name",
  121. "name": "DB_USERNAME",
  122. "from": "user[a-zA-Z0-9]{3}",
  123. "generate": "expression"
  124. },
  125. {
  126. "description": "Database user password",
  127. "name": "DB_PASSWORD",
  128. "from": "[a-zA-Z0-9]{8}",
  129. "generate": "expression"
  130. },
  131. {
  132. "description": "Database admin password",
  133. "name": "DB_ADMIN_PASSWORD",
  134. "from": "[a-zA-Z0-9]{8}",
  135. "generate": "expression"
  136. },
  137. {
  138. "description": "Github trigger secret",
  139. "name": "GITHUB_TRIGGER_SECRET",
  140. "from": "[a-zA-Z0-9]{8}",
  141. "generate": "expression"
  142. },
  143. {
  144. "description": "Generic build trigger secret",
  145. "name": "GENERIC_TRIGGER_SECRET",
  146. "from": "[a-zA-Z0-9]{8}",
  147. "generate": "expression"
  148. }
  149. ],
  150. "objects": [
  151. {
  152. "kind": "Service",
  153. "apiVersion": "v1",
  154. "spec": {
  155. "ports": [
  156. {
  157. "port": 8080,
  158. "targetPort": 8080
  159. }
  160. ],
  161. "selector": {
  162. "deploymentConfig": "${APPLICATION_NAME}"
  163. }
  164. },
  165. "metadata": {
  166. "name": "${APPLICATION_NAME}",
  167. "labels": {
  168. "application": "${APPLICATION_NAME}"
  169. },
  170. "annotations": {
  171. "description": "The web server's http port."
  172. }
  173. }
  174. },
  175. {
  176. "kind": "Service",
  177. "apiVersion": "v1",
  178. "spec": {
  179. "ports": [
  180. {
  181. "port": 8443,
  182. "targetPort": 8443
  183. }
  184. ],
  185. "selector": {
  186. "deploymentConfig": "${APPLICATION_NAME}"
  187. }
  188. },
  189. "metadata": {
  190. "name": "secure-${APPLICATION_NAME}",
  191. "labels": {
  192. "application": "${APPLICATION_NAME}"
  193. },
  194. "annotations": {
  195. "description": "The web server's https port."
  196. }
  197. }
  198. },
  199. {
  200. "kind": "Service",
  201. "apiVersion": "v1",
  202. "spec": {
  203. "ports": [
  204. {
  205. "port": 8888,
  206. "targetPort": 8888
  207. }
  208. ],
  209. "portalIP": "None",
  210. "selector": {
  211. "deploymentConfig": "${APPLICATION_NAME}"
  212. }
  213. },
  214. "metadata": {
  215. "name": "${APPLICATION_NAME}-ping",
  216. "labels": {
  217. "application": "${APPLICATION_NAME}"
  218. },
  219. "annotations": {
  220. "description": "Ping service for clustered applications."
  221. }
  222. }
  223. },
  224. {
  225. "kind": "Service",
  226. "apiVersion": "v1",
  227. "spec": {
  228. "ports": [
  229. {
  230. "port": 27017,
  231. "targetPort": 27017
  232. }
  233. ],
  234. "selector": {
  235. "deploymentConfig": "${APPLICATION_NAME}-mongodb"
  236. }
  237. },
  238. "metadata": {
  239. "name": "${APPLICATION_NAME}-mongodb",
  240. "labels": {
  241. "application": "${APPLICATION_NAME}"
  242. },
  243. "annotations": {
  244. "description": "The database server's port."
  245. }
  246. }
  247. },
  248. {
  249. "kind": "Route",
  250. "apiVersion": "v1",
  251. "id": "${APPLICATION_NAME}-http-route",
  252. "metadata": {
  253. "name": "${APPLICATION_NAME}-http-route",
  254. "labels": {
  255. "application": "${APPLICATION_NAME}"
  256. },
  257. "annotations": {
  258. "description": "Route for application's http service."
  259. }
  260. },
  261. "spec": {
  262. "host": "${APPLICATION_HOSTNAME}",
  263. "to": {
  264. "name": "${APPLICATION_NAME}"
  265. }
  266. }
  267. },
  268. {
  269. "kind": "Route",
  270. "apiVersion": "v1",
  271. "id": "${APPLICATION_NAME}-https-route",
  272. "metadata": {
  273. "name": "${APPLICATION_NAME}-https-route",
  274. "labels": {
  275. "application": "${APPLICATION_NAME}"
  276. },
  277. "annotations": {
  278. "description": "Route for application's https service."
  279. }
  280. },
  281. "spec": {
  282. "host": "${APPLICATION_HOSTNAME}",
  283. "to": {
  284. "name": "secure-${APPLICATION_NAME}"
  285. },
  286. "tls": {
  287. "termination" : "passthrough"
  288. }
  289. }
  290. },
  291. {
  292. "kind": "ImageStream",
  293. "apiVersion": "v1",
  294. "metadata": {
  295. "name": "${APPLICATION_NAME}",
  296. "labels": {
  297. "application": "${APPLICATION_NAME}"
  298. }
  299. }
  300. },
  301. {
  302. "kind": "BuildConfig",
  303. "apiVersion": "v1",
  304. "metadata": {
  305. "name": "${APPLICATION_NAME}",
  306. "labels": {
  307. "application": "${APPLICATION_NAME}"
  308. }
  309. },
  310. "spec": {
  311. "source": {
  312. "type": "Git",
  313. "git": {
  314. "uri": "${GIT_URI}",
  315. "ref": "${GIT_REF}"
  316. },
  317. "contextDir":"${GIT_CONTEXT_DIR}"
  318. },
  319. "strategy": {
  320. "type": "Source",
  321. "sourceStrategy": {
  322. "from": {
  323. "kind": "ImageStreamTag",
  324. "namespace": "openshift",
  325. "name": "jboss-eap6-openshift:${EAP_RELEASE}"
  326. }
  327. }
  328. },
  329. "output": {
  330. "to": {
  331. "kind": "ImageStreamTag",
  332. "name": "${APPLICATION_NAME}:latest"
  333. }
  334. },
  335. "triggers": [
  336. {
  337. "type": "GitHub",
  338. "github": {
  339. "secret": "${GITHUB_TRIGGER_SECRET}"
  340. }
  341. },
  342. {
  343. "type": "Generic",
  344. "generic": {
  345. "secret": "${GENERIC_TRIGGER_SECRET}"
  346. }
  347. },
  348. {
  349. "type": "ImageChange",
  350. "imageChange": {}
  351. }
  352. ]
  353. }
  354. },
  355. {
  356. "kind": "DeploymentConfig",
  357. "apiVersion": "v1",
  358. "metadata": {
  359. "name": "${APPLICATION_NAME}",
  360. "labels": {
  361. "application": "${APPLICATION_NAME}"
  362. }
  363. },
  364. "spec": {
  365. "strategy": {
  366. "type": "Recreate"
  367. },
  368. "triggers": [
  369. {
  370. "type": "ImageChange",
  371. "imageChangeParams": {
  372. "automatic": true,
  373. "containerNames": [
  374. "${APPLICATION_NAME}"
  375. ],
  376. "from": {
  377. "kind": "ImageStream",
  378. "name": "${APPLICATION_NAME}"
  379. }
  380. }
  381. }
  382. ],
  383. "replicas": 1,
  384. "selector": {
  385. "deploymentConfig": "${APPLICATION_NAME}"
  386. },
  387. "template": {
  388. "metadata": {
  389. "name": "${APPLICATION_NAME}",
  390. "labels": {
  391. "deploymentConfig": "${APPLICATION_NAME}",
  392. "application": "${APPLICATION_NAME}"
  393. }
  394. },
  395. "spec": {
  396. "serviceAccount": "eap-service-account",
  397. "containers": [
  398. {
  399. "name": "${APPLICATION_NAME}",
  400. "image": "${APPLICATION_NAME}",
  401. "imagePullPolicy": "Always",
  402. "volumeMounts": [
  403. {
  404. "name": "eap-keystore-volume",
  405. "mountPath": "/etc/eap-secret-volume",
  406. "readOnly": true
  407. }
  408. ],
  409. "readinessProbe": {
  410. "exec": {
  411. "command": [
  412. "/bin/bash",
  413. "-c",
  414. "/opt/eap/bin/readinessProbe.sh"
  415. ]
  416. }
  417. },
  418. "ports": [
  419. {
  420. "name": "http",
  421. "containerPort": 8080,
  422. "protocol": "TCP"
  423. },
  424. {
  425. "name": "https",
  426. "containerPort": 8443,
  427. "protocol": "TCP"
  428. },
  429. {
  430. "name": "ping",
  431. "containerPort": 8888,
  432. "protocol": "TCP"
  433. }
  434. ],
  435. "env": [
  436. {
  437. "name": "DB_SERVICE_PREFIX_MAPPING",
  438. "value": "${APPLICATION_NAME}-mongodb=DB"
  439. },
  440. {
  441. "name": "DB_JNDI",
  442. "value": "${DB_JNDI}"
  443. },
  444. {
  445. "name": "DB_USERNAME",
  446. "value": "${DB_USERNAME}"
  447. },
  448. {
  449. "name": "DB_PASSWORD",
  450. "value": "${DB_PASSWORD}"
  451. },
  452. {
  453. "name": "DB_DATABASE",
  454. "value": "${DB_DATABASE}"
  455. },
  456. {
  457. "name": "DB_ADMIN_PASSWORD",
  458. "value": "${DB_ADMIN_PASSWORD}"
  459. },
  460. {
  461. "name": "DB_MIN_POOL_SIZE",
  462. "value": "${DB_MIN_POOL_SIZE}"
  463. },
  464. {
  465. "name": "DB_MAX_POOL_SIZE",
  466. "value": "${DB_MAX_POOL_SIZE}"
  467. },
  468. {
  469. "name": "DB_TX_ISOLATION",
  470. "value": "${DB_TX_ISOLATION}"
  471. },
  472. {
  473. "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
  474. "value": "${APPLICATION_NAME}-ping"
  475. },
  476. {
  477. "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
  478. "value": "8888"
  479. },
  480. {
  481. "name": "EAP_HTTPS_KEYSTORE_DIR",
  482. "value": "/etc/eap-secret-volume"
  483. },
  484. {
  485. "name": "EAP_HTTPS_KEYSTORE",
  486. "value": "${EAP_HTTPS_KEYSTORE}"
  487. },
  488. {
  489. "name": "EAP_HTTPS_NAME",
  490. "value": "${EAP_HTTPS_NAME}"
  491. },
  492. {
  493. "name": "EAP_HTTPS_PASSWORD",
  494. "value": "${EAP_HTTPS_PASSWORD}"
  495. },
  496. {
  497. "name": "HORNETQ_CLUSTER_PASSWORD",
  498. "value": "${HORNETQ_CLUSTER_PASSWORD}"
  499. },
  500. {
  501. "name": "HORNETQ_QUEUES",
  502. "value": "${HORNETQ_QUEUES}"
  503. },
  504. {
  505. "name": "HORNETQ_TOPICS",
  506. "value": "${HORNETQ_TOPICS}"
  507. }
  508. ]
  509. }
  510. ],
  511. "volumes": [
  512. {
  513. "name": "eap-keystore-volume",
  514. "secret": {
  515. "secretName": "${EAP_HTTPS_SECRET}"
  516. }
  517. }
  518. ]
  519. }
  520. }
  521. }
  522. },
  523. {
  524. "kind": "DeploymentConfig",
  525. "apiVersion": "v1",
  526. "metadata": {
  527. "name": "${APPLICATION_NAME}-mongodb",
  528. "labels": {
  529. "application": "${APPLICATION_NAME}"
  530. }
  531. },
  532. "spec": {
  533. "strategy": {
  534. "type": "Recreate"
  535. },
  536. "triggers": [
  537. {
  538. "type": "ImageChange",
  539. "imageChangeParams": {
  540. "automatic": true,
  541. "containerNames": [
  542. "${APPLICATION_NAME}-mongodb"
  543. ],
  544. "from": {
  545. "kind": "ImageStreamTag",
  546. "namespace": "openshift",
  547. "name": "mongodb:latest"
  548. }
  549. }
  550. }
  551. ],
  552. "replicas": 1,
  553. "selector": {
  554. "deploymentConfig": "${APPLICATION_NAME}-mongodb"
  555. },
  556. "template": {
  557. "metadata": {
  558. "name": "${APPLICATION_NAME}-mongodb",
  559. "labels": {
  560. "deploymentConfig": "${APPLICATION_NAME}-mongodb",
  561. "application": "${APPLICATION_NAME}"
  562. }
  563. },
  564. "spec": {
  565. "containers": [
  566. {
  567. "name": "${APPLICATION_NAME}-mongodb",
  568. "image": "mongodb",
  569. "imagePullPolicy": "Always",
  570. "ports": [
  571. {
  572. "containerPort": 27017,
  573. "protocol": "TCP"
  574. }
  575. ],
  576. "volumeMounts": [
  577. {
  578. "mountPath": "/var/lib/mongodb/data",
  579. "name": "${APPLICATION_NAME}-mongodb-pvol"
  580. }
  581. ],
  582. "env": [
  583. {
  584. "name": "MONGODB_USER",
  585. "value": "${DB_USERNAME}"
  586. },
  587. {
  588. "name": "MONGODB_PASSWORD",
  589. "value": "${DB_PASSWORD}"
  590. },
  591. {
  592. "name": "MONGODB_DATABASE",
  593. "value": "${DB_DATABASE}"
  594. },
  595. {
  596. "name": "MONGODB_ADMIN_PASSWORD",
  597. "value": "${DB_ADMIN_PASSWORD}"
  598. },
  599. {
  600. "name": "MONGODB_NOPREALLOC",
  601. "value": "${MONGODB_NOPREALLOC}"
  602. },
  603. {
  604. "name": "MONGODB_SMALLFILES",
  605. "value": "${MONGODB_SMALLFILES}"
  606. },
  607. {
  608. "name": "MONGODB_QUIET",
  609. "value": "${MONGODB_QUIET}"
  610. }
  611. ]
  612. }
  613. ],
  614. "volumes": [
  615. {
  616. "name": "${APPLICATION_NAME}-mongodb-pvol",
  617. "persistentVolumeClaim": {
  618. "claimName": "${APPLICATION_NAME}-mongodb-claim"
  619. }
  620. }
  621. ]
  622. }
  623. }
  624. }
  625. },
  626. {
  627. "apiVersion": "v1",
  628. "kind": "PersistentVolumeClaim",
  629. "metadata": {
  630. "name": "${APPLICATION_NAME}-mongodb-claim",
  631. "labels": {
  632. "application": "${APPLICATION_NAME}"
  633. }
  634. },
  635. "spec": {
  636. "accessModes": [ "ReadWriteOnce" ],
  637. "resources": {
  638. "requests": {
  639. "storage": "${VOLUME_CAPACITY}"
  640. }
  641. }
  642. }
  643. }
  644. ]
  645. }