diff --git a/Dockerfile b/Dockerfile index baa318b..1c26f2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,6 @@ LABEL maintainer="Max Meinhold " EXPOSE 8080 -ENV NODE_ENV production - -RUN mkdir /opt/vote WORKDIR /opt/vote # nvm install deps 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 diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..40b3dd1 --- /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. 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..c13f81b --- /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: + 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