jws-tomcat8-https-sti.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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": "The name of the secret containing the certificate files",
  46. "name": "JWS_HTTPS_SECRET",
  47. "value": "jws-app-secret"
  48. },
  49. {
  50. "description": "The name of the certificate file within the secret",
  51. "name": "JWS_HTTPS_CERTIFICATE",
  52. "value": "server.crt"
  53. },
  54. {
  55. "description": "The name of the certificate key file within the secret",
  56. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  57. "value": "server.key"
  58. },
  59. {
  60. "description": "The certificate password",
  61. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  62. "value": ""
  63. },
  64. {
  65. "description": "JWS Admin User",
  66. "name": "JWS_ADMIN_USERNAME",
  67. "from": "[a-zA-Z0-9]{8}",
  68. "generate": "expression"
  69. },
  70. {
  71. "description": "JWS Admin Password",
  72. "name": "JWS_ADMIN_PASSWORD",
  73. "from": "[a-zA-Z0-9]{8}",
  74. "generate": "expression"
  75. },
  76. {
  77. "description": "Github trigger secret",
  78. "name": "GITHUB_TRIGGER_SECRET",
  79. "from": "[a-zA-Z0-9]{8}",
  80. "generate": "expression"
  81. },
  82. {
  83. "description": "Generic build trigger secret",
  84. "name": "GENERIC_TRIGGER_SECRET",
  85. "from": "[a-zA-Z0-9]{8}",
  86. "generate": "expression"
  87. }
  88. ],
  89. "objects": [
  90. {
  91. "kind": "Service",
  92. "apiVersion": "v1",
  93. "spec": {
  94. "ports": [
  95. {
  96. "port": 8080,
  97. "targetPort": 8080
  98. }
  99. ],
  100. "selector": {
  101. "deploymentConfig": "${APPLICATION_NAME}"
  102. }
  103. },
  104. "metadata": {
  105. "name": "${APPLICATION_NAME}",
  106. "labels": {
  107. "application": "${APPLICATION_NAME}"
  108. },
  109. "annotations": {
  110. "description": "The web server's http port."
  111. }
  112. }
  113. },
  114. {
  115. "kind": "Service",
  116. "apiVersion": "v1",
  117. "spec": {
  118. "ports": [
  119. {
  120. "port": 8443,
  121. "targetPort": 8443
  122. }
  123. ],
  124. "selector": {
  125. "deploymentConfig": "${APPLICATION_NAME}"
  126. }
  127. },
  128. "metadata": {
  129. "name": "secure-${APPLICATION_NAME}",
  130. "labels": {
  131. "application": "${APPLICATION_NAME}"
  132. },
  133. "annotations": {
  134. "description": "The web server's https port."
  135. }
  136. }
  137. },
  138. {
  139. "kind": "Route",
  140. "apiVersion": "v1",
  141. "id": "${APPLICATION_NAME}-http-route",
  142. "metadata": {
  143. "name": "${APPLICATION_NAME}-http-route",
  144. "labels": {
  145. "application": "${APPLICATION_NAME}"
  146. },
  147. "annotations": {
  148. "description": "Route for application's http service."
  149. }
  150. },
  151. "spec": {
  152. "host": "${APPLICATION_HOSTNAME}",
  153. "to": {
  154. "name": "${APPLICATION_NAME}"
  155. }
  156. }
  157. },
  158. {
  159. "kind": "Route",
  160. "apiVersion": "v1",
  161. "id": "${APPLICATION_NAME}-https-route",
  162. "metadata": {
  163. "name": "${APPLICATION_NAME}-https-route",
  164. "labels": {
  165. "application": "${APPLICATION_NAME}"
  166. },
  167. "annotations": {
  168. "description": "Route for application's https service."
  169. }
  170. },
  171. "spec": {
  172. "host": "${APPLICATION_HOSTNAME}",
  173. "to": {
  174. "name": "secure-${APPLICATION_NAME}"
  175. },
  176. "tls": {
  177. "termination" : "passthrough"
  178. }
  179. }
  180. },
  181. {
  182. "kind": "ImageStream",
  183. "apiVersion": "v1",
  184. "metadata": {
  185. "name": "${APPLICATION_NAME}",
  186. "labels": {
  187. "application": "${APPLICATION_NAME}"
  188. }
  189. }
  190. },
  191. {
  192. "kind": "BuildConfig",
  193. "apiVersion": "v1",
  194. "metadata": {
  195. "name": "${APPLICATION_NAME}",
  196. "labels": {
  197. "application": "${APPLICATION_NAME}"
  198. }
  199. },
  200. "spec": {
  201. "source": {
  202. "type": "Git",
  203. "git": {
  204. "uri": "${GIT_URI}",
  205. "ref": "${GIT_REF}"
  206. },
  207. "contextDir":"${GIT_CONTEXT_DIR}"
  208. },
  209. "strategy": {
  210. "type": "Source",
  211. "sourceStrategy": {
  212. "from": {
  213. "kind": "ImageStreamTag",
  214. "namespace": "openshift",
  215. "name": "jboss-webserver3-tomcat8-openshift:${JWS_RELEASE}"
  216. }
  217. }
  218. },
  219. "output": {
  220. "to": {
  221. "kind": "ImageStreamTag",
  222. "name": "${APPLICATION_NAME}:latest"
  223. }
  224. },
  225. "triggers": [
  226. {
  227. "type": "GitHub",
  228. "github": {
  229. "secret": "${GITHUB_TRIGGER_SECRET}"
  230. }
  231. },
  232. {
  233. "type": "Generic",
  234. "generic": {
  235. "secret": "${GENERIC_TRIGGER_SECRET}"
  236. }
  237. },
  238. {
  239. "type": "ImageChange",
  240. "imageChange": {}
  241. }
  242. ]
  243. }
  244. },
  245. {
  246. "kind": "DeploymentConfig",
  247. "apiVersion": "v1",
  248. "metadata": {
  249. "name": "${APPLICATION_NAME}",
  250. "labels": {
  251. "application": "${APPLICATION_NAME}"
  252. }
  253. },
  254. "spec": {
  255. "strategy": {
  256. "type": "Recreate"
  257. },
  258. "triggers": [
  259. {
  260. "type": "ImageChange",
  261. "imageChangeParams": {
  262. "automatic": true,
  263. "containerNames": [
  264. "${APPLICATION_NAME}"
  265. ],
  266. "from": {
  267. "kind": "ImageStream",
  268. "name": "${APPLICATION_NAME}"
  269. }
  270. }
  271. }
  272. ],
  273. "replicas": 1,
  274. "selector": {
  275. "deploymentConfig": "${APPLICATION_NAME}"
  276. },
  277. "template": {
  278. "metadata": {
  279. "name": "${APPLICATION_NAME}",
  280. "labels": {
  281. "deploymentConfig": "${APPLICATION_NAME}",
  282. "application": "${APPLICATION_NAME}"
  283. }
  284. },
  285. "spec": {
  286. "serviceAccount": "jws-service-account",
  287. "containers": [
  288. {
  289. "name": "${APPLICATION_NAME}",
  290. "image": "${APPLICATION_NAME}",
  291. "imagePullPolicy": "Always",
  292. "readinessProbe": {
  293. "exec": {
  294. "command": [
  295. "/bin/bash",
  296. "-c",
  297. "curl -s -u ${JWS_ADMIN_USERNAME}:${JWS_ADMIN_PASSWORD} 'http://localhost:8080/manager/jmxproxy/?get=Catalina%3Atype%3DServer&att=stateName' |grep -iq 'stateName *= *STARTED'"
  298. ]
  299. }
  300. },
  301. "volumeMounts": [
  302. {
  303. "name": "jws-certificate-volume",
  304. "mountPath": "/etc/jws-secret-volume",
  305. "readOnly": true
  306. }
  307. ],
  308. "ports": [
  309. {
  310. "name": "http",
  311. "containerPort": 8080,
  312. "protocol": "TCP"
  313. },
  314. {
  315. "name": "https",
  316. "containerPort": 8443,
  317. "protocol": "TCP"
  318. }
  319. ],
  320. "env": [
  321. {
  322. "name": "JWS_HTTPS_CERTIFICATE_DIR",
  323. "value": "/etc/jws-secret-volume"
  324. },
  325. {
  326. "name": "JWS_HTTPS_CERTIFICATE",
  327. "value": "${JWS_HTTPS_CERTIFICATE}"
  328. },
  329. {
  330. "name": "JWS_HTTPS_CERTIFICATE_KEY",
  331. "value": "${JWS_HTTPS_CERTIFICATE_KEY}"
  332. },
  333. {
  334. "name": "JWS_HTTPS_CERTIFICATE_PASSWORD",
  335. "value": "${JWS_HTTPS_CERTIFICATE_PASSWORD}"
  336. },
  337. {
  338. "name": "JWS_ADMIN_USERNAME",
  339. "value": "${JWS_ADMIN_USERNAME}"
  340. },
  341. {
  342. "name": "JWS_ADMIN_PASSWORD",
  343. "value": "${JWS_ADMIN_PASSWORD}"
  344. }
  345. ]
  346. }
  347. ],
  348. "volumes": [
  349. {
  350. "name": "jws-certificate-volume",
  351. "secret": {
  352. "secretName": "${JWS_HTTPS_SECRET}"
  353. }
  354. }
  355. ]
  356. }
  357. }
  358. }
  359. }
  360. ]
  361. }