aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Mehri <[email protected]>2020-05-25 23:09:20 -0600
committerGitHub <[email protected]>2020-05-25 23:09:20 -0600
commita104b512efb599d83c046dbea95379669b87bb8c (patch)
tree403e10b4ec1ebc78d7e6f16d1f50f299c973e242
parentMerge pull request #32 from jackyzha0/latex-renderer (diff)
parentupdate makefile and readme (diff)
downloadctrl-v-a104b512efb599d83c046dbea95379669b87bb8c.tar.xz
ctrl-v-a104b512efb599d83c046dbea95379669b87bb8c.zip
Merge pull request #33 from jackyzha0/firebase
deploy
-rw-r--r--Makefile11
-rw-r--r--README.md12
-rw-r--r--frontend/.firebaserc5
-rw-r--r--frontend/.gitignore65
-rw-r--r--frontend/firebase.json16
-rw-r--r--frontend/src/components/renderers/Latex.js2
-rw-r--r--frontend/src/helpers/httpHelper.js4
7 files changed, 108 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 472fb7c..0da146e 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,18 @@ docker-build:
docker-run:
docker run -p 8080:8080 jzhao2k19/ctrl-v:latest
docker-all: docker-build docker-run
+gcr:
+ docker tag jzhao2k19/ctrl-v:latest gcr.io/ctrl-v-278404/backend && docker push gcr.io/ctrl-v-278404/backend
docker-push:
docker push jzhao2k19/ctrl-v:latest
fe-run:
cd frontend && yarn start
fe-build:
cd frontend && yarn build
-all:
- make -j 2 run fe-run \ No newline at end of file
+firebase:
+ cd frontend && firebase deploy
+fe-deploy: fe-build firebase
+dev:
+ make -j 2 run fe-run
+deploy:
+ docker-build && gcr && fe-deploy \ No newline at end of file
diff --git a/README.md b/README.md
index 29d90e6..3bf9578 100644
--- a/README.md
+++ b/README.md
@@ -8,14 +8,20 @@ Frontend is in React and backend is in Go.
![View Paste (different theme)](https://user-images.githubusercontent.com/23178940/82101261-ea7a6b00-96c0-11ea-9cf1-9b81883ab9f5.png)
## developing
+when doing local backend development, make sure you change the backend address to be localhost. You can find this on Line 4 of `frontend/src/helpers/httpHelper.js`
+
#### Common
-`make all` &mdash; starts React development server on `:3000` and backend on `:8080`
+`make dev` &mdash; starts React development server on `:3000` and backend on `:8080`
+
+`make deploy` &mdash; deploys both frontend and backend
#### Frontend
`make fe-run` &mdash; starts React development server on `:3000`
`make fe-build` &mdash; builds development release of frontend in `frontend/build`
+`make firebase` &mdash; deploys dev release of frontend to Firebase. Live at `ctrl-v.app`
+
#### Backend
`make run` &mdash; starts backend on `:8080`
@@ -27,4 +33,6 @@ Frontend is in React and backend is in Go.
`make docker-all` &mdash; builds and runs built Docker image on `:8080`
-`make docker-push` &mdash; pushes build Docker image to Dockerhub \ No newline at end of file
+`make docker-push` &mdash; pushes build Docker image to Dockerhub
+
+`make gcr` &mdash; tags and pushes iamge to Google Container Registry for Cloud Run. Changes are live on `api.ctrl-v.app` \ No newline at end of file
diff --git a/frontend/.firebaserc b/frontend/.firebaserc
new file mode 100644
index 0000000..ae027e9
--- /dev/null
+++ b/frontend/.firebaserc
@@ -0,0 +1,5 @@
+{
+ "projects": {
+ "default": "ctrl-v-a8efd"
+ }
+}
diff --git a/frontend/.gitignore b/frontend/.gitignore
new file mode 100644
index 0000000..f626852
--- /dev/null
+++ b/frontend/.gitignore
@@ -0,0 +1,65 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+firebase-debug.log*
+
+# Firebase cache
+.firebase/
+
+# Firebase config
+
+# Uncomment this if you'd like others to create their own Firebase project.
+# For a team working on the same Firebase project(s), it is recommended to leave
+# it commented so all members can deploy to the same project(s) in .firebaserc.
+# .firebaserc
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
diff --git a/frontend/firebase.json b/frontend/firebase.json
new file mode 100644
index 0000000..340ed5b
--- /dev/null
+++ b/frontend/firebase.json
@@ -0,0 +1,16 @@
+{
+ "hosting": {
+ "public": "build",
+ "ignore": [
+ "firebase.json",
+ "**/.*",
+ "**/node_modules/**"
+ ],
+ "rewrites": [
+ {
+ "source": "**",
+ "destination": "/index.html"
+ }
+ ]
+ }
+}
diff --git a/frontend/src/components/renderers/Latex.js b/frontend/src/components/renderers/Latex.js
index 6915f75..dcb9ea3 100644
--- a/frontend/src/components/renderers/Latex.js
+++ b/frontend/src/components/renderers/Latex.js
@@ -20,8 +20,6 @@ class Latex extends React.Component {
}
}).flat()
- console.log(els)
-
// if <=1 lines, just render block
if (els.length <= 1) {
return (
diff --git a/frontend/src/helpers/httpHelper.js b/frontend/src/helpers/httpHelper.js
index 28704f5..0c7c295 100644
--- a/frontend/src/helpers/httpHelper.js
+++ b/frontend/src/helpers/httpHelper.js
@@ -1,6 +1,8 @@
import axios from 'axios';
-const base = `http://localhost:8080/api`
+// uncomment for local dev
+// const base = `http://localhost:8080/api`
+const base = `https://api.ctrl-v.app/api`
export function FetchPaste(hash) {
const serverURL = `${base}/${hash}`