jws30-tomcat8-mongodb-persistent-s2i.json 24 KB

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