Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ LABEL maintainer="Max Meinhold <mxmeinhold@gmail.com>"

EXPOSE 8080

ENV NODE_ENV production

RUN mkdir /opt/vote
WORKDIR /opt/vote

# nvm install deps
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -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: <name of cm>
namespace: vote
data:
DB_URL: mongodb://<user>:<password>@tide.csh.rit.edu/vote?ssl=true
NODE_ENV: <env>
REACT_APP_BASE_API_URL: https://vote.csh.rit.edu
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these values does the react app still just ignore this and pull from the .env for whatever reason? we probably need to fix that so that it actually will point to the dev service for dev

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I meant to ask you about that. Does dotenv get overridden by the actual environment? Looks like vote.cs.house is a wee bit broken, if I simulate loggint in as evals it's getting stuck. If flashes logged in and then goes back to redirecting.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the .env file was part of the boilerplate and I don't really know where it pulls it in off the top of my head but I could look into that at some point. When we tried to remove it completely the variables were "undefined", so I don't think it's getting the actual environment at all for some reason, but I'm not sure why

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'm gonna switch to homework for the rest of today, but we'll need to fix that before we're ready for 1.0.0 I think. I've set the dev build to build off this branch, so we can do a bit more testing on OKD if we need.

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 <directory>`, 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.
34 changes: 34 additions & 0 deletions deploy/bc-dev.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion deploy/bc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
secret: "vote"
- type: "ConfigChange"
source:
ref: docker
ref: main
git:
uri: "https://github.com/ComputerScienceHouse/Vote.git"
output:
Expand Down
49 changes: 49 additions & 0 deletions deploy/dc-dev.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions deploy/route-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ spec:
termination: edge
to:
kind: Service
name: vote
name: vote-dev
weight: 100
wildcardPolicy: None
wildcardPolicy: None
17 changes: 17 additions & 0 deletions deploy/service-dev.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ spec:
protocol: TCP
targetPort: 8080
selector:
deployment: vote
deploymentconfig: vote
sessionAffinity: None
type: ClusterIP
type: ClusterIP