cakephp-mysql.json 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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": "Secret",
  20. "apiVersion": "v1",
  21. "metadata": {
  22. "name": "${NAME}"
  23. },
  24. "stringData" : {
  25. "databaseUser" : "${DATABASE_USER}",
  26. "databasePassword" : "${DATABASE_PASSWORD}"
  27. }
  28. },
  29. {
  30. "kind": "Service",
  31. "apiVersion": "v1",
  32. "metadata": {
  33. "name": "${NAME}",
  34. "annotations": {
  35. "description": "Exposes and load balances the application pods",
  36. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
  37. }
  38. },
  39. "spec": {
  40. "ports": [
  41. {
  42. "name": "web",
  43. "port": 8080,
  44. "targetPort": 8080
  45. }
  46. ],
  47. "selector": {
  48. "name": "${NAME}"
  49. }
  50. }
  51. },
  52. {
  53. "kind": "Route",
  54. "apiVersion": "v1",
  55. "metadata": {
  56. "name": "${NAME}"
  57. },
  58. "spec": {
  59. "host": "${APPLICATION_DOMAIN}",
  60. "to": {
  61. "kind": "Service",
  62. "name": "${NAME}"
  63. }
  64. }
  65. },
  66. {
  67. "kind": "ImageStream",
  68. "apiVersion": "v1",
  69. "metadata": {
  70. "name": "${NAME}",
  71. "annotations": {
  72. "description": "Keeps track of changes in the application image"
  73. }
  74. }
  75. },
  76. {
  77. "kind": "BuildConfig",
  78. "apiVersion": "v1",
  79. "metadata": {
  80. "name": "${NAME}",
  81. "annotations": {
  82. "description": "Defines how to build the application"
  83. }
  84. },
  85. "spec": {
  86. "source": {
  87. "type": "Git",
  88. "git": {
  89. "uri": "${SOURCE_REPOSITORY_URL}",
  90. "ref": "${SOURCE_REPOSITORY_REF}"
  91. },
  92. "contextDir": "${CONTEXT_DIR}"
  93. },
  94. "strategy": {
  95. "type": "Source",
  96. "sourceStrategy": {
  97. "from": {
  98. "kind": "ImageStreamTag",
  99. "namespace": "${NAMESPACE}",
  100. "name": "php:5.6"
  101. },
  102. "env": [
  103. {
  104. "name": "COMPOSER_MIRROR",
  105. "value": "${COMPOSER_MIRROR}"
  106. }
  107. ]
  108. }
  109. },
  110. "output": {
  111. "to": {
  112. "kind": "ImageStreamTag",
  113. "name": "${NAME}:latest"
  114. }
  115. },
  116. "triggers": [
  117. {
  118. "type": "ImageChange"
  119. },
  120. {
  121. "type": "ConfigChange"
  122. },
  123. {
  124. "type": "GitHub",
  125. "github": {
  126. "secret": "${GITHUB_WEBHOOK_SECRET}"
  127. }
  128. }
  129. ]
  130. }
  131. },
  132. {
  133. "kind": "DeploymentConfig",
  134. "apiVersion": "v1",
  135. "metadata": {
  136. "name": "${NAME}",
  137. "annotations": {
  138. "description": "Defines how to deploy the application server"
  139. }
  140. },
  141. "spec": {
  142. "strategy": {
  143. "type": "Recreate",
  144. "recreateParams": {
  145. "pre": {
  146. "failurePolicy": "Retry",
  147. "execNewPod": {
  148. "command": [
  149. "./migrate-database.sh"
  150. ],
  151. "containerName": "cakephp-mysql-example"
  152. }
  153. }
  154. }
  155. },
  156. "triggers": [
  157. {
  158. "type": "ImageChange",
  159. "imageChangeParams": {
  160. "automatic": true,
  161. "containerNames": [
  162. "cakephp-mysql-example"
  163. ],
  164. "from": {
  165. "kind": "ImageStreamTag",
  166. "name": "${NAME}:latest"
  167. }
  168. }
  169. },
  170. {
  171. "type": "ConfigChange"
  172. }
  173. ],
  174. "replicas": 1,
  175. "selector": {
  176. "name": "${NAME}"
  177. },
  178. "template": {
  179. "metadata": {
  180. "name": "${NAME}",
  181. "labels": {
  182. "name": "${NAME}"
  183. }
  184. },
  185. "spec": {
  186. "containers": [
  187. {
  188. "name": "cakephp-mysql-example",
  189. "image": " ",
  190. "ports": [
  191. {
  192. "containerPort": 8080
  193. }
  194. ],
  195. "readinessProbe": {
  196. "timeoutSeconds": 3,
  197. "initialDelaySeconds": 3,
  198. "httpGet": {
  199. "path": "/health.php",
  200. "port": 8080
  201. }
  202. },
  203. "livenessProbe": {
  204. "timeoutSeconds": 3,
  205. "initialDelaySeconds": 30,
  206. "httpGet": {
  207. "path": "/",
  208. "port": 8080
  209. }
  210. },
  211. "env": [
  212. {
  213. "name": "DATABASE_SERVICE_NAME",
  214. "value": "${DATABASE_SERVICE_NAME}"
  215. },
  216. {
  217. "name": "DATABASE_ENGINE",
  218. "value": "${DATABASE_ENGINE}"
  219. },
  220. {
  221. "name": "DATABASE_NAME",
  222. "value": "${DATABASE_NAME}"
  223. },
  224. {
  225. "name": "DATABASE_USER",
  226. "valueFrom": {
  227. "secretKeyRef" : {
  228. "name" : "${NAME}",
  229. "key" : "databaseUser"
  230. }
  231. }
  232. },
  233. {
  234. "name": "DATABASE_PASSWORD",
  235. "valueFrom": {
  236. "secretKeyRef" : {
  237. "name" : "${NAME}",
  238. "key" : "databasePassword"
  239. }
  240. }
  241. },
  242. {
  243. "name": "CAKEPHP_SECRET_TOKEN",
  244. "value": "${CAKEPHP_SECRET_TOKEN}"
  245. },
  246. {
  247. "name": "CAKEPHP_SECURITY_SALT",
  248. "value": "${CAKEPHP_SECURITY_SALT}"
  249. },
  250. {
  251. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  252. "value": "${CAKEPHP_SECURITY_CIPHER_SEED}"
  253. },
  254. {
  255. "name": "OPCACHE_REVALIDATE_FREQ",
  256. "value": "${OPCACHE_REVALIDATE_FREQ}"
  257. }
  258. ],
  259. "resources": {
  260. "limits": {
  261. "memory": "${MEMORY_LIMIT}"
  262. }
  263. }
  264. }
  265. ]
  266. }
  267. }
  268. }
  269. },
  270. {
  271. "kind": "Service",
  272. "apiVersion": "v1",
  273. "metadata": {
  274. "name": "${DATABASE_SERVICE_NAME}",
  275. "annotations": {
  276. "description": "Exposes the database server"
  277. }
  278. },
  279. "spec": {
  280. "ports": [
  281. {
  282. "name": "mysql",
  283. "port": 3306,
  284. "targetPort": 3306
  285. }
  286. ],
  287. "selector": {
  288. "name": "${DATABASE_SERVICE_NAME}"
  289. }
  290. }
  291. },
  292. {
  293. "kind": "DeploymentConfig",
  294. "apiVersion": "v1",
  295. "metadata": {
  296. "name": "${DATABASE_SERVICE_NAME}",
  297. "annotations": {
  298. "description": "Defines how to deploy the database"
  299. }
  300. },
  301. "spec": {
  302. "strategy": {
  303. "type": "Recreate"
  304. },
  305. "triggers": [
  306. {
  307. "type": "ImageChange",
  308. "imageChangeParams": {
  309. "automatic": true,
  310. "containerNames": [
  311. "mysql"
  312. ],
  313. "from": {
  314. "kind": "ImageStreamTag",
  315. "namespace": "${NAMESPACE}",
  316. "name": "mysql:5.6"
  317. }
  318. }
  319. },
  320. {
  321. "type": "ConfigChange"
  322. }
  323. ],
  324. "replicas": 1,
  325. "selector": {
  326. "name": "${DATABASE_SERVICE_NAME}"
  327. },
  328. "template": {
  329. "metadata": {
  330. "name": "${DATABASE_SERVICE_NAME}",
  331. "labels": {
  332. "name": "${DATABASE_SERVICE_NAME}"
  333. }
  334. },
  335. "spec": {
  336. "volumes": [
  337. {
  338. "name": "data",
  339. "emptyDir": {}
  340. }
  341. ],
  342. "containers": [
  343. {
  344. "name": "mysql",
  345. "image": " ",
  346. "ports": [
  347. {
  348. "containerPort": 3306
  349. }
  350. ],
  351. "volumeMounts": [
  352. {
  353. "name": "data",
  354. "mountPath": "/var/lib/mysql/data"
  355. }
  356. ],
  357. "readinessProbe": {
  358. "timeoutSeconds": 1,
  359. "initialDelaySeconds": 5,
  360. "exec": {
  361. "command": [ "/bin/sh", "-i", "-c", "MYSQL_PWD='${DATABASE_PASSWORD}' mysql -h 127.0.0.1 -u ${DATABASE_USER} -D ${DATABASE_NAME} -e 'SELECT 1'" ]
  362. }
  363. },
  364. "livenessProbe": {
  365. "timeoutSeconds": 1,
  366. "initialDelaySeconds": 30,
  367. "tcpSocket": {
  368. "port": 3306
  369. }
  370. },
  371. "env": [
  372. {
  373. "name": "MYSQL_USER",
  374. "valueFrom": {
  375. "secretKeyRef" : {
  376. "name" : "${NAME}",
  377. "key" : "databaseUser"
  378. }
  379. }
  380. },
  381. {
  382. "name": "MYSQL_PASSWORD",
  383. "valueFrom": {
  384. "secretKeyRef" : {
  385. "name" : "${NAME}",
  386. "key" : "databasePassword"
  387. }
  388. }
  389. },
  390. {
  391. "name": "MYSQL_DATABASE",
  392. "value": "${DATABASE_NAME}"
  393. }
  394. ],
  395. "resources": {
  396. "limits": {
  397. "memory": "${MEMORY_MYSQL_LIMIT}"
  398. }
  399. }
  400. }
  401. ]
  402. }
  403. }
  404. }
  405. }
  406. ],
  407. "parameters": [
  408. {
  409. "name": "NAME",
  410. "displayName": "Name",
  411. "description": "The name assigned to all of the frontend objects defined in this template.",
  412. "required": true,
  413. "value": "cakephp-mysql-example"
  414. },
  415. {
  416. "name": "NAMESPACE",
  417. "displayName": "Namespace",
  418. "description": "The OpenShift Namespace where the ImageStream resides.",
  419. "required": true,
  420. "value": "openshift"
  421. },
  422. {
  423. "name": "MEMORY_LIMIT",
  424. "displayName": "Memory Limit",
  425. "description": "Maximum amount of memory the CakePHP container can use.",
  426. "required": true,
  427. "value": "512Mi"
  428. },
  429. {
  430. "name": "MEMORY_MYSQL_LIMIT",
  431. "displayName": "Memory Limit (MySQL)",
  432. "description": "Maximum amount of memory the MySQL container can use.",
  433. "required": true,
  434. "value": "512Mi"
  435. },
  436. {
  437. "name": "SOURCE_REPOSITORY_URL",
  438. "displayName": "Git Repository URL",
  439. "description": "The URL of the repository with your application source code.",
  440. "required": true,
  441. "value": "https://github.com/openshift/cakephp-ex.git"
  442. },
  443. {
  444. "name": "SOURCE_REPOSITORY_REF",
  445. "displayName": "Git Reference",
  446. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
  447. },
  448. {
  449. "name": "CONTEXT_DIR",
  450. "displayName": "Context Directory",
  451. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  452. },
  453. {
  454. "name": "APPLICATION_DOMAIN",
  455. "displayName": "Application Hostname",
  456. "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.",
  457. "value": ""
  458. },
  459. {
  460. "name": "GITHUB_WEBHOOK_SECRET",
  461. "displayName": "GitHub Webhook Secret",
  462. "description": "A secret string used to configure the GitHub webhook.",
  463. "generate": "expression",
  464. "from": "[a-zA-Z0-9]{40}"
  465. },
  466. {
  467. "name": "DATABASE_SERVICE_NAME",
  468. "displayName": "Database Service Name",
  469. "required": true,
  470. "value": "mysql"
  471. },
  472. {
  473. "name": "DATABASE_ENGINE",
  474. "displayName": "Database Engine",
  475. "description": "Database engine: postgresql, mysql or sqlite (default).",
  476. "required": true,
  477. "value": "mysql"
  478. },
  479. {
  480. "name": "DATABASE_NAME",
  481. "displayName": "Database Name",
  482. "required": true,
  483. "value": "default"
  484. },
  485. {
  486. "name": "DATABASE_USER",
  487. "displayName": "Database User",
  488. "required": true,
  489. "value": "cakephp"
  490. },
  491. {
  492. "name": "DATABASE_PASSWORD",
  493. "displayName": "Database Password",
  494. "generate": "expression",
  495. "from": "[a-zA-Z0-9]{16}"
  496. },
  497. {
  498. "name": "CAKEPHP_SECRET_TOKEN",
  499. "displayName": "CakePHP secret token",
  500. "description": "Set this to a long random string.",
  501. "generate": "expression",
  502. "from": "[\\w]{50}"
  503. },
  504. {
  505. "name": "CAKEPHP_SECURITY_SALT",
  506. "displayName": "CakePHP Security Salt",
  507. "description": "Security salt for session hash.",
  508. "generate": "expression",
  509. "from": "[a-zA-Z0-9]{40}"
  510. },
  511. {
  512. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  513. "displayName": "CakePHP Security Cipher Seed",
  514. "description": "Security cipher seed for session hash.",
  515. "generate": "expression",
  516. "from": "[0-9]{30}"
  517. },
  518. {
  519. "name": "OPCACHE_REVALIDATE_FREQ",
  520. "displayName": "OPcache Revalidation Frequency",
  521. "description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.",
  522. "value": "2"
  523. },
  524. {
  525. "name": "COMPOSER_MIRROR",
  526. "displayName": "Custom Composer Mirror URL",
  527. "description": "The custom Composer mirror URL",
  528. "value": ""
  529. }
  530. ]
  531. }