Skip to content

Commit

Permalink
Merge branch 'master' into advay/show-users-reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
advayanand authored Jun 2, 2023
2 parents 0d2938b + cedc558 commit 19660a4
Show file tree
Hide file tree
Showing 47 changed files with 66,454 additions and 424 deletions.
Binary file removed .DS_Store
Binary file not shown.
File renamed without changes.
90 changes: 16 additions & 74 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,9 @@ on:
- master

jobs:
build:
name: Build project
build_and_deploy:
name: Build and deploy PeterPortal
runs-on: ubuntu-latest
env:
# need to set to false, otherwise react warnings will be treated as errors
CI: false
PUBLIC_API_URL: ${{secrets.PUBLIC_API_URL}}
PUBLIC_API_GRAPHQL_URL: ${{secrets.PUBLIC_API_GRAPHQL_URL}}
MONGO_URL: ${{secrets.MONGO_URL}}
SESSION_SECRET: ${{secrets.SESSION_SECRET}}
GOOGLE_CLIENT: ${{secrets.GOOGLE_CLIENT}}
GOOGLE_SECRET: ${{secrets.GOOGLE_SECRET}}
ADMIN_EMAILS: ${{secrets.ADMIN_EMAILS}}
STAGING_PREFIX: ${{ github.event_name == 'pull_request' && format('staging-{0}.', github.event.pull_request.number) || '' }}
PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}}
STAGE_NAME: ${{ github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number) || 'prod' }}
PORT: ${{secrets.PORT}}

concurrency:
group: build-${{ github.head_ref || github.run_id }}
Expand All @@ -38,68 +24,24 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
cache: 'npm'

- name: Dump Environment Variables
run: |
cd api && printf "PUBLIC_API_URL=$PUBLIC_API_URL\n \
PUBLIC_API_GRAPHQL_URL=$PUBLIC_API_GRAPHQL_URL\n \
MONGO_URL=$MONGO_URL\n \
SESSION_SECRET=$SESSION_SECRET\n \
GOOGLE_CLIENT=$GOOGLE_CLIENT\n \
GOOGLE_SECRET=$GOOGLE_SECRET\n \
ADMIN_EMAILS=$ADMIN_EMAILS\n \
STAGING_PREFIX=$STAGING_PREFIX\n \
PRODUCTION_DOMAIN=$PRODUCTION_DOMAIN\n \
STAGE_NAME=$STAGE_NAME\n \
PORT=$PORT" > .env
- name: Install Dependencies
run: npm install

- name: Install and Build Frontend 🔧
run: |
cd site
npm install --legacy-peer-deps
npm run build
cp -r build ../api/
- name: Install and Build Backend 🔧
run: |
cd api
rm .env.local
npm install
npm run build
- name: Cache build to use in deployment
uses: actions/cache@v3
with:
key: "${{ github.workflow }} #${{ github.run_number }} attempt ${{ github.run_attempt }}"
path: ${{ github.workspace }}

deploy:
name: Deploy to AWS
needs: build
runs-on: ubuntu-latest

concurrency:
group: deploy-${{ github.head_ref || github.run_id }}

steps:
- name: Retrieve build from cache
uses: actions/cache@v3
with:
key: "${{ github.workflow }} #${{ github.run_number }} attempt ${{ github.run_attempt }}"
path: ${{ github.workspace }}

- name: Install Plugin and Deploy
uses: serverless/[email protected]
with:
args: >
-c "cd api &&
serverless plugin install --name serverless-dotenv-plugin &&
serverless plugin install --name serverless-domain-manager &&
serverless deploy"
entrypoint: /bin/sh
- name: Build and deploy
run: npx sst deploy --stage ${{ (github.event_name == 'pull_request' && format('staging-{0}', github.event.pull_request.number)) || 'prod' }}
env:
CI: false
PUBLIC_API_URL: ${{secrets.PUBLIC_API_URL}}
PUBLIC_API_GRAPHQL_URL: ${{secrets.PUBLIC_API_GRAPHQL_URL}}
MONGO_URL: ${{secrets.MONGO_URL}}
SESSION_SECRET: ${{secrets.SESSION_SECRET}}
GOOGLE_CLIENT: ${{secrets.GOOGLE_CLIENT}}
GOOGLE_SECRET: ${{secrets.GOOGLE_SECRET}}
ADMIN_EMAILS: ${{secrets.ADMIN_EMAILS}}
PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/clean-up-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,26 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Dump Environment Variables
run: |
cd api && printf "STAGING_PREFIX=$STAGING_PREFIX\n \
STAGE_NAME=$STAGE_NAME" > .env
- name: Remove Serverless stack
uses: serverless/[email protected]
- name: Setup Node
uses: actions/setup-node@v3
with:
args: >
-c "cd api &&
serverless plugin install --name serverless-dotenv-plugin &&
serverless plugin install --name serverless-domain-manager &&
serverless remove"
entrypoint: /bin/sh
node-version: '18'
cache: 'npm'

