jws-tomcat8-basic-sti.json 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass" : "icon-tomcat",
  7. "description": "Application template for JWS applications built using STI."
  8. },
  9. "name": "jws-tomcat8-basic-sti"
  10. },
  11. "labels": {
  12. "template": "jws-tomcat8-basic-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": "JWS Admin User",
  46. "name": "JWS_ADMIN_USERNAME",
  47. "from": "[a-zA-Z0-9]{8}",
  48. "generate": "expression"
  49. },
  50. {
  51. "description": "JWS Admin Password",
  52. "name": "JWS_ADMIN_PASSWORD",
  53. "from": "[a-zA-Z0-9]{8}",
  54. "generate": "expression"
  55. },
  56. {
  57. "description": "Github trigger secret",
  58. "name": "GITHUB_TRIGGER_SECRET",
  59. "from": "[a-zA-Z0-9]{8}",
  60. "generate": "expression"
  61. },
  62. {
  63. "description": "Generic build trigger secret",
  64. "name": "GENERIC_TRIGGER_SECRET",
  65. "from": "[a-zA-Z0-9]{8}",
  66. "generate": "expression"
  67. }
  68. ],
  69. "objects": [
  70. {
  71. "kind": "Service",
  72. "apiVersion": "v1",
  73. "spec": {
  74. "ports": [
  75. {
  76. "port": 8080,
  77. "targetPort": 8080
  78. }
  79. ],
  80. "selector": {
  81. "deploymentConfig": "${APPLICATION_NAME}"
  82. }
  83. },
  84. "metadata": {
  85. "name": "${APPLICATION_NAME}",
  86. "labels": {
  87. "application": "${APPLICATION_NAME}"
  88. },
  89. "annotations": {
  90. "description": "The web server's http port."
  91. }
  92. }
  93. },
  94. {
  95. "kind": "Route",
  96. "apiVersion": "v1",
  97. "id": "${APPLICATION_NAME}-http-route",
  98. "metadata": {
  99. "name": "${APPLICATION_NAME}-http-route",
  100. "labels": {
  101. "application": "${APPLICATION_NAME}"
  102. },
  103. "annotations": {
  104. "description": "Route for application's http service."
  105. }
  106. },
  107. "spec": {
  108. "host": "${APPLICATION_HOSTNAME}",
  109. "to": {
  110. "name": "${APPLICATION_NAME}"
  111. }
  112. }
  113. },
  114. {
  115. "kind": "ImageStream",
  116. "apiVersion": "v1",
  117. "metadata": {
  118. "name": "${APPLICATION_NAME}",
  119. "labels": {
  120. "application": "${APPLICATION_NAME}"
  121. }
  122. }
  123. },
  124. {
  125. "kind": "BuildConfig",
  126. "apiVersion": "v1",
  127. "metadata": {
  128. "name": "${APPLICATION_NAME}",
  129. "labels": {
  130. "application": "${APPLICATION_NAME}"
  131. }
  132. },
  133. "spec": {
  134. "source": {
  135. "type": "Git",
  136. "git": {
  137. "uri": "${GIT_URI}",
  138. "ref": "${GIT_REF}"
  139. },
  140. "contextDir":"${GIT_CONTEXT_DIR}"
  141. },
  142. "strategy": {
  143. "type": "Source",
  144. "sourceStrategy": {
  145. "from": {
  146. "kind": "ImageStreamTag",
  147. "namespace": "openshift",
  148. "name": "jboss-webserver3-tomcat8-openshift:${JWS_RELEASE}"
  149. }
  150. }
  151. },
  152. "output": {
  153. "to": {
  154. "kind": "ImageStreamTag",
  155. "name": "${APPLICATION_NAME}:latest"
  156. }
  157. },
  158. "triggers": [
  159. {
  160. "type": "GitHub",
  161. "github": {
  162. "secret": "${GITHUB_TRIGGER_SECRET}"
  163. }
  164. },
  165. {
  166. "type": "Generic",
  167. "generic": {
  168. "secret": "${GENERIC_TRIGGER_SECRET}"
  169. }
  170. },
  171. {
  172. "type": "ImageChange",
  173. "imageChange": {}
  174. }
  175. ]
  176. }
  177. },
  178. {
  179. "kind": "DeploymentConfig",
  180. "apiVersion": "v1",
  181. "metadata": {
  182. "name": "${APPLICATION_NAME}",
  183. "labels": {
  184. "application": "${APPLICATION_NAME}"
  185. }
  186. },
  187. "spec": {
  188. "strategy": {
  189. "type": "Recreate"
  190. },
  191. "triggers": [
  192. {
  193. "type": "ImageChange",
  194. "imageChangeParams": {
  195. "automatic": true,
  196. "containerNames": [
  197. "${APPLICATION_NAME}"
  198. ],
  199. "from": {
  200. "kind": "ImageStream",
  201. "name": "${APPLICATION_NAME}"
  202. }
  203. }
  204. }
  205. ],
  206. "replicas": 1,
  207. "selector": {
  208. "deploymentConfig": "${APPLICATION_NAME}"
  209. },
  210. "template": {
  211. "metadata": {
  212. "name": "${APPLICATION_NAME}",
  213. "labels": {
  214. "deploymentConfig": "${APPLICATION_NAME}",
  215. "application": "${APPLICATION_NAME}"
  216. }
  217. },
  218. "spec": {
  219. "containers": [
  220. {
  221. "name": "${APPLICATION_NAME}",
  222. "image": "${APPLICATION_NAME}",
  223. "imagePullPolicy": "Always",
  224. "readinessProbe": {
  225. "exec": {
  226. "command": [
  227. "/bin/bash",
  228. "-c",
  229. "curl -s -u ${JWS_ADMIN_USERNAME}:${JWS_ADMIN_PASSWORD} 'http://localhost:8080/manager/jmxproxy/?get=Catalina%3Atype%3DServer&att=stateName' |grep -iq 'stateName *= *STARTED'"
  230. ]
  231. }
  232. },
  233. "ports": [
  234. {
  235. "name": "http",
  236. "containerPort": 8080,
  237. "protocol": "TCP"
  238. }
  239. ],
  240. "env": [
  241. {
  242. "name": "JWS_ADMIN_USERNAME",
  243. "value": "${JWS_ADMIN_USERNAME}"
  244. },
  245. {
  246. "name": "JWS_ADMIN_PASSWORD",
  247. "value": "${JWS_ADMIN_PASSWORD}"
  248. }
  249. ]
  250. }
  251. ]
  252. }
  253. }
  254. }
  255. }
  256. ]
  257. }