Skip to content

swe-ucla/Event-Portal

Repository files navigation

Event-Portal

Overview

UCLA SWE's event portal. Coming Soon!

Built With

Architecture

  • More specific READMEs are located in client/ and server/.

  • Client: React

    • The client service contains the React app
    • Makes API calls to the Express server through proxy in client/package.json
  • Server: ExpressJS

    • The server service runs the Express app
    • Serves the Companies, Events, and Users APIs
    • Serves the static files from the production build of the React Client inclient/
  • Database: Postgres

    • Docker Postgres used for local development
    • Amazon RDS for PostgreSQL used for production
    • Main configuration with connection information in server/db/index.js
    • Diagrams for the database schema as of 3/7/19 is found in ./database/pg_db_diagram.pdf

Environment Setup

  • NOTE: In order to run the app, developers need the .env file
    • Should be kept in the same directory as the Makefile/this README/etc.
    • .env.example is an example .env file
  • Stack Dependencies
  • Store initial sample test data in order to restore data if modified
    • Sample data will be initially populated with make dev
    • Once generated, store it in a zip file with make store
    • NOTE: if there is some bug with the database, try resetting it by deleting the folder database/postgres/ then running make dev again
      • Following the below commands will be necessary to repopulate with sample data
# If database/postgres does not exist, will create postgres container and populate with sample data.
$ make dev

# Only needs to be run once and then will be able to restore initial sample data from the generated zip.
$ make store

# Unzip sample data and move to proper folder within database/. Can also overwrite current database data with this command.
$ make restore

Stack Commands

Run Stack in Development Mode
$ make dev
  • Both client/ and server/ are separate Docker Containers linked with docker-compose-dev.yml

  • The database/ container has locally mounted data for development at port 5432

    • Can access psql shell for running Postgres container

    • $ make pg
  • Local directories are mounted into the containers

    • Changes will reflect upon save/refresh
      • Exceptions: changes to package.json, new css files, etc.
Run Stack in Production Mode
$ make prod
  • Available at http://localhost (port 80)

  • Creates static build of the React Client app in client/build/

  • Runs Express Server which handles serving both the API and the static client files

  • Uses environment variables from docker-compose.yml to connect with Amazon Postgres database

    • Can access psql shell for Amazon RDS for PostgreSQL database

    • $ make db
Stop the Stack
  • Works for both production and development modes

  • In same terminal tab that we ran stack, Ctrl+C or:

$ make stop

Deploy to AWS EB

  • Commit all relevant changes in swe-ucla/Event-Portal repository
  • Bundle application source code
    • Only includes files stored in git, excluding ignored files and git files
    • Specify version number by setting environment variable with call
      • Version defaults to 666, should be manually fixed
$ make zip VERSION=4.2
  • Login to AWS Developer Console
    • Navigate to the Elastic Beanstalk Service in region us-east-1, aka N. Virginia
    • Select the environment EventPortalEnv in application swe-event-portal
  • Select Upload and Deploy in the EB dashboard
    • Upload zip from earlier step
    • Should autogenerate label of the format: event_portal_v#.#
  • Deploy!
    • Changes should appear after environment update has completed successfully