cakephp-mysql.json 12 KB

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