diff options
| author | Ryan Mehri <[email protected]> | 2020-05-25 23:09:20 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-25 23:09:20 -0600 |
| commit | a104b512efb599d83c046dbea95379669b87bb8c (patch) | |
| tree | 403e10b4ec1ebc78d7e6f16d1f50f299c973e242 | |
| parent | Merge pull request #32 from jackyzha0/latex-renderer (diff) | |
| parent | update makefile and readme (diff) | |
| download | ctrl-v-a104b512efb599d83c046dbea95379669b87bb8c.tar.xz ctrl-v-a104b512efb599d83c046dbea95379669b87bb8c.zip | |
Merge pull request #33 from jackyzha0/firebase
deploy
| -rw-r--r-- | Makefile | 11 | ||||
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | frontend/.firebaserc | 5 | ||||
| -rw-r--r-- | frontend/.gitignore | 65 | ||||
| -rw-r--r-- | frontend/firebase.json | 16 | ||||
| -rw-r--r-- | frontend/src/components/renderers/Latex.js | 2 | ||||
| -rw-r--r-- | frontend/src/helpers/httpHelper.js | 4 |
7 files changed, 108 insertions, 7 deletions
@@ -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 @@ -8,14 +8,20 @@ Frontend is in React and backend is in Go.  ## 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` — starts React development server on `:3000` and backend on `:8080` +`make dev` — starts React development server on `:3000` and backend on `:8080` + +`make deploy` — deploys both frontend and backend #### Frontend `make fe-run` — starts React development server on `:3000` `make fe-build` — builds development release of frontend in `frontend/build` +`make firebase` — deploys dev release of frontend to Firebase. Live at `ctrl-v.app` + #### Backend `make run` — starts backend on `:8080` @@ -27,4 +33,6 @@ Frontend is in React and backend is in Go. `make docker-all` — builds and runs built Docker image on `:8080` -`make docker-push` — pushes build Docker image to Dockerhub
\ No newline at end of file +`make docker-push` — pushes build Docker image to Dockerhub + +`make gcr` — 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}` |