nodejs.json 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. {
  2. "kind": "Template",
  3. "apiVersion": "template.openshift.io/v1",
  4. "metadata": {
  5. "name": "nodejs-example",
  6. "annotations": {
  7. "openshift.io/display-name": "Node.js",
  8. "description": "An example Node.js application with no database. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.",
  9. "tags": "quickstart,nodejs",
  10. "iconClass": "icon-nodejs",
  11. "openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration and application deployment configuration. It does not include a database.",
  12. "openshift.io/provider-display-name": "Red Hat, Inc.",
  13. "openshift.io/documentation-url": "https://github.com/sclorg/nodejs-ex",
  14. "openshift.io/support-url": "https://access.redhat.com",
  15. "template.openshift.io/bindable": "false"
  16. }
  17. },
  18. "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/nodejs-ex/blob/master/README.md.",
  19. "labels": {
  20. "template": "nodejs-example",
  21. "app": "nodejs-example"
  22. },
  23. "objects": [
  24. {
  25. "kind": "Service",
  26. "apiVersion": "v1",
  27. "metadata": {
  28. "name": "${NAME}",
  29. "annotations": {
  30. "description": "Exposes and load balances the application pods"
  31. }
  32. },
  33. "spec": {
  34. "ports": [
  35. {
  36. "name": "web",
  37. "port": 8080,
  38. "targetPort": 8080
  39. }
  40. ],
  41. "selector": {
  42. "name": "${NAME}"
  43. }
  44. }
  45. },
  46. {
  47. "kind": "Route",
  48. "apiVersion": "route.openshift.io/v1",
  49. "metadata": {
  50. "name": "${NAME}"
  51. },
  52. "spec": {
  53. "host": "${APPLICATION_DOMAIN}",
  54. "to": {
  55. "kind": "Service",
  56. "name": "${NAME}"
  57. }
  58. }
  59. },
  60. {
  61. "kind": "ImageStream",
  62. "apiVersion": "image.openshift.io/v1",
  63. "metadata": {
  64. "name": "${NAME}",
  65. "annotations": {
  66. "description": "Keeps track of changes in the application image"
  67. }
  68. }
  69. },
  70. {
  71. "kind": "BuildConfig",
  72. "apiVersion": "build.openshift.io/v1",
  73. "metadata": {
  74. "name": "${NAME}",
  75. "annotations": {
  76. "description": "Defines how to build the application",
  77. "template.alpha.openshift.io/wait-for-ready": "true"
  78. }
  79. },
  80. "spec": {
  81. "source": {
  82. "type": "Git",
  83. "git": {
  84. "uri": "${SOURCE_REPOSITORY_URL}",
  85. "ref": "${SOURCE_REPOSITORY_REF}"
  86. },
  87. "contextDir": "${CONTEXT_DIR}"
  88. },
  89. "strategy": {
  90. "type": "Source",
  91. "sourceStrategy": {
  92. "from": {
  93. "kind": "ImageStreamTag",
  94. "namespace": "${NAMESPACE}",
  95. "name": "nodejs:${NODEJS_VERSION}"
  96. },
  97. "env": [
  98. {
  99. "name": "NPM_MIRROR",
  100. "value": "${NPM_MIRROR}"
  101. }
  102. ]
  103. }
  104. },
  105. "output": {
  106. "to": {
  107. "kind": "ImageStreamTag",
  108. "name": "${NAME}:latest"
  109. }
  110. },
  111. "triggers": [
  112. {
  113. "type": "ImageChange"
  114. },
  115. {
  116. "type": "ConfigChange"
  117. },
  118. {
  119. "type": "GitHub",
  120. "github": {
  121. "secret": "${GITHUB_WEBHOOK_SECRET}"
  122. }
  123. },
  124. {
  125. "type": "Generic",
  126. "generic": {
  127. "secret": "${GENERIC_WEBHOOK_SECRET}"
  128. }
  129. }
  130. ]
  131. }
  132. },
  133. {
  134. "kind": "Deployment",
  135. "apiVersion": "apps/v1",
  136. "metadata": {
  137. "name": "${NAME}",
  138. "annotations": {
  139. "description": "Defines how to deploy the application server",
  140. "template.alpha.openshift.io/wait-for-ready": "true",
  141. "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"${NAME}:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
  142. }
  143. },
  144. "spec": {
  145. "strategy": {
  146. "type": "RollingUpdate"
  147. },
  148. "triggers": [
  149. {
  150. "type": "ImageChange",
  151. "imageChangeParams": {
  152. "automatic": true,
  153. "containerNames": [
  154. "nodejs-example"
  155. ],
  156. "from": {
  157. "kind": "ImageStreamTag",
  158. "name": "${NAME}:latest"
  159. }
  160. }
  161. },
  162. {
  163. "type": "ConfigChange"
  164. }
  165. ],
  166. "replicas": 1,
  167. "selector": {
  168. "matchLabels": {
  169. "name": "${NAME}"
  170. }
  171. },
  172. "template": {
  173. "metadata": {
  174. "name": "${NAME}",
  175. "labels": {
  176. "name": "${NAME}"
  177. }
  178. },
  179. "spec": {
  180. "containers": [
  181. {
  182. "name": "nodejs-example",
  183. "image": " ",
  184. "ports": [
  185. {
  186. "containerPort": 8080
  187. }
  188. ],
  189. "readinessProbe": {
  190. "timeoutSeconds": 3,
  191. "initialDelaySeconds": 3,
  192. "httpGet": {
  193. "path": "/",
  194. "port": 8080
  195. }
  196. },
  197. "livenessProbe": {
  198. "timeoutSeconds": 3,
  199. "initialDelaySeconds": 30,
  200. "httpGet": {
  201. "path": "/",
  202. "port": 8080
  203. }
  204. },
  205. "resources": {
  206. "limits": {
  207. "memory": "${MEMORY_LIMIT}"
  208. }
  209. },
  210. "env": [
  211. ]
  212. }
  213. ]
  214. }
  215. }
  216. }
  217. }
  218. ],
  219. "parameters": [
  220. {
  221. "name": "NAME",
  222. "displayName": "Name",
  223. "description": "The name assigned to all of the frontend objects defined in this template.",
  224. "required": true,
  225. "value": "nodejs-example"
  226. },
  227. {
  228. "name": "NAMESPACE",
  229. "displayName": "Namespace",
  230. "description": "The OpenShift Namespace where the ImageStream resides.",
  231. "required": true,
  232. "value": "openshift"
  233. },
  234. {
  235. "name": "NODEJS_VERSION",
  236. "displayName": "Version of NodeJS Image",
  237. "description": "Version of NodeJS image to be used (18-ubi9, 20-ubi9, 22-ubi9, or latest).",
  238. "value": "22-ubi9",
  239. "required": true
  240. },
  241. {
  242. "name": "MEMORY_LIMIT",
  243. "displayName": "Memory Limit",
  244. "description": "Maximum amount of memory the container can use.",
  245. "required": true,
  246. "value": "512Mi"
  247. },
  248. {
  249. "name": "SOURCE_REPOSITORY_URL",
  250. "displayName": "Git Repository URL",
  251. "description": "The URL of the repository with your application source code.",
  252. "required": true,
  253. "value": "https://github.com/sclorg/nodejs-ex.git"
  254. },
  255. {
  256. "name": "SOURCE_REPOSITORY_REF",
  257. "displayName": "Git Reference",
  258. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
  259. },
  260. {
  261. "name": "CONTEXT_DIR",
  262. "displayName": "Context Directory",
  263. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  264. },
  265. {
  266. "name": "APPLICATION_DOMAIN",
  267. "displayName": "Application Hostname",
  268. "description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted.",
  269. "value": ""
  270. },
  271. {
  272. "name": "GITHUB_WEBHOOK_SECRET",
  273. "displayName": "GitHub Webhook Secret",
  274. "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.",
  275. "generate": "expression",
  276. "from": "[a-zA-Z0-9]{40}"
  277. },
  278. {
  279. "name": "GENERIC_WEBHOOK_SECRET",
  280. "displayName": "Generic Webhook Secret",
  281. "description": "A secret string used to configure the Generic webhook.",
  282. "generate": "expression",
  283. "from": "[a-zA-Z0-9]{40}"
  284. },
  285. {
  286. "name": "NPM_MIRROR",
  287. "displayName": "Custom NPM Mirror URL",
  288. "description": "The custom NPM mirror URL",
  289. "value": ""
  290. }
  291. ]
  292. }