jws30-tomcat7-basic-s2i.json 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "annotations": {
  6. "iconClass": "icon-tomcat",
  7. "description": "Application template for JWS applications built using S2I.",
  8. "tags": "tomcat,tomcat7,java,jboss,xpaas",
  9. "version": "1.2.0"
  10. },
  11. "name": "jws30-tomcat7-basic-s2i"
  12. },
  13. "labels": {
  14. "template": "jws30-tomcat7-basic-s2i",
  15. "xpaas": "1.2.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 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": "Git source URI for application",
  32. "name": "SOURCE_REPOSITORY_URL",
  33. "value": "https://github.com/jboss-openshift/openshift-quickstarts.git",
  34. "required": true
  35. },
  36. {
  37. "description": "Git branch/tag reference",
  38. "name": "SOURCE_REPOSITORY_REF",
  39. "value": "1.2",
  40. "required": false
  41. },
  42. {
  43. "description": "Path within Git project to build; empty for root project directory.",
  44. "name": "CONTEXT_DIR",
  45. "value": "tomcat-websocket-chat",
  46. "required": false
  47. },
  48. {
  49. "description": "JWS Admin User",
  50. "name": "JWS_ADMIN_USERNAME",
  51. "from": "[a-zA-Z0-9]{8}",
  52. "generate": "expression",
  53. "required": true
  54. },
  55. {
  56. "description": "JWS Admin Password",
  57. "name": "JWS_ADMIN_PASSWORD",
  58. "from": "[a-zA-Z0-9]{8}",
  59. "generate": "expression",
  60. "required": true
  61. },
  62. {
  63. "description": "GitHub trigger secret",
  64. "name": "GITHUB_WEBHOOK_SECRET",
  65. "from": "[a-zA-Z0-9]{8}",
  66. "generate": "expression",
  67. "required": true
  68. },
  69. {
  70. "description": "Generic build trigger secret",
  71. "name": "GENERIC_WEBHOOK_SECRET",
  72. "from": "[a-zA-Z0-9]{8}",
  73. "generate": "expression",
  74. "required": true
  75. },
  76. {
  77. "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.",
  78. "name": "IMAGE_STREAM_NAMESPACE",
  79. "value": "openshift",
  80. "required": true
  81. }
  82. ],
  83. "objects": [
  84. {
  85. "kind": "Service",
  86. "apiVersion": "v1",
  87. "spec": {
  88. "ports": [
  89. {
  90. "port": 8080,
  91. "targetPort": 8080
  92. }
  93. ],
  94. "selector": {
  95. "deploymentConfig": "${APPLICATION_NAME}"
  96. }
  97. },
  98. "metadata": {
  99. "name": "${APPLICATION_NAME}",
  100. "labels": {
  101. "application": "${APPLICATION_NAME}"
  102. },
  103. "annotations": {
  104. "description": "The web server's http port."
  105. }
  106. }
  107. },
  108. {
  109. "kind": "Route",
  110. "apiVersion": "v1",
  111. "id": "${APPLICATION_NAME}-http",
  112. "metadata": {
  113. "name": "${APPLICATION_NAME}",
  114. "labels": {
  115. "application": "${APPLICATION_NAME}"
  116. },
  117. "annotations": {
  118. "description": "Route for application's http service."
  119. }
  120. },
  121. "spec": {
  122. "host": "${HOSTNAME_HTTP}",
  123. "to": {
  124. "name": "${APPLICATION_NAME}"
  125. }
  126. }
  127. },
  128. {
  129. "kind": "ImageStream",
  130. "apiVersion": "v1",
  131. "metadata": {
  132. "name": "${APPLICATION_NAME}",
  133. "labels": {
  134. "application": "${APPLICATION_NAME}"
  135. }
  136. }
  137. },
  138. {
  139. "kind": "BuildConfig",
  140. "apiVersion": "v1",
  141. "metadata": {
  142. "name": "${APPLICATION_NAME}",
  143. "labels": {
  144. "application": "${APPLICATION_NAME}"
  145. }
  146. },
  147. "spec": {
  148. "source": {
  149. "type": "Git",
  150. "git": {
  151. "uri": "${SOURCE_REPOSITORY_URL}",
  152. "ref": "${SOURCE_REPOSITORY_REF}"
  153. },
  154. "contextDir": "${CONTEXT_DIR}"
  155. },
  156. "strategy": {
  157. "type": "Source",
  158. "sourceStrategy": {
  159. "forcePull": true,
  160. "from": {
  161. "kind": "ImageStreamTag",
  162. "namespace": "${IMAGE_STREAM_NAMESPACE}",
  163. "name": "jboss-webserver30-tomcat7-openshift:1.2"
  164. }
  165. }
  166. },
  167. "output": {
  168. "to": {
  169. "kind": "ImageStreamTag",
  170. "name": "${APPLICATION_NAME}:latest"
  171. }
  172. },
  173. "triggers": [
  174. {
  175. "type": "GitHub",
  176. "github": {
  177. "secret": "${GITHUB_WEBHOOK_SECRET}"
  178. }
  179. },
  180. {
  181. "type": "Generic",
  182. "generic": {
  183. "secret": "${GENERIC_WEBHOOK_SECRET}"
  184. }
  185. },
  186. {
  187. "type": "ImageChange",
  188. "imageChange": {}
  189. },
  190. {
  191. "type": "ConfigChange"
  192. }
  193. ]
  194. }
  195. },
  196. {
  197. "kind": "DeploymentConfig",
  198. "apiVersion": "v1",
  199. "metadata": {
  200. "name": "${APPLICATION_NAME}",
  201. "labels": {
  202. "application": "${APPLICATION_NAME}"
  203. }
  204. },
  205. "spec": {
  206. "strategy": {
  207. "type": "Recreate"
  208. },
  209. "triggers": [
  210. {
  211. "type": "ImageChange",
  212. "imageChangeParams": {
  213. "automatic": true,
  214. "containerNames": [
  215. "${APPLICATION_NAME}"
  216. ],
  217. "from": {
  218. "kind": "ImageStreamTag",
  219. "name": "${APPLICATION_NAME}:latest"
  220. }
  221. }
  222. },
  223. {
  224. "type": "ConfigChange"
  225. }
  226. ],
  227. "replicas": 1,
  228. "selector": {
  229. "deploymentConfig": "${APPLICATION_NAME}"
  230. },
  231. "template": {
  232. "metadata": {
  233. "name": "${APPLICATION_NAME}",
  234. "labels": {
  235. "deploymentConfig": "${APPLICATION_NAME}",
  236. "application": "${APPLICATION_NAME}"
  237. }
  238. },
  239. "spec": {
  240. "terminationGracePeriodSeconds": 60,
  241. "containers": [
  242. {
  243. "name": "${APPLICATION_NAME}",
  244. "image": "${APPLICATION_NAME}",
  245. "imagePullPolicy": "Always",
  246. "readinessProbe": {
  247. "exec": {
  248. "command": [
  249. "/bin/bash",
  250. "-c",
  251. "curl -s -u ${JWS_ADMIN_USERNAME}:${JWS_ADMIN_PASSWORD} 'http://localhost:8080/manager/jmxproxy/?get=Catalina%3Atype%3DServer&att=stateName' |grep -iq 'stateName *= *STARTED'"
  252. ]
  253. }
  254. },
  255. "ports": [
  256. {
  257. "name": "jolokia",
  258. "containerPort": 8778,
  259. "protocol": "TCP"
  260. },
  261. {
  262. "name": "http",
  263. "containerPort": 8080,
  264. "protocol": "TCP"
  265. }
  266. ],
  267. "env": [
  268. {
  269. "name": "JWS_ADMIN_USERNAME",
  270. "value": "${JWS_ADMIN_USERNAME}"
  271. },
  272. {
  273. "name": "JWS_ADMIN_PASSWORD",
  274. "value": "${JWS_ADMIN_PASSWORD}"
  275. }
  276. ]
  277. }
  278. ]
  279. }
  280. }
  281. }
  282. }
  283. ]
  284. }