Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start work on Fastify server #1

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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: 1 addition & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
REACT_APP_GOOGLE_CLIENT_ID=706375540729-sqnnig7o0d0uqmvav0h8nh8aft6l55u3.apps.googleusercontent.com
API_BASE=https://hydrant.xvm.mit.edu
REACT_APP_GOOGLE_CLIENT_ID=706375540729-sqnnig7o0d0uqmvav0h8nh8aft6l55u3.apps.googleusercontent.com
5 changes: 3 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
API_PORT=6873
API_BASE=http://localhost:$API_PORT
PORT=3428
SITE=http://localhost:3428
FIREROAD_API_BASE=https://fireroad-dev.mit.edu
3 changes: 3 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SITE=https://hydrant.mit.edu
FIREROAD_API_BASE=https://fireroad.mit.edu
# Store secrets (if any) in .env.production.local
5 changes: 3 additions & 2 deletions .github/workflows/autodeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Install node dependencies
run: npm install
- name: Run build
Expand All @@ -26,4 +26,5 @@ jobs:
name: built-site
path: |
build
!build/latest.json
server
!server/dev.js
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ __pycache__
deploy.sh

.idea

# Secrets
.env.local
.env.*.local
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.16.0
18.17.0
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ There's the frontend, which is the website and the interface. Then there's the b

To update the frontend (source code in the `src/` directory), you can run `npm start` and open the link that shows up in your terminal window. As you change the source code, the site should update in real-time, but you can reload if you want to make sure you're using the latest version.

To work on the backend (located in `src-server/`), it's a similar process. If you run `npm start`, you can edit any of the files in `src-server/` to reload the Node.js server automatically with your changes. If you just want to tinker with the API without touching the frontend code, you can alternatively run `npm run start:frontend`.
To work on the backend (located in `src-server/`), it's a similar process. If you run `npm start`, you can edit any of the files in `src-server/` to reload the Node.js server automatically with your changes.

*NB: Hydrant is currently in the process of moving to a Node.js-only backend! For now, you'll need to do the following steps as well.*

Expand All @@ -40,9 +40,7 @@ Finally, run the normal update process and commit the results to the repo.

### Updating the server

The server's frontend updates based on the `deploy` branch on GitHub, so any changes pushed there will become live.

The server's backend is updated by an automatic deploy to an XVM instance via the same `deploy` branch.
The server's frontend and backend updates are based on the `deploy` branch on GitHub, so any changes pushed there will become live.

See `deploy/README.md` for more info.

Expand Down
3 changes: 2 additions & 1 deletion deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ The backend runs on an XVM instance at `hydrant.xvm.mit.edu`. It is deployed sep

After the backend is build with `npm run build`, we start the server on the XVM instance with [PM2](https://pm2.keymetrics.io/) using the `pm2.config.js` file located in this folder.

*NB: This documentation is incomplete! It will be updated after the migration to a Node.js backend is finished and we finalize the deployment process.*
*NB: This documentation is incomplete! It will be updated after the migration to a Node.js backend is finished and we finalize the deployment process.*
- TODO: how to use secrets on backend? `dotenv`?
Loading