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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass": "icon-tomcat",
  7. "description": "Application template for JWS PostgreSQL applications with persistent storage built using S2I.",
  8. "tags": "tomcat,tomcat8,java,jboss,xpaas",
  9. "version": "1.4.0",
  10. "openshift.io/display-name": "Red Hat JBoss Web Server 3.0 Tomcat 8 + PostgreSQL (Persistent with https)"
  11. },
  12. "name": "jws30-tomcat8-postgresql-persistent-s2i"
  13. },
  14. "labels": {
  15. "template": "jws30-tomcat8-postgresql-persistent-s2i",
  16. "xpaas": "1.4.0"
  17. },
  18. "message": "A new persistent JWS application for 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 \"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": "Database Volume Capacity",
  78. "description": "Size of persistent storage for database volume.",
  79. "name": "VOLUME_CAPACITY",
  80. "value": "512Mi",
  81. "required": true
  82. },
  83. {
  84. "displayName": "Secret Name",
  85. "description": "The name of the secret containing the certificate files",
  86. "name": "JWS_HTTPS_SECRET",
  87. "value": "jws-app-secret",
  88. "required": true
  89. },
  90. {
  91. "displayName": "Certificate Name",
  92. "description": "The name of the certificate file within the secret",
  93. "name": "JWS_HTTPS_CERTIFICATE",
  94. "value": "server.crt",
  95. "required": false
  96. },
  97. {
  98. "displayName": "Certificate Key Name",
  99. "description": "The name of the certificate key file within the secret",
  100. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  101. "value": "server.key",
  102. "required": false
  103. },
  104. {
  105. "displayName": "Certificate Password",
  106. "description": "The certificate password",
  107. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  108. "value": "",
  109. "required": false
  110. },
  111. {
  112. "displayName": "Datasource Minimum Pool Size",
  113. "description": "Sets xa-pool/min-pool-size for the configured datasource.",
  114. "name": "DB_MIN_POOL_SIZE",
  115. "required": false
  116. },
  117. {
  118. "displayName": "Datasource Maximum Pool Size",
  119. "description": "Sets xa-pool/max-pool-size for the configured datasource.",
  120. "name": "DB_MAX_POOL_SIZE",
  121. "required": false
  122. },
  123. {
  124. "displayName": "Datasource Transaction Isolation",
  125. "description": "Sets transaction-isolation for the configured datasource.",
  126. "name": "DB_TX_ISOLATION",
  127. "required": false
  128. },
  129. {
  130. "displayName": "PostgreSQL Maximum number of connections",
  131. "description": "The maximum number of client connections allowed. This also sets the maximum number of prepared transactions.",
  132. "name": "POSTGRESQL_MAX_CONNECTIONS",
  133. "required": false
  134. },
  135. {
  136. "displayName": "PostgreSQL Shared Buffers",
  137. "description": "Configures how much memory is dedicated to PostgreSQL for caching data.",
  138. "name": "POSTGRESQL_SHARED_BUFFERS",
  139. "required": false
  140. },
  141. {
  142. "displayName": "Database Username",
  143. "description": "Database user name",
  144. "name": "DB_USERNAME",
  145. "from": "user[a-zA-Z0-9]{3}",
  146. "generate": "expression",
  147. "required": true
  148. },
  149. {
  150. "displayName": "Database Password",
  151. "description": "Database user password",
  152. "name": "DB_PASSWORD",
  153. "from": "[a-zA-Z0-9]{8}",
  154. "generate": "expression",
  155. "required": true
  156. },
  157. {
  158. "displayName": "JWS Admin Username",
  159. "description": "JWS Admin User",
  160. "name": "JWS_ADMIN_USERNAME",
  161. "from": "[a-zA-Z0-9]{8}",
  162. "generate": "expression",
  163. "required": true
  164. },
  165. {
  166. "displayName": "JWS Admin Password",
  167. "description": "JWS Admin Password",
  168. "name": "JWS_ADMIN_PASSWORD",
  169. "from": "[a-zA-Z0-9]{8}",
  170. "generate": "expression",
  171. "required": true
  172. },
  173. {
  174. "displayName": "Github Webhook Secret",
  175. "description": "GitHub trigger secret",
  176. "name": "GITHUB_WEBHOOK_SECRET",
  177. "from": "[a-zA-Z0-9]{8}",
  178. "generate": "expression",
  179. "required": true
  180. },
  181. {
  182. "displayName": "Generic Webhook Secret",
  183. "description": "Generic build trigger secret",
  184. "name": "GENERIC_WEBHOOK_SECRET",
  185. "from": "[a-zA-Z0-9]{8}",
  186. "generate": "expression",
  187. "required": true
  188. },
  189. {
  190. "displayName": "ImageStream Namespace",
  191. "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.",
  192. "name": "IMAGE_STREAM_NAMESPACE",
  193. "value": "openshift",
  194. "required": true
  195. },
  196. {
  197. "displayName": "Maven mirror URL",
  198. "description": "Maven mirror to use for S2I builds",
  199. "name": "MAVEN_MIRROR_URL",
  200. "value": "",
  201. "required": false
  202. },
  203. {
  204. "description": "List of directories from which archives will be copied into the deployment folder. If unspecified, all archives in /target will be copied.",
  205. "name": "ARTIFACT_DIR",
  206. "value": "",
  207. "required": false
  208. },
  209. {
  210. "displayName": "PostgreSQL Image Stream Tag",
  211. "description": "The tag to use for the \"postgresql\" image stream. Typically, this aligns with the major.minor version of PostgreSQL.",
  212. "name": "POSTGRESQL_IMAGE_STREAM_TAG",
  213. "value": "9.5",
  214. "required": true
  215. }
  216. ],
  217. "objects": [
  218. {
  219. "kind": "Service",
  220. "apiVersion": "v1",
  221. "spec": {
  222. "ports": [
  223. {
  224. "port": 8080,
  225. "targetPort": 8080
  226. }
  227. ],
  228. "selector": {
  229. "deploymentConfig": "${APPLICATION_NAME}"
  230. }
  231. },
  232. "metadata": {
  233. "name": "${APPLICATION_NAME}",
  234. "labels": {
  235. "application": "${APPLICATION_NAME}"
  236. },
  237. "annotations": {
  238. "description": "The web server's http port.",
  239. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  240. }
  241. }
  242. },
  243. {
  244. "kind": "Service",
  245. "apiVersion": "v1",
  246. "spec": {
  247. "ports": [
  248. {
  249. "port": 8443,
  250. "targetPort": 8443
  251. }
  252. ],
  253. "selector": {
  254. "deploymentConfig": "${APPLICATION_NAME}"
  255. }
  256. },
  257. "metadata": {
  258. "name": "secure-${APPLICATION_NAME}",
  259. "labels": {
  260. "application": "${APPLICATION_NAME}"
  261. },
  262. "annotations": {
  263. "description": "The web server's https port.",
  264. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${APPLICATION_NAME}-postgresql\", \"kind\": \"Service\"}]"
  265. }
  266. }
  267. },
  268. {
  269. "kind": "Service",
  270. "apiVersion": "v1",
  271. "spec": {
  272. "ports": [
  273. {
  274. "port": 5432,
  275. "targetPort": 5432
  276. }
  277. ],
  278. "selector": {
  279. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  280. }
  281. },
  282. "metadata": {
  283. "name": "${APPLICATION_NAME}-postgresql",
  284. "labels": {
  285. "application": "${APPLICATION_NAME}"
  286. },
  287. "annotations": {
  288. "description": "The database server's port."
  289. }
  290. }
  291. },
  292. {
  293. "kind": "Route",
  294. "apiVersion": "v1",
  295. "id": "${APPLICATION_NAME}-http",
  296. "metadata": {
  297. "name": "${APPLICATION_NAME}",
  298. "labels": {
  299. "application": "${APPLICATION_NAME}"
  300. },
  301. "annotations": {
  302. "description": "Route for application's http service."
  303. }
  304. },
  305. "spec": {
  306. "host": "${HOSTNAME_HTTP}",
  307. "to": {
  308. "name": "${APPLICATION_NAME}"
  309. }
  310. }
  311. },
  312. {
  313. "kind": "Route",
  314. "apiVersion": "v1",
  315. "id": "${APPLICATION_NAME}-https",
  316. "metadata": {
  317. "name": "secure-${APPLICATION_NAME}",
  318. "labels": {
  319. "application": "${APPLICATION_NAME}"
  320. },
  321. "annotations": {
  322. "description": "Route for application's https service."
  323. }
  324. },
  325. "spec": {
  326. "host": "${HOSTNAME_HTTPS}",
  327. "to": {
  328. "name": "secure-${APPLICATION_NAME}"
  329. },
  330. "tls": {
  331. "termination": "passthrough"
  332. }
  333. }
  334. },
  335. {
  336. "kind": "ImageStream",
  337. "apiVersion": "v1",
  338. "metadata": {
  339. "name": "${APPLICATION_NAME}",
  340. "labels": {
  341. "application": "${APPLICATION_NAME}"
  342. }
  343. }
  344. },
  345. {
  346. "kind": "BuildConfig",
  347. "apiVersion": "v1",
  348. "metadata": {
  349. "name": "${APPLICATION_NAME}",
  350. "labels": {
  351. "application": "${APPLICATION_NAME}"
  352. }
  353. },
  354. "spec": {
  355. "source": {
  356. "type": "Git",
  357. "git": {
  358. "uri": "${SOURCE_REPOSITORY_URL}",
  359. "ref": "${SOURCE_REPOSITORY_REF}"
  360. },
  361. "contextDir": "${CONTEXT_DIR}"
  362. },
  363. "strategy": {
  364. "type": "Source",
  365. "sourceStrategy": {
  366. "env": [
  367. {
  368. "name": "MAVEN_MIRROR_URL",
  369. "value": "${MAVEN_MIRROR_URL}"
  370. },
  371. {
  372. "name": "ARTIFACT_DIR",
  373. "value": "${ARTIFACT_DIR}"
  374. }
  375. ],
  376. "forcePull": true,
  377. "from": {
  378. "kind": "ImageStreamTag",
  379. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  380. "name": "jboss-webserver30-tomcat8-openshift:1.3"
  381. }
  382. }
  383. },
  384. "output": {
  385. "to": {
  386. "kind": "ImageStreamTag",
  387. "name": "${APPLICATION_NAME}:latest"
  388. }
  389. },
  390. "triggers": [
  391. {
  392. "type": "GitHub",
  393. "github": {
  394. "secret": "${GITHUB_WEBHOOK_SECRET}"
  395. }
  396. },
  397. {
  398. "type": "Generic",
  399. "generic": {
  400. "secret": "${GENERIC_WEBHOOK_SECRET}"
  401. }
  402. },
  403. {
  404. "type": "ImageChange",
  405. "imageChange": {}
  406. },
  407. {
  408. "type": "ConfigChange"
  409. }
  410. ]
  411. }
  412. },
  413. {
  414. "kind": "DeploymentConfig",
  415. "apiVersion": "v1",
  416. "metadata": {
  417. "name": "${APPLICATION_NAME}",
  418. "labels": {
  419. "application": "${APPLICATION_NAME}"
  420. }
  421. },
  422. "spec": {
  423. "strategy": {
  424. "type": "Recreate"
  425. },
  426. "triggers": [
  427. {
  428. "type": "ImageChange",
  429. "imageChangeParams": {
  430. "automatic": true,
  431. "containerNames": [
  432. "${APPLICATION_NAME}"
  433. ],
  434. "from": {
  435. "kind": "ImageStreamTag",
  436. "name": "${APPLICATION_NAME}:latest"
  437. }
  438. }
  439. },
  440. {
  441. "type": "ConfigChange"
  442. }
  443. ],
  444. "replicas": 1,
  445. "selector": {
  446. "deploymentConfig": "${APPLICATION_NAME}"
  447. },
  448. "template": {
  449. "metadata": {
  450. "name": "${APPLICATION_NAME}",
  451. "labels": {
  452. "deploymentConfig": "${APPLICATION_NAME}",
  453. "application": "${APPLICATION_NAME}"
  454. }
  455. },
  456. "spec": {
  457. "serviceAccountName": "jws-service-account",
  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. }