jws-tomcat7-mongodb-sti.json 21 KB

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