cakephp-mysql.json 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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.5"
  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": "GitHub",
  102. "github": {
  103. "secret": "${GITHUB_WEBHOOK_SECRET}"
  104. }
  105. }
  106. ]
  107. }
  108. },
  109. {
  110. "kind": "DeploymentConfig",
  111. "apiVersion": "v1",
  112. "metadata": {
  113. "name": "cakephp-mysql-example",
  114. "annotations": {
  115. "description": "Defines how to deploy the application server"
  116. }
  117. },
  118. "spec": {
  119. "strategy": {
  120. "type": "Rolling",
  121. "recreateParams": {
  122. "pre": {
  123. "failurePolicy": "Abort",
  124. "execNewPod": {
  125. "command": [
  126. "./migrate-database.sh"
  127. ],
  128. "containerName": "cakephp-mysql-example"
  129. }
  130. }
  131. }
  132. },
  133. "triggers": [
  134. {
  135. "type": "ImageChange",
  136. "imageChangeParams": {
  137. "automatic": true,
  138. "containerNames": [
  139. "cakephp-mysql-example"
  140. ],
  141. "from": {
  142. "kind": "ImageStreamTag",
  143. "name": "cakephp-mysql-example:latest"
  144. }
  145. }
  146. },
  147. {
  148. "type": "ConfigChange"
  149. }
  150. ],
  151. "replicas": 1,
  152. "selector": {
  153. "name": "cakephp-mysql-example"
  154. },
  155. "template": {
  156. "metadata": {
  157. "name": "cakephp-mysql-example",
  158. "labels": {
  159. "name": "cakephp-mysql-example"
  160. }
  161. },
  162. "spec": {
  163. "containers": [
  164. {
  165. "name": "cakephp-mysql-example",
  166. "image": "cakephp-mysql-example",
  167. "ports": [
  168. {
  169. "containerPort": 8080
  170. }
  171. ],
  172. "env": [
  173. {
  174. "name": "DATABASE_SERVICE_NAME",
  175. "value": "${DATABASE_SERVICE_NAME}"
  176. },
  177. {
  178. "name": "DATABASE_ENGINE",
  179. "value": "${DATABASE_ENGINE}"
  180. },
  181. {
  182. "name": "DATABASE_NAME",
  183. "value": "${DATABASE_NAME}"
  184. },
  185. {
  186. "name": "DATABASE_USER",
  187. "value": "${DATABASE_USER}"
  188. },
  189. {
  190. "name": "DATABASE_PASSWORD",
  191. "value": "${DATABASE_PASSWORD}"
  192. },
  193. {
  194. "name": "CAKEPHP_SECRET_TOKEN",
  195. "value": "${CAKEPHP_SECRET_TOKEN}"
  196. },
  197. {
  198. "name": "CAKEPHP_SECURITY_SALT",
  199. "value": "${CAKEPHP_SECURITY_SALT}"
  200. },
  201. {
  202. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  203. "value": "${CAKEPHP_SECURITY_CIPHER_SEED}"
  204. }
  205. ]
  206. }
  207. ]
  208. }
  209. }
  210. }
  211. },
  212. {
  213. "kind": "Service",
  214. "apiVersion": "v1",
  215. "metadata": {
  216. "name": "${DATABASE_SERVICE_NAME}",
  217. "annotations": {
  218. "description": "Exposes the database server"
  219. }
  220. },
  221. "spec": {
  222. "ports": [
  223. {
  224. "name": "mysql",
  225. "port": 3306,
  226. "targetPort": 3306
  227. }
  228. ],
  229. "selector": {
  230. "name": "${DATABASE_SERVICE_NAME}"
  231. }
  232. }
  233. },
  234. {
  235. "kind": "DeploymentConfig",
  236. "apiVersion": "v1",
  237. "metadata": {
  238. "name": "${DATABASE_SERVICE_NAME}",
  239. "annotations": {
  240. "description": "Defines how to deploy the database"
  241. }
  242. },
  243. "spec": {
  244. "strategy": {
  245. "type": "Recreate"
  246. },
  247. "triggers": [
  248. {
  249. "type": "ConfigChange"
  250. }
  251. ],
  252. "replicas": 1,
  253. "selector": {
  254. "name": "${DATABASE_SERVICE_NAME}"
  255. },
  256. "template": {
  257. "metadata": {
  258. "name": "${DATABASE_SERVICE_NAME}",
  259. "labels": {
  260. "name": "${DATABASE_SERVICE_NAME}"
  261. }
  262. },
  263. "spec": {
  264. "containers": [
  265. {
  266. "name": "mysql",
  267. "image": "openshift/mysql-55-centos7",
  268. "ports": [
  269. {
  270. "containerPort": 3306
  271. }
  272. ],
  273. "env": [
  274. {
  275. "name": "MYSQL_USER",
  276. "value": "${DATABASE_USER}"
  277. },
  278. {
  279. "name": "MYSQL_PASSWORD",
  280. "value": "${DATABASE_PASSWORD}"
  281. },
  282. {
  283. "name": "MYSQL_DATABASE",
  284. "value": "${DATABASE_NAME}"
  285. }
  286. ]
  287. }
  288. ]
  289. }
  290. }
  291. }
  292. }
  293. ],
  294. "parameters": [
  295. {
  296. "name": "SOURCE_REPOSITORY_URL",
  297. "description": "The URL of the repository with your application source code",
  298. "value": "https://github.com/openshift/cakephp-ex.git"
  299. },
  300. {
  301. "name": "SOURCE_REPOSITORY_REF",
  302. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
  303. },
  304. {
  305. "name": "CONTEXT_DIR",
  306. "description": "Set this to the relative path to your project if it is not in the root of your repository"
  307. },
  308. {
  309. "name": "APPLICATION_DOMAIN",
  310. "description": "The exposed hostname that will route to the CakePHP service",
  311. "value": "cakephp-mysql-example.openshiftapps.com"
  312. },
  313. {
  314. "name": "GITHUB_WEBHOOK_SECRET",
  315. "description": "A secret string used to configure the GitHub webhook",
  316. "generate": "expression",
  317. "from": "[a-zA-Z0-9]{40}"
  318. },
  319. {
  320. "name": "DATABASE_SERVICE_NAME",
  321. "description": "Database service name",
  322. "value": "mysql"
  323. },
  324. {
  325. "name": "DATABASE_ENGINE",
  326. "description": "Database engine: postgresql, mysql or sqlite (default)",
  327. "value": "mysql"
  328. },
  329. {
  330. "name": "DATABASE_NAME",
  331. "description": "Database name",
  332. "value": "default"
  333. },
  334. {
  335. "name": "DATABASE_USER",
  336. "description": "Database user name",
  337. "value": "cakephp"
  338. },
  339. {
  340. "name": "DATABASE_PASSWORD",
  341. "description": "Database user password",
  342. "generate": "expression",
  343. "from": "[a-zA-Z0-9]{16}"
  344. },
  345. {
  346. "name": "CAKEPHP_SECRET_TOKEN",
  347. "description": "Set this to a long random string",
  348. "generate": "expression",
  349. "from": "[\\w]{50}"
  350. },
  351. {
  352. "name": "CAKEPHP_SECURITY_SALT",
  353. "description": "Security salt for session hash",
  354. "generate": "expression",
  355. "from": "[a-zA-Z0-9]{40}"
  356. },
  357. {
  358. "name": "CAKEPHP_SECURITY_CIPHER_SEED",
  359. "description": "Security cipher seed for session hash",
  360. "generate": "expression",
  361. "from": "[0-9]{30}"
  362. }
  363. ]
  364. }