jws-tomcat8-mongodb-persistent-sti.json 22 KB

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