jws31-tomcat7-mongodb-s2i.json 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass": "icon-rh-tomcat",
  7. "openshift.io/provider-display-name": "Red Hat, Inc.",
  8. "description": "Application template for JWS MongoDB applications built using S2I.",
  9. "tags": "tomcat,tomcat7,java,jboss,hidden",
  10. "version": "1.4.14",
  11. "openshift.io/display-name": "JBoss Web Server 3.1 Apache Tomcat 7 + MongoDB (Ephemeral with https)"
  12. },
  13. "name": "jws31-tomcat7-mongodb-s2i"
  14. },
  15. "labels": {
  16. "template": "jws31-tomcat7-mongodb-s2i",
  17. "xpaas": "1.4.14"
  18. },
  19. "message": "A new JWS application for Apache Tomcat 7 (using MongoDB) has been created in your project. The username/password for administering your JWS is ${JWS_ADMIN_USERNAME}/${JWS_ADMIN_PASSWORD}. For accessing the MongoDB database \"${DB_DATABASE}\" use the credentials ${DB_USERNAME}/${DB_PASSWORD} (Admin password is \"${DB_ADMIN_PASSWORD}\"). Please be sure to create the secret named \"${JWS_HTTPS_SECRET}\" containing the ${JWS_HTTPS_CERTIFICATE} file used for serving secure content.",
  20. "parameters": [
  21. {
  22. "displayName": "Application Name",
  23. "description": "The name for the application.",
  24. "name": "APPLICATION_NAME",
  25. "value": "jws-app",
  26. "required": true
  27. },
  28. {
  29. "displayName": "Custom http Route Hostname",
  30. "description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>-<project>.<default-domain-suffix>",
  31. "name": "HOSTNAME_HTTP",
  32. "value": "",
  33. "required": false
  34. },
  35. {
  36. "displayName": "Custom https Route Hostname",
  37. "description": "Custom hostname for https service route. Leave blank for default hostname, e.g.: secure-<application-name>-<project>.<default-domain-suffix>",
  38. "name": "HOSTNAME_HTTPS",
  39. "value": "",
  40. "required": false
  41. },
  42. {
  43. "displayName": "Git Repository URL",
  44. "description": "Git source URI for application",
  45. "name": "SOURCE_REPOSITORY_URL",
  46. "value": "https://github.com/jboss-openshift/openshift-quickstarts",
  47. "required": true
  48. },
  49. {
  50. "displayName": "Git Reference",
  51. "description": "Git branch/tag reference",
  52. "name": "SOURCE_REPOSITORY_REF",
  53. "value": "1.2",
  54. "required": false
  55. },
  56. {
  57. "displayName": "Context Directory",
  58. "description": "Path within Git project to build; empty for root project directory.",
  59. "name": "CONTEXT_DIR",
  60. "value": "todolist/todolist-mongodb",
  61. "required": false
  62. },
  63. {
  64. "displayName": "Database JNDI Name",
  65. "description": "Database JNDI name used by application to resolve the datasource, e.g. java:/jboss/datasources/mongodb",
  66. "name": "DB_JNDI",
  67. "value": "",
  68. "required": false
  69. },
  70. {
  71. "displayName": "Database Name",
  72. "description": "Database name",
  73. "name": "DB_DATABASE",
  74. "value": "root",
  75. "required": true
  76. },
  77. {
  78. "displayName": "Secret Name",
  79. "description": "The name of the secret containing the certificate files",
  80. "name": "JWS_HTTPS_SECRET",
  81. "value": "jws-app-secret",
  82. "required": true
  83. },
  84. {
  85. "displayName": "Certificate Name",
  86. "description": "The name of the certificate file within the secret",
  87. "name": "JWS_HTTPS_CERTIFICATE",
  88. "value": "server.crt",
  89. "required": false
  90. },
  91. {
  92. "displayName": "Certificate Key Name",
  93. "description": "The name of the certificate key file within the secret",
  94. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  95. "value": "server.key",
  96. "required": false
  97. },
  98. {
  99. "displayName": "Certificate Password",
  100. "description": "The certificate password",
  101. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  102. "value": "",
  103. "required": false
  104. },
  105. {
  106. "displayName": "Datasource Minimum Pool Size",
  107. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  108. "name": "DB_MIN_POOL_SIZE",
  109. "required": false
  110. },
  111. {
  112. "displayName": "Datasource Maximum Pool Size",
  113. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  114. "name": "DB_MAX_POOL_SIZE",
  115. "required": false
  116. },
  117. {
  118. "displayName": "Datasource Transaction Isolation",
  119. "description": "Sets transaction-isolation for the configured datasource.",
  120. "name": "DB_TX_ISOLATION",
  121. "required": false
  122. },
  123. {
  124. "displayName": "MongoDB No Preallocation",
  125. "description": "Disable data file preallocation.",
  126. "name": "MONGODB_NOPREALLOC",
  127. "required": false
  128. },
  129. {
  130. "displayName": "MongoDB Small Files",
  131. "description": "Set MongoDB to use a smaller default data file size.",
  132. "name": "MONGODB_SMALLFILES",
  133. "required": false
  134. },
  135. {
  136. "displayName": "MongoDB Quiet",
  137. "description": "Runs MongoDB in a quiet mode that attempts to limit the amount of output.",
  138. "name": "MONGODB_QUIET",
  139. "required": false
  140. },
  141. {
  142. "displayName": "Database Username",
  143. "description": "Database user name",
  144. "name": "DB_USERNAME",
  145. "from": "user[a-zA-Z0-9]{3}",
  146. "generate": "expression",
  147. "required": true
  148. },
  149. {
  150. "displayName": "Database Password",
  151. "description": "Database user password",
  152. "name": "DB_PASSWORD",
  153. "from": "[a-zA-Z0-9]{8}",
  154. "generate": "expression",
  155. "required": true
  156. },
  157. {
  158. "displayName": "Database admin password",
  159. "description": "Database admin password",
  160. "name": "DB_ADMIN_PASSWORD",
  161. "from": "[a-zA-Z0-9]{8}",
  162. "generate": "expression",
  163. "required": true
  164. },
  165. {
  166. "displayName": "JWS Admin Username",
  167. "description": "JWS Admin User",
  168. "name": "JWS_ADMIN_USERNAME",
  169. "from": "[a-zA-Z0-9]{8}",
  170. "generate": "expression",
  171. "required": true
  172. },
  173. {
  174. "displayName": "JWS Admin Password",
  175. "description": "JWS Admin Password",
  176. "name": "JWS_ADMIN_PASSWORD",
  177. "from": "[a-zA-Z0-9]{8}",
  178. "generate": "expression",
  179. "required": true
  180. },
  181. {
  182. "displayName": "Github Webhook Secret",
  183. "description": "GitHub trigger secret",
  184. "name": "GITHUB_WEBHOOK_SECRET",
  185. "from": "[a-zA-Z0-9]{8}",
  186. "generate": "expression",
  187. "required": true
  188. },
  189. {
  190. "displayName": "Generic Webhook Secret",
  191. "description": "Generic build trigger secret",
  192. "name": "GENERIC_WEBHOOK_SECRET",
  193. "from": "[a-zA-Z0-9]{8}",
  194. "generate": "expression",
  195. "required": true
  196. },
  197. {
  198. "displayName": "ImageStream Namespace",
  199. "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.",
  200. "name": "IMAGE_STREAM_NAMESPACE",
  201. "value": "openshift",
  202. "required": true
  203. },
  204. {
  205. "displayName": "Maven mirror URL",
  206. "description": "Maven mirror to use for S2I builds",
  207. "name": "MAVEN_MIRROR_URL",
  208. "value": "",
  209. "required": false
  210. },
  211. {
  212. "description": "List of directories from which archives will be copied into the deployment folder. If unspecified, all archives in /target will be copied.",
  213. "name": "ARTIFACT_DIR",
  214. "value": "",
  215. "required": false
  216. },
  217. {
  218. "displayName": "MongoDB Image Stream Tag",
  219. "description": "The tag to use for the \"mongodb\" image stream. Typically, this aligns with the major.minor version of MongoDB.",
  220. "name": "MONGODB_IMAGE_STREAM_TAG",
  221. "value": "3.2",
  222. "required": true
  223. }
  224. ],
  225. "objects": [
  226. {
  227. "kind": "Service",
  228. "apiVersion": "v1",
  229. "spec": {
  230. "ports": [
  231. {
  232. "port": 8080,
  233. "targetPort": 8080
  234. }
  235. ],
  236. "selector": {
  237. "deploymentConfig": "${APPLICATION_NAME}"
  238. }
  239. },
  240. "metadata": {
  241. "name": "${APPLICATION_NAME}",
  242. "labels": {
  243. "application": "${APPLICATION_NAME}"
  244. },
  245. "annotations": {
  246. "description": "The web server's http port.",
  247. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-mongodb\", \"kind\": \"Service\"}]"
  248. }
  249. }
  250. },
  251. {
  252. "kind": "Service",
  253. "apiVersion": "v1",
  254. "spec": {
  255. "ports": [
  256. {
  257. "port": 8443,
  258. "targetPort": 8443
  259. }
  260. ],
  261. "selector": {
  262. "deploymentConfig": "${APPLICATION_NAME}"
  263. }
  264. },
  265. "metadata": {
  266. "name": "secure-${APPLICATION_NAME}",
  267. "labels": {
  268. "application": "${APPLICATION_NAME}"
  269. },
  270. "annotations": {
  271. "description": "The web server's https port.",
  272. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-mongodb\", \"kind\": \"Service\"}]"
  273. }
  274. }
  275. },
  276. {
  277. "kind": "Service",
  278. "apiVersion": "v1",
  279. "spec": {
  280. "ports": [
  281. {
  282. "port": 27017,
  283. "targetPort": 27017
  284. }
  285. ],
  286. "selector": {
  287. "deploymentConfig": "${APPLICATION_NAME}-mongodb"
  288. }
  289. },
  290. "metadata": {
  291. "name": "${APPLICATION_NAME}-mongodb",
  292. "labels": {
  293. "application": "${APPLICATION_NAME}"
  294. },
  295. "annotations": {
  296. "description": "The database server's port."
  297. }
  298. }
  299. },
  300. {
  301. "kind": "Route",
  302. "apiVersion": "v1",
  303. "id": "${APPLICATION_NAME}-http",
  304. "metadata": {
  305. "name": "${APPLICATION_NAME}",
  306. "labels": {
  307. "application": "${APPLICATION_NAME}"
  308. },
  309. "annotations": {
  310. "description": "Route for application's http service."
  311. }
  312. },
  313. "spec": {
  314. "host": "${HOSTNAME_HTTP}",
  315. "to": {
  316. "name": "${APPLICATION_NAME}"
  317. }
  318. }
  319. },
  320. {
  321. "kind": "Route",
  322. "apiVersion": "v1",
  323. "id": "${APPLICATION_NAME}-https",
  324. "metadata": {
  325. "name": "secure-${APPLICATION_NAME}",
  326. "labels": {
  327. "application": "${APPLICATION_NAME}"
  328. },
  329. "annotations": {
  330. "description": "Route for application's https service."
  331. }
  332. },
  333. "spec": {
  334. "host": "${HOSTNAME_HTTPS}",
  335. "to": {
  336. "name": "secure-${APPLICATION_NAME}"
  337. },
  338. "tls": {
  339. "termination": "passthrough"
  340. }
  341. }
  342. },
  343. {
  344. "kind": "ImageStream",
  345. "apiVersion": "v1",
  346. "metadata": {
  347. "name": "${APPLICATION_NAME}",
  348. "labels": {
  349. "application": "${APPLICATION_NAME}"
  350. }
  351. }
  352. },
  353. {
  354. "kind": "BuildConfig",
  355. "apiVersion": "v1",
  356. "metadata": {
  357. "name": "${APPLICATION_NAME}",
  358. "labels": {
  359. "application": "${APPLICATION_NAME}"
  360. }
  361. },
  362. "spec": {
  363. "source": {
  364. "type": "Git",
  365. "git": {
  366. "uri": "${SOURCE_REPOSITORY_URL}",
  367. "ref": "${SOURCE_REPOSITORY_REF}"
  368. },
  369. "contextDir": "${CONTEXT_DIR}"
  370. },
  371. "strategy": {
  372. "type": "Source",
  373. "sourceStrategy": {
  374. "env": [
  375. {
  376. "name": "MAVEN_MIRROR_URL",
  377. "value": "${MAVEN_MIRROR_URL}"
  378. },
  379. {
  380. "name": "ARTIFACT_DIR",
  381. "value": "${ARTIFACT_DIR}"
  382. }
  383. ],
  384. "forcePull": true,
  385. "from": {
  386. "kind": "ImageStreamTag",
  387. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  388. "name": "jboss-webserver31-tomcat7-openshift:1.2"
  389. }
  390. }
  391. },
  392. "output": {
  393. "to": {
  394. "kind": "ImageStreamTag",
  395. "name": "${APPLICATION_NAME}:latest"
  396. }
  397. },
  398. "triggers": [
  399. {
  400. "type": "GitHub",
  401. "github": {
  402. "secret": "${GITHUB_WEBHOOK_SECRET}"
  403. }
  404. },
  405. {
  406. "type": "Generic",
  407. "generic": {
  408. "secret": "${GENERIC_WEBHOOK_SECRET}"
  409. }
  410. },
  411. {
  412. "type": "ImageChange",
  413. "imageChange": {}
  414. },
  415. {
  416. "type": "ConfigChange"
  417. }
  418. ]
  419. }
  420. },
  421. {
  422. "kind": "DeploymentConfig",
  423. "apiVersion": "v1",
  424. "metadata": {
  425. "name": "${APPLICATION_NAME}",
  426. "labels": {
  427. "application": "${APPLICATION_NAME}"
  428. }
  429. },
  430. "spec": {
  431. "strategy": {
  432. "type": "Recreate"
  433. },
  434. "triggers": [
  435. {
  436. "type": "ImageChange",
  437. "imageChangeParams": {
  438. "automatic": true,
  439. "containerNames": [
  440. "${APPLICATION_NAME}"
  441. ],
  442. "from": {
  443. "kind": "ImageStreamTag",
  444. "name": "${APPLICATION_NAME}:latest"
  445. }
  446. }
  447. },
  448. {
  449. "type": "ConfigChange"
  450. }
  451. ],
  452. "replicas": 1,
  453. "selector": {
  454. "deploymentConfig": "${APPLICATION_NAME}"
  455. },
  456. "template": {
  457. "metadata": {
  458. "name": "${APPLICATION_NAME}",
  459. "labels": {
  460. "deploymentConfig": "${APPLICATION_NAME}",
  461. "application": "${APPLICATION_NAME}"
  462. }
  463. },
  464. "spec": {
  465. "terminationGracePeriodSeconds": 60,
  466. "containers": [
  467. {
  468. "name": "${APPLICATION_NAME}",
  469. "image": "${APPLICATION_NAME}",
  470. "imagePullPolicy": "Always",
  471. "readinessProbe": {
  472. "exec": {
  473. "command": [
  474. "/bin/bash",
  475. "-c",
  476. "curl --noproxy '*' -s -u ${JWS_ADMIN_USERNAME}:${JWS_ADMIN_PASSWORD} 'http://localhost:8080/manager/jmxproxy/?get=Catalina%3Atype%3DServer&att=stateName' |grep -iq 'stateName *= *STARTED'"
  477. ]
  478. }
  479. },
  480. "volumeMounts": [
  481. {
  482. "name": "jws-certificate-volume",
  483. "mountPath": "/etc/jws-secret-volume",
  484. "readOnly": true
  485. }
  486. ],
  487. "ports": [
  488. {
  489. "name": "jolokia",
  490. "containerPort": 8778,
  491. "protocol": "TCP"
  492. },
  493. {
  494. "name": "http",
  495. "containerPort": 8080,
  496. "protocol": "TCP"
  497. },
  498. {
  499. "name": "https",
  500. "containerPort": 8443,
  501. "protocol": "TCP"
  502. }
  503. ],
  504. "env": [
  505. {
  506. "name": "DB_SERVICE_PREFIX_MAPPING",
  507. "value": "${APPLICATION_NAME}-mongodb=DB"
  508. },
  509. {
  510. "name": "DB_JNDI",
  511. "value": "${DB_JNDI}"
  512. },
  513. {
  514. "name": "DB_USERNAME",
  515. "value": "${DB_USERNAME}"
  516. },
  517. {
  518. "name": "DB_PASSWORD",
  519. "value": "${DB_PASSWORD}"
  520. },
  521. {
  522. "name": "DB_DATABASE",
  523. "value": "${DB_DATABASE}"
  524. },
  525. {
  526. "name": "DB_ADMIN_PASSWORD",
  527. "value": "${DB_ADMIN_PASSWORD}"
  528. },
  529. {
  530. "name": "DB_MIN_POOL_SIZE",
  531. "value": "${DB_MIN_POOL_SIZE}"
  532. },
  533. {
  534. "name": "DB_MAX_POOL_SIZE",
  535. "value": "${DB_MAX_POOL_SIZE}"
  536. },
  537. {
  538. "name": "DB_TX_ISOLATION",
  539. "value": "${DB_TX_ISOLATION}"
  540. },
  541. {
  542. "name": "JWS_HTTPS_CERTIFICATE_DIR",
  543. "value": "/etc/jws-secret-volume"
  544. },
  545. {
  546. "name": "JWS_HTTPS_CERTIFICATE",
  547. "value": "${JWS_HTTPS_CERTIFICATE}"
  548. },
  549. {
  550. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  551. "value": "${JWS_HTTPS_CERTIFICATE_KEY}"
  552. },
  553. {
  554. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  555. "value": "${JWS_HTTPS_CERTIFICATE_PASSWORD}"
  556. },
  557. {
  558. "name": "JWS_ADMIN_USERNAME",
  559. "value": "${JWS_ADMIN_USERNAME}"
  560. },
  561. {
  562. "name": "JWS_ADMIN_PASSWORD",
  563. "value": "${JWS_ADMIN_PASSWORD}"
  564. }
  565. ]
  566. }
  567. ],
  568. "volumes": [
  569. {
  570. "name": "jws-certificate-volume",
  571. "secret": {
  572. "secretName": "${JWS_HTTPS_SECRET}"
  573. }
  574. }
  575. ]
  576. }
  577. }
  578. }
  579. },
  580. {
  581. "kind": "DeploymentConfig",
  582. "apiVersion": "v1",
  583. "metadata": {
  584. "name": "${APPLICATION_NAME}-mongodb",
  585. "labels": {
  586. "application": "${APPLICATION_NAME}"
  587. }
  588. },
  589. "spec": {
  590. "strategy": {
  591. "type": "Recreate"
  592. },
  593. "triggers": [
  594. {
  595. "type": "ImageChange",
  596. "imageChangeParams": {
  597. "automatic": true,
  598. "containerNames": [
  599. "${APPLICATION_NAME}-mongodb"
  600. ],
  601. "from": {
  602. "kind": "ImageStreamTag",
  603. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  604. "name": "mongodb:${MONGODB_IMAGE_STREAM_TAG}"
  605. }
  606. }
  607. },
  608. {
  609. "type": "ConfigChange"
  610. }
  611. ],
  612. "replicas": 1,
  613. "selector": {
  614. "deploymentConfig": "${APPLICATION_NAME}-mongodb"
  615. },
  616. "template": {
  617. "metadata": {
  618. "name": "${APPLICATION_NAME}-mongodb",
  619. "labels": {
  620. "deploymentConfig": "${APPLICATION_NAME}-mongodb",
  621. "application": "${APPLICATION_NAME}"
  622. }
  623. },
  624. "spec": {
  625. "terminationGracePeriodSeconds": 60,
  626. "containers": [
  627. {
  628. "name": "${APPLICATION_NAME}-mongodb",
  629. "image": "mongodb",
  630. "imagePullPolicy": "Always",
  631. "ports": [
  632. {
  633. "containerPort": 27017,
  634. "protocol": "TCP"
  635. }
  636. ],
  637. "readinessProbe": {
  638. "timeoutSeconds": 1,
  639. "initialDelaySeconds": 3,
  640. "exec": {
  641. "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]
  642. }
  643. },
  644. "livenessProbe": {
  645. "timeoutSeconds": 1,
  646. "initialDelaySeconds": 30,
  647. "tcpSocket": {
  648. "port": 27017
  649. }
  650. },
  651. "env": [
  652. {
  653. "name": "MONGODB_USER",
  654. "value": "${DB_USERNAME}"
  655. },
  656. {
  657. "name": "MONGODB_PASSWORD",
  658. "value": "${DB_PASSWORD}"
  659. },
  660. {
  661. "name": "MONGODB_DATABASE",
  662. "value": "${DB_DATABASE}"
  663. },
  664. {
  665. "name": "MONGODB_ADMIN_PASSWORD",
  666. "value": "${DB_ADMIN_PASSWORD}"
  667. },
  668. {
  669. "name": "MONGODB_NOPREALLOC",
  670. "value": "${MONGODB_NOPREALLOC}"
  671. },
  672. {
  673. "name": "MONGODB_SMALLFILES",
  674. "value": "${MONGODB_SMALLFILES}"
  675. },
  676. {
  677. "name": "MONGODB_QUIET",
  678. "value": "${MONGODB_QUIET}"
  679. }
  680. ],
  681. "volumeMounts": [
  682. {
  683. "mountPath": "/var/lib/mongodb/data",
  684. "name": "${APPLICATION_NAME}-data"
  685. }
  686. ]
  687. }
  688. ],
  689. "volumes": [
  690. {
  691. "emptyDir": {
  692. "medium": ""
  693. },
  694. "name": "${APPLICATION_NAME}-data"
  695. }
  696. ]
  697. }
  698. }
  699. }
  700. }
  701. ]
  702. }