From 724f643755dd160606dfc4116c28a96fd22d08b8 Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Mon, 9 Nov 2020 13:39:01 -0500 Subject: [PATCH 1/7] Remove NODE_ENV from dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index baa318b..4343e7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,6 @@ LABEL maintainer="Max Meinhold " EXPOSE 8080 -ENV NODE_ENV production - RUN mkdir /opt/vote WORKDIR /opt/vote From 37e3f16588f79c01c15b7659778966b4f5c9ef3f Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Mon, 9 Nov 2020 13:40:17 -0500 Subject: [PATCH 2/7] Remove superfluous mkdir --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4343e7e..1c26f2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ LABEL maintainer="Max Meinhold " EXPOSE 8080 -RUN mkdir /opt/vote WORKDIR /opt/vote # nvm install deps From b9119c5e9fcbb0fde5eff25ecd107ccbf5fa5320 Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Mon, 9 Nov 2020 13:42:23 -0500 Subject: [PATCH 3/7] Create vote-dev deploy resources --- deploy/bc-dev.yaml | 34 ++++++++++++++++++++++++++++ deploy/bc.yaml | 2 +- deploy/dc-dev.yaml | 49 +++++++++++++++++++++++++++++++++++++++++ deploy/route-dev.yaml | 4 ++-- deploy/service-dev.yaml | 17 ++++++++++++++ 5 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 deploy/bc-dev.yaml create mode 100644 deploy/dc-dev.yaml create mode 100644 deploy/service-dev.yaml diff --git a/deploy/bc-dev.yaml b/deploy/bc-dev.yaml new file mode 100644 index 0000000..f5f0cfd --- /dev/null +++ b/deploy/bc-dev.yaml @@ -0,0 +1,34 @@ +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + labels: + app: vote + name: vote-dev + namespace: vote +spec: + successfulBuildsHistoryLimit: 3 + failedBuildsHistoryLimit: 3 + triggers: + - type: "GitHub" + github: + secret: "vote" + - type: "ConfigChange" + source: + ref: develop + git: + uri: "https://github.com/ComputerScienceHouse/Vote.git" + output: + to: + kind: ImageStreamTag + name: vote:develop + runPolicy: SerialLatestOnly + strategy: + dockerStrategy: {} + type: Docker + # Lookup local images + lookupPolicy: + local: true + status: + tags: + - items: + tag: develop diff --git a/deploy/bc.yaml b/deploy/bc.yaml index 84d8148..c130a0e 100644 --- a/deploy/bc.yaml +++ b/deploy/bc.yaml @@ -14,7 +14,7 @@ spec: secret: "vote" - type: "ConfigChange" source: - ref: docker + ref: main git: uri: "https://github.com/ComputerScienceHouse/Vote.git" output: diff --git a/deploy/dc-dev.yaml b/deploy/dc-dev.yaml new file mode 100644 index 0000000..830fd9c --- /dev/null +++ b/deploy/dc-dev.yaml @@ -0,0 +1,49 @@ +kind: DeploymentConfig +apiVersion: v1 +metadata: + name: vote-dev + labels: + app: vote + namespace: vote +spec: + replicas: 1 + revisionHistoryLimit: 10 + selector: + deploymentconfig: vote-dev + strategy: + type: Rolling + template: + metadata: + labels: + app: vote + deploymentconfig: vote-dev + spec: + containers: + - name: vote-http + image: vote-dev + envFrom: + - configMapRef: + name: vote-dev + livenessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 0 + timeoutSeconds: 1 + readinessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 0 + timeoutSeconds: 1 + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - vote-http + from: + kind: ImageStreamTag + name: vote:develop + namespace: vote diff --git a/deploy/route-dev.yaml b/deploy/route-dev.yaml index 148b6e6..caf7586 100644 --- a/deploy/route-dev.yaml +++ b/deploy/route-dev.yaml @@ -17,6 +17,6 @@ spec: termination: edge to: kind: Service - name: vote + name: vote-dev weight: 100 - wildcardPolicy: None \ No newline at end of file + wildcardPolicy: None diff --git a/deploy/service-dev.yaml b/deploy/service-dev.yaml new file mode 100644 index 0000000..113c642 --- /dev/null +++ b/deploy/service-dev.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: vote + name: vote-dev + namespace: vote +spec: + ports: + - name: 8080-tcp + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + deployment: vote-dev + sessionAffinity: None + type: ClusterIP From 970ffb45026f4c5c165f95c7027d6e401fe74208 Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Mon, 9 Nov 2020 13:59:19 -0500 Subject: [PATCH 4/7] Create deployment instructions --- deploy/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 deploy/README.md diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..289b98f --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,26 @@ +# Deployment instructions + +Vote is meant to be deployed on an OKD/Openshift cluster. +This directory contains most of the files needed to do that, but doesn't include the config maps, since they contain secrets. +You'll need to create 2 config maps, `vote` and `vote-dev`, which should look rather like this, but with placeholders filled in: +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: + namespace: vote +data: + DB_URL: mongodb://:@tide.csh.rit.edu/vote?ssl=true + NODE_ENV: + REACT_APP_BASE_API_URL: https://vote.csh.rit.edu + REACT_APP_SSO_AUTHORITY: https://sso.csh.rit.edu/auth/realms/csh + REACT_APP_SSO_CLIENT_ID: vote +``` + +Once you have all the files together, plop them in a directory and run `oc create -fr `, and you should see resources start to spin up. + + +## Updating an existing deployment + +Rather than `oc create`, you'll need `oc edit` or `oc replace`. +Please try to keep any changes synchronised with this repository. From 7c2f5965cf62f8f36e871c2057825c2a4d25218b Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Mon, 9 Nov 2020 14:11:31 -0500 Subject: [PATCH 5/7] Correct service selectors We use dc, not deploy --- deploy/service-dev.yaml | 2 +- deploy/service.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/service-dev.yaml b/deploy/service-dev.yaml index 113c642..c13f81b 100644 --- a/deploy/service-dev.yaml +++ b/deploy/service-dev.yaml @@ -12,6 +12,6 @@ spec: protocol: TCP targetPort: 8080 selector: - deployment: vote-dev + deploymentconfig: vote-dev sessionAffinity: None type: ClusterIP diff --git a/deploy/service.yaml b/deploy/service.yaml index 709ae81..c72ffc6 100644 --- a/deploy/service.yaml +++ b/deploy/service.yaml @@ -12,6 +12,6 @@ spec: protocol: TCP targetPort: 8080 selector: - deployment: vote + deploymentconfig: vote sessionAffinity: None - type: ClusterIP \ No newline at end of file + type: ClusterIP From 4c81f2f95e2f1246473c38d9c41d773fcd5e03fe Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Mon, 9 Nov 2020 17:55:57 -0500 Subject: [PATCH 6/7] Update Copyright year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 77356da..f9df604 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Computer Science House +Copyright (c) 2020 Computer Science House Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From b4cdd002a899ab373226b5ea0d84d59784dd8d82 Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Wed, 11 Nov 2020 13:21:50 -0500 Subject: [PATCH 7/7] s/Openshift/OpenShift/g There ya go @WillNilges --- deploy/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/README.md b/deploy/README.md index 289b98f..40b3dd1 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -1,6 +1,6 @@ # Deployment instructions -Vote is meant to be deployed on an OKD/Openshift cluster. +Vote is meant to be deployed on an OKD/OpenShift cluster. This directory contains most of the files needed to do that, but doesn't include the config maps, since they contain secrets. You'll need to create 2 config maps, `vote` and `vote-dev`, which should look rather like this, but with placeholders filled in: ```yaml