This bash script automates the process of deploying a MERN (MongoDB, Express, React, Node.js) stack application on an Ubuntu server. It handles:
- 🔄 System updates and installation of necessary dependencies:
Node.js,Nginx,Certbot, andPM2. - 📂 Environment variable management: Prompts for and manages environment variables using a
.envfile. - 📦 App installation and build: Installs the backend and frontend dependencies, then builds the application.
- 🌐 Nginx setup: Configures Nginx as a reverse proxy for the Node.js app.
- 🔐 SSL setup: Automatically sets up SSL with Certbot for the provided domain name.
- 🛡️ Firewall configuration: Sets up the firewall to allow secure web traffic.