cakephp-mysql.json 16 KB

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