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

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