jws30-tomcat8-mongodb-s2i.json 22 KB

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