dancer-mysql.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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": "quickstart,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": "${NAME}",
  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": "${NAME}"
  35. }
  36. }
  37. },
  38. {
  39. "kind": "Route",
  40. "apiVersion": "v1",
  41. "metadata": {
  42. "name": "${NAME}"
  43. },
  44. "spec": {
  45. "host": "${APPLICATION_DOMAIN}",
  46. "to": {
  47. "kind": "Service",
  48. "name": "${NAME}"
  49. }
  50. }
  51. },
  52. {
  53. "kind": "ImageStream",
  54. "apiVersion": "v1",
  55. "metadata": {
  56. "name": "${NAME}",
  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": "${NAME}",
  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": "${NAMESPACE}",
  86. "name": "perl:5.20"
  87. }
  88. }
  89. },
  90. "output": {
  91. "to": {
  92. "kind": "ImageStreamTag",
  93. "name": "${NAME}: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": "${NAME}",
  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": "${NAME}:latest"
  133. }
  134. }
  135. },
  136. {
  137. "type": "ConfigChange"
  138. }
  139. ],
  140. "replicas": 1,
  141. "selector": {
  142. "name": "${NAME}"
  143. },
  144. "template": {
  145. "metadata": {
  146. "name": "${NAME}",
  147. "labels": {
  148. "name": "${NAME}"
  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. "readinessProbe": {
  162. "timeoutSeconds": 3,
  163. "initialDelaySeconds": 3,
  164. "httpGet": {
  165. "path": "/health",
  166. "port": 8080
  167. }
  168. },
  169. "livenessProbe": {
  170. "timeoutSeconds": 3,
  171. "initialDelaySeconds": 30,
  172. "httpGet": {
  173. "path": "/",
  174. "port": 8080
  175. }
  176. },
  177. "env": [
  178. {
  179. "name": "DATABASE_SERVICE_NAME",
  180. "value": "${DATABASE_SERVICE_NAME}"
  181. },
  182. {
  183. "name": "MYSQL_USER",
  184. "value": "${DATABASE_USER}"
  185. },
  186. {
  187. "name": "MYSQL_PASSWORD",
  188. "value": "${DATABASE_PASSWORD}"
  189. },
  190. {
  191. "name": "MYSQL_DATABASE",
  192. "value": "${DATABASE_NAME}"
  193. },
  194. {
  195. "name": "SECRET_KEY_BASE",
  196. "value": "${SECRET_KEY_BASE}"
  197. },
  198. {
  199. "name": "PERL_APACHE2_RELOAD",
  200. "value": "${PERL_APACHE2_RELOAD}"
  201. }
  202. ],
  203. "resources": {
  204. "limits": {
  205. "memory": "${MEMORY_LIMIT}"
  206. }
  207. }
  208. }
  209. ]
  210. }
  211. }
  212. }
  213. },
  214. {
  215. "kind": "Service",
  216. "apiVersion": "v1",
  217. "metadata": {
  218. "name": "${DATABASE_SERVICE_NAME}",
  219. "annotations": {
  220. "description": "Exposes the database server"
  221. }
  222. },
  223. "spec": {
  224. "ports": [
  225. {
  226. "name": "mysql",
  227. "port": 3306,
  228. "targetPort": 3306
  229. }
  230. ],
  231. "selector": {
  232. "name": "${DATABASE_SERVICE_NAME}"
  233. }
  234. }
  235. },
  236. {
  237. "kind": "DeploymentConfig",
  238. "apiVersion": "v1",
  239. "metadata": {
  240. "name": "${DATABASE_SERVICE_NAME}",
  241. "annotations": {
  242. "description": "Defines how to deploy the database"
  243. }
  244. },
  245. "spec": {
  246. "strategy": {
  247. "type": "Recreate"
  248. },
  249. "triggers": [
  250. {
  251. "type": "ImageChange",
  252. "imageChangeParams": {
  253. "automatic": false,
  254. "containerNames": [
  255. "mysql"
  256. ],
  257. "from": {
  258. "kind": "ImageStreamTag",
  259. "namespace": "${NAMESPACE}",
  260. "name": "mysql:5.6"
  261. }
  262. }
  263. },
  264. {
  265. "type": "ConfigChange"
  266. }
  267. ],
  268. "replicas": 1,
  269. "selector": {
  270. "name": "${DATABASE_SERVICE_NAME}"
  271. },
  272. "template": {
  273. "metadata": {
  274. "name": "${DATABASE_SERVICE_NAME}",
  275. "labels": {
  276. "name": "${DATABASE_SERVICE_NAME}"
  277. }
  278. },
  279. "spec": {
  280. "containers": [
  281. {
  282. "name": "mysql",
  283. "image": "mysql",
  284. "ports": [
  285. {
  286. "containerPort": 3306
  287. }
  288. ],
  289. "readinessProbe": {
  290. "timeoutSeconds": 1,
  291. "initialDelaySeconds": 5,
  292. "exec": {
  293. "command": [ "/bin/sh", "-i", "-c", "MYSQL_PWD='${DATABASE_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${DATABASE_NAME} -e 'SELECT 1'" ]
  294. }
  295. },
  296. "livenessProbe": {
  297. "timeoutSeconds": 1,
  298. "initialDelaySeconds": 30,
  299. "tcpSocket": {
  300. "port": 3306
  301. }
  302. },
  303. "env": [
  304. {
  305. "name": "MYSQL_USER",
  306. "value": "${DATABASE_USER}"
  307. },
  308. {
  309. "name": "MYSQL_PASSWORD",
  310. "value": "${DATABASE_PASSWORD}"
  311. },
  312. {
  313. "name": "MYSQL_DATABASE",
  314. "value": "${DATABASE_NAME}"
  315. }
  316. ],
  317. "resources": {
  318. "limits": {
  319. "memory": "${MEMORY_MYSQL_LIMIT}"
  320. }
  321. }
  322. }
  323. ]
  324. }
  325. }
  326. }
  327. }
  328. ],
  329. "parameters": [
  330. {
  331. "name": "NAME",
  332. "displayName": "Name",
  333. "description": "The name assigned to all of the frontend objects defined in this template.",
  334. "required": true,
  335. "value": "dancer-mysql-example"
  336. },
  337. {
  338. "name": "NAMESPACE",
  339. "displayName": "Namespace",
  340. "description": "The OpenShift Namespace where the ImageStream resides.",
  341. "value": "openshift"
  342. },
  343. {
  344. "name": "MEMORY_LIMIT",
  345. "displayName": "Memory Limit",
  346. "description": "Maximum amount of memory the Perl Dancer container can use.",
  347. "value": "512Mi"
  348. },
  349. {
  350. "name": "MEMORY_MYSQL_LIMIT",
  351. "displayName": "Memory Limit (MySQL)",
  352. "description": "Maximum amount of memory the MySQL container can use.",
  353. "value": "512Mi"
  354. },
  355. {
  356. "name": "SOURCE_REPOSITORY_URL",
  357. "displayName": "Git Repository URL",
  358. "description": "The URL of the repository with your application source code.",
  359. "value": "https://github.com/openshift/dancer-ex.git"
  360. },
  361. {
  362. "name": "SOURCE_REPOSITORY_REF",
  363. "displayName": "Git Reference",
  364. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
  365. },
  366. {
  367. "name": "CONTEXT_DIR",
  368. "displayName": "Context Directory",
  369. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  370. },
  371. {
  372. "name": "APPLICATION_DOMAIN",
  373. "displayName": "Application Hostname",
  374. "description": "The exposed hostname that will route to the Dancer service, if left blank a value will be defaulted.",
  375. "value": ""
  376. },
  377. {
  378. "name": "GITHUB_WEBHOOK_SECRET",
  379. "displayName": "GitHub Webhook Secret",
  380. "description": "A secret string used to configure the GitHub webhook.",
  381. "generate": "expression",
  382. "from": "[a-zA-Z0-9]{40}"
  383. },
  384. {
  385. "name": "ADMIN_USERNAME",
  386. "displayName": "Administrator Username",
  387. "generate": "expression",
  388. "from": "admin[A-Z0-9]{3}"
  389. },
  390. {
  391. "name": "ADMIN_PASSWORD",
  392. "displayName": "Administrator Password",
  393. "generate": "expression",
  394. "from": "[a-zA-Z0-9]{8}"
  395. },
  396. {
  397. "name": "DATABASE_SERVICE_NAME",
  398. "displayName": "Database Service Name",
  399. "value": "database"
  400. },
  401. {
  402. "name": "DATABASE_USER",
  403. "displayName": "Database Username",
  404. "generate": "expression",
  405. "from": "user[A-Z0-9]{3}"
  406. },
  407. {
  408. "name": "DATABASE_PASSWORD",
  409. "displayName": "Database Password",
  410. "generate": "expression",
  411. "from": "[a-zA-Z0-9]{8}"
  412. },
  413. {
  414. "name": "DATABASE_NAME",
  415. "displayName": "Database Name",
  416. "value": "sampledb"
  417. },
  418. {
  419. "name": "PERL_APACHE2_RELOAD",
  420. "displayName": "Perl Module Reload",
  421. "description": "Set this to \"true\" to enable automatic reloading of modified Perl modules.",
  422. "value": ""
  423. },
  424. {
  425. "name": "SECRET_KEY_BASE",
  426. "displayName": "Secret Key",
  427. "description": "Your secret key for verifying the integrity of signed cookies.",
  428. "generate": "expression",
  429. "from": "[a-z0-9]{127}"
  430. }
  431. ]
  432. }