Skip to content

Commit

Permalink
Merge pull request #454 from tcet-opensource/development
Browse files Browse the repository at this point in the history
added setup.md
  • Loading branch information
TejasNair9977 authored Nov 10, 2023
2 parents 3b2c6b4 + 4f171f8 commit 5a66924
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ node_modules
coverage
logs
.env
data
logs
apidoc
47 changes: 47 additions & 0 deletions SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# TCET ERP System

Made in mind for testing APIs, database replication, providing data to frontend.

## Installation for Testing

### Prerequisites

Well before anything, you will have to install WSL. All you have to do is:

`wsl --install`

After this, you will need to restart.

Install Docker Desktop, it is docker bundled with a frontend. It will allow you do get the backend and databases up and running without any other installation steps.

The link for downloading Docker Desktop is given below.

[Docker Desktop Installer](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe)

Again, you will need to restart.

### Installation

After this, use these commands to set up the databases and the backend.

```bash
docker-compose pull
docker-compose up -d
```

The last step is a troublesome one, but a very necessary step. You will have to change your hosts file. On Linux, it will be in `/etc/hosts/` (use sudo vim/nano/any editor with admin privs and go to the next step). For Windows, it will be in `C:\Windows\System32\drivers\etc\hosts`. Open Notepad(or any code editor) as Admin, and open the specific hosts file, and go to the next step. You can use Microsoft PowerToys to change your Hosts file using the Hosts file editor.

Add the following to your hosts file.
```
127.0.0.1 mongo1
127.0.0.1 mongo2
127.0.0.1 mongo3
```

And voila! You have the backend set up! It will be running on port 4000.

You can use MongoDBCompass to login with the URI specified in the `docker-compose.yaml` and the `.env.sample`



NOTE! If, for any reason, the backend doesn't work, try restarting the backend container in Docker Desktop, in the Containers tab.
8 changes: 4 additions & 4 deletions _apidoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
/**
* @api {post} /exam/add Add Exam
* @apiName AddExam
* @apiExam Exam
* @apiGroup Exam
* @apiDescription Add a new exam.
*
* @apiBody {String} title Exam title.
Expand Down Expand Up @@ -1068,7 +1068,7 @@
/**
* @api {delete} /exam/delete/:id Delete Exam
* @apiName DeleteExam
* @apiExam Exam
* @apiGroup Exam
*
* @apiParam {ObjectId} id The ObjectID of the exam to delete.
*
Expand Down Expand Up @@ -1170,7 +1170,7 @@
/**
* @api {post} /exam/update/:id Update Exam Details
* @apiName UpdateExam
* @apiExam Exam
* @apiGroup Exam
* @apiDescription Update existing exam details.
*
* @apiParam {ObjectId} id The ObjectID of the exam to update.
Expand Down Expand Up @@ -1336,7 +1336,7 @@
/**
* @api {get} /exam/list Get Exam List
* @apiName GetExamList
* @apiExam Exam
* @apiGroup Exam
*
* @apiQuery {String} [title] Title of the exam.
*
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ services:
- ./data/mongo-3:/data/db
ports:
- 30003:30003

backend:
build: .
container_name: backend
env_file:
- .env
command: ["npm", "run", "serverstart"]
ports:
- 4000:4000

0 comments on commit 5a66924

Please sign in to comment.