jws31-tomcat8-postgresql-persistent-s2i.json 27 KB

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