jws30-tomcat7-postgresql-s2i.json 22 KB

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