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

Updated README #537

Merged
merged 6 commits into from
Apr 6, 2024
Merged
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
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,29 @@

### Requirements

- [NodeJS 18.18](https://nodejs.org/en)
Please ensure the following are installed on your system:
- [NodeJS v20.12.1](https://nodejs.org/en)
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)

### Step-by-step guide

- [Local Development Setup](docs/guides/local_development_setup.md)
- [Local Docker Development Setup](docs/guides/local_docker_development_setup.md)
- [AWS Authentication Credentials Setup](docs/guides/aws_authentication.md)
- [Poll Worker Setup](docs/guides/poll_worker_setup.md)
1. Clone the [project](https://github.com/COSC-499-W2023/year-long-project-team-3) using Git
2. Obtain the two required environment files for local development by contacting one of the project devs: `./.env` and `./workers/poll-worker/.env`
3. Follow the steps in: [AWS Authentication Credentials Setup](docs/guides/aws_authentication.md)
4. Project Setup
- Follow the steps in: [Poll Worker Setup](docs/guides/poll_worker_setup.md)
- and: [Local Development Setup](docs/guides/local_development_setup.md)

### Tests
- [Manually run E2E tests on PR](docs/guides/run_e2e_github_actions.md)

**Running tests locally:**

Run `npm run cypress:open` to use the cypress GUI to run tests. Alternatively, run `npx cypress run` to run all tests
in the commandline. Note: You need to have the website up and running to be able to run E2E tests.

**Running tests in the CI pipeline:**

Tests are automatically run every time you push to an active (non-draft) PR, but you can also [run them manually](docs/guides/run_e2e_github_actions.md)

### Common commands

Expand Down
21 changes: 0 additions & 21 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,6 @@ services:
networks:
- internal-dev

nextjs-app:
depends_on:
- db
build:
context: .
dockerfile: Dockerfile.dev
args:
- ARG_DATABASE_URL=$DATABASE_URL
- ARG_NEXTAUTH_URL=$NEXTAUTH_URL
container_name: docker-next
env_file: .env.docker.local
volumes:
- .:/app
ports:
- '3000:3000'
networks:
- internal-dev
links:
- db
restart: always

poll-worker:
build:
context: .
Expand Down
10 changes: 4 additions & 6 deletions docs/guides/aws_authentication.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# AWS Authentication Credentials Setup

1. Go to AWS console: https://ubc-cicsso.awsapps.com/start#/
2. Click on the AWS account, and choose: `Command line or programmatic access` (**IMPORTANT STEP**)
3. Click on your OS tab
4. Copy the code on option 1
5. Paste to command line
1. Go to the [AWS console](https://ubc-cicsso.awsapps.com/start#/)
2. Click on your AWS account, and choose: `Access Keys`
3. Select Mac/Linux as your OS, copy the text for _Option 1: Set AWS environment variables_. The three keys copied from here (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN) need to be pasted into the two environment files without the "export".

**Note**: This credential is temporary so there is chance you have to repeat this while working.
**Note**: This credential is temporary so there is a chance you have to repeat this while working.
16 changes: 9 additions & 7 deletions docs/guides/local_development_setup.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Local Development Setup

1. Install dependencies
1. Ensure that all environment files have already been added to the project.
2. From the root directory, install dependencies using (Node.js must be installed before doing this):
```bash
npm install
```
2. Go in the #dotenv in Capstone Discord server to find the link to `.env` and copy the contents
3. Paste the contents into a new file called `.env` in the root directory of the project
4. Repeat steps 1 and 2 for `.env.docker.local`
5. Run the database
3. Make sure Docker Desktop is running
4. Spin up the database using:
```bash
docker-compose -f docker-compose.dev.yml up db -d
```
6. Migrate the database
5. Verify that the container is running in Docker Desktop. If it fails it may be due to improperly configured or missing `.env` files.
6. Migrate the database using:
```bash
npm run migrate
```
7. Run the server
7. Run the server using:
```bash
npm run dev
```

The project should now be fully set up and running on [port 3000](http://localhost:3000/).
30 changes: 13 additions & 17 deletions docs/guides/local_docker_development_setup.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
# Local Docker Development Setup

1. Go in the #dotenv in Capstone Discord server to find the link to `.env` and copy the contents
2. Paste the contents into a new file called `.env` in the root directory of the project
3. Repeat steps 1 and 2 for `.env.docker.local`
4. Initialize database

```bash
docker-compose -f docker-compose.dev.yml up db -d
npx prisma migrate dev
```

5. Run docker

```bash
npm run dev:docker
```

6. Go to http://localhost:3000
1. Contact one of our devs to receive a link to the environment files and add them to the root directory:
1. Make sure to replace the text highlighted in yellow inside this file with <u>your</u> AWS access key ID, AWS secret
access key, and AWS session token (from the [AWS console](https://ubc-cicsso.awsapps.com/start#/))
2. Initialize the database using:
```bash
docker-compose -f docker-compose.dev.yml up db -d
npx prisma migrate dev
```
3. Run docker:
```bash
npm run dev:docker
```
4. Go to http://localhost:3000
21 changes: 7 additions & 14 deletions docs/guides/poll_worker_setup.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# Poll Worker Setup

1. Navigate to the poll worker directory and install the required packages

```bash
# Make sure to run this from the project root
cd workers/poll-worker
npm install
```
2. Add the `.env` file from Google Drive to the `workers/poll-worker` directory
3. Update the poll worker `.env` file with your AWS credentials (see [AWS Authentication](aws_authentication.md))
4. Start the Docker Container from the root directory

```bash
docker-compose -f docker-compose.dev.yml up poll-worker -d
```
1. Ensure that all environment files have already been added to the project.
2. Make sure Docker Desktop is running
3. From the root directory, start the poll worker using:
```bash
docker-compose -f docker-compose.dev.yml up poll-worker -d
```
4. Verify that the container _docker-poll-worker_ is running in Docker Desktop
Loading