dancer-mysql.json 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "dancer-mysql-example",
  6. "annotations": {
  7. "description": "An example Dancer application with a MySQL database",
  8. "tags": "instant-app,perl,dancer,mysql",
  9. "iconClass": "icon-perl"
  10. }
  11. },
  12. "labels": {
  13. "template": "dancer-mysql-example"
  14. },
  15. "objects": [
  16. {
  17. "kind": "Service",
  18. "apiVersion": "v1",
  19. "metadata": {
  20. "name": "dancer-mysql-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": "dancer-mysql-example"
  35. }
  36. }
  37. },
  38. {
  39. "kind": "Route",
  40. "apiVersion": "v1",
  41. "metadata": {
  42. "name": "dancer-mysql-example"
  43. },
  44. "spec": {
  45. "host": "${APPLICATION_DOMAIN}",
  46. "to": {
  47. "kind": "Service",
  48. "name": "dancer-mysql-example"
  49. }
  50. }
  51. },
  52. {
  53. "kind": "ImageStream",
  54. "apiVersion": "v1",
  55. "metadata": {
  56. "name": "dancer-mysql-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": "dancer-mysql-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": "perl:5.16"
  87. }
  88. }
  89. },
  90. "output": {
  91. "to": {
  92. "kind": "ImageStreamTag",
  93. "name": "dancer-mysql-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. }
  108. },
  109. {
  110. "kind": "DeploymentConfig",
  111. "apiVersion": "v1",
  112. "metadata": {
  113. "name": "dancer-mysql-example",
  114. "annotations": {
  115. "description": "Defines how to deploy the application server"
  116. }
  117. },
  118. "spec": {
  119. "triggers": [
  120. {
  121. "type": "ImageChange",
  122. "imageChangeParams": {
  123. "automatic": true,
  124. "containerNames": [
  125. "dancer-mysql-example"
  126. ],
  127. "from": {
  128. "kind": "ImageStreamTag",
  129. "name": "dancer-mysql-example:latest"
  130. }
  131. }
  132. },
  133. {
  134. "type": "ConfigChange"
  135. }
  136. ],
  137. "replicas": 1,
  138. "selector": {
  139. "name": "dancer-mysql-example"
  140. },
  141. "template": {
  142. "metadata": {
  143. "name": "dancer-mysql-example",
  144. "labels": {
  145. "name": "dancer-mysql-example"
  146. }
  147. },
  148. "spec": {
  149. "containers": [
  150. {
  151. "name": "dancer-mysql-example",
  152. "image": "dancer-mysql-example",
  153. "ports": [
  154. {
  155. "containerPort": 8080
  156. }
  157. ],
  158. "env": [
  159. {
  160. "name": "DATABASE_SERVICE_NAME",
  161. "value": "${DATABASE_SERVICE_NAME}"
  162. },
  163. {
  164. "name": "MYSQL_USER",
  165. "value": "${DATABASE_USER}"
  166. },
  167. {
  168. "name": "MYSQL_PASSWORD",
  169. "value": "${DATABASE_PASSWORD}"
  170. },
  171. {
  172. "name": "MYSQL_DATABASE",
  173. "value": "${DATABASE_NAME}"
  174. },
  175. {
  176. "name": "SECRET_KEY_BASE",
  177. "value": "${SECRET_KEY_BASE}"
  178. }
  179. ]
  180. }
  181. ]
  182. }
  183. }
  184. }
  185. },
  186. {
  187. "kind": "Service",
  188. "apiVersion": "v1",
  189. "metadata": {
  190. "name": "${DATABASE_SERVICE_NAME}",
  191. "annotations": {
  192. "description": "Exposes the database server"
  193. }
  194. },
  195. "spec": {
  196. "ports": [
  197. {
  198. "name": "mysql",
  199. "port": 3306,
  200. "targetPort": 3306
  201. }
  202. ],
  203. "selector": {
  204. "name": "${DATABASE_SERVICE_NAME}"
  205. }
  206. }
  207. },
  208. {
  209. "kind": "DeploymentConfig",
  210. "apiVersion": "v1",
  211. "metadata": {
  212. "name": "${DATABASE_SERVICE_NAME}",
  213. "annotations": {
  214. "description": "Defines how to deploy the database"
  215. }
  216. },
  217. "spec": {
  218. "strategy": {
  219. "type": "Recreate"
  220. },
  221. "triggers": [
  222. {
  223. "type": "ConfigChange"
  224. }
  225. ],
  226. "replicas": 1,
  227. "selector": {
  228. "name": "${DATABASE_SERVICE_NAME}"
  229. },
  230. "template": {
  231. "metadata": {
  232. "name": "${DATABASE_SERVICE_NAME}",
  233. "labels": {
  234. "name": "${DATABASE_SERVICE_NAME}"
  235. }
  236. },
  237. "spec": {
  238. "containers": [
  239. {
  240. "name": "mysql",
  241. "image": "${MYSQL_IMAGE}",
  242. "ports": [
  243. {
  244. "containerPort": 3306
  245. }
  246. ],
  247. "env": [
  248. {
  249. "name": "MYSQL_USER",
  250. "value": "${DATABASE_USER}"
  251. },
  252. {
  253. "name": "MYSQL_PASSWORD",
  254. "value": "${DATABASE_PASSWORD}"
  255. },
  256. {
  257. "name": "MYSQL_DATABASE",
  258. "value": "${DATABASE_NAME}"
  259. }
  260. ]
  261. }
  262. ]
  263. }
  264. }
  265. }
  266. }
  267. ],
  268. "parameters": [
  269. {
  270. "name": "SOURCE_REPOSITORY_URL",
  271. "description": "The URL of the repository with your application source code",
  272. "value": "https://github.com/openshift/dancer-ex.git"
  273. },
  274. {
  275. "name": "SOURCE_REPOSITORY_REF",
  276. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
  277. },
  278. {
  279. "name": "CONTEXT_DIR",
  280. "description": "Set this to the relative path to your project if it is not in the root of your repository"
  281. },
  282. {
  283. "name": "APPLICATION_DOMAIN",
  284. "description": "The exposed hostname that will route to the Dancer service, if left blank a value will be defaulted.",
  285. "value": ""
  286. },
  287. {
  288. "name": "GITHUB_WEBHOOK_SECRET",
  289. "description": "A secret string used to configure the GitHub webhook",
  290. "generate": "expression",
  291. "from": "[a-zA-Z0-9]{40}"
  292. },
  293. {
  294. "name": "ADMIN_USERNAME",
  295. "description": "administrator username",
  296. "generate": "expression",
  297. "from": "admin[A-Z0-9]{3}"
  298. },
  299. {
  300. "name": "ADMIN_PASSWORD",
  301. "description": "administrator password",
  302. "generate": "expression",
  303. "from": "[a-zA-Z0-9]{8}"
  304. },
  305. {
  306. "name": "DATABASE_SERVICE_NAME",
  307. "description": "Database service name",
  308. "value": "database"
  309. },
  310. {
  311. "name": "DATABASE_USER",
  312. "description": "database username",
  313. "generate": "expression",
  314. "from": "user[A-Z0-9]{3}"
  315. },
  316. {
  317. "name": "DATABASE_PASSWORD",
  318. "description": "database password",
  319. "generate": "expression",
  320. "from": "[a-zA-Z0-9]{8}"
  321. },
  322. {
  323. "name": "DATABASE_NAME",
  324. "description": "database name",
  325. "value": "sampledb"
  326. },
  327. {
  328. "name": "MYSQL_IMAGE",
  329. "description": "Image to use for mysql",
  330. "value": "openshift/mysql-55-centos7"
  331. },
  332. {
  333. "name": "SECRET_KEY_BASE",
  334. "description": "Your secret key for verifying the integrity of signed cookies",
  335. "generate": "expression",
  336. "from": "[a-z0-9]{127}"
  337. }
  338. ]
  339. }