jws-tomcat7-mysql-sti.json 21 KB

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