A webService to retrieve data from the control room
A visual representation of the endpoints and the objects associated can be seen here using swagger.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Install the latest version of Node.js: https://nodejs.org/en/
Install Chocolatey: https://chocolatey.org/install
Or brew if you are on a Mac: https://docs.brew.sh/Installation
Then Install Yarn: https://classic.yarnpkg.com/en/docs/install/#windows-stable
Clone the project
In the terminal navigate into the project folder
run npm install
Acquire the config.json file from Todd or one of the other mobile app team members and place it in the main directory (same area as index.js).
In the terminal, navigate to the project folder
run node index.js
The service will attempt to connect to the host, which is production by default.
If you would like to connect to a local backend then install the backend (instructions: https://github.com/YCPRadioTelescope/RT-Contracts) and then change "host" in config.json to the address of the local backend
Go to aws and get an access key and a secret key
Set up Docker Desktop on your machine https://www.docker.com/products/docker-desktop
navigate to the project in the terminal
run docker build -t 'your username'/node-web-app . to create a new docker container
run docker run -p 49160:8080 -d 'your username'/node-web-app to test
run docker ps to get the container id
run docker logs 'container id' to ensure the app ran correctly
run zip ../myapp.zip -r * .[^.]* to create a zip bundle for aws
Login to AWS and go to the elastic beanstalk console
Click on the beanstalk itself
In the middle where it says running version, click upload and deploy
Upload the newly zipped bundle
Run yarn jest
connect ETIMEDOUT at Connection._handleConnectTimeout (C:....\rtWebService\node_modules\mysql\lib\Connection.js:412:13)
This occurs if the production database cannot be reached. Check if you are connected to the internet and you have a security inbound route set to your IP address.
Instructions to fix:
Log in to AWS
Click on RDS
Click on DB instances
Select ycas-rt-production
Under connectivity and security, click the link under VPC security groups
Click the Inbound tab and press edit
Find your rule (or create a new one if you dont)
click source and set to my IP
error should disappear