jws30-tomcat7-mysql-persistent-s2i.json 25 KB

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