jws31-tomcat7-postgresql-s2i.json 26 KB

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