Skip to content

Commit

Permalink
Fixed users docs and added build folder
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBeydoun committed May 20, 2020
1 parent 7b84abf commit 7e52826
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 5 deletions.
31 changes: 31 additions & 0 deletions build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: start start-api start-problems start-users forward-problems forward-users

start:
@echo "Starting local dev server..."
@echo "UI: http://localhost:8080"
@echo "API: http://localhost:3000"
@docker-compose up

start-api:
@echo "Starting local dev server without UI..."
@echo "API: http://localhost:3000"
@docker-compose up --scale wisp-ui=0

start-problems:
@echo "Starting local problems server..."
@echo "Problems API: http://localhost:3001"
@docker-compose up --scale wisp-ui=0 --scale wisp-gateway=0 --scale wisp-users=0

start-users:
@echo "Starting local problems server..."
@echo "Problems API: http://localhost:3001"
@echo "Users API: http://localhost:3002"
@docker-compose up --scale wisp-ui=0 --scale wisp-gateway=0

forward-problems:
@echo "Forwarding port 3001 to problems microservice..."
@kubectl port-forward -n prod deploy/wisp-problems 3001:3000

forward-users:
@echo "Forwarding port 3002 to users microservice..."
@kubectl port-forward -n prod deploy/wisp-users 3002:3000
48 changes: 48 additions & 0 deletions build/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: "3"
services:
mongo:
container_name: mongo
image: mongo
logging:
driver: none
wisp-problems:
image: competemcgill/wisp-problems:latest
container_name: wisp-problems
environment:
- NODE_ENV=dev
- DB_URL=mongodb://mongo:27017
ports:
- 3001:3000
links:
- mongo
wisp-users:
image: competemcgill/wisp-users:latest
container_name: wisp-users
environment:
- NODE_ENV=dev
- DB_URL=mongodb://mongo:27017
- SECRET=Ks10daK3g
- WISP_PROBLEMS_URL=http://wisp-users:3000
ports:
- 3002:3000
links:
- mongo
wisp-gateway:
image: competemcgill/e2e-wisp-gateway:latest
container_name: wisp-gateway
ports:
- 3000:80
links:
- wisp-users
- wisp-problems
wisp-ui:
image: competemcgill/wisp-ui:latest
container_name: wisp-ui
environment:
- VUE_APP_WISP_API_URL=http://localhost:3000
ports:
- 80:80
links:
- wisp-gateway
- wisp-users
- wisp-problems
34 changes: 29 additions & 5 deletions docs/microservices/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The purpose of this microservice is to manage all logic relating to users and to

**Requirements**

* [`gcloud`](https://cloud.google.com/sdk/install)
* [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
* [`docker`](https://www.docker.com/)
* [`docker-compose`](https://docs.docker.com/compose/)

Expand All @@ -53,9 +55,30 @@ The purpose of this microservice is to manage all logic relating to users and to

**Running**

Clone the [repository](https://github.com/Compete-McGill/wisp-users-microservice), and navigate to the root of the project.
1. Login to a gcloud account that has access to our cluster on GKE

Then run:
```bash
$ gcloud auth login <EMAIL>
```

2. Connect to our wisp-prod cluster

```bash
$ gcloud container clusters get-credentials wisp-prod --zone northamerica-northeast1-c --project wisp-276819
```

3. Use port forwarding to get access to the problems microservice (this will keep running in foreground by default)

```bash
# we don't currently have a dev namespace so prod will be used intermittently
$ kubectl port-forward -n prod deploy/wisp-problems 3001:3000
```

NOTE: steps 1 through 3 can be skipped by running a local copy of the problems microservice with docker or node (keep in mind that the default mongodb url for the problems microservice is mongodb://mongo:27017)

4. Clone the [repository](https://github.com/Compete-McGill/wisp-users-microservice), and navigate to the root of the project.

5. run:

```bash
npm i
Expand Down Expand Up @@ -88,7 +111,7 @@ For a more extensive documentation, visit the swagger docs

| Status | Response |
| --- | --- |
| 200 | `{"token": "jwt token"}` |
| 200 | `{"token": "jwt token", "user": {...}}` |
| 400 | Invalid email or passowrd |
| 422 | Missing or invalid email/password |
| 500 | Internal server error |
Expand Down Expand Up @@ -129,6 +152,7 @@ For a more extensive documentation, visit the swagger docs
bio: String,
profilePhoto: String,
},
problemSets: [ObjectId],
problems: [
{
problemId: String,
Expand Down Expand Up @@ -247,7 +271,7 @@ See user model

```json
{
"problemId": "OnjectId"
"problemId": "ObjectId"
}
```

Expand All @@ -270,7 +294,7 @@ See user model

```json
{
"problemSetId": "OnjectId"
"problemSetId": "ObjectId"
}
```

Expand Down

0 comments on commit 7e52826

Please sign in to comment.