dancer-mysql.json 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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.20"
  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": "ConfigChange"
  102. },
  103. {
  104. "type": "GitHub",
  105. "github": {
  106. "secret": "${GITHUB_WEBHOOK_SECRET}"
  107. }
  108. }
  109. ]
  110. }
  111. },
  112. {
  113. "kind": "DeploymentConfig",
  114. "apiVersion": "v1",
  115. "metadata": {
  116. "name": "dancer-mysql-example",
  117. "annotations": {
  118. "description": "Defines how to deploy the application server"
  119. }
  120. },
  121. "spec": {
  122. "triggers": [
  123. {
  124. "type": "ImageChange",
  125. "imageChangeParams": {
  126. "automatic": true,
  127. "containerNames": [
  128. "dancer-mysql-example"
  129. ],
  130. "from": {
  131. "kind": "ImageStreamTag",
  132. "name": "dancer-mysql-example:latest"
  133. }
  134. }
  135. },
  136. {
  137. "type": "ConfigChange"
  138. }
  139. ],
  140. "replicas": 1,
  141. "selector": {
  142. "name": "dancer-mysql-example"
  143. },
  144. "template": {
  145. "metadata": {
  146. "name": "dancer-mysql-example",
  147. "labels": {
  148. "name": "dancer-mysql-example"
  149. }
  150. },
  151. "spec": {
  152. "containers": [
  153. {
  154. "name": "dancer-mysql-example",
  155. "image": "dancer-mysql-example",
  156. "ports": [
  157. {
  158. "containerPort": 8080
  159. }
  160. ],
  161. "env": [
  162. {
  163. "name": "DATABASE_SERVICE_NAME",
  164. "value": "${DATABASE_SERVICE_NAME}"
  165. },
  166. {
  167. "name": "MYSQL_USER",
  168. "value": "${DATABASE_USER}"
  169. },
  170. {
  171. "name": "MYSQL_PASSWORD",
  172. "value": "${DATABASE_PASSWORD}"
  173. },
  174. {
  175. "name": "MYSQL_DATABASE",
  176. "value": "${DATABASE_NAME}"
  177. },
  178. {
  179. "name": "SECRET_KEY_BASE",
  180. "value": "${SECRET_KEY_BASE}"
  181. },
  182. {
  183. "name": "PERL_APACHE2_RELOAD",
  184. "value": "${PERL_APACHE2_RELOAD}"
  185. }
  186. ]
  187. }
  188. ]
  189. }
  190. }
  191. }
  192. },
  193. {
  194. "kind": "Service",
  195. "apiVersion": "v1",
  196. "metadata": {
  197. "name": "${DATABASE_SERVICE_NAME}",
  198. "annotations": {
  199. "description": "Exposes the database server"
  200. }
  201. },
  202. "spec": {
  203. "ports": [
  204. {
  205. "name": "mysql",
  206. "port": 3306,
  207. "targetPort": 3306
  208. }
  209. ],
  210. "selector": {
  211. "name": "${DATABASE_SERVICE_NAME}"
  212. }
  213. }
  214. },
  215. {
  216. "kind": "DeploymentConfig",
  217. "apiVersion": "v1",
  218. "metadata": {
  219. "name": "${DATABASE_SERVICE_NAME}",
  220. "annotations": {
  221. "description": "Defines how to deploy the database"
  222. }
  223. },
  224. "spec": {
  225. "strategy": {
  226. "type": "Recreate"
  227. },
  228. "triggers": [
  229. {
  230. "type": "ImageChange",
  231. "imageChangeParams": {
  232. "automatic": false,
  233. "containerNames": [
  234. "mysql"
  235. ],
  236. "from": {
  237. "kind": "ImageStreamTag",
  238. "namespace": "openshift",
  239. "name": "mysql:5.6"
  240. }
  241. }
  242. },
  243. {
  244. "type": "ConfigChange"
  245. }
  246. ],
  247. "replicas": 1,
  248. "selector": {
  249. "name": "${DATABASE_SERVICE_NAME}"
  250. },
  251. "template": {
  252. "metadata": {
  253. "name": "${DATABASE_SERVICE_NAME}",
  254. "labels": {
  255. "name": "${DATABASE_SERVICE_NAME}"
  256. }
  257. },
  258. "spec": {
  259. "containers": [
  260. {
  261. "name": "mysql",
  262. "image": "mysql",
  263. "ports": [
  264. {
  265. "containerPort": 3306
  266. }
  267. ],
  268. "env": [
  269. {
  270. "name": "MYSQL_USER",
  271. "value": "${DATABASE_USER}"
  272. },
  273. {
  274. "name": "MYSQL_PASSWORD",
  275. "value": "${DATABASE_PASSWORD}"
  276. },
  277. {
  278. "name": "MYSQL_DATABASE",
  279. "value": "${DATABASE_NAME}"
  280. }
  281. ]
  282. }
  283. ]
  284. }
  285. }
  286. }
  287. }
  288. ],
  289. "parameters": [
  290. {
  291. "name": "SOURCE_REPOSITORY_URL",
  292. "description": "The URL of the repository with your application source code",
  293. "value": "https://github.com/openshift/dancer-ex.git"
  294. },
  295. {
  296. "name": "SOURCE_REPOSITORY_REF",
  297. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
  298. },
  299. {
  300. "name": "CONTEXT_DIR",
  301. "description": "Set this to the relative path to your project if it is not in the root of your repository"
  302. },
  303. {
  304. "name": "APPLICATION_DOMAIN",
  305. "description": "The exposed hostname that will route to the Dancer service, if left blank a value will be defaulted.",
  306. "value": ""
  307. },
  308. {
  309. "name": "GITHUB_WEBHOOK_SECRET",
  310. "description": "A secret string used to configure the GitHub webhook",
  311. "generate": "expression",
  312. "from": "[a-zA-Z0-9]{40}"
  313. },
  314. {
  315. "name": "ADMIN_USERNAME",
  316. "description": "administrator username",
  317. "generate": "expression",
  318. "from": "admin[A-Z0-9]{3}"
  319. },
  320. {
  321. "name": "ADMIN_PASSWORD",
  322. "description": "administrator password",
  323. "generate": "expression",
  324. "from": "[a-zA-Z0-9]{8}"
  325. },
  326. {
  327. "name": "DATABASE_SERVICE_NAME",
  328. "description": "Database service name",
  329. "value": "database"
  330. },
  331. {
  332. "name": "DATABASE_USER",
  333. "description": "database username",
  334. "generate": "expression",
  335. "from": "user[A-Z0-9]{3}"
  336. },
  337. {
  338. "name": "DATABASE_PASSWORD",
  339. "description": "database password",
  340. "generate": "expression",
  341. "from": "[a-zA-Z0-9]{8}"
  342. },
  343. {
  344. "name": "DATABASE_NAME",
  345. "description": "database name",
  346. "value": "sampledb"
  347. },
  348. {
  349. "name": "PERL_APACHE2_RELOAD",
  350. "description": "Set this to \"true\" to enable automatic reloading of modified Perl modules",
  351. "value": ""
  352. },
  353. {
  354. "name": "SECRET_KEY_BASE",
  355. "description": "Your secret key for verifying the integrity of signed cookies",
  356. "generate": "expression",
  357. "from": "[a-z0-9]{127}"
  358. }
  359. ]
  360. }