cakephp-mysql.json 16 KB

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