rails-postgresql.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "rails-postgresql-example",
  6. "annotations": {
  7. "description": "An example Rails application with a PostgreSQL database",
  8. "tags": "instant-app,ruby,rails,postgresql",
  9. "iconClass": "icon-ruby"
  10. }
  11. },
  12. "labels": {
  13. "template": "rails-postgresql-example"
  14. },
  15. "objects": [
  16. {
  17. "kind": "Service",
  18. "apiVersion": "v1",
  19. "metadata": {
  20. "name": "rails-postgresql-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": "rails-postgresql-example"
  35. }
  36. }
  37. },
  38. {
  39. "kind": "Route",
  40. "apiVersion": "v1",
  41. "metadata": {
  42. "name": "rails-postgresql-example"
  43. },
  44. "spec": {
  45. "host": "${APPLICATION_DOMAIN}",
  46. "to": {
  47. "kind": "Service",
  48. "name": "rails-postgresql-example"
  49. }
  50. }
  51. },
  52. {
  53. "kind": "ImageStream",
  54. "apiVersion": "v1",
  55. "metadata": {
  56. "name": "rails-postgresql-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": "rails-postgresql-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": "ruby:2.0"
  87. }
  88. }
  89. },
  90. "output": {
  91. "to": {
  92. "kind": "ImageStreamTag",
  93. "name": "rails-postgresql-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": "rails-postgresql-example",
  114. "annotations": {
  115. "description": "Defines how to deploy the application server"
  116. }
  117. },
  118. "spec": {
  119. "strategy": {
  120. "type": "Recreate",
  121. "recreateParams": {
  122. "pre": {
  123. "failurePolicy": "Abort",
  124. "execNewPod": {
  125. "command": [
  126. "./migrate-database.sh"
  127. ],
  128. "containerName": "rails-postgresql-example"
  129. }
  130. }
  131. }
  132. },
  133. "triggers": [
  134. {
  135. "type": "ImageChange",
  136. "imageChangeParams": {
  137. "automatic": true,
  138. "containerNames": [
  139. "rails-postgresql-example"
  140. ],
  141. "from": {
  142. "kind": "ImageStreamTag",
  143. "name": "rails-postgresql-example:latest"
  144. }
  145. }
  146. },
  147. {
  148. "type": "ConfigChange"
  149. }
  150. ],
  151. "replicas": 1,
  152. "selector": {
  153. "name": "rails-postgresql-example"
  154. },
  155. "template": {
  156. "metadata": {
  157. "name": "rails-postgresql-example",
  158. "labels": {
  159. "name": "rails-postgresql-example"
  160. }
  161. },
  162. "spec": {
  163. "containers": [
  164. {
  165. "name": "rails-postgresql-example",
  166. "image": "rails-postgresql-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": "POSTGRESQL_USER",
  179. "value": "${DATABASE_USER}"
  180. },
  181. {
  182. "name": "POSTGRESQL_PASSWORD",
  183. "value": "${DATABASE_PASSWORD}"
  184. },
  185. {
  186. "name": "POSTGRESQL_DATABASE",
  187. "value": "${DATABASE_NAME}"
  188. },
  189. {
  190. "name": "SECRET_KEY_BASE",
  191. "value": "${SECRET_KEY_BASE}"
  192. },
  193. {
  194. "name": "POSTGRESQL_MAX_CONNECTIONS",
  195. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  196. },
  197. {
  198. "name": "POSTGRESQL_SHARED_BUFFERS",
  199. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  200. },
  201. {
  202. "name": "SECRET_KEY_BASE",
  203. "value": "${SECRET_KEY_BASE}"
  204. },
  205. {
  206. "name": "APPLICATION_DOMAIN",
  207. "value": "${APPLICATION_DOMAIN}"
  208. },
  209. {
  210. "name": "APPLICATION_USER",
  211. "value": "${APPLICATION_USER}"
  212. },
  213. {
  214. "name": "APPLICATION_PASSWORD",
  215. "value": "${APPLICATION_PASSWORD}"
  216. },
  217. {
  218. "name": "RAILS_ENV",
  219. "value": "${RAILS_ENV}"
  220. }
  221. ]
  222. }
  223. ]
  224. }
  225. }
  226. }
  227. },
  228. {
  229. "kind": "Service",
  230. "apiVersion": "v1",
  231. "metadata": {
  232. "name": "${DATABASE_SERVICE_NAME}",
  233. "annotations": {
  234. "description": "Exposes the database server"
  235. }
  236. },
  237. "spec": {
  238. "ports": [
  239. {
  240. "name": "postgresql",
  241. "port": 5432,
  242. "targetPort": 5432
  243. }
  244. ],
  245. "selector": {
  246. "name": "${DATABASE_SERVICE_NAME}"
  247. }
  248. }
  249. },
  250. {
  251. "kind": "DeploymentConfig",
  252. "apiVersion": "v1",
  253. "metadata": {
  254. "name": "${DATABASE_SERVICE_NAME}",
  255. "annotations": {
  256. "description": "Defines how to deploy the database"
  257. }
  258. },
  259. "spec": {
  260. "strategy": {
  261. "type": "Recreate"
  262. },
  263. "triggers": [
  264. {
  265. "type": "ConfigChange"
  266. }
  267. ],
  268. "replicas": 1,
  269. "selector": {
  270. "name": "${DATABASE_SERVICE_NAME}"
  271. },
  272. "template": {
  273. "metadata": {
  274. "name": "${DATABASE_SERVICE_NAME}",
  275. "labels": {
  276. "name": "${DATABASE_SERVICE_NAME}"
  277. }
  278. },
  279. "spec": {
  280. "containers": [
  281. {
  282. "name": "postgresql",
  283. "image": "${POSTGRESQL_IMAGE}",
  284. "ports": [
  285. {
  286. "containerPort": 5432
  287. }
  288. ],
  289. "env": [
  290. {
  291. "name": "POSTGRESQL_USER",
  292. "value": "${DATABASE_USER}"
  293. },
  294. {
  295. "name": "POSTGRESQL_PASSWORD",
  296. "value": "${DATABASE_PASSWORD}"
  297. },
  298. {
  299. "name": "POSTGRESQL_DATABASE",
  300. "value": "${DATABASE_NAME}"
  301. },
  302. {
  303. "name": "POSTGRESQL_MAX_CONNECTIONS",
  304. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  305. },
  306. {
  307. "name": "POSTGRESQL_SHARED_BUFFERS",
  308. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  309. }
  310. ]
  311. }
  312. ]
  313. }
  314. }
  315. }
  316. }
  317. ],
  318. "parameters": [
  319. {
  320. "name": "SOURCE_REPOSITORY_URL",
  321. "description": "The URL of the repository with your application source code",
  322. "value": "https://github.com/openshift/rails-ex.git"
  323. },
  324. {
  325. "name": "SOURCE_REPOSITORY_REF",
  326. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch"
  327. },
  328. {
  329. "name": "CONTEXT_DIR",
  330. "description": "Set this to the relative path to your project if it is not in the root of your repository"
  331. },
  332. {
  333. "name": "APPLICATION_DOMAIN",
  334. "description": "The exposed hostname that will route to the Rails service, if left blank a value will be defaulted.",
  335. "value": ""
  336. },
  337. {
  338. "name": "GITHUB_WEBHOOK_SECRET",
  339. "description": "A secret string used to configure the GitHub webhook",
  340. "generate": "expression",
  341. "from": "[a-zA-Z0-9]{40}"
  342. },
  343. {
  344. "name": "SECRET_KEY_BASE",
  345. "description": "Your secret key for verifying the integrity of signed cookies",
  346. "generate": "expression",
  347. "from": "[a-z0-9]{127}"
  348. },
  349. {
  350. "name": "APPLICATION_USER",
  351. "description": "The application user that is used within the sample application to authorize access on pages",
  352. "value": "openshift"
  353. },
  354. {
  355. "name": "APPLICATION_PASSWORD",
  356. "description": "The application password that is used within the sample application to authorize access on pages",
  357. "value": "secret"
  358. },
  359. {
  360. "name": "RAILS_ENV",
  361. "description": "Environment under which the sample application will run. Could be set to production, development or test",
  362. "value": "production"
  363. },
  364. {
  365. "name": "DATABASE_SERVICE_NAME",
  366. "description": "Database service name",
  367. "value": "postgresql"
  368. },
  369. {
  370. "name": "DATABASE_USER",
  371. "description": "database username",
  372. "generate": "expression",
  373. "from": "user[A-Z0-9]{3}"
  374. },
  375. {
  376. "name": "DATABASE_PASSWORD",
  377. "description": "database password",
  378. "generate": "expression",
  379. "from": "[a-zA-Z0-9]{8}"
  380. },
  381. {
  382. "name": "DATABASE_NAME",
  383. "description": "database name",
  384. "value": "root"
  385. },
  386. {
  387. "name": "POSTGRESQL_IMAGE",
  388. "description": "Image to use for postgresql",
  389. "value": "openshift/postgresql-92-centos7"
  390. },
  391. {
  392. "name": "POSTGRESQL_MAX_CONNECTIONS",
  393. "description": "database max connections",
  394. "value": "10"
  395. },
  396. {
  397. "name": "POSTGRESQL_SHARED_BUFFERS",
  398. "description": "database shared buffers",
  399. "value": "12MB"
  400. }
  401. ]
  402. }