This application has been developed for the purpose of a thesis of an undergraduate student studying at the department of Electrical and Computer Engineering of the University of Patras (UoP).
Its purpose is to serve a front-end application that communicates, through a protected Reverse-proxy server, with a Web Service that manages gNodeB (5G antennas) using the TMF639 API model.
For that a reason the present Angular application (/frontend) along with the present Nodejs (/backend) for authorization and reverse-proxy have been developed.
The below infographic represents the whole system and the green bordered boxes address the applications developed for the purpose of the thesis.
The present repository consists of 2 submodules (repositories)
- An Angular Frontend single page application found in github.com/spiros3p/angular-frontend-tmf639
- And a NodeJS/Express backend application found in github.com/spiros3p/nodejs-AuthAPI
- In order to have complete functionality, we use the JSON-SERVER for a mock REST API server that serves the resources, since developing that backend application was not part of my work.
- Frontend Angular SPA - thesis.speppas.online
- Backend auth API - thesisauth.speppas.online/
- Dummy jsonServer (serves dummy resources) - thesisapi.speppas.online/
- For the Angular frontend can be found in this Github Page
- For the nodejs express backend endpoints can be found:
- for the TMF-639 Resource Model used in the project (thesisauth.speppas.online/resource-api-docs/)[https://thesisauth.speppas.online/resource-api-docs/]
- for the auth API endpoints (thesisauth.speppas.online/rms-api-docs/)[https://thesisauth.speppas.online/rms-api-docs/]
- Download/clone the repository on your local system using the flag --recursive (to download the content of both submodules)
git clone --recursive https://github.com/spiros3p/Radio-Management-Server-thesis.git
- Have Node.js and NPM installed on your system.
- Have Angular (12.2.7) installed on your system:
npm install -g @angular/[email protected]
- (Optional) Have Docker installed on your system.
- Navigate to ./frontend directory
- RUN
npm install
- Edit file ./frontend/src/app/router/app-routing.module.ts
by commenting out the desired block of code that defines theconst appRoutes
canActivate: [AuthGuard]
protects the routes using ./backend server of this project. - (Optional) RUN
npm run server
on ./frontend directory
Starts a local JSON-SERVER (fake RestAPI) at port 5000 that serves your TMF639 specification based Resources.- Edit ./frontend/package.json - line 10 to change port or uninstall the module.
- ./frontend/json-server/db.json file contains the dummy Resources that are being served.
- Edit files
- For Development build ./frontend/src/environments/environment.ts
- For Production build ./frontend/src/environments/environment.prod.ts
- Define the following variables according to your own servers and ports that RUN the server for the Resources (here JSON-SERVER port 5000) and the server for the user Authorization/reverse-proxy (here the nodejs server in the ./backend directory at port 3000).
- You can still use direct connection between the Front end and the Web Service serving the Resources by filling the apiURL variable or leaving it empty for the Reverse-Proxy to do the job.
- Start the Angular application on the ./frontend directory
- For Development RUN
ng serve
- For Production RUN
ng build
(compiles the angular app) and drop your build into your own production server
- For Development RUN
- Angular app is ready and running at http://localhost:4200/
- Navigate to ./backend directory
- RUN
npm install
(you may need to RUNnpm install bcrypt
separately in some occasions) - RENAME ./backend/.env-example file to ./backend/.env
- EDIT the same ./backend/.env file
- Define your existing MySQL database connection settings (if you dont have one see the docker setup of the project further below to setup one).
- Define SESSION_SECRET to protect the sessions created by PassportJS in the present Express NodeJS app.
- Define FRONT_END_IP as the IP and Port where the Angular app - frontend is running (this is needed to allow the certain IP to exchange cookies between the nodeJS app and the Angular app)
- Navigate to your MySQL db (own or see docker setup to use one) and copy the table ./backend/db/tbl_users.sql inside the MySQL Database defined at
DB_DATABASE
previously. - Start the NodeJS application on the ./backend directory (Runs at Port 3000)
- For Development RUN
npm run watch
(to run the app with Nodemon. This will restart the app at every save.) - For Production RUN
node app.js
- For Development RUN
- Voila! You can navigate to http://localhost:4200/ and login with the existing users (admin and test - found in the table file you copied at step 12.) or create a new one
Using docker to run the app will start 5 different containers
- Angular app running at port 4200
- JSON-SERVER (mock Resources server API) running at port 5000
- NodeJS app (auth/user/reverse-proxy API) running at port 3000
- MySQL database running at defualt port 3306
- phpMyAdmin app running at port 5001
You can edit files and comment out any application you dont want the docker to run:
- For Development build ./docker-compose.yml
- For Production build ./docker-compose.prod.yml
- RENAME ./.env-example file to ./.env
- EDIT the same ./.env file (like previously at step 11.)
- Default DB is using root user - MySQL Docker image is not creating another one.
- Define everything like before (these variables will be used in the mysql docker image to setup the database and also in the nodejs app to connect to the db)
FRONT_END_IP
depends on whether you are running it on your local machine or remote server. In the case of a remote server you need to use the external IP of the machine.PROXY_IP
is used in the NodeJS application to target the Web Service that serves the resources. Even at development you may need to use the network's IP of your machine to target the application correctly.
- Same like step 3. before at manual setup
- Same like step 5. before at manual setup
- RUN the docker-compose file in the root directory:
- For Development RUN
docker-compose -f docker-compose.yml up --build -d
- For Production RUN
docker-compose -f docker-compose.prod.yml up --build -d
- For Development RUN
- Make sure you navigate to http://localhost:5001/ and copy the table ./backend/db/tbl_users.sql inside the running MySQL application defined
DB_DATABASE
- Voila! The full application is app and running at http://localhost:4200/