dotnet-pgsql-persistent.json 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "dotnet-pgsql-persistent",
  6. "annotations": {
  7. "openshift.io/display-name": ".NET Core + PostgreSQL (Persistent)",
  8. "description": "An example .NET Core application with a PostgreSQL database. For more information about using this template, including OpenShift considerations, see https://github.com/redhat-developer/s2i-dotnetcore.",
  9. "tags": "quickstart,dotnet",
  10. "iconClass": "icon-dotnet",
  11. "template.openshift.io/provider-display-name": "Red Hat, Inc.",
  12. "template.openshift.io/documentation-url": "https://github.com/redhat-developer/s2i-dotnetcore",
  13. "template.openshift.io/support-url": "https://access.redhat.com"
  14. }
  15. },
  16. "message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/redhat-developer/s2i-dotnetcore.",
  17. "labels": {
  18. "template": "dotnet-pgsql-persistent"
  19. },
  20. "objects": [
  21. {
  22. "kind": "Service",
  23. "apiVersion": "v1",
  24. "metadata": {
  25. "name": "${NAME}",
  26. "annotations": {
  27. "description": "Exposes and load balances the application pods",
  28. "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"kind\": \"Service\"}]"
  29. }
  30. },
  31. "spec": {
  32. "ports": [
  33. {
  34. "name": "web",
  35. "port": 8080,
  36. "targetPort": 8080
  37. }
  38. ],
  39. "selector": {
  40. "name": "${NAME}"
  41. }
  42. }
  43. },
  44. {
  45. "kind": "Route",
  46. "apiVersion": "v1",
  47. "metadata": {
  48. "name": "${NAME}"
  49. },
  50. "spec": {
  51. "host": "${APPLICATION_DOMAIN}",
  52. "to": {
  53. "kind": "Service",
  54. "name": "${NAME}"
  55. }
  56. }
  57. },
  58. {
  59. "kind": "ImageStream",
  60. "apiVersion": "v1",
  61. "metadata": {
  62. "name": "${NAME}",
  63. "annotations": {
  64. "description": "Keeps track of changes in the application image"
  65. }
  66. }
  67. },
  68. {
  69. "kind": "BuildConfig",
  70. "apiVersion": "v1",
  71. "metadata": {
  72. "name": "${NAME}",
  73. "annotations": {
  74. "description": "Defines how to build the application"
  75. }
  76. },
  77. "spec": {
  78. "source": {
  79. "type": "Git",
  80. "git": {
  81. "uri": "${SOURCE_REPOSITORY_URL}",
  82. "ref": "${SOURCE_REPOSITORY_REF}"
  83. },
  84. "contextDir": "${CONTEXT_DIR}"
  85. },
  86. "strategy": {
  87. "type": "Source",
  88. "sourceStrategy": {
  89. "from": {
  90. "kind": "ImageStreamTag",
  91. "namespace": "${NAMESPACE}",
  92. "name": "${DOTNET_IMAGE_STREAM_TAG}"
  93. },
  94. "env": [
  95. {
  96. "name": "DOTNET_STARTUP_PROJECT",
  97. "value": "${DOTNET_STARTUP_PROJECT}"
  98. },
  99. {
  100. "name": "DOTNET_ASSEMBLY_NAME",
  101. "value": "${DOTNET_ASSEMBLY_NAME}"
  102. },
  103. {
  104. "name": "DOTNET_NPM_TOOLS",
  105. "value": "${DOTNET_NPM_TOOLS}"
  106. },
  107. {
  108. "name": "DOTNET_TEST_PROJECTS",
  109. "value": "${DOTNET_TEST_PROJECTS}"
  110. },
  111. {
  112. "name": "DOTNET_CONFIGURATION",
  113. "value": "${DOTNET_CONFIGURATION}"
  114. },
  115. {
  116. "name": "DOTNET_PUBLISH",
  117. "value": "true"
  118. },
  119. {
  120. "name": "DOTNET_RESTORE_SOURCES",
  121. "value": "${DOTNET_RESTORE_SOURCES}"
  122. }
  123. ]
  124. }
  125. },
  126. "output": {
  127. "to": {
  128. "kind": "ImageStreamTag",
  129. "name": "${NAME}:latest"
  130. }
  131. },
  132. "triggers": [
  133. {
  134. "type": "ImageChange"
  135. },
  136. {
  137. "type": "ConfigChange"
  138. },
  139. {
  140. "type": "GitHub",
  141. "github": {
  142. "secret": "${GITHUB_WEBHOOK_SECRET}"
  143. }
  144. }
  145. ],
  146. "postCommit": {}
  147. }
  148. },
  149. {
  150. "kind": "DeploymentConfig",
  151. "apiVersion": "v1",
  152. "metadata": {
  153. "name": "${NAME}",
  154. "annotations": {
  155. "description": "Defines how to deploy the application server"
  156. }
  157. },
  158. "spec": {
  159. "strategy": {
  160. "type": "Rolling",
  161. "rollingParams": {
  162. "updatePeriodSeconds": 1,
  163. "intervalSeconds": 1,
  164. "timeoutSeconds": 600,
  165. "maxUnavailable": "25%",
  166. "maxSurge": "25%"
  167. },
  168. "resources": {}
  169. },
  170. "triggers": [
  171. {
  172. "type": "ImageChange",
  173. "imageChangeParams": {
  174. "automatic": true,
  175. "containerNames": [
  176. "dotnet-pgsql-persistent"
  177. ],
  178. "from": {
  179. "kind": "ImageStreamTag",
  180. "name": "${NAME}:latest"
  181. }
  182. }
  183. },
  184. {
  185. "type": "ConfigChange"
  186. }
  187. ],
  188. "replicas": 1,
  189. "selector": {
  190. "name": "${NAME}"
  191. },
  192. "template": {
  193. "metadata": {
  194. "name": "${NAME}",
  195. "labels": {
  196. "name": "${NAME}"
  197. }
  198. },
  199. "spec": {
  200. "containers": [
  201. {
  202. "name": "dotnet-pgsql-persistent",
  203. "image": " ",
  204. "ports": [
  205. {
  206. "containerPort": 8080
  207. }
  208. ],
  209. "env": [
  210. {
  211. "name": "ConnectionString",
  212. "value": "Host=${DATABASE_SERVICE_NAME};Database=${DATABASE_NAME};Username=${DATABASE_USER};Password=${DATABASE_PASSWORD}"
  213. }
  214. ],
  215. "resources": {
  216. "limits": {
  217. "memory": "${MEMORY_LIMIT}"
  218. }
  219. },
  220. "livenessProbe": {
  221. "httpGet": {
  222. "path": "/",
  223. "port": 8080,
  224. "scheme": "HTTP"
  225. },
  226. "initialDelaySeconds": 40,
  227. "timeoutSeconds": 10
  228. },
  229. "readinessProbe": {
  230. "httpGet": {
  231. "path": "/",
  232. "port": 8080,
  233. "scheme": "HTTP"
  234. },
  235. "initialDelaySeconds": 10,
  236. "timeoutSeconds": 30
  237. }
  238. }
  239. ]
  240. }
  241. }
  242. }
  243. },
  244. {
  245. "kind": "PersistentVolumeClaim",
  246. "apiVersion": "v1",
  247. "metadata": {
  248. "name": "${DATABASE_SERVICE_NAME}"
  249. },
  250. "spec": {
  251. "accessModes": [
  252. "ReadWriteOnce"
  253. ],
  254. "resources": {
  255. "requests": {
  256. "storage": "${VOLUME_CAPACITY}"
  257. }
  258. }
  259. }
  260. },
  261. {
  262. "kind": "Service",
  263. "apiVersion": "v1",
  264. "metadata": {
  265. "name": "${DATABASE_SERVICE_NAME}",
  266. "annotations": {
  267. "description": "Exposes the database server"
  268. }
  269. },
  270. "spec": {
  271. "ports": [
  272. {
  273. "name": "postgresql",
  274. "port": 5432,
  275. "targetPort": 5432
  276. }
  277. ],
  278. "selector": {
  279. "name": "${DATABASE_SERVICE_NAME}"
  280. }
  281. }
  282. },
  283. {
  284. "kind": "DeploymentConfig",
  285. "apiVersion": "v1",
  286. "metadata": {
  287. "name": "${DATABASE_SERVICE_NAME}",
  288. "annotations": {
  289. "description": "Defines how to deploy the database"
  290. }
  291. },
  292. "spec": {
  293. "strategy": {
  294. "type": "Recreate"
  295. },
  296. "triggers": [
  297. {
  298. "type": "ImageChange",
  299. "imageChangeParams": {
  300. "automatic": true,
  301. "containerNames": [
  302. "postgresql"
  303. ],
  304. "from": {
  305. "kind": "ImageStreamTag",
  306. "namespace": "openshift",
  307. "name": "postgresql:9.5"
  308. }
  309. }
  310. },
  311. {
  312. "type": "ConfigChange"
  313. }
  314. ],
  315. "replicas": 1,
  316. "selector": {
  317. "name": "${DATABASE_SERVICE_NAME}"
  318. },
  319. "template": {
  320. "metadata": {
  321. "name": "${DATABASE_SERVICE_NAME}",
  322. "labels": {
  323. "name": "${DATABASE_SERVICE_NAME}"
  324. }
  325. },
  326. "spec": {
  327. "volumes": [
  328. {
  329. "name": "${DATABASE_SERVICE_NAME}-data",
  330. "persistentVolumeClaim": {
  331. "claimName": "${DATABASE_SERVICE_NAME}"
  332. }
  333. }
  334. ],
  335. "containers": [
  336. {
  337. "name": "postgresql",
  338. "image": " ",
  339. "ports": [
  340. {
  341. "containerPort": 5432
  342. }
  343. ],
  344. "readinessProbe": {
  345. "timeoutSeconds": 1,
  346. "initialDelaySeconds": 5,
  347. "exec": {
  348. "command": [
  349. "/bin/sh",
  350. "-i",
  351. "-c",
  352. "psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1'"
  353. ]
  354. }
  355. },
  356. "livenessProbe": {
  357. "timeoutSeconds": 1,
  358. "initialDelaySeconds": 30,
  359. "tcpSocket": {
  360. "port": 5432
  361. }
  362. },
  363. "volumeMounts": [
  364. {
  365. "name": "${DATABASE_SERVICE_NAME}-data",
  366. "mountPath": "/var/lib/pgsql/data"
  367. }
  368. ],
  369. "env": [
  370. {
  371. "name": "POSTGRESQL_USER",
  372. "value": "${DATABASE_USER}"
  373. },
  374. {
  375. "name": "POSTGRESQL_PASSWORD",
  376. "value": "${DATABASE_PASSWORD}"
  377. },
  378. {
  379. "name": "POSTGRESQL_DATABASE",
  380. "value": "${DATABASE_NAME}"
  381. },
  382. {
  383. "name": "POSTGRESQL_MAX_CONNECTIONS",
  384. "value": "${POSTGRESQL_MAX_CONNECTIONS}"
  385. },
  386. {
  387. "name": "POSTGRESQL_SHARED_BUFFERS",
  388. "value": "${POSTGRESQL_SHARED_BUFFERS}"
  389. }
  390. ],
  391. "resources": {
  392. "limits": {
  393. "memory": "${MEMORY_POSTGRESQL_LIMIT}"
  394. }
  395. }
  396. }
  397. ]
  398. }
  399. }
  400. }
  401. }
  402. ],
  403. "parameters": [
  404. {
  405. "name": "NAME",
  406. "displayName": "Name",
  407. "description": "The name assigned to all of the frontend objects defined in this template.",
  408. "required": true,
  409. "value": "musicstore"
  410. },
  411. {
  412. "name": "MEMORY_LIMIT",
  413. "displayName": "Memory Limit",
  414. "required": true,
  415. "description": "Maximum amount of memory the .NET Core container can use.",
  416. "value": "512Mi"
  417. },
  418. {
  419. "name": "MEMORY_POSTGRESQL_LIMIT",
  420. "displayName": "Memory Limit (PostgreSQL)",
  421. "required": true,
  422. "description": "Maximum amount of memory the PostgreSQL container can use.",
  423. "value": "512Mi"
  424. },
  425. {
  426. "name": "VOLUME_CAPACITY",
  427. "displayName": "Volume Capacity",
  428. "description": "Volume space available for data, e.g. 512Mi, 2Gi",
  429. "value": "1Gi",
  430. "required": true
  431. },
  432. {
  433. "name": "DOTNET_IMAGE_STREAM_TAG",
  434. "displayName": ".NET builder",
  435. "required": true,
  436. "description": "The image stream tag which is used to build the code.",
  437. "value": "dotnet:1.1"
  438. },
  439. {
  440. "name": "NAMESPACE",
  441. "displayName": "Namespace",
  442. "required": true,
  443. "description": "The OpenShift Namespace where the .NET builder ImageStream resides.",
  444. "value": "openshift"
  445. },
  446. {
  447. "name": "SOURCE_REPOSITORY_URL",
  448. "displayName": "Git Repository URL",
  449. "required": true,
  450. "description": "The URL of the repository with your application source code.",
  451. "value": "https://github.com/redhat-developer/s2i-aspnet-musicstore-ex.git"
  452. },
  453. {
  454. "name": "SOURCE_REPOSITORY_REF",
  455. "displayName": "Git Reference",
  456. "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch.",
  457. "value": "rel/1.1-example"
  458. },
  459. {
  460. "name": "CONTEXT_DIR",
  461. "displayName": "Context Directory",
  462. "description": "Set this to the relative path to your project if it is not in the root of your repository."
  463. },
  464. {
  465. "name": "DOTNET_STARTUP_PROJECT",
  466. "displayName": "Startup Project",
  467. "description": "Set this to the folder containing your startup project.",
  468. "value": "samples/MusicStore"
  469. },
  470. {
  471. "name": "DOTNET_ASSEMBLY_NAME",
  472. "displayName": "Startup Assembly",
  473. "description": "Set this when the assembly name is overridden in the project file."
  474. },
  475. {
  476. "name": "DOTNET_NPM_TOOLS",
  477. "displayName": "Npm Tools",
  478. "description": "Set this to a space separated list of npm tools needed to publish."
  479. },
  480. {
  481. "name": "DOTNET_TEST_PROJECTS",
  482. "displayName": "Test projects",
  483. "description": "Set this to a space separated list of test projects to run before publishing."
  484. },
  485. {
  486. "name": "DOTNET_CONFIGURATION",
  487. "displayName": "Configuration",
  488. "description": "Set this to configuration (Release/Debug).",
  489. "value": "Release"
  490. },
  491. {
  492. "name": "DOTNET_RESTORE_SOURCES",
  493. "displayName": "NuGet package sources",
  494. "description": "Set this to override the NuGet.config sources."
  495. },
  496. {
  497. "name": "APPLICATION_DOMAIN",
  498. "displayName": "Application Hostname",
  499. "description": "The exposed hostname that will route to the .NET Core service, if left blank a value will be defaulted.",
  500. "value": ""
  501. },
  502. {
  503. "name": "GITHUB_WEBHOOK_SECRET",
  504. "displayName": "GitHub Webhook Secret",
  505. "description": "A secret string used to configure the GitHub webhook.",
  506. "generate": "expression",
  507. "from": "[a-zA-Z0-9]{40}"
  508. },
  509. {
  510. "name": "DATABASE_SERVICE_NAME",
  511. "required": true,
  512. "displayName": "Database Service Name",
  513. "value": "postgresql"
  514. },
  515. {
  516. "name": "DATABASE_USER",
  517. "displayName": "Database Username",
  518. "generate": "expression",
  519. "from": "user[A-Z0-9]{3}"
  520. },
  521. {
  522. "name": "DATABASE_PASSWORD",
  523. "displayName": "Database Password",
  524. "generate": "expression",
  525. "from": "[a-zA-Z0-9]{8}"
  526. },
  527. {
  528. "name": "DATABASE_NAME",
  529. "required": true,
  530. "displayName": "Database Name",
  531. "value": "musicstore"
  532. },
  533. {
  534. "name": "POSTGRESQL_MAX_CONNECTIONS",
  535. "displayName": "Maximum Database Connections",
  536. "value": "100"
  537. },
  538. {
  539. "name": "POSTGRESQL_SHARED_BUFFERS",
  540. "displayName": "Shared Buffer Amount",
  541. "value": "12MB"
  542. }
  543. ]
  544. }