jws30-tomcat7-postgresql-s2i.json 22 KB

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