jws30-tomcat7-mysql-s2i.json 23 KB

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