[virttools-web PATCH 0/3] Switch www.virt-tools.org over to use GitLab Pages

This introduces use of GitLab CI + Pages to replace the current OpenShift application which is only admin accessible by myself. It also has automatic integration with LetsEncrypt guaranteeing that we'll never have expired certificates. Daniel P. Berrangé (3): Convert README to markdown format Introduce use of GitLab CI for publishing to GitLab Pages Remove obsolete openshift hosting configuration .gitlab-ci.yml | 9 + README | 19 -- README.md | 15 ++ openshift/templates/.gitignore | 2 - openshift/templates/update-tls.sh | 16 -- openshift/templates/virttools-web-tls.json | 82 ------- openshift/templates/virttools-web.json | 272 --------------------- {web => public}/header-bg.png | Bin {web => public}/index.css | 0 {web => public}/index.html | 4 +- {web => public}/logo-kvm.png | Bin {web => public}/logo-libguestfs.png | Bin {web => public}/logo-libosinfo.png | Bin {web => public}/logo-libvirt.png | Bin {web => public}/logo-qemu.png | Bin {web => public}/logo-virt-manager.png | Bin {web => public}/logo.png | Bin {web => public}/logo.xcf | Bin 18 files changed, 25 insertions(+), 394 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 README create mode 100644 README.md delete mode 100644 openshift/templates/.gitignore delete mode 100755 openshift/templates/update-tls.sh delete mode 100644 openshift/templates/virttools-web-tls.json delete mode 100644 openshift/templates/virttools-web.json rename {web => public}/header-bg.png (100%) rename {web => public}/index.css (100%) rename {web => public}/index.html (93%) rename {web => public}/logo-kvm.png (100%) rename {web => public}/logo-libguestfs.png (100%) rename {web => public}/logo-libosinfo.png (100%) rename {web => public}/logo-libvirt.png (100%) rename {web => public}/logo-qemu.png (100%) rename {web => public}/logo-virt-manager.png (100%) rename {web => public}/logo.png (100%) rename {web => public}/logo.xcf (100%) -- 2.24.1

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- README | 19 ------------------- README.md | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 19 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 9126ab1..0000000 --- a/README +++ /dev/null @@ -1,19 +0,0 @@ - Virt Tools static site - ====================== - -This directory contains content / configuration for managing - - http(s)://virttools.org - http(s)://virt-tools.org - http(s)://www.virttools.org - http(s)://www.virt-tools.org - -The site is setup to run under OpenShift - -Initial load can be done with - - oc process -f virttools-web/openshift/templates/virttools-web.json | oc create -f - - -Updates to the OpenShift config are manually activated using 'oc replace'. - -Updates to the content itself are automatically propagated via a web hook. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b7a60d --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +Virt Tools static site +====================== + +This directory contains content / configuration for managing + +* [https://virttools.org](https://virttools.org) +* [https://virt-tools.org](https://virt-tools.org) +* [https://www.virttools.org](https://www.virttools.org) +* [https://www.virt-tools.org](https://www.virt-tools.org) + +The site is setup to run under OpenShift + +Initial load can be done with + +``` + oc process -f virttools-web/openshift/templates/virttools-web.json | oc create -f - +``` + +Updates to the OpenShift config are manually activated using `oc replace`. + +Updates to the content itself are automatically propagated via a web hook. -- 2.24.1

