cakephp-mysql.json 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "cakephp-mysql-example",
  6. "annotations": {
  7. "openshift.io/display-name": "CakePHP + MySQL (Ephemeral)",
  8. "description": "An example CakePHP application with a MySQL database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/cakephp-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,php,cakephp",
  10. "iconClass": "icon-php"
  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/cake-ex/blob/master/README.md.",
  14. "labels": {
  15. "template": "cakephp-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": "php:5.6"
  90. },
  91. "env": [
  92. {
  93. "name": "COMPOSER_MIRROR",
  94. "value": "${COMPOSER_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. "strategy": {
  132. "type": "Recreate",
  133. "recreateParams": {
  134. "pre": {
  135. "failurePolicy": "Retry",
  136. "execNewPod": {
  137. "command": [
  138. "./migrate-database.sh"
  139. ],
  140. "containerName": "cakephp-mysql-example"
  141. }
  142. }
  143. }
  144. },
  145. "triggers": [
  146. {
  147. "type": "ImageChange",
  148. "imageChangeParams": {
  149. "automatic": true,
  150. "containerNames": [
  151. "cakephp-mysql-example"
  152. ],
  153. "from": {
  154. "kind": "ImageStreamTag",
  155. "name": "${NAME}:latest"
  156. }
  157. }
  158. },
  159. {
  160. "type": "ConfigChange"
  161. }
  162. ],
  163. "replicas": 1,
  164. "selector": {
  165. "name": "${NAME}"
  166. },
  167. "template": {
  168. "metadata": {
  169. "name": "${NAME}",
  170. "labels": {
  171. "name": "${NAME}"
  172. }
  173. },
  174. "spec": {
  175. "containers": [
  176. {
  177. "name": "cakephp-mysql-example",
  178. "image": " ",
  179. "ports": [
  180. {
  181. "containerPort": 8080
  182. }
  183. ],
  184. "readinessProbe": {
  185. "timeoutSeconds": 3,
  186. "initialDelaySeconds": 3,
  187. "httpGet": {
  188. "path": "/health.php",
  189. "port": 8080
  190. }
  191. },
  192. "livenessProbe": {
  193. "timeoutSeconds": 3,
  194. "initialDelaySeconds": 30,
  195. "httpGet": {
  196. "path": "/",
  197. "port": 8080
  198. }
  199. },
  200. "env": [
  201. {
  202. "name": "DATABASE_SERVICE_NAME",
  203. "value": "${DATABASE_SERVICE_NAME}"
  204. },
  205. {
  206. "name": "DATABASE_ENGINE",
  207. "value": "${DATABASE_ENGINE}"
  208. },
  209. {
  210. "name": "DATABASE_NAME",
  211. "value": "${DATABASE_NAME}"
  212. },
  213. {
  214. "name": "DATABASE_USER",
  215. "value": "${DATABASE_USER}"
  216. },
  217. {
  218. "name": "DATABASE_PASSWORD",
  219. "value": "${DATABASE_PASSWORD}"
  220. },
  221. {
  222. "name": "CAKEPHP_SECRET_TOKEN",
  223. "value": "${CAKEPHP_SECRET_TOKEN}"
  224. },
  225. {
  226. "name": "CAKEPHP_SECURITY_SALT",
  227. "value": "${CAKEPHP_SECURITY_SALT}"
  228. },
  229. {
  230. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  231. "value": "${CAKEPHP_SECURITY_CIPHER_SEED}"
  232. },
  233. {
  234. "name": "OPCACHE_REVALIDATE_FREQ",
  235. "value": "${OPCACHE_REVALIDATE_FREQ}"
  236. }
  237. ],
  238. "resources": {
  239. "limits": {
  240. "memory": "${MEMORY_LIMIT}"
  241. }
  242. }
  243. }
  244. ]
  245. }
  246. }
  247. }
  248. },
  249. {
  250. "kind": "Service",
  251. "apiVersion": "v1",
  252. "metadata": {
  253. "name": "${DATABASE_SERVICE_NAME}",
  254. "annotations": {
  255. "description": "Exposes the database server"
  256. }
  257. },
  258. "spec": {
  259. "ports": [
  260. {
  261. "name": "mysql",
  262. "port": 3306,
  263. "targetPort": 3306
  264. }
  265. ],
  266. "selector": {
  267. "name": "${DATABASE_SERVICE_NAME}"
  268. }
  269. }
  270. },
  271. {
  272. "kind": "DeploymentConfig",
  273. "apiVersion": "v1",
  274. "metadata": {
  275. "name": "${DATABASE_SERVICE_NAME}",
  276. "annotations": {
  277. "description": "Defines how to deploy the database"
  278. }
  279. },
  280. "spec": {
  281. "strategy": {
  282. "type": "Recreate"
  283. },
  284. "triggers": [
  285. {
  286. "type": "ImageChange",
  287. "imageChangeParams": {
  288. "automatic": true,
  289. "containerNames": [
  290. "mysql"
  291. ],
  292. "from": {
  293. "kind": "ImageStreamTag",
  294. "namespace": "${NAMESPACE}",
  295. "name": "mysql:5.6"
  296. }
  297. }
  298. },
  299. {
  300. "type": "ConfigChange"
  301. }
  302. ],
  303. "replicas": 1,
  304. "selector": {
  305. "name": "${DATABASE_SERVICE_NAME}"
  306. },
  307. "template": {
  308. "metadata": {
  309. "name": "${DATABASE_SERVICE_NAME}",
  310. "labels": {
  311. "name": "${DATABASE_SERVICE_NAME}"
  312. }
  313. },
  314. "spec": {
  315. "volumes": [
  316. {
  317. "name": "data",
  318. "emptyDir": {}
  319. }
  320. ],
  321. "containers": [
  322. {
  323. "name": "mysql",
  324. "image": " ",
  325. "ports": [
  326. {
  327. "containerPort": 3306
  328. }
  329. ],
  330. "volumeMounts": [
  331. {
  332. "name": "data",
  333. "mountPath": "/var/lib/mysql/data"
  334. }
  335. ],
  336. "readinessProbe": {
  337. "timeoutSeconds": 1,
  338. "initialDelaySeconds": 5,
  339. "exec": {
  340. "command": [ "/bin/sh", "-i", "-c", "MYSQL_PWD='${DATABASE_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${DATABASE_NAME} -e 'SELECT 1'" ]
  341. }
  342. },
  343. "livenessProbe": {
  344. "timeoutSeconds": 1,
  345. "initialDelaySeconds": 30,
  346. "tcpSocket": {
  347. "port": 3306
  348. }
  349. },
  350. "env": [
  351. {
  352. "name": "MYSQL_USER",
  353. "value": "${DATABASE_USER}"
  354. },
  355. {
  356. "name": "MYSQL_PASSWORD",
  357. "value": "${DATABASE_PASSWORD}"
  358. },
  359. {
  360. "name": "MYSQL_DATABASE",
  361. "value": "${DATABASE_NAME}"
  362. }
  363. ],
  364. "resources": {
  365. "limits": {
  366. "memory": "${MEMORY_MYSQL_LIMIT}"
  367. }
  368. }
  369. }
  370. ]
  371. }
  372. }
  373. }
  374. }
  375. ],
  376. "parameters": [
  377. {
  378. "name": "NAME",
  379. "displayName": "Name",
  380. "description": "The name assigned to all of the frontend objects defined in this template.",
  381. "required": true,
  382. "value": "cakephp-mysql-example"
  383. },
  384. {
  385. "name": "NAMESPACE",
  386. "displayName": "Namespace",
  387. "description": "The OpenShift Namespace where the ImageStream resides.",
  388. "required": true,
  389. "value": "openshift"
  390. },
  391. {
  392. "name": "MEMORY_LIMIT",
  393. "displayName": "Memory Limit",
  394. "description": "Maximum amount of memory the CakePHP container can use.",
  395. "required": true,
  396. "value": "512Mi"
  397. },
  398. {
  399. "name": "MEMORY_MYSQL_LIMIT",
  400. "displayName": "Memory Limit (MySQL)",
  401. "description": "Maximum amount of memory the MySQL container can use.",
  402. "required": true,
  403. "value": "512Mi"
  404. },
  405. {
  406. "name": "SOURCE_REPOSITORY_URL",
  407. "displayName": "Git Repository URL",
  408. "description": "The URL of the repository with your application source code.",
  409. "required": true,
  410. "value": "https://github.com/openshift/cakephp-ex.git"
  411. },
  412. {
  413. "name": "SOURCE_REPOSITORY_REF",
  414. "displayName": "Git Reference",
  415. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
  416. },
  417. {
  418. "name": "CONTEXT_DIR",
  419. "displayName": "Context Directory",
  420. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  421. },
  422. {
  423. "name": "APPLICATION_DOMAIN",
  424. "displayName": "Application Hostname",
  425. "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.",
  426. "value": ""
  427. },
  428. {
  429. "name": "GITHUB_WEBHOOK_SECRET",
  430. "displayName": "GitHub Webhook Secret",
  431. "description": "A secret string used to configure the GitHub webhook.",
  432. "generate": "expression",
  433. "from": "[a-zA-Z0-9]{40}"
  434. },
  435. {
  436. "name": "DATABASE_SERVICE_NAME",
  437. "displayName": "Database Service Name",
  438. "required": true,
  439. "value": "mysql"
  440. },
  441. {
  442. "name": "DATABASE_ENGINE",
  443. "displayName": "Database Engine",
  444. "description": "Database engine: postgresql, mysql or sqlite (default).",
  445. "required": true,
  446. "value": "mysql"
  447. },
  448. {
  449. "name": "DATABASE_NAME",
  450. "displayName": "Database Name",
  451. "required": true,
  452. "value": "default"
  453. },
  454. {
  455. "name": "DATABASE_USER",
  456. "displayName": "Database User",
  457. "required": true,
  458. "value": "cakephp"
  459. },
  460. {
  461. "name": "DATABASE_PASSWORD",
  462. "displayName": "Database Password",
  463. "generate": "expression",
  464. "from": "[a-zA-Z0-9]{16}"
  465. },
  466. {
  467. "name": "CAKEPHP_SECRET_TOKEN",
  468. "displayName": "CakePHP secret token",
  469. "description": "Set this to a long random string.",
  470. "generate": "expression",
  471. "from": "[\\w]{50}"
  472. },
  473. {
  474. "name": "CAKEPHP_SECURITY_SALT",
  475. "displayName": "CakePHP Security Salt",
  476. "description": "Security salt for session hash.",
  477. "generate": "expression",
  478. "from": "[a-zA-Z0-9]{40}"
  479. },
  480. {
  481. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  482. "displayName": "CakePHP Security Cipher Seed",
  483. "description": "Security cipher seed for session hash.",
  484. "generate": "expression",
  485. "from": "[0-9]{30}"
  486. },
  487. {
  488. "name": "OPCACHE_REVALIDATE_FREQ",
  489. "displayName": "OPcache Revalidation Frequency",
  490. "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.",
  491. "value": "2"
  492. },
  493. {
  494. "name": "COMPOSER_MIRROR",
  495. "displayName": "Custom Composer Mirror URL",
  496. "description": "The custom Composer mirror URL",
  497. "value": ""
  498. }
  499. ]
  500. }