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

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