Credits & Source from: https://github.com/sendmail2krrish/eCommerce-site-using-Node-Express-js
- Provision a Google Compute Engine (GCE)
- SSH into the db-server. Switch as root user using sudo -s and below command to install MySQL Server. When prompted for password give a strong like P@ssW0rd2020
apt update
apt install mysql-server -y - Comment bind-address configuration using vi /etc/mysql/mysql.conf.d/mysqld.cnf and save the configuration using ESC followed :wq!
- Restart MySQL Service using systemctl restart mysql
- Logging to mysql using mysql -h 127.0.0.1 -u root -p
- Create a database named eCommerce using CREATE DATABASE eCommerce
- Run this command GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'P@ssw0rd2020'; to allow mysql to be accessed from app-server
- Exit mysql session
- Change directory to home directory using cd ~ and run git clone https://github.com/learngcpwithmahesh/Dress4Win.git
- Change directory to Dress4Win/sql
- Create the table schema using mysql -h 127.0.0.1 -u root -p < ecommerce.sql
- Provision a Google Compute Engine (GCE) with below startup script
apt install -y git
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
bash nodesource_setup.sh
apt install -y nodejs
npm install -g forever
git clone https://github.com/learngcpwithmahesh/Dress4Win.git
cd Dress4Win
npm install
2. SSH into the app-server. Switch as root user using sudo -s and change the database IP address in database/config.js file
3. Now, run the Node JS app to in daemon mode using forever start index.js
4. Use the external IP of app-server to access the Dress4Win App