gogs-template.yaml 8.2 KB

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