cakephp-mysql.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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": "instant-app,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": "cakephp-mysql-example",
  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": "cakephp-mysql-example"
  35. }
  36. }
  37. },
  38. {
  39. "kind": "Route",
  40. "apiVersion": "v1",
  41. "metadata": {
  42. "name": "cakephp-mysql-example"
  43. },
  44. "spec": {
  45. "host": "${APPLICATION_DOMAIN}",
  46. "to": {
  47. "kind": "Service",
  48. "name": "cakephp-mysql-example"
  49. }
  50. }
  51. },
  52. {
  53. "kind": "ImageStream",
  54. "apiVersion": "v1",
  55. "metadata": {
  56. "name": "cakephp-mysql-example",
  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": "cakephp-mysql-example",
  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": "openshift",
  86. "name": "php:5.6"
  87. }
  88. }
  89. },
  90. "output": {
  91. "to": {
  92. "kind": "ImageStreamTag",
  93. "name": "cakephp-mysql-example: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": "cakephp-mysql-example",
  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": "Abort",
  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": "cakephp-mysql-example:latest"
  147. }
  148. }
  149. },
  150. {
  151. "type": "ConfigChange"
  152. }
  153. ],
  154. "replicas": 1,
  155. "selector": {
  156. "name": "cakephp-mysql-example"
  157. },
  158. "template": {
  159. "metadata": {
  160. "name": "cakephp-mysql-example",
  161. "labels": {
  162. "name": "cakephp-mysql-example"
  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. "env": [
  176. {
  177. "name": "DATABASE_SERVICE_NAME",
  178. "value": "${DATABASE_SERVICE_NAME}"
  179. },
  180. {
  181. "name": "DATABASE_ENGINE",
  182. "value": "${DATABASE_ENGINE}"
  183. },
  184. {
  185. "name": "DATABASE_NAME",
  186. "value": "${DATABASE_NAME}"
  187. },
  188. {
  189. "name": "DATABASE_USER",
  190. "value": "${DATABASE_USER}"
  191. },
  192. {
  193. "name": "DATABASE_PASSWORD",
  194. "value": "${DATABASE_PASSWORD}"
  195. },
  196. {
  197. "name": "CAKEPHP_SECRET_TOKEN",
  198. "value": "${CAKEPHP_SECRET_TOKEN}"
  199. },
  200. {
  201. "name": "CAKEPHP_SECURITY_SALT",
  202. "value": "${CAKEPHP_SECURITY_SALT}"
  203. },
  204. {
  205. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  206. "value": "${CAKEPHP_SECURITY_CIPHER_SEED}"
  207. },
  208. {
  209. "name": "OPCACHE_REVALIDATE_FREQ",
  210. "value": "${OPCACHE_REVALIDATE_FREQ}"
  211. }
  212. ]
  213. }
  214. ]
  215. }
  216. }
  217. }
  218. },
  219. {
  220. "kind": "Service",
  221. "apiVersion": "v1",
  222. "metadata": {
  223. "name": "${DATABASE_SERVICE_NAME}",
  224. "annotations": {
  225. "description": "Exposes the database server"
  226. }
  227. },
  228. "spec": {
  229. "ports": [
  230. {
  231. "name": "mysql",
  232. "port": 3306,
  233. "targetPort": 3306
  234. }
  235. ],
  236. "selector": {
  237. "name": "${DATABASE_SERVICE_NAME}"
  238. }
  239. }
  240. },
  241. {
  242. "kind": "DeploymentConfig",
  243. "apiVersion": "v1",
  244. "metadata": {
  245. "name": "${DATABASE_SERVICE_NAME}",
  246. "annotations": {
  247. "description": "Defines how to deploy the database"
  248. }
  249. },
  250. "spec": {
  251. "strategy": {
  252. "type": "Recreate"
  253. },
  254. "triggers": [
  255. {
  256. "type": "ImageChange",
  257. "imageChangeParams": {
  258. "automatic": false,
  259. "containerNames": [
  260. "mysql"
  261. ],
  262. "from": {
  263. "kind": "ImageStreamTag",
  264. "namespace": "openshift",
  265. "name": "mysql:5.6"
  266. }
  267. }
  268. },
  269. {
  270. "type": "ConfigChange"
  271. }
  272. ],
  273. "replicas": 1,
  274. "selector": {
  275. "name": "${DATABASE_SERVICE_NAME}"
  276. },
  277. "template": {
  278. "metadata": {
  279. "name": "${DATABASE_SERVICE_NAME}",
  280. "labels": {
  281. "name": "${DATABASE_SERVICE_NAME}"
  282. }
  283. },
  284. "spec": {
  285. "containers": [
  286. {
  287. "name": "mysql",
  288. "image": "mysql",
  289. "ports": [
  290. {
  291. "containerPort": 3306
  292. }
  293. ],
  294. "env": [
  295. {
  296. "name": "MYSQL_USER",
  297. "value": "${DATABASE_USER}"
  298. },
  299. {
  300. "name": "MYSQL_PASSWORD",
  301. "value": "${DATABASE_PASSWORD}"
  302. },
  303. {
  304. "name": "MYSQL_DATABASE",
  305. "value": "${DATABASE_NAME}"
  306. }
  307. ]
  308. }
  309. ]
  310. }
  311. }
  312. }
  313. }
  314. ],
  315. "parameters": [
  316. {
  317. "name": "SOURCE_REPOSITORY_URL",
  318. "description": "The URL of the repository with your application source code",
  319. "value": "https://github.com/openshift/cakephp-ex.git"
  320. },
  321. {
  322. "name": "SOURCE_REPOSITORY_REF",
  323. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
  324. },
  325. {
  326. "name": "CONTEXT_DIR",
  327. "description": "Set this to the relative path to your project if it is not in the root of your repository"
  328. },
  329. {
  330. "name": "APPLICATION_DOMAIN",
  331. "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.",
  332. "value": ""
  333. },
  334. {
  335. "name": "GITHUB_WEBHOOK_SECRET",
  336. "description": "A secret string used to configure the GitHub webhook",
  337. "generate": "expression",
  338. "from": "[a-zA-Z0-9]{40}"
  339. },
  340. {
  341. "name": "DATABASE_SERVICE_NAME",
  342. "description": "Database service name",
  343. "value": "mysql"
  344. },
  345. {
  346. "name": "DATABASE_ENGINE",
  347. "description": "Database engine: postgresql, mysql or sqlite (default)",
  348. "value": "mysql"
  349. },
  350. {
  351. "name": "DATABASE_NAME",
  352. "description": "Database name",
  353. "value": "default"
  354. },
  355. {
  356. "name": "DATABASE_USER",
  357. "description": "Database user name",
  358. "value": "cakephp"
  359. },
  360. {
  361. "name": "DATABASE_PASSWORD",
  362. "description": "Database user password",
  363. "generate": "expression",
  364. "from": "[a-zA-Z0-9]{16}"
  365. },
  366. {
  367. "name": "CAKEPHP_SECRET_TOKEN",
  368. "description": "Set this to a long random string",
  369. "generate": "expression",
  370. "from": "[\\w]{50}"
  371. },
  372. {
  373. "name": "CAKEPHP_SECURITY_SALT",
  374. "description": "Security salt for session hash",
  375. "generate": "expression",
  376. "from": "[a-zA-Z0-9]{40}"
  377. },
  378. {
  379. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  380. "description": "Security cipher seed for session hash",
  381. "generate": "expression",
  382. "from": "[0-9]{30}"
  383. },
  384. {
  385. "name": "OPCACHE_REVALIDATE_FREQ",
  386. "description": "The How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.",
  387. "value": "2"
  388. }
  389. ]
  390. }