- name: Install Dependencies
run: npm install

- name: Remove staging stack
run: npx sst remove --stage ${{ format('staging-{0}', github.event.pull_request.number) }} backend && npx sst remove --stage ${{ format('staging-{0}', github.event.pull_request.number) }} frontend
env:
CI: false
PUBLIC_API_URL: ${{secrets.PUBLIC_API_URL}}
PUBLIC_API_GRAPHQL_URL: ${{secrets.PUBLIC_API_GRAPHQL_URL}}
MONGO_URL: ${{secrets.MONGO_URL}}
SESSION_SECRET: ${{secrets.SESSION_SECRET}}
GOOGLE_CLIENT: ${{secrets.GOOGLE_CLIENT}}
GOOGLE_SECRET: ${{secrets.GOOGLE_SECRET}}
ADMIN_EMAILS: ${{secrets.ADMIN_EMAILS}}
PRODUCTION_DOMAIN: ${{secrets.PRODUCTION_DOMAIN}}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
15 changes: 11 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,17 @@ dist
.tern-port
.DS_Store

# sst files
.sst
cdk.context.json

# local files
.idea
.vscode
.DS_STORE

# env files
.env

api/build
site/build

api/package-lock.json
site/package-lock.json
package-lock.json
56 changes: 26 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,41 @@ PeterPortal is a web application aimed to aid UCI students with course discovery
* PeterPortal API
* ExpressJS
* ReactJS
* ElasticSearch
* SST and AWS CDK
* MongoDB
* GraphQL
* Typescript

## Running the project locally
1. Clone the `PeterPortal` repository to your local machine.

> `git clone https://github.com/icssc-projects/peterportal-client`
>
## First time setup
1. Clone the repository to your local machine:
```
git clone https://github.com/icssc/peterportal-client
```

2. Switch to a branch you will be working on.

> `git checkout -b [branch name]`
>
3. Make sure you have node version 14 or 16
1. `node -v`
4. Open two terminal windows and `cd [local directory of your repo]`.
1. Running the client

> `cd site`
>
- **On initial start**, run `npm install` to install all node dependencies.
- Run the development server using `npm start`.
- React development server should be running on port 3000 by default.
2. Running the server/API

> `cd api`
>
- **On initial start**, run `npm install` to install all node dependencies.
- Rename the 'dev.env' file to '.env'
- Run the development server using `npm run dev`.
- Express development server should be running on port 5000 by default.
```
git checkout -b [branch name]
```

3. Check your Node version with `node -v`. Make sure you have version 14 or above (18 recommended).

4. Open a terminal window and `cd` into the directory of your repo.

5. Run `npm install` to install all node dependencies for the site and API. This may take a few minutes.

## Running the project locally (after setup)
1. Open two terminal windows and `cd` into the directory of your repo in each of them.

2. In the first terminal window, enter the client directory with `cd site`. Then run the React development server using `npm start`. Ensure the server is running on port 3000 by default.

3. In the second terminal window, enter the API directory with `cd api`. Then run the Express development server using `npm run dev`. Ensure the server is running on port 5000 by default.

## Our Mission
🎇 Our mission is to improve the UCI student experience with course planning and encourage student software developers to create open-source applications that are beneficial to the Anteater community.
🎇 Our mission is to improve the UCI student experience with course planning

## Where does the data come from?

We consolidate our data directly from official UCI sources such as: UCI Catalogue, UCI Public Records Office, and UCI Webreg. We routinely monitor for updates to ensure you get the most accurate information to serve on your application.
We consolidate our data directly from official UCI sources such as: UCI Catalogue, UCI Public Records Office, and UCI Webreg (courtesy of [PeterPortal API](https://github.com/icssc/peterportal-api-nex)).

## Bug Report
🐞 If you encountered any issues or bug, please open an issue @ https://github.com/icssc-projects/peterportal-client/issues/new
Expand All @@ -55,4 +51,4 @@ We consolidate our data directly from official UCI sources such as: UCI Catalogu
✅ Although we consolidate our data directly from official UCI sources, this application is by all means, not an official UCI tool. We stride to keep our data as accurate as possible with the limited support we have from UCI. Please take that into consideration while using this Website.

## Terms & Conditions
📜 There are no hard policies at the moment for utilizing this tool. However, please refrain from abusing the Website by methods such as: sending excessive amount of requests in a small period of time or purposely looking to exploit the system. This tool is here mainly to assist developers in bringing their idea to life to benefit all UCI students. Please don't ruin it for others! 🙂
📜 There are no hard policies at the moment for utilizing this tool. However, please refrain from abusing the Website by methods such as: sending excessive amount of requests in a small period of time or purposely looking to exploit the system.
Binary file removed api/.DS_Store
Binary file not shown.
Loading

0 comments on commit 19660a4

Please sign in to comment.