cakephp-mysql.json 16 KB

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