dancer-mysql.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "dancer-mysql-example",
  6. "annotations": {
  7. "openshift.io/display-name": "Dancer + MySQL (Ephemeral)",
  8. "description": "An example Dancer application with a MySQL database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/dancer-ex/blob/master/README.md.\n\nWARNING: Any data stored will be lost upon pod destruction. Only use this template for testing.",
  9. "tags": "quickstart,perl,dancer",
  10. "iconClass": "icon-perl"
  11. }
  12. },
  13. "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/dancer-ex/blob/master/README.md.",
  14. "labels": {
  15. "template": "dancer-mysql-example"
  16. },
  17. "objects": [
  18. {
  19. "kind": "Service",
  20. "apiVersion": "v1",
  21. "metadata": {
  22. "name": "${NAME}",
  23. "annotations": {
  24. "description": "Exposes and load balances the application pods",
  25. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
  26. }
  27. },
  28. "spec": {
  29. "ports": [
  30. {
  31. "name": "web",
  32. "port": 8080,
  33. "targetPort": 8080
  34. }
  35. ],
  36. "selector": {
  37. "name": "${NAME}"
  38. }
  39. }
  40. },
  41. {
  42. "kind": "Route",
  43. "apiVersion": "v1",
  44. "metadata": {
  45. "name": "${NAME}"
  46. },
  47. "spec": {
  48. "host": "${APPLICATION_DOMAIN}",
  49. "to": {
  50. "kind": "Service",
  51. "name": "${NAME}"
  52. }
  53. }
  54. },
  55. {
  56. "kind": "ImageStream",
  57. "apiVersion": "v1",
  58. "metadata": {
  59. "name": "${NAME}",
  60. "annotations": {
  61. "description": "Keeps track of changes in the application image"
  62. }
  63. }
  64. },
  65. {
  66. "kind": "BuildConfig",
  67. "apiVersion": "v1",
  68. "metadata": {
  69. "name": "${NAME}",
  70. "annotations": {
  71. "description": "Defines how to build the application"
  72. }
  73. },
  74. "spec": {
  75. "source": {
  76. "type": "Git",
  77. "git": {
  78. "uri": "${SOURCE_REPOSITORY_URL}",
  79. "ref": "${SOURCE_REPOSITORY_REF}"
  80. },
  81. "contextDir": "${CONTEXT_DIR}"
  82. },
  83. "strategy": {
  84. "type": "Source",
  85. "sourceStrategy": {
  86. "from": {
  87. "kind": "ImageStreamTag",
  88. "namespace": "${NAMESPACE}",
  89. "name": "perl:5.20"
  90. },
  91. "env": [
  92. {
  93. "name": "CPAN_MIRROR",
  94. "value": "${CPAN_MIRROR}"
  95. }
  96. ]
  97. }
  98. },
  99. "output": {
  100. "to": {
  101. "kind": "ImageStreamTag",
  102. "name": "${NAME}:latest"
  103. }
  104. },
  105. "triggers": [
  106. {
  107. "type": "ImageChange"
  108. },
  109. {
  110. "type": "ConfigChange"
  111. },
  112. {
  113. "type": "GitHub",
  114. "github": {
  115. "secret": "${GITHUB_WEBHOOK_SECRET}"
  116. }
  117. }
  118. ]
  119. }
  120. },
  121. {
  122. "kind": "DeploymentConfig",
  123. "apiVersion": "v1",
  124. "metadata": {
  125. "name": "${NAME}",
  126. "annotations": {
  127. "description": "Defines how to deploy the application server"
  128. }
  129. },
  130. "spec": {
  131. "triggers": [
  132. {
  133. "type": "ImageChange",
  134. "imageChangeParams": {
  135. "automatic": true,
  136. "containerNames": [
  137. "dancer-mysql-example"
  138. ],
  139. "from": {
  140. "kind": "ImageStreamTag",
  141. "name": "${NAME}:latest"
  142. }
  143. }
  144. },
  145. {
  146. "type": "ConfigChange"
  147. }
  148. ],
  149. "replicas": 1,
  150. "selector": {
  151. "name": "${NAME}"
  152. },
  153. "template": {
  154. "metadata": {
  155. "name": "${NAME}",
  156. "labels": {
  157. "name": "${NAME}"
  158. }
  159. },
  160. "spec": {
  161. "containers": [
  162. {
  163. "name": "dancer-mysql-example",
  164. "image": " ",
  165. "ports": [
  166. {
  167. "containerPort": 8080
  168. }
  169. ],
  170. "readinessProbe": {
  171. "timeoutSeconds": 3,
  172. "initialDelaySeconds": 3,
  173. "httpGet": {
  174. "path": "/health",
  175. "port": 8080
  176. }
  177. },
  178. "livenessProbe": {
  179. "timeoutSeconds": 3,
  180. "initialDelaySeconds": 30,
  181. "httpGet": {
  182. "path": "/",
  183. "port": 8080
  184. }
  185. },
  186. "env": [
  187. {
  188. "name": "DATABASE_SERVICE_NAME",
  189. "value": "${DATABASE_SERVICE_NAME}"
  190. },
  191. {
  192. "name": "MYSQL_USER",
  193. "value": "${DATABASE_USER}"
  194. },
  195. {
  196. "name": "MYSQL_PASSWORD",
  197. "value": "${DATABASE_PASSWORD}"
  198. },
  199. {
  200. "name": "MYSQL_DATABASE",
  201. "value": "${DATABASE_NAME}"
  202. },
  203. {
  204. "name": "SECRET_KEY_BASE",
  205. "value": "${SECRET_KEY_BASE}"
  206. },
  207. {
  208. "name": "PERL_APACHE2_RELOAD",
  209. "value": "${PERL_APACHE2_RELOAD}"
  210. }
  211. ],
  212. "resources": {
  213. "limits": {
  214. "memory": "${MEMORY_LIMIT}"
  215. }
  216. }
  217. }
  218. ]
  219. }
  220. }
  221. }
  222. },
  223. {
  224. "kind": "Service",
  225. "apiVersion": "v1",
  226. "metadata": {
  227. "name": "${DATABASE_SERVICE_NAME}",
  228. "annotations": {
  229. "description": "Exposes the database server"
  230. }
  231. },
  232. "spec": {
  233. "ports": [
  234. {
  235. "name": "mysql",
  236. "port": 3306,
  237. "targetPort": 3306
  238. }
  239. ],
  240. "selector": {
  241. "name": "${DATABASE_SERVICE_NAME}"
  242. }
  243. }
  244. },
  245. {
  246. "kind": "DeploymentConfig",
  247. "apiVersion": "v1",
  248. "metadata": {
  249. "name": "${DATABASE_SERVICE_NAME}",
  250. "annotations": {
  251. "description": "Defines how to deploy the database"
  252. }
  253. },
  254. "spec": {
  255. "strategy": {
  256. "type": "Recreate"
  257. },
  258. "triggers": [
  259. {
  260. "type": "ImageChange",
  261. "imageChangeParams": {
  262. "automatic": true,
  263. "containerNames": [
  264. "mysql"
  265. ],
  266. "from": {
  267. "kind": "ImageStreamTag",
  268. "namespace": "${NAMESPACE}",
  269. "name": "mysql:5.6"
  270. }
  271. }
  272. },
  273. {
  274. "type": "ConfigChange"
  275. }
  276. ],
  277. "replicas": 1,
  278. "selector": {
  279. "name": "${DATABASE_SERVICE_NAME}"
  280. },
  281. "template": {
  282. "metadata": {
  283. "name": "${DATABASE_SERVICE_NAME}",
  284. "labels": {
  285. "name": "${DATABASE_SERVICE_NAME}"
  286. }
  287. },
  288. "spec": {
  289. "volumes": [
  290. {
  291. "name": "data",
  292. "emptyDir": {}
  293. }
  294. ],
  295. "containers": [
  296. {
  297. "name": "mysql",
  298. "image": " ",
  299. "ports": [
  300. {
  301. "containerPort": 3306
  302. }
  303. ],
  304. "volumeMounts": [
  305. {
  306. "name": "data",
  307. "mountPath": "/var/lib/mysql/data"
  308. }
  309. ],
  310. "readinessProbe": {
  311. "timeoutSeconds": 1,
  312. "initialDelaySeconds": 5,
  313. "exec": {
  314. "command": [ "/bin/sh", "-i", "-c", "MYSQL_PWD='${DATABASE_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${DATABASE_NAME} -e 'SELECT 1'" ]
  315. }
  316. },
  317. "livenessProbe": {
  318. "timeoutSeconds": 1,
  319. "initialDelaySeconds": 30,
  320. "tcpSocket": {
  321. "port": 3306
  322. }
  323. },
  324. "env": [
  325. {
  326. "name": "MYSQL_USER",
  327. "value": "${DATABASE_USER}"
  328. },
  329. {
  330. "name": "MYSQL_PASSWORD",
  331. "value": "${DATABASE_PASSWORD}"
  332. },
  333. {
  334. "name": "MYSQL_DATABASE",
  335. "value": "${DATABASE_NAME}"
  336. }
  337. ],
  338. "resources": {
  339. "limits": {
  340. "memory": "${MEMORY_MYSQL_LIMIT}"
  341. }
  342. }
  343. }
  344. ]
  345. }
  346. }
  347. }
  348. }
  349. ],
  350. "parameters": [
  351. {
  352. "name": "NAME",
  353. "displayName": "Name",
  354. "description": "The name assigned to all of the frontend objects defined in this template.",
  355. "required": true,
  356. "value": "dancer-mysql-example"
  357. },
  358. {
  359. "name": "NAMESPACE",
  360. "displayName": "Namespace",
  361. "description": "The OpenShift Namespace where the ImageStream resides.",
  362. "required": true,
  363. "value": "openshift"
  364. },
  365. {
  366. "name": "MEMORY_LIMIT",
  367. "displayName": "Memory Limit",
  368. "description": "Maximum amount of memory the Perl Dancer container can use.",
  369. "required": true,
  370. "value": "512Mi"
  371. },
  372. {
  373. "name": "MEMORY_MYSQL_LIMIT",
  374. "displayName": "Memory Limit (MySQL)",
  375. "description": "Maximum amount of memory the MySQL container can use.",
  376. "required": true,
  377. "value": "512Mi"
  378. },
  379. {
  380. "name": "SOURCE_REPOSITORY_URL",
  381. "displayName": "Git Repository URL",
  382. "description": "The URL of the repository with your application source code.",
  383. "required": true,
  384. "value": "https://github.com/openshift/dancer-ex.git"
  385. },
  386. {
  387. "name": "SOURCE_REPOSITORY_REF",
  388. "displayName": "Git Reference",
  389. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
  390. },
  391. {
  392. "name": "CONTEXT_DIR",
  393. "displayName": "Context Directory",
  394. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  395. },
  396. {
  397. "name": "APPLICATION_DOMAIN",
  398. "displayName": "Application Hostname",
  399. "description": "The exposed hostname that will route to the Dancer service, if left blank a value will be defaulted.",
  400. "value": ""
  401. },
  402. {
  403. "name": "GITHUB_WEBHOOK_SECRET",
  404. "displayName": "GitHub Webhook Secret",
  405. "description": "A secret string used to configure the GitHub webhook.",
  406. "generate": "expression",
  407. "from": "[a-zA-Z0-9]{40}"
  408. },
  409. {
  410. "name": "ADMIN_USERNAME",
  411. "displayName": "Administrator Username",
  412. "generate": "expression",
  413. "from": "admin[A-Z0-9]{3}"
  414. },
  415. {
  416. "name": "ADMIN_PASSWORD",
  417. "displayName": "Administrator Password",
  418. "generate": "expression",
  419. "from": "[a-zA-Z0-9]{8}"
  420. },
  421. {
  422. "name": "DATABASE_SERVICE_NAME",
  423. "displayName": "Database Service Name",
  424. "required": true,
  425. "value": "database"
  426. },
  427. {
  428. "name": "DATABASE_USER",
  429. "displayName": "Database Username",
  430. "generate": "expression",
  431. "from": "user[A-Z0-9]{3}"
  432. },
  433. {
  434. "name": "DATABASE_PASSWORD",
  435. "displayName": "Database Password",
  436. "generate": "expression",
  437. "from": "[a-zA-Z0-9]{8}"
  438. },
  439. {
  440. "name": "DATABASE_NAME",
  441. "displayName": "Database Name",
  442. "required": true,
  443. "value": "sampledb"
  444. },
  445. {
  446. "name": "PERL_APACHE2_RELOAD",
  447. "displayName": "Perl Module Reload",
  448. "description": "Set this to \"true\" to enable automatic reloading of modified Perl modules.",
  449. "value": ""
  450. },
  451. {
  452. "name": "SECRET_KEY_BASE",
  453. "displayName": "Secret Key",
  454. "description": "Your secret key for verifying the integrity of signed cookies.",
  455. "generate": "expression",
  456. "from": "[a-z0-9]{127}"
  457. },
  458. {
  459. "name": "CPAN_MIRROR",
  460. "displayName": "Custom CPAN Mirror URL",
  461. "description": "The custom CPAN mirror URL",
  462. "value": ""
  463. }
  464. ]
  465. }