jws-tomcat7-mysql-persistent-sti.json 22 KB

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