jws30-tomcat8-mongodb-s2i.json 23 KB

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