diff --git a/.s2i/bin/assemble b/.s2i/bin/assemble deleted file mode 100644 index d8945bb..0000000 --- a/.s2i/bin/assemble +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -e -# -# S2I assemble script for the 's2i-caddy' image. -# The 'assemble' script builds your application source so that it is ready to run. -# -# For more information refer to the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -if [[ "$1" == "-h" ]]; then - # If the 's2i-caddy' assemble script is executed with '-h' flag, - # print the usage. - exec /usr/libexec/s2i/usage -fi - -# Restore artifacts from the previous build (if they exist). -# -if [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring build artifacts..." - mv /tmp/artifacts/. ./ -fi - -echo "---> Copying repository content into place..." -echo "Contents of /tmp/src:" -find /tmp/src -print -cp -Rf /tmp/src/* /var/www/html - -# (through detective work, we discovered that additional source image content is placed in /tmp/build/inputs by s2i) -# the bit below allows additional content that originates from one or more additional source images to be added to the output image -if [ -d /tmp/build/inputs ]; then - echo "Additional image content found..." - echo "---> Copying additional image content into place..." - cp -Rf /tmp/build/inputs/* /var/www/html -else - echo "No additional image content found." -fi - -if [[ -e "/var/www/html/Caddyfile" ]]; then - echo "Replacing default Caddyfile..." - cat /var/www/html/Caddyfile > /etc/Caddyfile -else - echo "Using default Caddyfile." -fi \ No newline at end of file diff --git a/.s2i/bin/run b/.s2i/bin/run deleted file mode 100644 index fb70c05..0000000 --- a/.s2i/bin/run +++ /dev/null @@ -1,11 +0,0 @@ - -#!/bin/sh -e -# -# S2I run script for the 's2i-caddy' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -exec caddy -quic --conf /etc/Caddyfile \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index bd78a35..597d64f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ node('master') { // run the oc build to package the artifacts into a docker image openshiftBuild bldCfg: APP_NAME, showBuildLogs: 'true', verbose: 'true' - // openshiftBuild bldCfg: CADDY_BUILD_CONFIG, showBuildLogs: 'true', verbose: 'true' + openshiftBuild bldCfg: CADDY_BUILD_CONFIG, showBuildLogs: 'true', verbose: 'true' // Don't tag with BUILD_ID so the pruner can do it's job; it won't delete tagged images. // Tag the images for deployment based on the image's hash diff --git a/_in-practice-examples/aged-out.md b/_in-practice-examples/aged-out.md index fc4983d..dc6f1eb 100644 --- a/_in-practice-examples/aged-out.md +++ b/_in-practice-examples/aged-out.md @@ -7,7 +7,7 @@ example-of: Put your user and their needs at the centre of your design ### Impact -Agedout.com uses modern, interactive technology to guide users through “Quests.” As the youth proceed through the quests, they earn badges for their learning. Youth are then able to put the badges towards real life rewards, such as computers from Best Buy. \[Metrics forthcoming.\] This approach has the potential to expand to other Ministries, the Quests functionality and methodology being shared with partners in an example of gov-as-a-platform. +Agedout.com uses modern, interactive technology to guide users through “Quests.” As the youth proceed through the quests, they earn badges for their learning. Youth are then able to put the badges towards real life rewards, such as computers from Best Buy. \[Metrics forthcoming.\] This approach has the potential to expand to other Ministries, the Quests functionality and methodology being shared with partners in an example of gov-as-a-platform... ### Partners diff --git a/openshift/templates/README.md b/openshift/templates/README.md index 571bea0..c40ca58 100644 --- a/openshift/templates/README.md +++ b/openshift/templates/README.md @@ -1,6 +1,6 @@ ## Deployment Flow: -Update in the `develop` branch will trigger Jenkins pipeline: +Update in the `os-pages` branch will trigger Jenkins pipeline: 1. Checkout the source from Github 2. Build images: diff --git a/openshift/templates/digital-toolkit-build.json b/openshift/templates/digital-toolkit-build.json index 01b28a8..2f0b5ce 100644 --- a/openshift/templates/digital-toolkit-build.json +++ b/openshift/templates/digital-toolkit-build.json @@ -5,18 +5,15 @@ "name": "innovation-toolkit", "creationTimestamp": null }, - "labels": { - "template":"toolkit-jekyll" - }, "objects": [ { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { - "name": "${NAME}-jekyll${NAME_SUFFIX}", + "name": "innovation-toolkit", "creationTimestamp": null, "labels": { - "app": "${APP_NAME}" + "app": "innovation-toolkit" }, "annotations": { "openshift.io/generated-by": "OpenShiftNewApp" @@ -49,7 +46,7 @@ "type": "Git", "git": { "uri": "https://github.com/bcgov/digital-toolkit.git", - "ref": "develop" + "ref": "os-pages" } }, "strategy": { @@ -57,14 +54,14 @@ "dockerStrategy": { "from": { "kind": "ImageStreamTag", - "name": "ruby:2.3.0-alpine" + "name": "docker-registry.default.svc:5000/ocio-guides-tools/ruby:2.3.0-alpine" } } }, "output": { "to": { "kind": "ImageStreamTag", - "name": "${NAME}-jekyll${NAME_SUFFIX}:latest" + "name": "innovation-toolkit-jekyll:latest" } }, "resources": { @@ -88,11 +85,11 @@ "kind": "ImageStream", "apiVersion": "v1", "metadata": { - "name": "${NAME}", + "name": "innovation-toolkit-jekyll", "generation": 1, "creationTimestamp": null, "labels": { - "app": "${APP_NAME}" + "app": "innovation-toolkit" }, "annotations": { "openshift.io/generated-by": "OpenShiftNewApp" @@ -108,7 +105,7 @@ "annotations": null, "from": { "kind": "DockerImage", - "name": "172.50.0.2:5000/guides/innovation-toolkit:latest" + "name": "172.50.0.2:5000/ocio-guides-tools/innovation-toolkit-jekyll:latest" }, "generation": null, "importPolicy": {}, @@ -122,26 +119,5 @@ "dockerImageRepository": "" } } - ], - "parameters": [ - { - "name": "APP_NAME", - "displayName": "Name", - "description": "Application name used for grouping objects in the openshift console. You should keep this as default unless your know what your doing.", - "required": true, - "value": "innovation-toolkit" - },{ - "name": "NAME", - "displayName": "Name", - "description": "The name assigned to all of the objects defined in this template. You should keep this as default unless your know what your doing.", - "required": true, - "value": "innovation-toolkit" - },{ - "name": "NAME_SUFFIX", - "displayName": "Name", - "description": "The suffix for all created objects", - "required": false, - "value": "" - } ] -} +} \ No newline at end of file diff --git a/openshift/templates/digital-toolkit-caddy-build.json b/openshift/templates/digital-toolkit-caddy-build.json index cf97836..e8a1c73 100644 --- a/openshift/templates/digital-toolkit-caddy-build.json +++ b/openshift/templates/digital-toolkit-caddy-build.json @@ -47,16 +47,16 @@ "runPolicy": "Serial", "source": { "type": "Dockerfile", - "dockerfile": "FROM bcgov-s2i-caddy\nCOPY _site /var/www/html/", + "dockerfile": "FROM bcgov-s2i-caddy\nCOPY /toolkit/_site /var/www/html/", "images": [ { "from": { "kind": "ImageStreamTag", - "name": "${NAME}-jekyll${NAME_SUFFIX}:latest" + "name": "innovation-toolkit-jekyll:latest" }, "paths": [ { - "sourcePath": "/opt/app-root/src/_site", + "sourcePath": "/toolkit", "destinationDir": "./" } ] diff --git a/openshift/templates/digital-toolkit-deploy-prod.json b/openshift/templates/digital-toolkit-deploy-prod.json new file mode 100644 index 0000000..e8ef25d --- /dev/null +++ b/openshift/templates/digital-toolkit-deploy-prod.json @@ -0,0 +1,142 @@ +{ + "kind": "Template", + "apiVersion": "v1", + "metadata": { + "name": "innovation-toolkit-caddy", + "creationTimestamp": null + }, + "objects": [ + { + "kind": "DeploymentConfig", + "apiVersion": "v1", + "metadata": { + "name": "innovation-toolkit-caddy", + "generation": 1, + "creationTimestamp": null, + "labels": { + "app": "innovation-toolkit-caddy" + }, + "annotations": { + "openshift.io/generated-by": "OpenShiftWebConsole" + } + }, + "spec": { + "strategy": { + "type": "Rolling", + "rollingParams": { + "updatePeriodSeconds": 1, + "intervalSeconds": 1, + "timeoutSeconds": 600, + "maxUnavailable": "25%", + "maxSurge": "25%" + }, + "resources": {}, + "activeDeadlineSeconds": 21600 + }, + "triggers": [ + { + "type": "ConfigChange" + }, + { + "type": "ImageChange", + "imageChangeParams": { + "automatic": true, + "containerNames": [ + "innovation-toolkit-caddy" + ], + "from": { + "kind": "ImageStreamTag", + "namespace": "ocio-guides-tools", + "name": "innovation-toolkit-caddy:prod" + } + } + } + ], + "replicas": 1, + "test": false, + "selector": { + "app": "innovation-toolkit-caddy", + "deploymentconfig": "innovation-toolkit-caddy" + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app": "innovation-toolkit-caddy", + "deploymentconfig": "innovation-toolkit-caddy" + }, + "annotations": { + "openshift.io/generated-by": "OpenShiftWebConsole" + } + }, + "spec": { + "containers": [ + { + "name": "innovation-toolkit-caddy", + "image": "docker-registry.default.svc:5000/ocio-guides-tools/innovation-toolkit-caddy@sha256:b3cbedf2a2f40521a1dc94280f67a5d68635ce095f03f0b587b48b410919842b", + "args": [ + "/tmp/scripts/run" + ], + "ports": [ + { + "containerPort": 2015, + "protocol": "TCP" + } + ], + "resources": {}, + "terminationMessagePath": "/dev/termination-log", + "terminationMessagePolicy": "File", + "imagePullPolicy": "Always" + } + ], + "restartPolicy": "Always", + "terminationGracePeriodSeconds": 30, + "dnsPolicy": "ClusterFirst", + "securityContext": {}, + "schedulerName": "default-scheduler" + } + } + }, + "status": { + "latestVersion": 0, + "observedGeneration": 0, + "replicas": 0, + "updatedReplicas": 0, + "availableReplicas": 0, + "unavailableReplicas": 0 + } + }, + { + "kind": "Service", + "apiVersion": "v1", + "metadata": { + "name": "innovation-toolkit-caddy", + "creationTimestamp": null, + "labels": { + "app": "innovation-toolkit-caddy" + }, + "annotations": { + "openshift.io/generated-by": "OpenShiftWebConsole" + } + }, + "spec": { + "ports": [ + { + "name": "2015-tcp", + "protocol": "TCP", + "port": 2015, + "targetPort": 2015 + } + ], + "selector": { + "deploymentconfig": "innovation-toolkit-caddy" + }, + "type": "ClusterIP", + "sessionAffinity": "None" + }, + "status": { + "loadBalancer": {} + } + } + ] +} diff --git a/openshift/templates/digital-toolkit-deploy.json b/openshift/templates/digital-toolkit-deploy.json index e7ce507..eb9df44 100644 --- a/openshift/templates/digital-toolkit-deploy.json +++ b/openshift/templates/digital-toolkit-deploy.json @@ -2,7 +2,7 @@ "kind": "Template", "apiVersion": "v1", "metadata": { - "name": "innovation-toolkit", + "name": "innovation-toolkit-caddy", "creationTimestamp": null }, "objects": [ @@ -10,14 +10,14 @@ "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { - "name": "innovation-toolkit", + "name": "innovation-toolkit-caddy", "generation": 1, "creationTimestamp": null, "labels": { - "app": "innovation-toolkit" + "app": "innovation-toolkit-caddy" }, "annotations": { - "openshift.io/generated-by": "OpenShiftNewApp" + "openshift.io/generated-by": "OpenShiftWebConsole" } }, "spec": { @@ -42,12 +42,12 @@ "imageChangeParams": { "automatic": true, "containerNames": [ - "innovation-toolkit" + "innovation-toolkit-caddy" ], "from": { "kind": "ImageStreamTag", - "namespace": "guides", - "name": "innovation-toolkit:latest" + "namespace": "ocio-guides-tools", + "name": "innovation-toolkit-caddy:latest" } } } @@ -55,28 +55,31 @@ "replicas": 1, "test": false, "selector": { - "app": "innovation-toolkit", - "deploymentconfig": "innovation-toolkit" + "app": "innovation-toolkit-caddy", + "deploymentconfig": "innovation-toolkit-caddy" }, "template": { "metadata": { "creationTimestamp": null, "labels": { - "app": "innovation-toolkit", - "deploymentconfig": "innovation-toolkit" + "app": "innovation-toolkit-caddy", + "deploymentconfig": "innovation-toolkit-caddy" }, "annotations": { - "openshift.io/generated-by": "OpenShiftNewApp" + "openshift.io/generated-by": "OpenShiftWebConsole" } }, "spec": { "containers": [ { - "name": "innovation-toolkit", - "image": "172.50.0.2:5000/guides/innovation-toolkit@sha256:e2da593f8d590abd8e4e94217aa189815960e46e64891f306b87574e6be8c56c", + "name": "innovation-toolkit-caddy", + "image": "docker-registry.default.svc:5000/ocio-guides-tools/innovation-toolkit-caddy@sha256:b3cbedf2a2f40521a1dc94280f67a5d68635ce095f03f0b587b48b410919842b", + "args": [ + "/tmp/scripts/run" + ], "ports": [ { - "containerPort": 4000, + "containerPort": 2015, "protocol": "TCP" } ], @@ -107,27 +110,26 @@ "kind": "Service", "apiVersion": "v1", "metadata": { - "name": "innovation-toolkit", + "name": "innovation-toolkit-caddy", "creationTimestamp": null, "labels": { - "app": "innovation-toolkit" + "app": "innovation-toolkit-caddy" }, "annotations": { - "openshift.io/generated-by": "OpenShiftNewApp" + "openshift.io/generated-by": "OpenShiftWebConsole" } }, "spec": { "ports": [ { - "name": "4000-tcp", + "name": "2015-tcp", "protocol": "TCP", - "port": 4000, - "targetPort": 4000 + "port": 2015, + "targetPort": 2015 } ], "selector": { - "app": "innovation-toolkit", - "deploymentconfig": "innovation-toolkit" + "deploymentconfig": "innovation-toolkit-caddy" }, "type": "ClusterIP", "sessionAffinity": "None" diff --git a/openshift/templates/digital-toolkit-route.json b/openshift/templates/digital-toolkit-route.json index 543048a..9a77bbd 100644 --- a/openshift/templates/digital-toolkit-route.json +++ b/openshift/templates/digital-toolkit-route.json @@ -21,14 +21,14 @@ } }, "spec": { - "host": "digital-toolkit.pathfinder.gov.bc.ca", + "host": "digital-toolkit-dev.pathfinder.gov.bc.ca", "to": { "kind": "Service", - "name": "innovation-toolkit", + "name": "innovation-toolkit-caddy", "weight": 100 }, "port": { - "targetPort": "4000-tcp" + "targetPort": "2015-tcp" }, "tls": { "termination": "edge", @@ -39,7 +39,7 @@ "status": { "ingress": [ { - "host": "digital-toolkit.pathfinder.gov.bc.ca", + "host": "digital-toolkit-dev.pathfinder.gov.bc.ca", "routerName": "router", "conditions": [ { diff --git a/openshift/templates/pipeline-build.json b/openshift/templates/pipeline-build.json new file mode 100644 index 0000000..0e2439e --- /dev/null +++ b/openshift/templates/pipeline-build.json @@ -0,0 +1,46 @@ +{ + "kind": "Template", + "apiVersion": "v1", + "metadata": { + "name": "innovation-toolkit", + "creationTimestamp": null + }, + "objects": [ + { + "kind": "BuildConfig", + "apiVersion": "v1", + "metadata": { + "name": "innovation-toolkit-pipeline", + "creationTimestamp": null, + "labels": { + "app": "innovation-toolkit-pipeline", + "name": "innovation-toolkit-pipeline", + "template": "innovation-toolkit-pipeline" + } + }, + "spec": { + "runPolicy": "Parallel", + "source": { + "type": "Git", + "git": { + "uri": "https://github.com/bcgov/digital-toolkit.git", + "ref": "os-pages" + } + }, + "strategy": { + "type": "JenkinsPipeline", + "jenkinsPipelineStrategy": { + "jenkinsfilePath": "Jenkinsfile" + } + }, + "output": {}, + "resources": {}, + "postCommit": {}, + "nodeSelector": null + }, + "status": { + "lastVersion": 0 + } + } + ] +} \ No newline at end of file