Skip to content

Latest commit

ย 

History

History
86 lines (59 loc) ยท 2.42 KB

File metadata and controls

86 lines (59 loc) ยท 2.42 KB

Readme for Todo App ๐Ÿ“

Installation ๐Ÿš€

  1. Install Node.js and NPM on Ubuntu:
    • Make sure you have Node.js 16.x and NPM installed on your machine. If not, you can install them using the following commands:
      curl -s https://deb.nodesource.com/setup_16.x | sudo bash
      sudo apt install nodejs -y

Configuration โš™๏ธ

  1. Update Backend URL:
    • Open the src/TodoApp.js file.
    • Locate the variable storing the backend URL and update it with the appropriate value. (* See Below for PrivateIp Configuration)

Building and Running ๐Ÿ—๏ธ

  1. Install Dependencies:

    • Run the following command to install project dependencies:
      npm install
  2. Build the Project:

    • Execute the following command to build the project:
      npm run build

Deployment ๐Ÿš€

  1. Deploy to Nginx Server:
    • Copy the generated artifacts from the build process.
    • Deploy the artifacts to your Nginx server. Ensure that the server is properly configured to serve the application.

* Using Private IP on the Backend VM ๐ŸŒ

To use a Private IP on the Backend VM, follow the steps below:

1. Configure NGINX on the Backend VM โš™๏ธ

Open the NGINX configuration file:

sudo nano /etc/nginx/sites-available/default

2. Insert Proxy Configuration ๐Ÿ”„

Copy and paste the following code just above the root /var/www/html line:

location /api {
   proxy_pass http://<PrivateIP of BackendVM>:8000;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Proto $scheme;
}

Replace <PrivateIP of BackendVM> with the actual Private IP address of your Backend VM.

3. Update Frontend Configuration โš™๏ธ

Open the src/TodoApp.js file in your frontend project.

Update the Backend URL by replacing the existing line with the following:

const API_BASE_URL = 'http://<FrontendVM Public IP>:80/api';

Replace <FrontendVM Public IP> with the actual Public IP address of your Frontend VM.

Important Note ๐Ÿ“Œ

Make sure to restart NGINX on the VM after making the changes:

sudo service nginx restart

These configurations enable communication between the Frontend and Backend using Private IP on the Backend VM. Ensure that the IPs and ports are correctly set to match your environment.

โšก