gogs-persistent-template.yaml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. kind: Template
  2. apiVersion: v1
  3. metadata:
  4. annotations:
  5. description: The Gogs git server (https://gogs.io/)
  6. tags: instant-app,gogs,go,golang
  7. name: gogs
  8. objects:
  9. - kind: ServiceAccount
  10. apiVersion: v1
  11. metadata:
  12. creationTimestamp: null
  13. labels:
  14. app: ${APPLICATION_NAME}
  15. name: ${APPLICATION_NAME}
  16. - kind: Service
  17. apiVersion: v1
  18. metadata:
  19. annotations:
  20. description: Exposes the database server
  21. name: ${APPLICATION_NAME}-postgresql
  22. labels:
  23. app: ${APPLICATION_NAME}
  24. spec:
  25. ports:
  26. - name: postgresql
  27. port: 5432
  28. targetPort: 5432
  29. selector:
  30. name: ${APPLICATION_NAME}-postgresql
  31. - kind: DeploymentConfig
  32. apiVersion: v1
  33. metadata:
  34. annotations:
  35. description: Defines how to deploy the database
  36. name: ${APPLICATION_NAME}-postgresql
  37. labels:
  38. app: ${APPLICATION_NAME}
  39. spec:
  40. replicas: 1
  41. selector:
  42. name: ${APPLICATION_NAME}-postgresql
  43. strategy:
  44. type: Recreate
  45. template:
  46. metadata:
  47. labels:
  48. name: ${APPLICATION_NAME}-postgresql
  49. name: ${APPLICATION_NAME}-postgresql
  50. spec:
  51. serviceAccountName: ${APPLICATION_NAME}
  52. containers:
  53. - env:
  54. - name: POSTGRESQL_USER
  55. value: ${DATABASE_USER}
  56. - name: POSTGRESQL_PASSWORD
  57. value: ${DATABASE_PASSWORD}
  58. - name: POSTGRESQL_DATABASE
  59. value: ${DATABASE_NAME}
  60. - name: POSTGRESQL_MAX_CONNECTIONS
  61. value: ${DATABASE_MAX_CONNECTIONS}
  62. - name: POSTGRESQL_SHARED_BUFFERS
  63. value: ${DATABASE_SHARED_BUFFERS}
  64. - name: POSTGRESQL_ADMIN_PASSWORD
  65. value: ${DATABASE_ADMIN_PASSWORD}
  66. image: ' '
  67. livenessProbe:
  68. initialDelaySeconds: 30
  69. tcpSocket:
  70. port: 5432
  71. timeoutSeconds: 1
  72. failureThreshold: 10
  73. periodSeconds: 20
  74. name: postgresql
  75. ports:
  76. - containerPort: 5432
  77. readinessProbe:
  78. exec:
  79. command:
  80. - /bin/sh
  81. - -i
  82. - -c
  83. - psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1'
  84. initialDelaySeconds: 5
  85. timeoutSeconds: 1
  86. failureThreshold: 10
  87. resources:
  88. limits:
  89. memory: 512Mi
  90. volumeMounts:
  91. - mountPath: /var/lib/pgsql/data
  92. name: gogs-postgres-data
  93. volumes:
  94. - name: gogs-postgres-data
  95. persistentVolumeClaim:
  96. claimName: gogs-postgres-data
  97. triggers:
  98. - imageChangeParams:
  99. automatic: true
  100. containerNames:
  101. - postgresql
  102. from:
  103. kind: ImageStreamTag
  104. name: postgresql:9.5
  105. namespace: openshift
  106. type: ImageChange
  107. - type: ConfigChange
  108. - kind: Service
  109. apiVersion: v1
  110. metadata:
  111. annotations:
  112. description: The Gogs server's http port
  113. service.alpha.openshift.io/dependencies: '[{"name":"${APPLICATION_NAME}-postgresql","namespace":"","kind":"Service"}]'
  114. labels:
  115. app: ${APPLICATION_NAME}
  116. name: ${APPLICATION_NAME}
  117. spec:
  118. ports:
  119. - name: 3000-tcp
  120. port: 3000
  121. protocol: TCP
  122. targetPort: 3000
  123. selector:
  124. app: ${APPLICATION_NAME}
  125. deploymentconfig: ${APPLICATION_NAME}
  126. sessionAffinity: None
  127. type: ClusterIP
  128. status:
  129. loadBalancer: {}
  130. - kind: Route
  131. apiVersion: v1
  132. id: ${APPLICATION_NAME}-http
  133. metadata:
  134. annotations:
  135. description: Route for application's http service.
  136. labels:
  137. app: ${APPLICATION_NAME}
  138. name: ${APPLICATION_NAME}
  139. spec:
  140. host: ${HOSTNAME}
  141. to:
  142. name: ${APPLICATION_NAME}
  143. - kind: DeploymentConfig
  144. apiVersion: v1
  145. metadata:
  146. labels:
  147. app: ${APPLICATION_NAME}
  148. name: ${APPLICATION_NAME}
  149. spec:
  150. replicas: 1
  151. selector:
  152. app: ${APPLICATION_NAME}
  153. deploymentconfig: ${APPLICATION_NAME}
  154. strategy:
  155. resources: {}
  156. rollingParams:
  157. intervalSeconds: 1
  158. maxSurge: 25%
  159. maxUnavailable: 25%
  160. timeoutSeconds: 600
  161. updatePeriodSeconds: 1
  162. type: Rolling
  163. template:
  164. metadata:
  165. creationTimestamp: null
  166. labels:
  167. app: ${APPLICATION_NAME}
  168. deploymentconfig: ${APPLICATION_NAME}
  169. spec:
  170. serviceAccountName: ${APPLICATION_NAME}
  171. containers:
  172. - image: " "
  173. imagePullPolicy: Always
  174. name: ${APPLICATION_NAME}
  175. ports:
  176. - containerPort: 3000
  177. protocol: TCP
  178. resources: {}
  179. terminationMessagePath: /dev/termination-log
  180. volumeMounts:
  181. - name: gogs-data
  182. mountPath: /opt/gogs/data
  183. - name: gogs-config
  184. mountPath: /etc/gogs/conf
  185. readinessProbe:
  186. httpGet:
  187. path: /
  188. port: 3000
  189. scheme: HTTP
  190. initialDelaySeconds: 3
  191. timeoutSeconds: 1
  192. periodSeconds: 20
  193. successThreshold: 1
  194. failureThreshold: 10
  195. livenessProbe:
  196. httpGet:
  197. path: /
  198. port: 3000
  199. scheme: HTTP
  200. initialDelaySeconds: 20
  201. timeoutSeconds: 1
  202. periodSeconds: 10
  203. successThreshold: 1
  204. failureThreshold: 10
  205. dnsPolicy: ClusterFirst
  206. restartPolicy: Always
  207. securityContext: {}
  208. terminationGracePeriodSeconds: 30
  209. volumes:
  210. - name: gogs-data
  211. persistentVolumeClaim:
  212. claimName: gogs-data
  213. - name: gogs-config
  214. configMap:
  215. name: gogs-config
  216. items:
  217. - key: app.ini
  218. path: app.ini
  219. test: false
  220. triggers:
  221. - type: ConfigChange
  222. - imageChangeParams:
  223. automatic: true
  224. containerNames:
  225. - ${APPLICATION_NAME}
  226. from:
  227. kind: ImageStreamTag
  228. name: ${APPLICATION_NAME}:${GOGS_VERSION}
  229. type: ImageChange
  230. - kind: ImageStream
  231. apiVersion: v1
  232. metadata:
  233. labels:
  234. app: ${APPLICATION_NAME}
  235. name: ${APPLICATION_NAME}
  236. spec:
  237. tags:
  238. - name: "${GOGS_VERSION}"
  239. from:
  240. kind: DockerImage
  241. name: docker.io/openshiftdemos/gogs:${GOGS_VERSION}
  242. importPolicy: {}
  243. annotations:
  244. description: The Gogs git server docker image
  245. tags: gogs,go,golang
  246. version: "${GOGS_VERSION}"
  247. - kind: PersistentVolumeClaim
  248. apiVersion: v1
  249. metadata:
  250. name: gogs-data
  251. labels:
  252. app: ${APPLICATION_NAME}
  253. spec:
  254. accessModes:
  255. - ReadWriteOnce
  256. resources:
  257. requests:
  258. storage: ${GOGS_VOLUME_CAPACITY}
  259. - kind: PersistentVolumeClaim
  260. apiVersion: v1
  261. metadata:
  262. name: gogs-postgres-data
  263. labels:
  264. app: ${APPLICATION_NAME}
  265. spec:
  266. accessModes:
  267. - ReadWriteOnce
  268. resources:
  269. requests:
  270. storage: ${DB_VOLUME_CAPACITY}
  271. - kind: ConfigMap
  272. apiVersion: v1
  273. metadata:
  274. name: gogs-config
  275. labels:
  276. app: ${APPLICATION_NAME}
  277. data:
  278. app.ini: |
  279. RUN_MODE = prod
  280. RUN_USER = gogs
  281. [database]
  282. DB_TYPE = postgres
  283. HOST = ${APPLICATION_NAME}-postgresql:5432
  284. NAME = ${DATABASE_NAME}
  285. USER = ${DATABASE_USER}
  286. PASSWD = ${DATABASE_PASSWORD}
  287. [repository]
  288. ROOT = /opt/gogs/data/repositories
  289. [server]
  290. ROOT_URL=http://${HOSTNAME}
  291. SSH_DOMAIN=${HOSTNAME}
  292. [security]
  293. INSTALL_LOCK = ${INSTALL_LOCK}
  294. [service]
  295. ENABLE_CAPTCHA = false
  296. [webhook]
  297. SKIP_TLS_VERIFY = ${SKIP_TLS_VERIFY}
  298. parameters:
  299. - description: The name for the application.
  300. name: APPLICATION_NAME
  301. required: true
  302. value: gogs
  303. - description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>-<project>.<default-domain-suffix>'
  304. name: HOSTNAME
  305. required: true
  306. - description: Volume space available for data, e.g. 512Mi, 2Gi
  307. name: GOGS_VOLUME_CAPACITY
  308. required: true
  309. value: 1Gi
  310. - description: Volume space available for postregs data, e.g. 512Mi, 2Gi
  311. name: DB_VOLUME_CAPACITY
  312. required: true
  313. value: 1Gi
  314. - displayName: Database Username
  315. from: gogs
  316. value: gogs
  317. name: DATABASE_USER
  318. - displayName: Database Password
  319. from: '[a-zA-Z0-9]{8}'
  320. value: gogs
  321. name: DATABASE_PASSWORD
  322. - displayName: Database Name
  323. name: DATABASE_NAME
  324. value: gogs
  325. - displayName: Database Admin Password
  326. from: '[a-zA-Z0-9]{8}'
  327. generate: expression
  328. name: DATABASE_ADMIN_PASSWORD
  329. - displayName: Maximum Database Connections
  330. name: DATABASE_MAX_CONNECTIONS
  331. value: "100"
  332. - displayName: Shared Buffer Amount
  333. name: DATABASE_SHARED_BUFFERS
  334. value: 12MB
  335. - name: GOGS_VERSION
  336. displayName: Gogs Version
  337. description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags)'
  338. value: "0.11.34"
  339. required: true
  340. - name: INSTALL_LOCK
  341. displayName: Installation lock
  342. description: 'If set to true, installation (/install) page will be disabled. Set to false if you want to run the installation wizard via web'
  343. value: "true"
  344. - name: SKIP_TLS_VERIFY
  345. displayName: Skip TLS verification on webhooks
  346. description: Skip TLS verification on webhooks. Enable with caution!
  347. value: "false"