rails-postgresql.json 11 KB

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