gitlab-template.json 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. {
  2. "kind": "Template",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "name": "gitlab-ce",
  6. "annotations": {
  7. "iconClass": "icon-gitlab",
  8. "description": "GitLab. Collaboration and source control management: code, test, and deploy together! \n\n GitLab requries that the serviceaccount for the main GitLab app be added to the anyuid security context. The service account name is: -user",
  9. "tags": "instant-app,gitlab,VCS,ci-cd"
  10. }
  11. },
  12. "labels": {
  13. "createdBy": "gitlab-ce-template"
  14. },
  15. "parameters": [
  16. {
  17. "description": "The name for the application. The service will be named like the application.",
  18. "displayName": "Application name.",
  19. "name": "APPLICATION_NAME",
  20. "value": "gitlab-ce"
  21. },
  22. {
  23. "description": "Hostname for service routes. Set this in order to have the GitLab display the correct clone urls.",
  24. "displayName": "Gitlab instance hostname",
  25. "name": "APPLICATION_HOSTNAME",
  26. "required": true
  27. },
  28. {
  29. "name": "GITLAB_ROOT_PASSWORD",
  30. "displayName": "GitLab Root User Password",
  31. "description": "Password for the GitLab 'root' user. Must be at least 8 characters long. Leave blank if you would rather configure the password using the website during first use."
  32. },
  33. {
  34. "name": "POSTGRESQL_USER",
  35. "displayName": "PostgreSQL User",
  36. "description": "Username for PostgreSQL user that will be used for accessing the database.",
  37. "generate": "expression",
  38. "from": "user[A-Z0-9]{3}",
  39. "required": true
  40. },
  41. {
  42. "name": "POSTGRESQL_PASSWORD",
  43. "displayName": "PostgreSQL Password",
  44. "description": "Password for the PostgreSQL user.",
  45. "generate": "expression",
  46. "from": "[a-zA-Z0-9]{16}",
  47. "required": true
  48. },
  49. {
  50. "name": "POSTGRESQL_ADMIN_PASSWORD",
  51. "displayName": "PostgreSQL Admin User Password",
  52. "description": "Password for the PostgreSQL Admin user.",
  53. "generate": "expression",
  54. "from": "[a-zA-Z0-9]{16}",
  55. "required": true
  56. },
  57. {
  58. "name": "POSTGRESQL_DATABASE",
  59. "displayName": "PostgreSQL Database Name",
  60. "description": "Name of the PostgreSQL database accessed.",
  61. "value": "gitlabhq_production",
  62. "required": true
  63. },
  64. {
  65. "name": "UNICORN_WORKERS",
  66. "displayName": "Number of Unicorn Workers",
  67. "description": "Number of Unicorn Workers to use per instance. Must be at least 2.",
  68. "value": "2",
  69. "required": true
  70. },
  71. {
  72. "description": "Volume size for /etc",
  73. "displayName": "/etc/gitlab volume size",
  74. "name": "ETC_VOL_SIZE",
  75. "value": "100Mi"
  76. },
  77. {
  78. "description": "Volume size for GitLab data",
  79. "displayName": "GitLab data volume size",
  80. "name": "GITLAB_DATA_VOL_SIZE",
  81. "value": "5Gi"
  82. },
  83. {
  84. "description": "Volume size for postgresql data",
  85. "displayName": "postgresql volume size",
  86. "name": "POSTGRESQL_VOL_SIZE",
  87. "value": "2Gi"
  88. },
  89. {
  90. "description": "Volume size for redis data",
  91. "displayName": "redis volume size",
  92. "name": "REDIS_VOL_SIZE",
  93. "value": "512Mi"
  94. }
  95. ],
  96. "objects": [
  97. {
  98. "kind": "ImageStream",
  99. "apiVersion": "v1",
  100. "metadata": {
  101. "name": "${APPLICATION_NAME}",
  102. "labels": {
  103. "app": "${APPLICATION_NAME}"
  104. }
  105. },
  106. "spec": {
  107. "tags": [
  108. {
  109. "name": "gitlab-11.4.0",
  110. "from": {
  111. "kind": "DockerImage",
  112. "name": "gitlab/gitlab-ce:11.4.0-ce.0"
  113. }
  114. }
  115. ]
  116. }
  117. },
  118. {
  119. "kind": "ImageStream",
  120. "apiVersion": "v1",
  121. "metadata": {
  122. "name": "${APPLICATION_NAME}-redis",
  123. "labels": {
  124. "app": "${APPLICATION_NAME}"
  125. }
  126. },
  127. "spec": {
  128. "tags": [
  129. {
  130. "name": "3.2.3",
  131. "from": {
  132. "kind": "DockerImage",
  133. "name": "redis:3.2.3-alpine"
  134. }
  135. }
  136. ]
  137. }
  138. },
  139. {
  140. "kind": "ServiceAccount",
  141. "apiVersion": "v1",
  142. "metadata": {
  143. "name": "${APPLICATION_NAME}-user"
  144. }
  145. },
  146. {
  147. "kind": "DeploymentConfig",
  148. "apiVersion": "v1",
  149. "metadata": {
  150. "name": "${APPLICATION_NAME}",
  151. "labels": {
  152. "app": "${APPLICATION_NAME}"
  153. }
  154. },
  155. "spec": {
  156. "strategy": {
  157. "type": "Recreate",
  158. "recreateParams": {},
  159. "resources": {}
  160. },
  161. "triggers": [
  162. {
  163. "type": "ConfigChange"
  164. },
  165. {
  166. "type": "ImageChange",
  167. "imageChangeParams": {
  168. "automatic": true,
  169. "containerNames": [
  170. "gitlab-ce"
  171. ],
  172. "from": {
  173. "kind": "ImageStreamTag",
  174. "name": "${APPLICATION_NAME}:gitlab-11.4.0"
  175. }
  176. }
  177. }
  178. ],
  179. "replicas": 1,
  180. "test": false,
  181. "selector": {
  182. "app": "${APPLICATION_NAME}",
  183. "deploymentconfig": "${APPLICATION_NAME}"
  184. },
  185. "template": {
  186. "metadata": {
  187. "labels": {
  188. "app": "${APPLICATION_NAME}",
  189. "deploymentconfig": "${APPLICATION_NAME}"
  190. }
  191. },
  192. "spec": {
  193. "volumes": [
  194. {
  195. "name": "gitlab-ce-volume-1",
  196. "persistentVolumeClaim": {
  197. "claimName": "${APPLICATION_NAME}-etc"
  198. }
  199. },
  200. {
  201. "name": "gitlab-ce-volume-2",
  202. "persistentVolumeClaim": {
  203. "claimName": "${APPLICATION_NAME}-data"
  204. }
  205. }
  206. ],
  207. "containers": [
  208. {
  209. "name": "gitlab-ce",
  210. "image": "gitlab-ce",
  211. "ports": [
  212. {
  213. "containerPort": 22,
  214. "protocol": "TCP"
  215. },
  216. {
  217. "containerPort": 80,
  218. "protocol": "TCP"
  219. }
  220. ],
  221. "env": [
  222. {
  223. "name": "GITLAB_OMNIBUS_CONFIG",
  224. "value": "hostname='${APPLICATION_HOSTNAME}'; external_url \"http://#{hostname}/\" unless hostname.to_s == ''; root_pass='${GITLAB_ROOT_PASSWORD}'; gitlab_rails['initial_root_password']=root_pass unless root_pass.to_s == ''; postgresql['enable']=false; gitlab_rails['db_host'] = '${APPLICATION_NAME}-postgresql'; gitlab_rails['db_password']='${POSTGRESQL_PASSWORD}'; gitlab_rails['db_username']='${POSTGRESQL_USER}'; gitlab_rails['db_database']='${POSTGRESQL_DATABASE}'; redis['enable'] = false; gitlab_rails['redis_host']='${APPLICATION_NAME}-redis'; unicorn['worker_processes'] = ${UNICORN_WORKERS}; manage_accounts['enable'] = true; manage_storage_directories['manage_etc'] = false; gitlab_shell['auth_file'] = '/gitlab-data/ssh/authorized_keys'; git_data_dirs({ 'default' => { 'path' => '/gitlab-data/git-data' } }); gitlab_rails['shared_path'] = '/gitlab-data/shared'; gitlab_rails['uploads_directory'] = '/gitlab-data/uploads'; gitlab_ci['builds_directory'] = '/gitlab-data/builds'; prometheus_monitoring['enable'] = false;"
  225. }
  226. ],
  227. "resources": {
  228. "limits": {
  229. "cpu": "1",
  230. "memory": "2Gi"
  231. },
  232. "requests": {
  233. "cpu": "500m",
  234. "memory": "1Gi"
  235. }
  236. },
  237. "volumeMounts": [
  238. {
  239. "name": "gitlab-ce-volume-1",
  240. "mountPath": "/etc/gitlab"
  241. },
  242. {
  243. "name": "gitlab-ce-volume-2",
  244. "mountPath": "/gitlab-data"
  245. }
  246. ],
  247. "livenessProbe": {
  248. "httpGet": {
  249. "path": "/help",
  250. "port": 80,
  251. "scheme": "HTTP"
  252. },
  253. "initialDelaySeconds": 120,
  254. "timeoutSeconds": 1,
  255. "periodSeconds": 10,
  256. "successThreshold": 1,
  257. "failureThreshold": 3
  258. },
  259. "readinessProbe": {
  260. "httpGet": {
  261. "path": "/help",
  262. "port": 80,
  263. "scheme": "HTTP"
  264. },
  265. "initialDelaySeconds": 20,
  266. "timeoutSeconds": 1,
  267. "periodSeconds": 10,
  268. "successThreshold": 1,
  269. "failureThreshold": 3
  270. },
  271. "terminationMessagePath": "/dev/termination-log",
  272. "imagePullPolicy": "IfNotPresent"
  273. }
  274. ],
  275. "restartPolicy": "Always",
  276. "terminationGracePeriodSeconds": 30,
  277. "dnsPolicy": "ClusterFirst",
  278. "serviceAccount": "${APPLICATION_NAME}-user"
  279. }
  280. }
  281. }
  282. },
  283. {
  284. "kind": "DeploymentConfig",
  285. "apiVersion": "v1",
  286. "metadata": {
  287. "name": "${APPLICATION_NAME}-redis",
  288. "labels": {
  289. "app": "${APPLICATION_NAME}"
  290. }
  291. },
  292. "spec": {
  293. "strategy": {
  294. "type": "Recreate",
  295. "recreateParams": {},
  296. "resources": {}
  297. },
  298. "triggers": [
  299. {
  300. "type": "ConfigChange"
  301. },
  302. {
  303. "type": "ImageChange",
  304. "imageChangeParams": {
  305. "automatic": true,
  306. "containerNames": [
  307. "gitlab-ce-redis"
  308. ],
  309. "from": {
  310. "kind": "ImageStreamTag",
  311. "name": "${APPLICATION_NAME}-redis:3.2.3"
  312. }
  313. }
  314. }
  315. ],
  316. "replicas": 1,
  317. "test": false,
  318. "selector": {
  319. "app": "${APPLICATION_NAME}",
  320. "deploymentconfig": "${APPLICATION_NAME}-redis"
  321. },
  322. "template": {
  323. "metadata": {
  324. "labels": {
  325. "app": "${APPLICATION_NAME}",
  326. "deploymentconfig": "${APPLICATION_NAME}-redis"
  327. }
  328. },
  329. "spec": {
  330. "volumes": [
  331. {
  332. "name": "gitlab-ce-volume-4",
  333. "persistentVolumeClaim": {
  334. "claimName": "${APPLICATION_NAME}-redis-data"
  335. }
  336. }
  337. ],
  338. "containers": [
  339. {
  340. "name": "gitlab-ce-redis",
  341. "image": "gitlab-ce-redis",
  342. "command": [
  343. "/bin/sh",
  344. "-ec"
  345. ],
  346. "args": [
  347. "exec redis-server"
  348. ],
  349. "ports": [
  350. {
  351. "containerPort": 6379,
  352. "protocol": "TCP"
  353. }
  354. ],
  355. "resources": {
  356. "limits": {
  357. "cpu": "1",
  358. "memory": "512Mi"
  359. },
  360. "requests": {
  361. "cpu": "100m",
  362. "memory": "300Mi"
  363. }
  364. },
  365. "volumeMounts": [
  366. {
  367. "name": "gitlab-ce-volume-4",
  368. "mountPath": "/data"
  369. }
  370. ],
  371. "terminationMessagePath": "/dev/termination-log",
  372. "imagePullPolicy": "IfNotPresent"
  373. }
  374. ],
  375. "restartPolicy": "Always",
  376. "terminationGracePeriodSeconds": 30,
  377. "dnsPolicy": "ClusterFirst"
  378. }
  379. }
  380. }
  381. },
  382. {
  383. "kind": "DeploymentConfig",
  384. "apiVersion": "v1",
  385. "metadata": {
  386. "name": "${APPLICATION_NAME}-postgresql",
  387. "labels": {
  388. "app": "${APPLICATION_NAME}"
  389. }
  390. },
  391. "spec": {
  392. "strategy": {
  393. "type": "Recreate",
  394. "recreateParams": {
  395. "post": {
  396. "failurePolicy": "Abort",
  397. "execNewPod": {
  398. "containerName": "gitlab-ce-postgresql",
  399. "command": [
  400. "/usr/bin/scl",
  401. "enable",
  402. "rh-postgresql94",
  403. "export PGPASSWORD='${POSTGRESQL_ADMIN_PASSWORD}'; psql -h '${APPLICATION_NAME}-postgresql' -U postgres -d ${POSTGRESQL_DATABASE} -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'"
  404. ],
  405. "env": [
  406. {
  407. "name": "HOME",
  408. "value": "/var/lib/pgsql"
  409. },
  410. {
  411. "name": "PGDATA",
  412. "value": "/var/lib/pgsql/data/userdata"
  413. },
  414. {
  415. "name": "CONTAINER_SCRIPTS_PATH",
  416. "value": "/usr/share/container-scripts/postgresql"
  417. }
  418. ]
  419. }
  420. }
  421. },
  422. "resources": {}
  423. },
  424. "triggers": [
  425. {
  426. "type": "ConfigChange"
  427. },
  428. {
  429. "type": "ImageChange",
  430. "imageChangeParams": {
  431. "automatic": true,
  432. "containerNames": [
  433. "gitlab-ce-postgresql"
  434. ],
  435. "from": {
  436. "kind": "ImageStreamTag",
  437. "name": "postgresql:9.4",
  438. "namespace": "openshift"
  439. }
  440. }
  441. }
  442. ],
  443. "replicas": 1,
  444. "test": false,
  445. "selector": {
  446. "app": "${APPLICATION_NAME}",
  447. "deploymentconfig": "${APPLICATION_NAME}-postgresql"
  448. },
  449. "template": {
  450. "metadata": {
  451. "labels": {
  452. "app": "${APPLICATION_NAME}",
  453. "deploymentconfig": "${APPLICATION_NAME}-postgresql"
  454. }
  455. },
  456. "spec": {
  457. "volumes": [
  458. {
  459. "name": "gitlab-ce-volume-3",
  460. "persistentVolumeClaim": {
  461. "claimName": "${APPLICATION_NAME}-postgresql"
  462. }
  463. }
  464. ],
  465. "containers": [
  466. {
  467. "name": "gitlab-ce-postgresql",
  468. "image": "gitlab-ce-postgresql",
  469. "ports": [
  470. {
  471. "containerPort": 5432,
  472. "protocol": "TCP"
  473. }
  474. ],
  475. "readinessProbe": {
  476. "timeoutSeconds": 1,
  477. "initialDelaySeconds": 5,
  478. "exec": {
  479. "command": [
  480. "/bin/sh",
  481. "-i",
  482. "-c",
  483. "psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'"
  484. ]
  485. }
  486. },
  487. "livenessProbe": {
  488. "timeoutSeconds": 1,
  489. "initialDelaySeconds": 30,
  490. "tcpSocket": {
  491. "port": 5432
  492. }
  493. },
  494. "env": [
  495. {
  496. "name": "POSTGRESQL_USER",
  497. "value": "${POSTGRESQL_USER}"
  498. },
  499. {
  500. "name": "POSTGRESQL_PASSWORD",
  501. "value": "${POSTGRESQL_PASSWORD}"
  502. },
  503. {
  504. "name": "POSTGRESQL_DATABASE",
  505. "value": "${POSTGRESQL_DATABASE}"
  506. },
  507. {
  508. "name": "POSTGRESQL_ADMIN_PASSWORD",
  509. "value": "${POSTGRESQL_ADMIN_PASSWORD}"
  510. }
  511. ],
  512. "resources": {
  513. "limits": {
  514. "cpu": "1",
  515. "memory": "512Mi"
  516. },
  517. "requests": {
  518. "cpu": "1",
  519. "memory": "512Mi"
  520. }
  521. },
  522. "volumeMounts": [
  523. {
  524. "name": "gitlab-ce-volume-3",
  525. "mountPath": "/var/lib/pgsql/data"
  526. }
  527. ],
  528. "terminationMessagePath": "/dev/termination-log",
  529. "imagePullPolicy": "IfNotPresent"
  530. }
  531. ],
  532. "restartPolicy": "Always",
  533. "terminationGracePeriodSeconds": 30,
  534. "dnsPolicy": "ClusterFirst"
  535. }
  536. }
  537. }
  538. },
  539. {
  540. "kind": "Service",
  541. "apiVersion": "v1",
  542. "metadata": {
  543. "name": "${APPLICATION_NAME}",
  544. "labels": {
  545. "app": "${APPLICATION_NAME}"
  546. }
  547. },
  548. "spec": {
  549. "ports": [
  550. {
  551. "name": "22-ssh",
  552. "protocol": "TCP",
  553. "port": 22,
  554. "targetPort": 22
  555. },
  556. {
  557. "name": "80-http",
  558. "protocol": "TCP",
  559. "port": 80,
  560. "targetPort": 80
  561. }
  562. ],
  563. "selector": {
  564. "app": "${APPLICATION_NAME}",
  565. "deploymentconfig": "${APPLICATION_NAME}"
  566. },
  567. "type": "ClusterIP",
  568. "sessionAffinity": "None"
  569. }
  570. },
  571. {
  572. "kind": "Service",
  573. "apiVersion": "v1",
  574. "metadata": {
  575. "name": "${APPLICATION_NAME}-redis",
  576. "labels": {
  577. "app": "${APPLICATION_NAME}"
  578. }
  579. },
  580. "spec": {
  581. "ports": [
  582. {
  583. "name": "6379-redis",
  584. "protocol": "TCP",
  585. "port": 6379,
  586. "targetPort": 6379
  587. }
  588. ],
  589. "selector": {
  590. "app": "${APPLICATION_NAME}",
  591. "deploymentconfig": "${APPLICATION_NAME}-redis"
  592. },
  593. "type": "ClusterIP",
  594. "sessionAffinity": "None"
  595. }
  596. },
  597. {
  598. "kind": "Service",
  599. "apiVersion": "v1",
  600. "metadata": {
  601. "name": "${APPLICATION_NAME}-postgresql",
  602. "labels": {
  603. "app": "${APPLICATION_NAME}"
  604. }
  605. },
  606. "spec": {
  607. "ports": [
  608. {
  609. "name": "5432-postgresql",
  610. "protocol": "TCP",
  611. "port": 5432,
  612. "targetPort": 5432
  613. }
  614. ],
  615. "selector": {
  616. "app": "${APPLICATION_NAME}",
  617. "deploymentconfig": "${APPLICATION_NAME}-postgresql"
  618. },
  619. "type": "ClusterIP",
  620. "sessionAffinity": "None"
  621. }
  622. },
  623. {
  624. "kind": "PersistentVolumeClaim",
  625. "apiVersion": "v1",
  626. "metadata": {
  627. "name": "${APPLICATION_NAME}-redis-data"
  628. },
  629. "spec": {
  630. "accessModes": [
  631. "ReadWriteOnce"
  632. ],
  633. "resources": {
  634. "requests": {
  635. "storage": "${REDIS_VOL_SIZE}"
  636. }
  637. }
  638. }
  639. },
  640. {
  641. "kind": "PersistentVolumeClaim",
  642. "apiVersion": "v1",
  643. "metadata": {
  644. "name": "${APPLICATION_NAME}-etc"
  645. },
  646. "spec": {
  647. "accessModes": [
  648. "ReadWriteOnce"
  649. ],
  650. "resources": {
  651. "requests": {
  652. "storage": "${ETC_VOL_SIZE}"
  653. }
  654. }
  655. }
  656. },
  657. {
  658. "kind": "PersistentVolumeClaim",
  659. "apiVersion": "v1",
  660. "metadata": {
  661. "name": "${APPLICATION_NAME}-data"
  662. },
  663. "spec": {
  664. "accessModes": [
  665. "ReadWriteOnce"
  666. ],
  667. "resources": {
  668. "requests": {
  669. "storage": "${GITLAB_DATA_VOL_SIZE}"
  670. }
  671. }
  672. }
  673. },
  674. {
  675. "kind": "PersistentVolumeClaim",
  676. "apiVersion": "v1",
  677. "metadata": {
  678. "name": "${APPLICATION_NAME}-postgresql"
  679. },
  680. "spec": {
  681. "accessModes": [
  682. "ReadWriteOnce"
  683. ],
  684. "resources": {
  685. "requests": {
  686. "storage": "${POSTGRESQL_VOL_SIZE}"
  687. }
  688. }
  689. }
  690. },
  691. {
  692. "kind": "Route",
  693. "apiVersion": "v1",
  694. "metadata": {
  695. "name": "${APPLICATION_NAME}",
  696. "labels": {
  697. "app": "${APPLICATION_NAME}"
  698. }
  699. },
  700. "spec": {
  701. "host": "${APPLICATION_HOSTNAME}",
  702. "to": {
  703. "kind": "Service",
  704. "name": "${APPLICATION_NAME}"
  705. },
  706. "port": {
  707. "targetPort": "80-http"
  708. }
  709. }
  710. }
  711. ]
  712. }