To publish to GitLab pages, all that is required is to provide a CI job that creates files in a directory called "public" and list that as an artifact. When the CI job completes, the website is immediately available at the URL https://username.gitlab.io/reponame. This makes it much easier to preview changes to the site than with OpenShift apps. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- .gitlab-ci.yml | 9 +++++++++ README.md | 14 ++++---------- {web => public}/header-bg.png | Bin {web => public}/index.css | 0 {web => public}/index.html | 4 +--- {web => public}/logo-kvm.png | Bin {web => public}/logo-libguestfs.png | Bin {web => public}/logo-libosinfo.png | Bin {web => public}/logo-libvirt.png | Bin {web => public}/logo-qemu.png | Bin {web => public}/logo-virt-manager.png | Bin {web => public}/logo.png | Bin {web => public}/logo.xcf | Bin 13 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 .gitlab-ci.yml rename {web => public}/header-bg.png (100%) rename {web => public}/index.css (100%) rename {web => public}/index.html (93%) rename {web => public}/logo-kvm.png (100%) rename {web => public}/logo-libguestfs.png (100%) rename {web => public}/logo-libosinfo.png (100%) rename {web => public}/logo-libvirt.png (100%) rename {web => public}/logo-qemu.png (100%) rename {web => public}/logo-virt-manager.png (100%) rename {web => public}/logo.png (100%) rename {web => public}/logo.xcf (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..5613e31 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,9 @@ + +image: centos:8 + +pages: + script: + - /bin/true + artifacts: + paths: + - public diff --git a/README.md b/README.md index 5b7a60d..a0c5a5e 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,8 @@ This directory contains content / configuration for managing * [https://www.virttools.org](https://www.virttools.org) * [https://www.virt-tools.org](https://www.virt-tools.org) -The site is setup to run under OpenShift +The site is intended to be published with GitLab Pages -Initial load can be done with - -``` - oc process -f virttools-web/openshift/templates/virttools-web.json | oc create -f - -``` - -Updates to the OpenShift config are manually activated using `oc replace`. - -Updates to the content itself are automatically propagated via a web hook. +Upon pushing changes to the GitLab repository, CI rules will automatically +build the site and publish the result to the repository's GitLab Pages +site. diff --git a/web/header-bg.png b/public/header-bg.png similarity index 100% rename from web/header-bg.png rename to public/header-bg.png diff --git a/web/index.css b/public/index.css similarity index 100% rename from web/index.css rename to public/index.css diff --git a/web/index.html b/public/index.html similarity index 93% rename from web/index.html rename to public/index.html index 3fb6f48..d801c48 100644 --- a/web/index.html +++ b/public/index.html @@ -92,9 +92,7 @@ <div id="footer"> - <a href="https://www.openshift.com/" title="Powered by OpenShift Online"> - <img alt="Powered by OpenShift Online" src="https://www.openshift.com/images/logos/powered_by_openshift_reverse.png"> - </a> + <a href="https://gitlab.com/libvirt/virttools-web/-/blob/master/public/index.html" title="Edit this page">Edit this page</a> </div> </body> </html> diff --git a/web/logo-kvm.png b/public/logo-kvm.png similarity index 100% rename from web/logo-kvm.png rename to public/logo-kvm.png diff --git a/web/logo-libguestfs.png b/public/logo-libguestfs.png similarity index 100% rename from web/logo-libguestfs.png rename to public/logo-libguestfs.png diff --git a/web/logo-libosinfo.png b/public/logo-libosinfo.png similarity index 100% rename from web/logo-libosinfo.png rename to public/logo-libosinfo.png diff --git a/web/logo-libvirt.png b/public/logo-libvirt.png similarity index 100% rename from web/logo-libvirt.png rename to public/logo-libvirt.png diff --git a/web/logo-qemu.png b/public/logo-qemu.png similarity index 100% rename from web/logo-qemu.png rename to public/logo-qemu.png diff --git a/web/logo-virt-manager.png b/public/logo-virt-manager.png similarity index 100% rename from web/logo-virt-manager.png rename to public/logo-virt-manager.png diff --git a/web/logo.png b/public/logo.png similarity index 100% rename from web/logo.png rename to public/logo.png diff --git a/web/logo.xcf b/public/logo.xcf similarity index 100% rename from web/logo.xcf rename to public/logo.xcf -- 2.24.1

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- openshift/templates/.gitignore | 2 - openshift/templates/update-tls.sh | 16 -- openshift/templates/virttools-web-tls.json | 82 ------- openshift/templates/virttools-web.json | 272 --------------------- 4 files changed, 372 deletions(-) delete mode 100644 openshift/templates/.gitignore delete mode 100755 openshift/templates/update-tls.sh delete mode 100644 openshift/templates/virttools-web-tls.json delete mode 100644 openshift/templates/virttools-web.json diff --git a/openshift/templates/.gitignore b/openshift/templates/.gitignore deleted file mode 100644 index 199c6e6..0000000 --- a/openshift/templates/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -tls-cert.pem -tls-key.pem diff --git a/openshift/templates/update-tls.sh b/openshift/templates/update-tls.sh deleted file mode 100755 index 9b62697..0000000 --- a/openshift/templates/update-tls.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -function die() { - echo $* - exit 1 -} - -test -f "tls-cert.pem" || die "Missing tls-cert.pem" -test -f "tls-key.pem" || die "Missing tls-key.pem" - -TLS_CERT=`cat tls-cert.pem` -TLS_KEY=`cat tls-key.pem` - -oc process -f virttools-web-tls.json | oc delete -f - -oc process -p TLS_CERT="$TLS_CERT" -p TLS_KEY="$TLS_KEY" -f virttools-web-tls.json | oc create -f - - diff --git a/openshift/templates/virttools-web-tls.json b/openshift/templates/virttools-web-tls.json deleted file mode 100644 index b7d1d33..0000000 --- a/openshift/templates/virttools-web-tls.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "apiVersion": "v1", - "kind": "Template", - "labels": { - "app": "virttools-web", - "template": "virttools-web" - }, - "message": "The following service(s) have been created in your project: ${NAME}.\n", - "metadata": { - "name": "virtttools-web", - "annotations": { - "openshift.io/display-name": "Virt Tools", - "description": "Static web for virt-tools.org", - "tags": "quickstart,httpd", - "iconClass": "icon-apache", - "openshift.io/long-description": "Template for virttools.org static web content", - "openshift.io/provider-display-name": "Libvirt", - "template.openshift.io/bindable": "false" - } - }, - "objects": [ - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "www.virt-tools.org" - }, - "spec": { - "host": "www.virt-tools.org", - "to": { - "kind": "Service", - "name": "${NAME}" - }, - "tls": { - "termination": "edge", - "insecureEdgeTerminationPolicy": "Redirect", - "key": "${TLS_KEY}", - "certificate": "${TLS_CERT}" - } - } - }, - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "www.virttools.org" - }, - "spec": { - "host": "www.virttools.org", - "to": { - "kind": "Service", - "name": "${NAME}" - }, - "tls": { - "termination": "edge", - "insecureEdgeTerminationPolicy": "Redirect", - "key": "${TLS_KEY}", - "certificate": "${TLS_CERT}" - } - } - } - ], - "parameters": [ - { - "name": "NAME", - "displayName": "Name", - "description": "The name assigned to all of the frontend objects defined in this template.", - "required": true, - "value": "virttools-web" - }, - { - "name": "TLS_KEY", - "displayName": "TLS key for public routes", - "description": "TLS key for public routes" - }, - { - "name": "TLS_CERT", - "displayName": "TLS cert for public routes", - "description": "TLS cert for public routes" - } - ] -} diff --git a/openshift/templates/virttools-web.json b/openshift/templates/virttools-web.json deleted file mode 100644 index 0e60a44..0000000 --- a/openshift/templates/virttools-web.json +++ /dev/null @@ -1,272 +0,0 @@ -{ - "apiVersion": "v1", - "kind": "Template", - "labels": { - "app": "virttools-web", - "template": "virttools-web" - }, - "message": "The following service(s) have been created in your project: ${NAME}.\n", - "metadata": { - "name": "virtttools-web", - "annotations": { - "openshift.io/display-name": "Virt Tools", - "description": "Static web for virt-tools.org", - "tags": "quickstart,httpd", - "iconClass": "icon-apache", - "openshift.io/long-description": "Template for virttools.org static web content", - "openshift.io/provider-display-name": "Libvirt", - "template.openshift.io/bindable": "false" - } - }, - "objects": [ - { - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Exposes and load balances the application pods" - } - }, - "spec": { - "ports": [ - { - "name": "web", - "port": 8080, - "targetPort": 8080 - } - ], - "selector": { - "name": "${NAME}" - } - } - }, - { - "kind": "Route", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}" - }, - "spec": { - "host": "${APPLICATION_DOMAIN}", - "to": { - "kind": "Service", - "name": "${NAME}" - }, - "tls": { - "termination": "edge", - "insecureEdgeTerminationPolicy": "Allow" - } - } - }, - { - "kind": "ImageStream", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Keeps track of changes in the application image" - } - } - }, - { - "kind": "BuildConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to build the application", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "source": { - "type": "Git", - "git": { - "uri": "${SOURCE_REPOSITORY_URL}", - "ref": "${SOURCE_REPOSITORY_REF}" - }, - "contextDir": "${CONTEXT_DIR}" - }, - "strategy": { - "type": "Source", - "sourceStrategy": { - "from": { - "kind": "DockerImage", - "name": "centos/httpd-24-centos7:latest" - } - } - }, - "output": { - "to": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - }, - "triggers": [ - { - "type": "ImageChange" - }, - { - "type": "ConfigChange" - }, - { - "type": "GitHub", - "github": { - "secret": "${GITHUB_WEBHOOK_SECRET}" - } - }, - { - "type": "Generic", - "generic": { - "secret": "${GENERIC_WEBHOOK_SECRET}" - } - } - ] - } - }, - { - "kind": "DeploymentConfig", - "apiVersion": "v1", - "metadata": { - "name": "${NAME}", - "annotations": { - "description": "Defines how to deploy the application server", - "template.alpha.openshift.io/wait-for-ready": "true" - } - }, - "spec": { - "strategy": { - "type": "Rolling" - }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "virttools-web" - ], - "from": { - "kind": "ImageStreamTag", - "name": "${NAME}:latest" - } - } - }, - { - "type": "ConfigChange" - } - ], - "replicas": 1, - "selector": { - "name": "${NAME}" - }, - "template": { - "metadata": { - "name": "${NAME}", - "labels": { - "name": "${NAME}" - } - }, - "spec": { - "containers": [ - { - "name": "virttools-web", - "image": " ", - "ports": [ - { - "containerPort": 8080 - } - ], - "readinessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 3, - "httpGet": { - "path": "/", - "port": 8080 - } - }, - "livenessProbe": { - "timeoutSeconds": 3, - "initialDelaySeconds": 30, - "httpGet": { - "path": "/", - "port": 8080 - } - }, - "resources": { - "limits": { - "memory": "${MEMORY_LIMIT}" - } - }, - "env": [ - ] - } - ] - } - } - } - } - ], - "parameters": [ - { - "name": "NAME", - "displayName": "Name", - "description": "The name assigned to all of the frontend objects defined in this template.", - "required": true, - "value": "virttools-web" - }, - { - "name": "NAMESPACE", - "displayName": "Namespace", - "description": "The OpenShift Namespace where the ImageStream resides.", - "required": true, - "value": "openshift" - }, - { - "name": "MEMORY_LIMIT", - "displayName": "Memory Limit", - "description": "Maximum amount of memory the container can use.", - "required": true, - "value": "512Mi" - }, - { - "name": "SOURCE_REPOSITORY_URL", - "displayName": "Git Repository URL", - "description": "The URL of the repository with your application source code.", - "required": true, - "value": "git://libvirt.org/virttools-web.git" - }, - { - "name": "SOURCE_REPOSITORY_REF", - "displayName": "Git Reference", - "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch." - }, - { - "name": "CONTEXT_DIR", - "displayName": "Context Directory", - "description": "Set this to the relative path to your project if it is not in the root of your repository.", - "value": "web" - }, - { - "name": "APPLICATION_DOMAIN", - "displayName": "Application Hostname", - "description": "The exposed hostname that will route to the httpd service, if left blank a value will be defaulted.", - "value": "" - }, - { - "name": "GITHUB_WEBHOOK_SECRET", - "displayName": "GitHub Webhook Secret", - "description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - }, - { - "name": "GENERIC_WEBHOOK_SECRET", - "displayName": "Generic Webhook Secret", - "description": "A secret string used to configure the Generic webhook.", - "generate": "expression", - "from": "[a-zA-Z0-9]{40}" - } - ] -} -- 2.24.1

On Tue, 2020-03-31 at 11:21 +0100, Daniel P. Berrangé wrote:
This introduces use of GitLab CI + Pages to replace the current OpenShift application which is only admin accessible by myself. It also has automatic integration with LetsEncrypt guaranteeing that we'll never have expired certificates.
Daniel P. Berrangé (3): Convert README to markdown format Introduce use of GitLab CI for publishing to GitLab Pages Remove obsolete openshift hosting configuration
Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrangé