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. "name": "${APPLICATION_NAME}"
  288. }
  289. },
  290. "triggers": [
  291. {
  292. "type": "github",
  293. "github": {
  294. "secret": "${GITHUB_TRIGGER_SECRET}"
  295. }
  296. },
  297. {
  298. "type": "generic",
  299. "generic": {
  300. "secret": "${GENERIC_TRIGGER_SECRET}"
  301. }
  302. },
  303. {
  304. "type": "imageChange",
  305. "imageChange": {}
  306. }
  307. ]
  308. }
  309. },
  310. {
  311. "kind": "DeploymentConfig",
  312. "apiVersion": "v1",
  313. "metadata": {
  314. "name": "${APPLICATION_NAME}",
  315. "labels": {
  316. "application": "${APPLICATION_NAME}"
  317. }
  318. },
  319. "spec": {
  320. "strategy": {
  321. "type": "Recreate"
  322. },
  323. "triggers": [
  324. {
  325. "type": "ImageChange",
  326. "imageChangeParams": {
  327. "automatic": true,
  328. "containerNames": [
  329. "${APPLICATION_NAME}"
  330. ],
  331. "from": {
  332. "kind": "ImageStream",
  333. "name": "${APPLICATION_NAME}"
  334. }
  335. }
  336. }
  337. ],
  338. "replicas": 1,
  339. "selector": {
  340. "deploymentConfig": "${APPLICATION_NAME}"
  341. },
  342. "template": {
  343. "metadata": {
  344. "name": "${APPLICATION_NAME}",
  345. "labels": {
  346. "deploymentConfig": "${APPLICATION_NAME}",
  347. "application": "${APPLICATION_NAME}"
  348. }
  349. },
  350. "spec": {
  351. "serviceAccount": "jws-service-account",
  352. "containers": [
  353. {
  354. "name": "${APPLICATION_NAME}",
  355. "image": "${APPLICATION_NAME}",
  356. "imagePullPolicy": "Always",
  357. "readinessProbe": {
  358. "exec": {
  359. "command": [
  360. "/bin/bash",
  361. "-c",
  362. "curl -s -u ${JWS_ADMIN_USERNAME}:${JWS_ADMIN_PASSWORD} 'http://localhost:8080/manager/jmxproxy/?get=Catalina%3Atype%3DServer&att=stateName' |grep -iq 'stateName *= *STARTED'"
  363. ]
  364. }
  365. },
  366. "volumeMounts": [
  367. {
  368. "name": "jws-certificate-volume",
  369. "mountPath": "/etc/jws-secret-volume",
  370. "readOnly": true
  371. }
  372. ],
  373. "ports": [
  374. {
  375. "name": "${APPLICATION_NAME}-tcp-8080",
  376. "containerPort": 8080,
  377. "protocol": "TCP"
  378. },
  379. {
  380. "name": "${APPLICATION_NAME}-tcp-8443",
  381. "containerPort": 8443,
  382. "protocol": "TCP"
  383. }
  384. ],
  385. "env": [
  386. {
  387. "name": "DB_SERVICE_PREFIX_MAPPING",
  388. "value": "${APPLICATION_NAME}-postgresql=DB"
  389. },
  390. {
  391. "name": "DB_JNDI",
  392. "value": "${DB_JNDI}"
  393. },
  394. {
  395. "name": "DB_USERNAME",
  396. "value": "${DB_USERNAME}"
  397. },
  398. {
  399. "name": "DB_PASSWORD",
  400. "value": "${DB_PASSWORD}"
  401. },
  402. {
  403. "name": "DB_DATABASE",
  404. "value": "${DB_DATABASE}"
  405. },
  406. {
  407. "name": "DB_MIN_POOL_SIZE",
  408. "value": "${DB_MIN_POOL_SIZE}"
  409. },
  410. {
  411. "name": "DB_MAX_POOL_SIZE",
  412. "value": "${DB_MAX_POOL_SIZE}"
  413. },
  414. {
  415. "name": "DB_TX_ISOLATION",
  416. "value": "${DB_TX_ISOLATION}"
  417. },
  418. {
  419. "name": "JWS_HTTPS_CERTIFICATE_DIR",
  420. "value": "/etc/jws-secret-volume"
  421. },
  422. {
  423. "name": "JWS_HTTPS_CERTIFICATE",
  424. "value": "${JWS_HTTPS_CERTIFICATE}"
  425. },
  426. {
  427. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  428. "value": "${JWS_HTTPS_CERTIFICATE_KEY}"
  429. },
  430. {
  431. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  432. "value": "${JWS_HTTPS_CERTIFICATE_PASSWORD}"
  433. },
  434. {
  435. "name": "JWS_ADMIN_USERNAME",
  436. "value": "${JWS_ADMIN_USERNAME}"
  437. },
  438. {
  439. "name": "JWS_ADMIN_PASSWORD",
  440. "value": "${JWS_ADMIN_PASSWORD}"
  441. }
  442. ]
  443. }
  444. ],
  445. "volumes": [
  446. {
  447. "name": "jws-certificate-volume",
  448. "secret": {
  449. "secretName": "${JWS_HTTPS_SECRET}"
  450. }
  451. }
  452. ]
  453. }
  454. }
  455. }
  456. },
  457. {
  458. "kind": "DeploymentConfig",
  459. "apiVersion": "v1",
  460. "metadata": {
  461. "name": "${APPLICATION_NAME}-postgresql",
  462. "labels": {
  463. "application": "${APPLICATION_NAME}"
  464. }
  465. },
  466. "spec": {
  467. "strategy": {
  468. "type": "Recreate"
  469. },
  470. "triggers": [
  471. {
  472. "type": "ImageChange",
  473. "imageChangeParams": {
  474. "automatic": true,
  475. "containerNames": [
  476. "${APPLICATION_NAME}-postgresql"
  477. ],
  478. "from": {
  479. "kind": "ImageStreamTag",
  480. "namespace": "openshift",
  481. "name": "postgresql:latest"
  482. }
  483. }
  484. }
  485. ],
  486. "replicas": 1,
  487. "selector": {
  488. "deploymentConfig": "${APPLICATION_NAME}-postgresql"
  489. },
  490. "template": {
  491. "metadata": {
  492. "name": "${APPLICATION_NAME}-postgresql",
  493. "labels": {
  494. "deploymentConfig": "${APPLICATION_NAME}-postgresql",
  495. "application": "${APPLICATION_NAME}"
  496. }
  497. },
  498. "spec": {
  499. "containers": [
  500. {
  501. "name": "${APPLICATION_NAME}-postgresql",
  502. "image": "postgresql",
  503. "ports": [
  504. {
  505. "name": "${APPLICATION_NAME}-postgresql-tcp-5432",
  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. }