From 2129ce579c50a32fa5703f08534ad9e69ed6882f Mon Sep 17 00:00:00 2001 From: "Rafael T. C. Soares (A.K.A Tuelho)" Date: Mon, 23 Jan 2017 10:22:54 -0300 Subject: [PATCH 01/17] solving #8 updating README description according to suggestions in #8 --- README.md | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a44a957..461ca9f 100644 --- a/README.md +++ b/README.md @@ -10,28 +10,42 @@ requirements. This repository contains: * Usage instructions ## Prerequisites + * An account in an OpenShift 3.2+ environment and a project -* Gogs requires a database to store its information. Provisioning a database is - out-of-scope for this repository. If you wish to run the database on - OpenShift, it is suggested that you deploy PostgreSQL using persistent - storage. More information on the OpenShift PostgreSQL deployment is here: +## Deployment +Gogs can be easily deployed using the included templates in `openshift` namespace. + +There are two templates available: _persistent_ and _non-persistent_. The pesistent one requires two `PersistentVolume` available with default size required of 1Gi (the volume size can be specified with the template variables: `GOGS_VOLUME_CAPACITY` and `DB_VOLUME_CAPACITY`). - https://docs.openshift.org/latest/using_images/db_images/postgresql.html +* gogs-data +* gogs-postgres-data + +Both templates will provision two linked PODs: one for GOGS and other for Postgresql DB. -## Deployment -Gogs can be easily deployed using the included templates in `openshift` folder. If your have persistent volumes available in your cluster: ``` oc new-app -f https://raw.githubusercontent.com/OpenShiftDemos/gogs-openshift-docker/master/openshift/gogs-persistent-template.yaml --param=HOSTNAME=gogs-demo.yourdomain.com ``` + Otherwise: ``` oc new-app -f https://raw.githubusercontent.com/OpenShiftDemos/gogs-openshift-docker/master/openshift/gogs-template.yaml --param=HOSTNAME=gogs-demo.yourdomain.com ``` +## Accessing GOGs interface +You can access and manage your GOGs app creating an admin user as described in GOGs' official FAQ [1]: + +> Administration +> +> How can I become an administrator? +> +> The first registered user with ID = 1 is an administrator. No e-mail confirmation is required for this (if enabled). > The default administrator can log into Admin > Users and authorize another user. A user will also be an > administrator if they register in the install page. + +[1] https://gogs.io/docs/intro/faqs -Note that hostname is required during Gogs installation in order to configure repository urls correctly. +## Notes + * that hostname is required during Gogs installation in order to configure repository urls correctly. ## ToDos * git via ssh support From d9928ccc443775bc2f38e95ebd962f26b9355fc6 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Sun, 2 Apr 2017 19:50:21 +0700 Subject: [PATCH 02/17] add ARG to install the provided Gogs version --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index af4d9a4..a42a52f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM centos:7 MAINTAINER Erik Jacobs -ENV GOGS_VERSION="0.9.113" +ARG GOGS_VERSION="0.9.113" LABEL name="Gogs - Go Git Service" \ vendor="Gogs" \ @@ -11,8 +11,8 @@ LABEL name="Gogs - Go Git Service" \ summary="The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service." \ io.openshift.expose-services="3000,gogs" \ io.openshift.tags="gogs" \ - build-date="2017-01-05" \ - version="0.9.113" \ + build-date="2017-04-02" \ + version="${GOGS_VERSION}" \ release="1" ENV HOME=/var/lib/gogs @@ -21,7 +21,7 @@ COPY ./root / RUN rpm --import https://rpm.packager.io/key && \ yum -y install epel-release && \ - yum -y --setopt=tsflags=nodocs install gogs nss_wrapper gettext && \ + yum -y --setopt=tsflags=nodocs install gogs-${GOGS_VERSION} nss_wrapper gettext && \ yum -y clean all && \ mkdir -p /var/lib/gogs From 19e1f75436a0fecea00e2e61c9eab2a0687be0bf Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Sun, 2 Apr 2017 22:54:04 +0700 Subject: [PATCH 03/17] adjusted templates and run script for Gogs 0.10 --- openshift/gogs-persistent-template.yaml | 3 ++- openshift/gogs-template.yaml | 3 ++- root/usr/bin/rungogs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index 944e14b..b162c87 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -287,6 +287,7 @@ objects: [server] ROOT_URL=http://${HOSTNAME} + SSH_DOMAIN=${HOSTNAME} [security] INSTALL_LOCK = ${INSTALL_LOCK} @@ -335,7 +336,7 @@ parameters: value: 12MB - name: GOGS_VERSION displayName: Gogs Version - description: 'Version of the Gogs container image to be used (0.9.97 or 0.9.113)' + description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags)' value: "0.9.97" required: true - name: INSTALL_LOCK diff --git a/openshift/gogs-template.yaml b/openshift/gogs-template.yaml index a8ad89f..da5d902 100644 --- a/openshift/gogs-template.yaml +++ b/openshift/gogs-template.yaml @@ -265,6 +265,7 @@ objects: [server] ROOT_URL=http://${HOSTNAME} + SSH_DOMAIN=${HOSTNAME} [security] INSTALL_LOCK = ${INSTALL_LOCK} @@ -305,7 +306,7 @@ parameters: value: 12MB - name: GOGS_VERSION displayName: Gogs Version - description: 'Version of the Gogs container image to be used (0.9.97 or 0.9.113)' + description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags)' value: "0.9.97" required: true - name: INSTALL_LOCK diff --git a/root/usr/bin/rungogs b/root/usr/bin/rungogs index b3aa48e..8c56d32 100755 --- a/root/usr/bin/rungogs +++ b/root/usr/bin/rungogs @@ -9,5 +9,6 @@ echo "gogs:x:${USER_ID}:${GROUP_ID}:gogs.io user:${HOME}:/bin/bash" >> "$HOME/pa export LD_PRELOAD=libnss_wrapper.so export NSS_WRAPPER_PASSWD=${HOME}/passwd export NSS_WRAPPER_GROUP=/etc/group +export PORT=3000 /usr/bin/gogs run web From 426d8ace449339253235858060f9011fdb81a320 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Mon, 24 Apr 2017 21:03:17 +0700 Subject: [PATCH 04/17] use postgresql 9.5 --- openshift/gogs-persistent-template.yaml | 2 +- openshift/gogs-template.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index b162c87..3fae969 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -94,7 +94,7 @@ objects: - postgresql from: kind: ImageStreamTag - name: postgresql:9.4 + name: postgresql:9.5 namespace: openshift type: ImageChange - type: ConfigChange diff --git a/openshift/gogs-template.yaml b/openshift/gogs-template.yaml index da5d902..ac26b40 100644 --- a/openshift/gogs-template.yaml +++ b/openshift/gogs-template.yaml @@ -93,7 +93,7 @@ objects: - postgresql from: kind: ImageStreamTag - name: postgresql:9.4 + name: postgresql:9.5 namespace: openshift type: ImageChange - type: ConfigChange From a7ce1947066a4ea3e500e00cb3acee8e88686bdb Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Mon, 24 Apr 2017 23:51:55 +0700 Subject: [PATCH 05/17] fixed the imagestream latest tag --- openshift/gogs-persistent-template.yaml | 11 +---------- openshift/gogs-template.yaml | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index 3fae969..9def854 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -218,7 +218,7 @@ objects: - ${APPLICATION_NAME} from: kind: ImageStreamTag - name: ${APPLICATION_NAME}:latest + name: ${APPLICATION_NAME}:${GOGS_VERSION} type: ImageChange - kind: ImageStream apiVersion: v1 @@ -237,15 +237,6 @@ objects: description: The Gogs git server docker image tags: gogs,go,golang version: "${GOGS_VERSION}" - - annotations: - description: The Gogs git server docker image - tags: gogs,go,golang - version: "latest" - from: - kind: ImageStreamTag - name: "${GOGS_VERSION}" - importPolicy: {} - name: "latest" - kind: PersistentVolumeClaim apiVersion: v1 metadata: diff --git a/openshift/gogs-template.yaml b/openshift/gogs-template.yaml index ac26b40..67971df 100644 --- a/openshift/gogs-template.yaml +++ b/openshift/gogs-template.yaml @@ -216,7 +216,7 @@ objects: - ${APPLICATION_NAME} from: kind: ImageStreamTag - name: ${APPLICATION_NAME}:latest + name: ${APPLICATION_NAME}:${GOGS_VERSION} type: ImageChange - kind: ImageStream apiVersion: v1 @@ -235,15 +235,6 @@ objects: description: The Gogs git server docker image tags: gogs,go,golang version: "${GOGS_VERSION}" - - annotations: - description: The Gogs git server docker image - tags: gogs,go,golang - version: "latest" - from: - kind: ImageStreamTag - name: "${GOGS_VERSION}" - importPolicy: {} - name: "latest" - kind: ConfigMap apiVersion: v1 metadata: From 20f59f46006c0a2e182a75eba4936d5bf9819d98 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Tue, 25 Apr 2017 11:59:57 +0700 Subject: [PATCH 06/17] added README for templates --- openshift/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 openshift/README.md diff --git a/openshift/README.md b/openshift/README.md new file mode 100644 index 0000000..fe34522 --- /dev/null +++ b/openshift/README.md @@ -0,0 +1,26 @@ +OpenShift Gogs Templates +=== +Note that Gogs route url is required to be provided as a paramter to the template since Gogs needs this url for self-configuration. + +Use a version of Gogs available on Docker Hub or just ```latest```: +https://hub.docker.com/r/openshiftdemos/gogs/tags/ + +### Using persistent volumes + +``` +$ oc process \ + -f http://bit.ly/openshift-gogs-persistent-template \ + --param=HOSTNAME=your-gogs-hostname \ + --param=VERSION=0.11.4 \ + | oc create -f - +``` + +### Without persistent volumes (ephemeral) + +``` +$ oc process \ + -f http://bit.ly/openshift-gogs-template \ + --param=HOSTNAME=your-gogs-hostname \ + --param=VERSION=0.11.4 \ + | oc create -f - +``` \ No newline at end of file From 629a536357ccf742e5fbdee9fed3f010d9096077 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Tue, 25 Apr 2017 12:02:56 +0700 Subject: [PATCH 07/17] fixed version param in README --- openshift/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openshift/README.md b/openshift/README.md index fe34522..0b4a4c5 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -11,7 +11,7 @@ https://hub.docker.com/r/openshiftdemos/gogs/tags/ $ oc process \ -f http://bit.ly/openshift-gogs-persistent-template \ --param=HOSTNAME=your-gogs-hostname \ - --param=VERSION=0.11.4 \ + --param=GOGS_VERSION=0.11.4 \ | oc create -f - ``` @@ -21,6 +21,6 @@ $ oc process \ $ oc process \ -f http://bit.ly/openshift-gogs-template \ --param=HOSTNAME=your-gogs-hostname \ - --param=VERSION=0.11.4 \ + --param=GOGS_VERSION=0.11.4 \ | oc create -f - ``` \ No newline at end of file From a5ec6082bda6d80a492d1c9bb5b5b9d9e8377523 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Tue, 25 Apr 2017 12:10:59 +0700 Subject: [PATCH 08/17] added guide to README --- README.md | 23 +++++++++-------------- openshift/README.md | 26 -------------------------- 2 files changed, 9 insertions(+), 40 deletions(-) delete mode 100644 openshift/README.md diff --git a/README.md b/README.md index a44a957..73144a0 100644 --- a/README.md +++ b/README.md @@ -9,29 +9,24 @@ requirements. This repository contains: * OpenShift templates for deploying the image * Usage instructions -## Prerequisites -* An account in an OpenShift 3.2+ environment and a project - -* Gogs requires a database to store its information. Provisioning a database is - out-of-scope for this repository. If you wish to run the database on - OpenShift, it is suggested that you deploy PostgreSQL using persistent - storage. More information on the OpenShift PostgreSQL deployment is here: - - https://docs.openshift.org/latest/using_images/db_images/postgresql.html - ## Deployment Gogs can be easily deployed using the included templates in `openshift` folder. If your have persistent volumes available in your cluster: ``` -oc new-app -f https://raw.githubusercontent.com/OpenShiftDemos/gogs-openshift-docker/master/openshift/gogs-persistent-template.yaml --param=HOSTNAME=gogs-demo.yourdomain.com +oc new-app -f http://bit.ly/openshift-gogs-persistent-template --param=HOSTNAME=gogs-demo.yourdomain.com ``` Otherwise: ``` -oc new-app -f https://raw.githubusercontent.com/OpenShiftDemos/gogs-openshift-docker/master/openshift/gogs-template.yaml --param=HOSTNAME=gogs-demo.yourdomain.com +oc new-app -f http://bit.ly/openshift-gogs-template --param=HOSTNAME=gogs-demo.yourdomain.com ``` Note that hostname is required during Gogs installation in order to configure repository urls correctly. -## ToDos -* git via ssh support +You can deploy any of the available Gogs versions on [openshiftdemos/gogs](https://hub.docker.com/r/openshiftdemos/gogs/tags/) on Docker Hub using the ```GOGS_VERSION``` template parameter: +``` +oc new-app -f http://bit.ly/openshift-gogs-template --param=HOSTNAME=gogs-demo.yourdomain.com --param=GOGS_VERSION=0.11.4 +``` + +# Admin User +After Gogs deployment, the first registered user will be admin. The default administrator can log into Admin > Users and authorize another user. A user will also be an > administrator if they register in the install page. Read more on [Gogs FAQ](https://gogs.io/docs/intro/faqs#how-can-i-become-an-administrator%3F) \ No newline at end of file diff --git a/openshift/README.md b/openshift/README.md deleted file mode 100644 index 0b4a4c5..0000000 --- a/openshift/README.md +++ /dev/null @@ -1,26 +0,0 @@ -OpenShift Gogs Templates -=== -Note that Gogs route url is required to be provided as a paramter to the template since Gogs needs this url for self-configuration. - -Use a version of Gogs available on Docker Hub or just ```latest```: -https://hub.docker.com/r/openshiftdemos/gogs/tags/ - -### Using persistent volumes - -``` -$ oc process \ - -f http://bit.ly/openshift-gogs-persistent-template \ - --param=HOSTNAME=your-gogs-hostname \ - --param=GOGS_VERSION=0.11.4 \ - | oc create -f - -``` - -### Without persistent volumes (ephemeral) - -``` -$ oc process \ - -f http://bit.ly/openshift-gogs-template \ - --param=HOSTNAME=your-gogs-hostname \ - --param=GOGS_VERSION=0.11.4 \ - | oc create -f - -``` \ No newline at end of file From 79b20836e12e844916b8f13e02c20848b92bcf6e Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Tue, 25 Apr 2017 12:18:34 +0700 Subject: [PATCH 09/17] updated README --- README.md | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4215341..9380510 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ There are two templates available: _persistent_ and _non-persistent_. The pesist * gogs-data * gogs-postgres-data -Both templates will provision two linked PODs: one for GOGS and other for Postgresql DB. If your have persistent volumes available in your cluster: +Both templates will provision two linked pods: one for GOGS and other for Postgresql DB. If your have persistent volumes available in your cluster: ``` oc new-app -f http://bit.ly/openshift-gogs-persistent-template --param=HOSTNAME=gogs-demo.yourdomain.com @@ -25,24 +25,17 @@ Otherwise: ``` oc new-app -f http://bit.ly/openshift-gogs-template --param=HOSTNAME=gogs-demo.yourdomain.com ``` -## Accessing GOGs interface -You can access and manage your GOGs app creating an admin user as described in GOGs' official FAQ [1]: -> Administration -> -> How can I become an administrator? -> -> The first registered user with ID = 1 is an administrator. No e-mail confirmation is required for this (if enabled). > The default administrator can log into Admin > Users and authorize another user. A user will also be an > administrator if they register in the install page. - -[1] https://gogs.io/docs/intro/faqs - -## Notes - * that hostname is required during Gogs installation in order to configure repository urls correctly. +Note that hostname is required during Gogs installation in order to configure repository urls correctly. +## Gogs Versions You can deploy any of the available Gogs versions on [openshiftdemos/gogs](https://hub.docker.com/r/openshiftdemos/gogs/tags/) on Docker Hub using the ```GOGS_VERSION``` template parameter: ``` oc new-app -f http://bit.ly/openshift-gogs-template --param=HOSTNAME=gogs-demo.yourdomain.com --param=GOGS_VERSION=0.11.4 ``` -# Admin User -After Gogs deployment, the first registered user will be admin. The default administrator can log into Admin > Users and authorize another user. A user will also be an > administrator if they register in the install page. Read more on [Gogs FAQ](https://gogs.io/docs/intro/faqs#how-can-i-become-an-administrator%3F) \ No newline at end of file +# Gogs Admin User +After Gogs deployment, the first registered user will be admin. The default administrator can log into Admin > Users and authorize another user. A user will also be an > administrator if they register in the install page. Read more on [Gogs FAQ](https://gogs.io/docs/intro/faqs#how-can-i-become-an-administrator%3F) + + + From e7a434ced89b5df4a634694f43e74f05542d58ae Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Wed, 20 Sep 2017 18:13:01 +0200 Subject: [PATCH 10/17] added template for embedded SQLite db --- openshift/gogs-nodb-template.yaml | 223 ++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 openshift/gogs-nodb-template.yaml diff --git a/openshift/gogs-nodb-template.yaml b/openshift/gogs-nodb-template.yaml new file mode 100644 index 0000000..2a2238f --- /dev/null +++ b/openshift/gogs-nodb-template.yaml @@ -0,0 +1,223 @@ +kind: Template +apiVersion: v1 +metadata: + annotations: + description: The Gogs git server (https://gogs.io/) + tags: instant-app,gogs,go,golang + name: gogs +objects: +- kind: ServiceAccount + apiVersion: v1 + metadata: + labels: + app: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} +- kind: Service + apiVersion: v1 + metadata: + annotations: + description: The Gogs server's http port + labels: + app: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + spec: + ports: + - name: 3000-tcp + port: 3000 + protocol: TCP + targetPort: 3000 + selector: + app: ${APPLICATION_NAME} + deploymentconfig: ${APPLICATION_NAME} + sessionAffinity: None + type: ClusterIP + status: + loadBalancer: {} +- kind: Route + apiVersion: v1 + id: ${APPLICATION_NAME}-http + metadata: + annotations: + description: Route for application's http service. + labels: + app: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + spec: + host: ${HOSTNAME} + to: + name: ${APPLICATION_NAME} +- kind: DeploymentConfig + apiVersion: v1 + metadata: + labels: + app: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + spec: + replicas: 1 + selector: + app: ${APPLICATION_NAME} + deploymentconfig: ${APPLICATION_NAME} + strategy: + resources: {} + rollingParams: + intervalSeconds: 1 + maxSurge: 25% + maxUnavailable: 25% + timeoutSeconds: 600 + updatePeriodSeconds: 1 + type: Rolling + template: + metadata: + labels: + app: ${APPLICATION_NAME} + deploymentconfig: ${APPLICATION_NAME} + spec: + serviceAccountName: ${APPLICATION_NAME} + containers: + - image: " " + imagePullPolicy: Always + name: ${APPLICATION_NAME} + ports: + - containerPort: 3000 + protocol: TCP + resources: {} + terminationMessagePath: /dev/termination-log + volumeMounts: + - name: gogs-data + mountPath: /opt/gogs/data + - name: gogs-config + mountPath: /opt/gogs/custom/conf + readinessProbe: + httpGet: + path: / + port: 3000 + scheme: HTTP + initialDelaySeconds: 3 + timeoutSeconds: 1 + periodSeconds: 20 + successThreshold: 1 + failureThreshold: 3 + livenessProbe: + httpGet: + path: / + port: 3000 + scheme: HTTP + initialDelaySeconds: 3 + timeoutSeconds: 1 + periodSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + dnsPolicy: ClusterFirst + restartPolicy: Always + securityContext: {} + terminationGracePeriodSeconds: 30 + volumes: + - name: gogs-data + persistentVolumeClaim: + claimName: gogs-data + - name: gogs-config + configMap: + name: gogs-config + items: + - key: app.ini + path: app.ini + test: false + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - ${APPLICATION_NAME} + from: + kind: ImageStreamTag + name: ${APPLICATION_NAME}:${GOGS_VERSION} + type: ImageChange +- kind: ImageStream + apiVersion: v1 + metadata: + labels: + app: ${APPLICATION_NAME} + name: ${APPLICATION_NAME} + spec: + tags: + - name: "${GOGS_VERSION}" + from: + kind: DockerImage + name: docker.io/openshiftdemos/gogs:${GOGS_VERSION} + importPolicy: {} + annotations: + description: The Gogs git server docker image + tags: gogs,go,golang + version: "${GOGS_VERSION}" +- kind: PersistentVolumeClaim + apiVersion: v1 + metadata: + name: gogs-data + labels: + app: ${APPLICATION_NAME} + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: ${GOGS_VOLUME_CAPACITY} +- kind: ConfigMap + apiVersion: v1 + metadata: + name: gogs-config + labels: + app: ${APPLICATION_NAME} + data: + app.ini: | + RUN_MODE = prod + RUN_USER = gogs + + [database] + DB_TYPE = sqlite3 + HOST = 127.0.0.1:3306 + NAME = gogs + USER = root + PASSWD = + SSL_MODE = disable + PATH = /opt/gogs/data/gogs.db + + [repository] + ROOT = /opt/gogs/data/repositories + + [server] + ROOT_URL=http://${HOSTNAME} + SSH_DOMAIN=${HOSTNAME} + + [security] + INSTALL_LOCK = ${INSTALL_LOCK} + + [service] + ENABLE_CAPTCHA = false + + [webhook] + SKIP_TLS_VERIFY = ${SKIP_TLS_VERIFY} +parameters: +- description: The name for the application. + name: APPLICATION_NAME + required: true + value: gogs +- description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' + name: HOSTNAME + required: true +- description: Volume space available for data, e.g. 512Mi, 2Gi + name: GOGS_VOLUME_CAPACITY + required: true + value: 1Gi +- name: GOGS_VERSION + displayName: Gogs Version + description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags, currently only 0.11.29 supports SQLite)' + value: "0.11.29" + required: true +- name: INSTALL_LOCK + displayName: Installation lock + description: 'If set to true, installation (/install) page will be disabled. Set to false if you want to run the installation wizard via web' + value: "true" +- name: SKIP_TLS_VERIFY + displayName: Skip TLS verification on webhooks + description: Skip TLS verification on webhooks. Enable with caution! + value: "false" From b8b3edd55cabc0c8ac644b2a37c24ca9f813cbb0 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Wed, 20 Sep 2017 18:12:20 +0200 Subject: [PATCH 11/17] added app label --- openshift/gogs-persistent-template.yaml | 10 ++++++++++ openshift/gogs-template.yaml | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index 9def854..da75832 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -19,6 +19,8 @@ objects: annotations: description: Exposes the database server name: ${APPLICATION_NAME}-postgresql + labels: + app: ${APPLICATION_NAME} spec: ports: - name: postgresql @@ -32,6 +34,8 @@ objects: annotations: description: Defines how to deploy the database name: ${APPLICATION_NAME}-postgresql + labels: + app: ${APPLICATION_NAME} spec: replicas: 1 selector: @@ -241,6 +245,8 @@ objects: apiVersion: v1 metadata: name: gogs-data + labels: + app: ${APPLICATION_NAME} spec: accessModes: - ReadWriteOnce @@ -251,6 +257,8 @@ objects: apiVersion: v1 metadata: name: gogs-postgres-data + labels: + app: ${APPLICATION_NAME} spec: accessModes: - ReadWriteOnce @@ -261,6 +269,8 @@ objects: apiVersion: v1 metadata: name: gogs-config + labels: + app: ${APPLICATION_NAME} data: app.ini: | RUN_MODE = prod diff --git a/openshift/gogs-template.yaml b/openshift/gogs-template.yaml index 67971df..9a3b288 100644 --- a/openshift/gogs-template.yaml +++ b/openshift/gogs-template.yaml @@ -32,6 +32,8 @@ objects: annotations: description: Defines how to deploy the database name: ${APPLICATION_NAME}-postgresql + labels: + app: ${APPLICATION_NAME} spec: replicas: 1 selector: @@ -239,6 +241,8 @@ objects: apiVersion: v1 metadata: name: gogs-config + labels: + app: ${APPLICATION_NAME} data: app.ini: | RUN_MODE = prod From 45f72e0996abc6e318fa48d89375774908446f8f Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Wed, 8 Nov 2017 16:16:36 +0100 Subject: [PATCH 12/17] updated gogs tag in nodb template --- openshift/gogs-nodb-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openshift/gogs-nodb-template.yaml b/openshift/gogs-nodb-template.yaml index 2a2238f..68761d1 100644 --- a/openshift/gogs-nodb-template.yaml +++ b/openshift/gogs-nodb-template.yaml @@ -211,7 +211,7 @@ parameters: - name: GOGS_VERSION displayName: Gogs Version description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags, currently only 0.11.29 supports SQLite)' - value: "0.11.29" + value: "0.11.29-sqlite" required: true - name: INSTALL_LOCK displayName: Installation lock From e7ae04a24547ec07c92685ba424f429552f250ac Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Wed, 8 Nov 2017 16:17:38 +0100 Subject: [PATCH 13/17] updated dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a42a52f..6e03405 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,8 @@ ENV HOME=/var/lib/gogs COPY ./root / -RUN rpm --import https://rpm.packager.io/key && \ +RUN curl -L -o /etc/yum.repos.d/gogs.repo https://dl.packager.io/srv/pkgr/gogs/pkgr/installer/el/7.repo && \ + rpm --import https://rpm.packager.io/key && \ yum -y install epel-release && \ yum -y --setopt=tsflags=nodocs install gogs-${GOGS_VERSION} nss_wrapper gettext && \ yum -y clean all && \ From 05eb313de81735158b4bc0e9a5ef2458e3e0b75e Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Wed, 8 Nov 2017 18:03:22 +0100 Subject: [PATCH 14/17] removed nodb template --- openshift/gogs-nodb-template.yaml | 223 ------------------------------ 1 file changed, 223 deletions(-) delete mode 100644 openshift/gogs-nodb-template.yaml diff --git a/openshift/gogs-nodb-template.yaml b/openshift/gogs-nodb-template.yaml deleted file mode 100644 index 68761d1..0000000 --- a/openshift/gogs-nodb-template.yaml +++ /dev/null @@ -1,223 +0,0 @@ -kind: Template -apiVersion: v1 -metadata: - annotations: - description: The Gogs git server (https://gogs.io/) - tags: instant-app,gogs,go,golang - name: gogs -objects: -- kind: ServiceAccount - apiVersion: v1 - metadata: - labels: - app: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} -- kind: Service - apiVersion: v1 - metadata: - annotations: - description: The Gogs server's http port - labels: - app: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - spec: - ports: - - name: 3000-tcp - port: 3000 - protocol: TCP - targetPort: 3000 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} -- kind: Route - apiVersion: v1 - id: ${APPLICATION_NAME}-http - metadata: - annotations: - description: Route for application's http service. - labels: - app: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - spec: - host: ${HOSTNAME} - to: - name: ${APPLICATION_NAME} -- kind: DeploymentConfig - apiVersion: v1 - metadata: - labels: - app: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - spec: - replicas: 1 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - strategy: - resources: {} - rollingParams: - intervalSeconds: 1 - maxSurge: 25% - maxUnavailable: 25% - timeoutSeconds: 600 - updatePeriodSeconds: 1 - type: Rolling - template: - metadata: - labels: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - spec: - serviceAccountName: ${APPLICATION_NAME} - containers: - - image: " " - imagePullPolicy: Always - name: ${APPLICATION_NAME} - ports: - - containerPort: 3000 - protocol: TCP - resources: {} - terminationMessagePath: /dev/termination-log - volumeMounts: - - name: gogs-data - mountPath: /opt/gogs/data - - name: gogs-config - mountPath: /opt/gogs/custom/conf - readinessProbe: - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 3 - timeoutSeconds: 1 - periodSeconds: 20 - successThreshold: 1 - failureThreshold: 3 - livenessProbe: - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 3 - timeoutSeconds: 1 - periodSeconds: 10 - successThreshold: 1 - failureThreshold: 3 - dnsPolicy: ClusterFirst - restartPolicy: Always - securityContext: {} - terminationGracePeriodSeconds: 30 - volumes: - - name: gogs-data - persistentVolumeClaim: - claimName: gogs-data - - name: gogs-config - configMap: - name: gogs-config - items: - - key: app.ini - path: app.ini - test: false - triggers: - - type: ConfigChange - - imageChangeParams: - automatic: true - containerNames: - - ${APPLICATION_NAME} - from: - kind: ImageStreamTag - name: ${APPLICATION_NAME}:${GOGS_VERSION} - type: ImageChange -- kind: ImageStream - apiVersion: v1 - metadata: - labels: - app: ${APPLICATION_NAME} - name: ${APPLICATION_NAME} - spec: - tags: - - name: "${GOGS_VERSION}" - from: - kind: DockerImage - name: docker.io/openshiftdemos/gogs:${GOGS_VERSION} - importPolicy: {} - annotations: - description: The Gogs git server docker image - tags: gogs,go,golang - version: "${GOGS_VERSION}" -- kind: PersistentVolumeClaim - apiVersion: v1 - metadata: - name: gogs-data - labels: - app: ${APPLICATION_NAME} - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: ${GOGS_VOLUME_CAPACITY} -- kind: ConfigMap - apiVersion: v1 - metadata: - name: gogs-config - labels: - app: ${APPLICATION_NAME} - data: - app.ini: | - RUN_MODE = prod - RUN_USER = gogs - - [database] - DB_TYPE = sqlite3 - HOST = 127.0.0.1:3306 - NAME = gogs - USER = root - PASSWD = - SSL_MODE = disable - PATH = /opt/gogs/data/gogs.db - - [repository] - ROOT = /opt/gogs/data/repositories - - [server] - ROOT_URL=http://${HOSTNAME} - SSH_DOMAIN=${HOSTNAME} - - [security] - INSTALL_LOCK = ${INSTALL_LOCK} - - [service] - ENABLE_CAPTCHA = false - - [webhook] - SKIP_TLS_VERIFY = ${SKIP_TLS_VERIFY} -parameters: -- description: The name for the application. - name: APPLICATION_NAME - required: true - value: gogs -- description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: -.' - name: HOSTNAME - required: true -- description: Volume space available for data, e.g. 512Mi, 2Gi - name: GOGS_VOLUME_CAPACITY - required: true - value: 1Gi -- name: GOGS_VERSION - displayName: Gogs Version - description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags, currently only 0.11.29 supports SQLite)' - value: "0.11.29-sqlite" - required: true -- name: INSTALL_LOCK - displayName: Installation lock - description: 'If set to true, installation (/install) page will be disabled. Set to false if you want to run the installation wizard via web' - value: "true" -- name: SKIP_TLS_VERIFY - displayName: Skip TLS verification on webhooks - description: Skip TLS verification on webhooks. Enable with caution! - value: "false" From 4c4ea7ecd4ea79893ae5ef15f806faeb49d7d5c3 Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Thu, 8 Feb 2018 11:59:11 +0100 Subject: [PATCH 15/17] adjusted readiness and liveness probes --- openshift/gogs-persistent-template.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index da75832..c870e08 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -69,6 +69,8 @@ objects: tcpSocket: port: 5432 timeoutSeconds: 1 + failureThreshold: 10 + periodSeconds: 20 name: postgresql ports: - containerPort: 5432 @@ -81,6 +83,7 @@ objects: - psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1' initialDelaySeconds: 5 timeoutSeconds: 1 + failureThreshold: 10 resources: limits: memory: 512Mi @@ -188,17 +191,17 @@ objects: timeoutSeconds: 1 periodSeconds: 20 successThreshold: 1 - failureThreshold: 3 + failureThreshold: 10 livenessProbe: httpGet: path: / port: 3000 scheme: HTTP - initialDelaySeconds: 3 + initialDelaySeconds: 20 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 - failureThreshold: 3 + failureThreshold: 10 dnsPolicy: ClusterFirst restartPolicy: Always securityContext: {} From 8f54ac27245a33b6a646ff25ecbd2238104e30b7 Mon Sep 17 00:00:00 2001 From: Jorge Morales Pou Date: Tue, 30 Jul 2019 18:39:09 +0200 Subject: [PATCH 16/17] Updating readiness and liveness probes initialDelay for slow platforms --- openshift/gogs-persistent-template.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index c870e08..c437869 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -81,7 +81,7 @@ objects: - -i - -c - psql -h 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE} -c 'SELECT 1' - initialDelaySeconds: 5 + initialDelaySeconds: 30 timeoutSeconds: 1 failureThreshold: 10 resources: @@ -187,7 +187,7 @@ objects: path: / port: 3000 scheme: HTTP - initialDelaySeconds: 3 + initialDelaySeconds: 40 timeoutSeconds: 1 periodSeconds: 20 successThreshold: 1 @@ -197,7 +197,7 @@ objects: path: / port: 3000 scheme: HTTP - initialDelaySeconds: 20 + initialDelaySeconds: 40 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 From 30b0fc78dd1f982e64ac97daee7d6eb9dff7122f Mon Sep 17 00:00:00 2001 From: Siamak Sadeghianfar Date: Thu, 10 Oct 2019 08:37:05 -0400 Subject: [PATCH 17/17] parameterized psql version for ocp 4 --- openshift/gogs-persistent-template.yaml | 5 +++- openshift/gogs-template.yaml | 37 +++++++++++++++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/openshift/gogs-persistent-template.yaml b/openshift/gogs-persistent-template.yaml index c870e08..01a234a 100644 --- a/openshift/gogs-persistent-template.yaml +++ b/openshift/gogs-persistent-template.yaml @@ -101,7 +101,7 @@ objects: - postgresql from: kind: ImageStreamTag - name: postgresql:9.5 + name: postgresql:${DATABASE_VERSION} namespace: openshift type: ImageChange - type: ConfigChange @@ -338,6 +338,9 @@ parameters: - displayName: Shared Buffer Amount name: DATABASE_SHARED_BUFFERS value: 12MB +- displayName: Database version (PostgreSQL) + name: DATABASE_VERSION + value: "9.5" - name: GOGS_VERSION displayName: Gogs Version description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags)' diff --git a/openshift/gogs-template.yaml b/openshift/gogs-template.yaml index 9a3b288..929ef97 100644 --- a/openshift/gogs-template.yaml +++ b/openshift/gogs-template.yaml @@ -9,7 +9,6 @@ objects: - kind: ServiceAccount apiVersion: v1 metadata: - creationTimestamp: null labels: app: ${APPLICATION_NAME} name: ${APPLICATION_NAME} @@ -95,7 +94,7 @@ objects: - postgresql from: kind: ImageStreamTag - name: postgresql:9.5 + name: postgresql:${DATABASE_VERSION} namespace: openshift type: ImageChange - type: ConfigChange @@ -114,13 +113,15 @@ objects: port: 3000 protocol: TCP targetPort: 3000 + - name: 10022-tcp + port: 10022 + protocol: TCP + targetPort: 10022 selector: app: ${APPLICATION_NAME} deploymentconfig: ${APPLICATION_NAME} sessionAffinity: None type: ClusterIP - status: - loadBalancer: {} - kind: Route apiVersion: v1 id: ${APPLICATION_NAME}-http @@ -132,6 +133,23 @@ objects: name: ${APPLICATION_NAME} spec: host: ${HOSTNAME} + port: + targetPort: 3000-tcp + to: + name: ${APPLICATION_NAME} +- kind: Route + apiVersion: v1 + id: ${APPLICATION_NAME}-ssh + metadata: + annotations: + description: Route for application's ssh service. + labels: + app: ${APPLICATION_NAME} + name: ${APPLICATION_NAME}-ssh + spec: + host: secure${HOSTNAME} + port: + targetPort: 10022-tcp to: name: ${APPLICATION_NAME} - kind: DeploymentConfig @@ -169,6 +187,8 @@ objects: ports: - containerPort: 3000 protocol: TCP + - containerPort: 10022 + protocol: TCP resources: {} terminationMessagePath: /dev/termination-log volumeMounts: @@ -260,7 +280,9 @@ objects: [server] ROOT_URL=http://${HOSTNAME} - SSH_DOMAIN=${HOSTNAME} + SSH_DOMAIN=secure${HOSTNAME} + START_SSH_SERVER=true + SSH_LISTEN_PORT=10022 [security] INSTALL_LOCK = ${INSTALL_LOCK} @@ -299,10 +321,13 @@ parameters: - displayName: Shared Buffer Amount name: DATABASE_SHARED_BUFFERS value: 12MB +- displayName: Database version (PostgreSQL) + name: DATABASE_VERSION + value: "9.5" - name: GOGS_VERSION displayName: Gogs Version description: 'Version of the Gogs container image to be used (check the available version https://hub.docker.com/r/openshiftdemos/gogs/tags)' - value: "0.9.97" + value: "0.11.34" required: true - name: INSTALL_LOCK displayName: Installation lock