jws-tomcat7-postgresql-sti.json 20 KB

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