nodejs-mongodb.json 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "nodejs-mongodb-example",
  6. "annotations": {
  7. "description": "An example Node.js application with a MongoDB database",
  8. "tags": "instant-app,nodejs,mongodb",
  9. "iconClass": "icon-nodejs"
  10. }
  11. },
  12. "labels": {
  13. "template": "nodejs-mongodb-example"
  14. },
  15. "objects": [
  16. {
  17. "kind": "Service",
  18. "apiVersion": "v1",
  19. "metadata": {
  20. "name": "nodejs-mongodb-example",
  21. "annotations": {
  22. "description": "Exposes and load balances the application pods"
  23. }
  24. },
  25. "spec": {
  26. "ports": [
  27. {
  28. "name": "web",
  29. "port": 8080,
  30. "targetPort": 8080
  31. }
  32. ],
  33. "selector": {
  34. "name": "nodejs-mongodb-example"
  35. }
  36. }
  37. },
  38. {
  39. "kind": "Route",
  40. "apiVersion": "v1",
  41. "metadata": {
  42. "name": "nodejs-mongodb-example"
  43. },
  44. "spec": {
  45. "host": "${APPLICATION_DOMAIN}",
  46. "to": {
  47. "kind": "Service",
  48. "name": "nodejs-mongodb-example"
  49. }
  50. }
  51. },
  52. {
  53. "kind": "ImageStream",
  54. "apiVersion": "v1",
  55. "metadata": {
  56. "name": "nodejs-mongodb-example",
  57. "annotations": {
  58. "description": "Keeps track of changes in the application image"
  59. }
  60. }
  61. },
  62. {
  63. "kind": "BuildConfig",
  64. "apiVersion": "v1",
  65. "metadata": {
  66. "name": "nodejs-mongodb-example",
  67. "annotations": {
  68. "description": "Defines how to build the application"
  69. }
  70. },
  71. "spec": {
  72. "source": {
  73. "type": "Git",
  74. "git": {
  75. "uri": "${SOURCE_REPOSITORY_URL}",
  76. "ref": "${SOURCE_REPOSITORY_REF}"
  77. },
  78. "contextDir": "${CONTEXT_DIR}"
  79. },
  80. "strategy": {
  81. "type": "Source",
  82. "sourceStrategy": {
  83. "from": {
  84. "kind": "ImageStreamTag",
  85. "namespace": "openshift",
  86. "name": "nodejs:0.10"
  87. }
  88. }
  89. },
  90. "output": {
  91. "to": {
  92. "kind": "ImageStreamTag",
  93. "name": "nodejs-mongodb-example:latest"
  94. }
  95. },
  96. "triggers": [
  97. {
  98. "type": "ImageChange"
  99. },
  100. {
  101. "type": "GitHub",
  102. "github": {
  103. "secret": "${GITHUB_WEBHOOK_SECRET}"
  104. }
  105. },
  106. {
  107. "type": "Generic",
  108. "generic": {
  109. "secret": "${GENERIC_WEBHOOK_SECRET}"
  110. }
  111. }
  112. ]
  113. }
  114. },
  115. {
  116. "kind": "DeploymentConfig",
  117. "apiVersion": "v1",
  118. "metadata": {
  119. "name": "nodejs-mongodb-example",
  120. "annotations": {
  121. "description": "Defines how to deploy the application server"
  122. }
  123. },
  124. "spec": {
  125. "strategy": {
  126. "type": "Rolling"
  127. },
  128. "triggers": [
  129. {
  130. "type": "ImageChange",
  131. "imageChangeParams": {
  132. "automatic": true,
  133. "containerNames": [
  134. "nodejs-mongodb-example"
  135. ],
  136. "from": {
  137. "kind": "ImageStreamTag",
  138. "name": "nodejs-mongodb-example:latest"
  139. }
  140. }
  141. },
  142. {
  143. "type": "ConfigChange"
  144. }
  145. ],
  146. "replicas": 1,
  147. "selector": {
  148. "name": "nodejs-mongodb-example"
  149. },
  150. "template": {
  151. "metadata": {
  152. "name": "nodejs-mongodb-example",
  153. "labels": {
  154. "name": "nodejs-mongodb-example"
  155. }
  156. },
  157. "spec": {
  158. "containers": [
  159. {
  160. "name": "nodejs-mongodb-example",
  161. "image": "nodejs-mongodb-example",
  162. "ports": [
  163. {
  164. "containerPort": 8080
  165. }
  166. ],
  167. "env": [
  168. {
  169. "name": "DATABASE_SERVICE_NAME",
  170. "value": "${DATABASE_SERVICE_NAME}"
  171. },
  172. {
  173. "name": "MONGODB_USER",
  174. "value": "${DATABASE_USER}"
  175. },
  176. {
  177. "name": "MONGODB_PASSWORD",
  178. "value": "${DATABASE_PASSWORD}"
  179. },
  180. {
  181. "name": "MONGODB_DATABASE",
  182. "value": "${DATABASE_NAME}"
  183. },
  184. {
  185. "name": "MONGODB_ADMIN_PASSWORD",
  186. "value": "${DATABASE_ADMIN_PASSWORD}"
  187. }
  188. ]
  189. }
  190. ]
  191. }
  192. }
  193. }
  194. },
  195. {
  196. "kind": "Service",
  197. "apiVersion": "v1",
  198. "metadata": {
  199. "name": "${DATABASE_SERVICE_NAME}",
  200. "annotations": {
  201. "description": "Exposes the database server"
  202. }
  203. },
  204. "spec": {
  205. "ports": [
  206. {
  207. "name": "mongodb",
  208. "port": 27017,
  209. "targetPort": 27017
  210. }
  211. ],
  212. "selector": {
  213. "name": "${DATABASE_SERVICE_NAME}"
  214. }
  215. }
  216. },
  217. {
  218. "kind": "DeploymentConfig",
  219. "apiVersion": "v1",
  220. "metadata": {
  221. "name": "${DATABASE_SERVICE_NAME}",
  222. "annotations": {
  223. "description": "Defines how to deploy the database"
  224. }
  225. },
  226. "spec": {
  227. "strategy": {
  228. "type": "Recreate"
  229. },
  230. "triggers": [
  231. {
  232. "type": "ConfigChange"
  233. }
  234. ],
  235. "replicas": 1,
  236. "selector": {
  237. "name": "${DATABASE_SERVICE_NAME}"
  238. },
  239. "template": {
  240. "metadata": {
  241. "name": "${DATABASE_SERVICE_NAME}",
  242. "labels": {
  243. "name": "${DATABASE_SERVICE_NAME}"
  244. }
  245. },
  246. "spec": {
  247. "containers": [
  248. {
  249. "name": "mongodb",
  250. "image": "${MONGODB_IMAGE}",
  251. "ports": [
  252. {
  253. "containerPort": 27017
  254. }
  255. ],
  256. "env": [
  257. {
  258. "name": "MONGODB_USER",
  259. "value": "${DATABASE_USER}"
  260. },
  261. {
  262. "name": "MONGODB_PASSWORD",
  263. "value": "${DATABASE_PASSWORD}"
  264. },
  265. {
  266. "name": "MONGODB_DATABASE",
  267. "value": "${DATABASE_NAME}"
  268. },
  269. {
  270. "name": "MONGODB_ADMIN_PASSWORD",
  271. "value": "${DATABASE_ADMIN_PASSWORD}"
  272. }
  273. ]
  274. }
  275. ]
  276. }
  277. }
  278. }
  279. }
  280. ],
  281. "parameters": [
  282. {
  283. "name": "SOURCE_REPOSITORY_URL",
  284. "description": "The URL of the repository with your application source code",
  285. "value": "https://github.com/openshift/nodejs-ex.git"
  286. },
  287. {
  288. "name": "SOURCE_REPOSITORY_REF",
  289. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
  290. },
  291. {
  292. "name": "CONTEXT_DIR",
  293. "description": "Set this to the relative path to your project if it is not in the root of your repository"
  294. },
  295. {
  296. "name": "APPLICATION_DOMAIN",
  297. "description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted.",
  298. "value": ""
  299. },
  300. {
  301. "name": "GITHUB_WEBHOOK_SECRET",
  302. "description": "A secret string used to configure the GitHub webhook",
  303. "generate": "expression",
  304. "from": "[a-zA-Z0-9]{40}"
  305. },
  306. {
  307. "name": "GENERIC_WEBHOOK_SECRET",
  308. "description": "A secret string used to configure the Generic webhook",
  309. "generate": "expression",
  310. "from": "[a-zA-Z0-9]{40}"
  311. },
  312. {
  313. "name": "DATABASE_SERVICE_NAME",
  314. "description": "Database service name",
  315. "value": "mongodb"
  316. },
  317. {
  318. "name": "DATABASE_USER",
  319. "description": "Username for MongoDB user that will be used for accessing the database",
  320. "generate": "expression",
  321. "from": "user[A-Z0-9]{3}"
  322. },
  323. {
  324. "name": "DATABASE_PASSWORD",
  325. "description": "Password for the MongoDB user",
  326. "generate": "expression",
  327. "from": "[a-zA-Z0-9]{16}"
  328. },
  329. {
  330. "name": "DATABASE_NAME",
  331. "description": "Database name",
  332. "value": "sampledb"
  333. },
  334. {
  335. "name": "DATABASE_ADMIN_PASSWORD",
  336. "description": "Password for the database admin user",
  337. "generate": "expression",
  338. "from": "[a-zA-Z0-9]{16}"
  339. },
  340. {
  341. "name": "MONGODB_IMAGE",
  342. "description": "Image to use for mongodb",
  343. "value": "openshift/mongodb-24-centos7"
  344. }
  345. ]
  346. }