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