eap70-mongodb-persistent-s2i.json 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "description": "Application template for EAP 7 MongoDB applications with persistent storage built using S2I.",
  7. "iconClass": "icon-jboss",
  8. "tags": "eap,mongodb,javaee,java,database,jboss,xpaas",
  9. "version": "1.3.1"
  10. },
  11. "name": "eap70-mongodb-persistent-s2i"
  12. },
  13. "labels": {
  14. "template": "eap70-mongodb-persistent-s2i",
  15. "xpaas": "1.3.1"
  16. },
  17. "parameters": [
  18. {
  19. "description": "The name for the application.",
  20. "name": "APPLICATION_NAME",
  21. "value": "eap-app",
  22. "required": true
  23. },
  24. {
  25. "description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>-<project>.<default-domain-suffix>",
  26. "name": "HOSTNAME_HTTP",
  27. "value": "",
  28. "required": false
  29. },
  30. {
  31. "description": "Custom hostname for https service route. Leave blank for default hostname, e.g.: secure-<application-name>-<project>.<default-domain-suffix>",
  32. "name": "HOSTNAME_HTTPS",
  33. "value": "",
  34. "required": false
  35. },
  36. {
  37. "description": "Git source URI for application",
  38. "name": "SOURCE_REPOSITORY_URL",
  39. "value": "https://github.com/jboss-openshift/openshift-quickstarts",
  40. "required": true
  41. },
  42. {
  43. "description": "Git branch/tag reference",
  44. "name": "SOURCE_REPOSITORY_REF",
  45. "value": "1.3",
  46. "required": false
  47. },
  48. {
  49. "description": "Path within Git project to build; empty for root project directory.",
  50. "name": "CONTEXT_DIR",
  51. "value": "todolist/todolist-mongodb",
  52. "required": false
  53. },
  54. {
  55. "description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/mongodb",
  56. "name": "DB_JNDI",
  57. "value": "",
  58. "required": false
  59. },
  60. {
  61. "description": "Database name",
  62. "name": "DB_DATABASE",
  63. "value": "root",
  64. "required": true
  65. },
  66. {
  67. "description": "Size of persistent storage for database volume.",
  68. "name": "VOLUME_CAPACITY",
  69. "value": "512Mi",
  70. "required": true
  71. },
  72. {
  73. "description": "Queue names",
  74. "name": "MQ_QUEUES",
  75. "value": "",
  76. "required": false
  77. },
  78. {
  79. "description": "Topic names",
  80. "name": "MQ_TOPICS",
  81. "value": "",
  82. "required": false
  83. },
  84. {
  85. "description": "The name of the secret containing the keystore file",
  86. "name": "HTTPS_SECRET",
  87. "value": "eap7-app-secret",
  88. "required": false
  89. },
  90. {
  91. "description": "The name of the keystore file within the secret",
  92. "name": "HTTPS_KEYSTORE",
  93. "value": "keystore.jks",
  94. "required": false
  95. },
  96. {
  97. "description": "The name associated with the server certificate",
  98. "name": "HTTPS_NAME",
  99. "value": "",
  100. "required": false
  101. },
  102. {
  103. "description": "The password for the keystore and certificate",
  104. "name": "HTTPS_PASSWORD",
  105. "value": "",
  106. "required": false
  107. },
  108. {
  109. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  110. "name": "DB_MIN_POOL_SIZE",
  111. "required": false
  112. },
  113. {
  114. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  115. "name": "DB_MAX_POOL_SIZE",
  116. "required": false
  117. },
  118. {
  119. "description": "Sets transaction-isolation for the configured datasource.",
  120. "name": "DB_TX_ISOLATION",
  121. "required": false
  122. },
  123. {
  124. "description": "Disable data file preallocation.",
  125. "name": "MONGODB_NOPREALLOC",
  126. "required": false
  127. },
  128. {
  129. "description": "Set MongoDB to use a smaller default data file size.",
  130. "name": "MONGODB_SMALLFILES",
  131. "required": false
  132. },
  133. {
  134. "description": "Runs MongoDB in a quiet mode that attempts to limit the amount of output.",
  135. "name": "MONGODB_QUIET",
  136. "required": false
  137. },
  138. {
  139. "description": "A-MQ cluster admin password",
  140. "name": "MQ_CLUSTER_PASSWORD",
  141. "from": "[a-zA-Z0-9]{8}",
  142. "generate": "expression",
  143. "required": true
  144. },
  145. {
  146. "description": "Database user name",
  147. "name": "DB_USERNAME",
  148. "from": "user[a-zA-Z0-9]{3}",
  149. "generate": "expression",
  150. "required": true
  151. },
  152. {
  153. "description": "Database user password",
  154. "name": "DB_PASSWORD",
  155. "from": "[a-zA-Z0-9]{8}",
  156. "generate": "expression",
  157. "required": true
  158. },
  159. {
  160. "description": "Database admin password",
  161. "name": "DB_ADMIN_PASSWORD",
  162. "from": "[a-zA-Z0-9]{8}",
  163. "generate": "expression",
  164. "required": true
  165. },
  166. {
  167. "description": "GitHub trigger secret",
  168. "name": "GITHUB_WEBHOOK_SECRET",
  169. "from": "[a-zA-Z0-9]{8}",
  170. "generate": "expression",
  171. "required": true
  172. },
  173. {
  174. "description": "Generic build trigger secret",
  175. "name": "GENERIC_WEBHOOK_SECRET",
  176. "from": "[a-zA-Z0-9]{8}",
  177. "generate": "expression",
  178. "required": true
  179. },
  180. {
  181. "description": "Namespace in which the ImageStreams for Red Hat Middleware images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.",
  182. "name": "IMAGE_STREAM_NAMESPACE",
  183. "value": "openshift",
  184. "required": true
  185. },
  186. {
  187. "description": "The name of the secret containing the keystore file",
  188. "name": "JGROUPS_ENCRYPT_SECRET",
  189. "value": "eap7-app-secret",
  190. "required": false
  191. },
  192. {
  193. "description": "The name of the keystore file within the secret",
  194. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  195. "value": "jgroups.jceks",
  196. "required": false
  197. },
  198. {
  199. "description": "The name associated with the server certificate",
  200. "name": "JGROUPS_ENCRYPT_NAME",
  201. "value": "",
  202. "required": false
  203. },
  204. {
  205. "description": "The password for the keystore and certificate",
  206. "name": "JGROUPS_ENCRYPT_PASSWORD",
  207. "value": "",
  208. "required": false
  209. },
  210. {
  211. "description": "JGroups cluster password",
  212. "name": "JGROUPS_CLUSTER_PASSWORD",
  213. "from": "[a-zA-Z0-9]{8}",
  214. "generate": "expression",
  215. "required": true
  216. }
  217. ],
  218. "objects": [
  219. {
  220. "kind": "Service",
  221. "apiVersion": "v1",
  222. "spec": {
  223. "ports": [
  224. {
  225. "port": 8080,
  226. "targetPort": 8080
  227. }
  228. ],
  229. "selector": {
  230. "deploymentConfig": "${APPLICATION_NAME}"
  231. }
  232. },
  233. "metadata": {
  234. "name": "${APPLICATION_NAME}",
  235. "labels": {
  236. "application": "${APPLICATION_NAME}"
  237. },
  238. "annotations": {
  239. "description": "The web server's http port."
  240. }
  241. }
  242. },
  243. {
  244. "kind": "Service",
  245. "apiVersion": "v1",
  246. "spec": {
  247. "ports": [
  248. {
  249. "port": 8443,
  250. "targetPort": 8443
  251. }
  252. ],
  253. "selector": {
  254. "deploymentConfig": "${APPLICATION_NAME}"
  255. }
  256. },
  257. "metadata": {
  258. "name": "secure-${APPLICATION_NAME}",
  259. "labels": {
  260. "application": "${APPLICATION_NAME}"
  261. },
  262. "annotations": {
  263. "description": "The web server's https port."
  264. }
  265. }
  266. },
  267. {
  268. "kind": "Service",
  269. "apiVersion": "v1",
  270. "spec": {
  271. "ports": [
  272. {
  273. "port": 27017,
  274. "targetPort": 27017
  275. }
  276. ],
  277. "selector": {
  278. "deploymentConfig": "${APPLICATION_NAME}-mongodb"
  279. }
  280. },
  281. "metadata": {
  282. "name": "${APPLICATION_NAME}-mongodb",
  283. "labels": {
  284. "application": "${APPLICATION_NAME}"
  285. },
  286. "annotations": {
  287. "description": "The database server's port."
  288. }
  289. }
  290. },
  291. {
  292. "kind": "Route",
  293. "apiVersion": "v1",
  294. "id": "${APPLICATION_NAME}-http",
  295. "metadata": {
  296. "name": "${APPLICATION_NAME}",
  297. "labels": {
  298. "application": "${APPLICATION_NAME}"
  299. },
  300. "annotations": {
  301. "description": "Route for application's http service."
  302. }
  303. },
  304. "spec": {
  305. "host": "${HOSTNAME_HTTP}",
  306. "to": {
  307. "name": "${APPLICATION_NAME}"
  308. }
  309. }
  310. },
  311. {
  312. "kind": "Route",
  313. "apiVersion": "v1",
  314. "id": "${APPLICATION_NAME}-https",
  315. "metadata": {
  316. "name": "secure-${APPLICATION_NAME}",
  317. "labels": {
  318. "application": "${APPLICATION_NAME}"
  319. },
  320. "annotations": {
  321. "description": "Route for application's https service."
  322. }
  323. },
  324. "spec": {
  325. "host": "${HOSTNAME_HTTPS}",
  326. "to": {
  327. "name": "secure-${APPLICATION_NAME}"
  328. },
  329. "tls": {
  330. "termination": "passthrough"
  331. }
  332. }
  333. },
  334. {
  335. "kind": "ImageStream",
  336. "apiVersion": "v1",
  337. "metadata": {
  338. "name": "${APPLICATION_NAME}",
  339. "labels": {
  340. "application": "${APPLICATION_NAME}"
  341. }
  342. }
  343. },
  344. {
  345. "kind": "BuildConfig",
  346. "apiVersion": "v1",
  347. "metadata": {
  348. "name": "${APPLICATION_NAME}",
  349. "labels": {
  350. "application": "${APPLICATION_NAME}"
  351. }
  352. },
  353. "spec": {
  354. "source": {
  355. "type": "Git",
  356. "git": {
  357. "uri": "${SOURCE_REPOSITORY_URL}",
  358. "ref": "${SOURCE_REPOSITORY_REF}"
  359. },
  360. "contextDir": "${CONTEXT_DIR}"
  361. },
  362. "strategy": {
  363. "type": "Source",
  364. "sourceStrategy": {
  365. "forcePull": true,
  366. "from": {
  367. "kind": "ImageStreamTag",
  368. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  369. "name": "jboss-eap70-openshift:1.3"
  370. }
  371. }
  372. },
  373. "output": {
  374. "to": {
  375. "kind": "ImageStreamTag",
  376. "name": "${APPLICATION_NAME}:latest"
  377. }
  378. },
  379. "triggers": [
  380. {
  381. "type": "GitHub",
  382. "github": {
  383. "secret": "${GITHUB_WEBHOOK_SECRET}"
  384. }
  385. },
  386. {
  387. "type": "Generic",
  388. "generic": {
  389. "secret": "${GENERIC_WEBHOOK_SECRET}"
  390. }
  391. },
  392. {
  393. "type": "ImageChange",
  394. "imageChange": {}
  395. },
  396. {
  397. "type": "ConfigChange"
  398. }
  399. ]
  400. }
  401. },
  402. {
  403. "kind": "DeploymentConfig",
  404. "apiVersion": "v1",
  405. "metadata": {
  406. "name": "${APPLICATION_NAME}",
  407. "labels": {
  408. "application": "${APPLICATION_NAME}"
  409. }
  410. },
  411. "spec": {
  412. "strategy": {
  413. "type": "Recreate"
  414. },
  415. "triggers": [
  416. {
  417. "type": "ImageChange",
  418. "imageChangeParams": {
  419. "automatic": true,
  420. "containerNames": [
  421. "${APPLICATION_NAME}"
  422. ],
  423. "from": {
  424. "kind": "ImageStream",
  425. "name": "${APPLICATION_NAME}"
  426. }
  427. }
  428. },
  429. {
  430. "type": "ConfigChange"
  431. }
  432. ],
  433. "replicas": 1,
  434. "selector": {
  435. "deploymentConfig": "${APPLICATION_NAME}"
  436. },
  437. "template": {
  438. "metadata": {
  439. "name": "${APPLICATION_NAME}",
  440. "labels": {
  441. "deploymentConfig": "${APPLICATION_NAME}",
  442. "application": "${APPLICATION_NAME}"
  443. }
  444. },
  445. "spec": {
  446. "serviceAccountName": "eap7-service-account",
  447. "terminationGracePeriodSeconds": 60,
  448. "containers": [
  449. {
  450. "name": "${APPLICATION_NAME}",
  451. "image": "${APPLICATION_NAME}",
  452. "imagePullPolicy": "Always",
  453. "volumeMounts": [
  454. {
  455. "name": "eap-keystore-volume",
  456. "mountPath": "/etc/eap-secret-volume",
  457. "readOnly": true
  458. },
  459. {
  460. "name": "eap-jgroups-keystore-volume",
  461. "mountPath": "/etc/jgroups-encrypt-secret-volume",
  462. "readOnly": true
  463. }
  464. ],
  465. "livenessProbe": {
  466. "exec": {
  467. "command": [
  468. "/bin/bash",
  469. "-c",
  470. "/opt/eap/bin/livenessProbe.sh"
  471. ]
  472. }
  473. },
  474. "readinessProbe": {
  475. "exec": {
  476. "command": [
  477. "/bin/bash",
  478. "-c",
  479. "/opt/eap/bin/readinessProbe.sh"
  480. ]
  481. }
  482. },
  483. "ports": [
  484. {
  485. "name": "jolokia",
  486. "containerPort": 8778,
  487. "protocol": "TCP"
  488. },
  489. {
  490. "name": "http",
  491. "containerPort": 8080,
  492. "protocol": "TCP"
  493. },
  494. {
  495. "name": "https",
  496. "containerPort": 8443,
  497. "protocol": "TCP"
  498. },
  499. {
  500. "name": "ping",
  501. "containerPort": 8888,
  502. "protocol": "TCP"
  503. }
  504. ],
  505. "env": [
  506. {
  507. "name": "DB_SERVICE_PREFIX_MAPPING",
  508. "value": "${APPLICATION_NAME}-mongodb=DB"
  509. },
  510. {
  511. "name": "DB_JNDI",
  512. "value": "${DB_JNDI}"
  513. },
  514. {
  515. "name": "DB_USERNAME",
  516. "value": "${DB_USERNAME}"
  517. },
  518. {
  519. "name": "DB_PASSWORD",
  520. "value": "${DB_PASSWORD}"
  521. },
  522. {
  523. "name": "DB_DATABASE",
  524. "value": "${DB_DATABASE}"
  525. },
  526. {
  527. "name": "DB_ADMIN_PASSWORD",
  528. "value": "${DB_ADMIN_PASSWORD}"
  529. },
  530. {
  531. "name": "DB_MIN_POOL_SIZE",
  532. "value": "${DB_MIN_POOL_SIZE}"
  533. },
  534. {
  535. "name": "DB_MAX_POOL_SIZE",
  536. "value": "${DB_MAX_POOL_SIZE}"
  537. },
  538. {
  539. "name": "DB_TX_ISOLATION",
  540. "value": "${DB_TX_ISOLATION}"
  541. },
  542. {
  543. "name": "OPENSHIFT_KUBE_PING_LABELS",
  544. "value": "application=${APPLICATION_NAME}"
  545. },
  546. {
  547. "name": "OPENSHIFT_KUBE_PING_NAMESPACE",
  548. "valueFrom": {
  549. "fieldRef": {
  550. "fieldPath": "metadata.namespace"
  551. }
  552. }
  553. },
  554. {
  555. "name": "HTTPS_KEYSTORE_DIR",
  556. "value": "/etc/eap-secret-volume"
  557. },
  558. {
  559. "name": "HTTPS_KEYSTORE",
  560. "value": "${HTTPS_KEYSTORE}"
  561. },
  562. {
  563. "name": "HTTPS_NAME",
  564. "value": "${HTTPS_NAME}"
  565. },
  566. {
  567. "name": "HTTPS_PASSWORD",
  568. "value": "${HTTPS_PASSWORD}"
  569. },
  570. {
  571. "name": "MQ_CLUSTER_PASSWORD",
  572. "value": "${MQ_CLUSTER_PASSWORD}"
  573. },
  574. {
  575. "name": "MQ_QUEUES",
  576. "value": "${MQ_QUEUES}"
  577. },
  578. {
  579. "name": "MQ_TOPICS",
  580. "value": "${MQ_TOPICS}"
  581. },
  582. {
  583. "name": "JGROUPS_ENCRYPT_SECRET",
  584. "value": "${JGROUPS_ENCRYPT_SECRET}"
  585. },
  586. {
  587. "name": "JGROUPS_ENCRYPT_KEYSTORE_DIR",
  588. "value": "/etc/jgroups-encrypt-secret-volume"
  589. },
  590. {
  591. "name": "JGROUPS_ENCRYPT_KEYSTORE",
  592. "value": "${JGROUPS_ENCRYPT_KEYSTORE}"
  593. },
  594. {
  595. "name": "JGROUPS_ENCRYPT_NAME",
  596. "value": "${JGROUPS_ENCRYPT_NAME}"
  597. },
  598. {
  599. "name": "JGROUPS_ENCRYPT_PASSWORD",
  600. "value": "${JGROUPS_ENCRYPT_PASSWORD}"
  601. },
  602. {
  603. "name": "JGROUPS_CLUSTER_PASSWORD",
  604. "value": "${JGROUPS_CLUSTER_PASSWORD}"
  605. }
  606. ]
  607. }
  608. ],
  609. "volumes": [
  610. {
  611. "name": "eap-keystore-volume",
  612. "secret": {
  613. "secretName": "${HTTPS_SECRET}"
  614. }
  615. },
  616. {
  617. "name": "eap-jgroups-keystore-volume",
  618. "secret": {
  619. "secretName": "${JGROUPS_ENCRYPT_SECRET}"
  620. }
  621. }
  622. ]
  623. }
  624. }
  625. }
  626. },
  627. {
  628. "kind": "DeploymentConfig",
  629. "apiVersion": "v1",
  630. "metadata": {
  631. "name": "${APPLICATION_NAME}-mongodb",
  632. "labels": {
  633. "application": "${APPLICATION_NAME}"
  634. }
  635. },
  636. "spec": {
  637. "strategy": {
  638. "type": "Recreate"
  639. },
  640. "triggers": [
  641. {
  642. "type": "ImageChange",
  643. "imageChangeParams": {
  644. "automatic": true,
  645. "containerNames": [
  646. "${APPLICATION_NAME}-mongodb"
  647. ],
  648. "from": {
  649. "kind": "ImageStreamTag",
  650. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  651. "name": "mongodb:latest"
  652. }
  653. }
  654. },
  655. {
  656. "type": "ConfigChange"
  657. }
  658. ],
  659. "replicas": 1,
  660. "selector": {
  661. "deploymentConfig": "${APPLICATION_NAME}-mongodb"
  662. },
  663. "template": {
  664. "metadata": {
  665. "name": "${APPLICATION_NAME}-mongodb",
  666. "labels": {
  667. "deploymentConfig": "${APPLICATION_NAME}-mongodb",
  668. "application": "${APPLICATION_NAME}"
  669. }
  670. },
  671. "spec": {
  672. "terminationGracePeriodSeconds": 60,
  673. "containers": [
  674. {
  675. "name": "${APPLICATION_NAME}-mongodb",
  676. "image": "mongodb",
  677. "imagePullPolicy": "Always",
  678. "ports": [
  679. {
  680. "containerPort": 27017,
  681. "protocol": "TCP"
  682. }
  683. ],
  684. "volumeMounts": [
  685. {
  686. "mountPath": "/var/lib/mongodb/data",
  687. "name": "${APPLICATION_NAME}-mongodb-pvol"
  688. }
  689. ],
  690. "env": [
  691. {
  692. "name": "MONGODB_USER",
  693. "value": "${DB_USERNAME}"
  694. },
  695. {
  696. "name": "MONGODB_PASSWORD",
  697. "value": "${DB_PASSWORD}"
  698. },
  699. {
  700. "name": "MONGODB_DATABASE",
  701. "value": "${DB_DATABASE}"
  702. },
  703. {
  704. "name": "MONGODB_ADMIN_PASSWORD",
  705. "value": "${DB_ADMIN_PASSWORD}"
  706. },
  707. {
  708. "name": "MONGODB_NOPREALLOC",
  709. "value": "${MONGODB_NOPREALLOC}"
  710. },
  711. {
  712. "name": "MONGODB_SMALLFILES",
  713. "value": "${MONGODB_SMALLFILES}"
  714. },
  715. {
  716. "name": "MONGODB_QUIET",
  717. "value": "${MONGODB_QUIET}"
  718. }
  719. ]
  720. }
  721. ],
  722. "volumes": [
  723. {
  724. "name": "${APPLICATION_NAME}-mongodb-pvol",
  725. "persistentVolumeClaim": {
  726. "claimName": "${APPLICATION_NAME}-mongodb-claim"
  727. }
  728. }
  729. ]
  730. }
  731. }
  732. }
  733. },
  734. {
  735. "apiVersion": "v1",
  736. "kind": "PersistentVolumeClaim",
  737. "metadata": {
  738. "name": "${APPLICATION_NAME}-mongodb-claim",
  739. "labels": {
  740. "application": "${APPLICATION_NAME}"
  741. }
  742. },
  743. "spec": {
  744. "accessModes": [
  745. "ReadWriteOnce"
  746. ],
  747. "resources": {
  748. "requests": {
  749. "storage": "${VOLUME_CAPACITY}"
  750. }
  751. }
  752. }
  753. }
  754. ]
  755. }