jws-tomcat8-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-tomcat8-mysql-persistent-sti"
  10. },
  11. "labels": {
  12. "template": "jws-tomcat8-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-tomcat8-openshift:${JWS_RELEASE}"
  299. }
  300. }
  301. },
  302. "output": {
  303. "to": {
  304. "kind": "ImageStreamTag",
  305. "name": "${APPLICATION_NAME}:latest"
  306. }
  307. },
  308. "triggers": [
  309. {
  310. "type": "GitHub",
  311. "github": {
  312. "secret": "${GITHUB_TRIGGER_SECRET}"
  313. }
  314. },
  315. {
  316. "type": "Generic",
  317. "generic": {
  318. "secret": "${GENERIC_TRIGGER_SECRET}"
  319. }
  320. },
  321. {
  322. "type": "ImageChange",
  323. "imageChange": {}
  324. }
  325. ]
  326. }
  327. },
  328. {
  329. "kind": "DeploymentConfig",
  330. "apiVersion": "v1",
  331. "metadata": {
  332. "name": "${APPLICATION_NAME}",
  333. "labels": {
  334. "application": "${APPLICATION_NAME}"
  335. }
  336. },
  337. "spec": {
  338. "strategy": {
  339. "type": "Recreate"
  340. },
  341. "triggers": [
  342. {
  343. "type": "ImageChange",
  344. "imageChangeParams": {
  345. "automatic": true,
  346. "containerNames": [
  347. "${APPLICATION_NAME}"
  348. ],
  349. "from": {
  350. "kind": "ImageStream",
  351. "name": "${APPLICATION_NAME}"
  352. }
  353. }
  354. }
  355. ],
  356. "replicas": 1,
  357. "selector": {
  358. "deploymentConfig": "${APPLICATION_NAME}"
  359. },
  360. "template": {
  361. "metadata": {
  362. "name": "${APPLICATION_NAME}",
  363. "labels": {
  364. "deploymentConfig": "${APPLICATION_NAME}",
  365. "application": "${APPLICATION_NAME}"
  366. }
  367. },
  368. "spec": {
  369. "serviceAccount": "jws-service-account",
  370. "containers": [
  371. {
  372. "name": "${APPLICATION_NAME}",
  373. "image": "${APPLICATION_NAME}",
  374. "imagePullPolicy": "Always",
  375. "readinessProbe": {
  376. "exec": {
  377. "command": [
  378. "/bin/bash",
  379. "-c",
  380. "curl -s -u ${JWS_ADMIN_USERNAME}:${JWS_ADMIN_PASSWORD} 'http://localhost:8080/manager/jmxproxy/?get=Catalina%3Atype%3DServer&att=stateName' |grep -iq 'stateName *= *STARTED'"
  381. ]
  382. }
  383. },
  384. "volumeMounts": [
  385. {
  386. "name": "jws-certificate-volume",
  387. "mountPath": "/etc/jws-secret-volume",
  388. "readOnly": true
  389. }
  390. ],
  391. "ports": [
  392. {
  393. "name": "http",
  394. "containerPort": 8080,
  395. "protocol": "TCP"
  396. },
  397. {
  398. "name": "https",
  399. "containerPort": 8443,
  400. "protocol": "TCP"
  401. }
  402. ],
  403. "env": [
  404. {
  405. "name": "DB_SERVICE_PREFIX_MAPPING",
  406. "value": "${APPLICATION_NAME}-mysql=DB"
  407. },
  408. {
  409. "name": "DB_JNDI",
  410. "value": "${DB_JNDI}"
  411. },
  412. {
  413. "name": "DB_USERNAME",
  414. "value": "${DB_USERNAME}"
  415. },
  416. {
  417. "name": "DB_PASSWORD",
  418. "value": "${DB_PASSWORD}"
  419. },
  420. {
  421. "name": "DB_DATABASE",
  422. "value": "${DB_DATABASE}"
  423. },
  424. {
  425. "name": "DB_MIN_POOL_SIZE",
  426. "value": "${DB_MIN_POOL_SIZE}"
  427. },
  428. {
  429. "name": "DB_MAX_POOL_SIZE",
  430. "value": "${DB_MAX_POOL_SIZE}"
  431. },
  432. {
  433. "name": "DB_TX_ISOLATION",
  434. "value": "${DB_TX_ISOLATION}"
  435. },
  436. {
  437. "name": "JWS_HTTPS_CERTIFICATE_DIR",
  438. "value": "/etc/jws-secret-volume"
  439. },
  440. {
  441. "name": "JWS_HTTPS_CERTIFICATE",
  442. "value": "${JWS_HTTPS_CERTIFICATE}"
  443. },
  444. {
  445. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  446. "value": "${JWS_HTTPS_CERTIFICATE_KEY}"
  447. },
  448. {
  449. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  450. "value": "${JWS_HTTPS_CERTIFICATE_PASSWORD}"
  451. },
  452. {
  453. "name": "JWS_ADMIN_USERNAME",
  454. "value": "${JWS_ADMIN_USERNAME}"
  455. },
  456. {
  457. "name": "JWS_ADMIN_PASSWORD",
  458. "value": "${JWS_ADMIN_PASSWORD}"
  459. }
  460. ]
  461. }
  462. ],
  463. "volumes": [
  464. {
  465. "name": "jws-certificate-volume",
  466. "secret": {
  467. "secretName": "${JWS_HTTPS_SECRET}"
  468. }
  469. }
  470. ]
  471. }
  472. }
  473. }
  474. },
  475. {
  476. "kind": "DeploymentConfig",
  477. "apiVersion": "v1",
  478. "metadata": {
  479. "name": "${APPLICATION_NAME}-mysql",
  480. "labels": {
  481. "application": "${APPLICATION_NAME}"
  482. }
  483. },
  484. "spec": {
  485. "strategy": {
  486. "type": "Recreate"
  487. },
  488. "triggers": [
  489. {
  490. "type": "ImageChange",
  491. "imageChangeParams": {
  492. "automatic": true,
  493. "containerNames": [
  494. "${APPLICATION_NAME}-mysql"
  495. ],
  496. "from": {
  497. "kind": "ImageStreamTag",
  498. "namespace": "openshift",
  499. "name": "mysql:latest"
  500. }
  501. }
  502. }
  503. ],
  504. "replicas": 1,
  505. "selector": {
  506. "deploymentConfig": "${APPLICATION_NAME}-mysql"
  507. },
  508. "template": {
  509. "metadata": {
  510. "name": "${APPLICATION_NAME}-mysql",
  511. "labels": {
  512. "deploymentConfig": "${APPLICATION_NAME}-mysql",
  513. "application": "${APPLICATION_NAME}"
  514. }
  515. },
  516. "spec": {
  517. "containers": [
  518. {
  519. "name": "${APPLICATION_NAME}-mysql",
  520. "image": "mysql",
  521. "ports": [
  522. {
  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. }