Deploying FCJ Management Application

Deploy FCJ Management application

  1. We use git to clone the source code. First of all, install git with the following command:
sudo yum install git

Deploy app

Deploy app

  1. Use the git init command used to create and initialize a new Git repository (Git Repo) locally.
git init

Deploy app

  1. Make a clone of the application code repository
git clone https://github.com/First-Cloud-Journey/000004-EC2.git

Deploy app

  1. Go to the directory of the lab 000004-EC2
cd 000004-EC2

Deploy app

  1. NPM stands for Node package manager is a tool to create and manage Javascript programming libraries for Node.js. Using npm init to initialize the project will generate a sample package.json file.
npm init

Deploy app

  1. Next we do the dependencies installation

    • express
    • Dotenv
    • express-handlebars
    • body-parser
    • mysql
npm install express dotenv express-handlebars body-parser mysql

Deploy app

Deploy app

  1. Do the test and create a .env file that uses vi to configure the database. Create .env file using touch .env command Use vi to open configuration.

Deploy app

Deploy app

  1. Perform database configuration
DB_HOST = 'db-instance.crmmitoajvxx.us-east-1.rds.amazonaws.com'
DB_NAME = 'awsfcjuser'
DB_USER = 'admin'
DB_PASS = '123Vodanhphai'
  • In which, DB_HOST is the Endpoint of the DB instance
  • DB_NAME is the name of the database created in the DB instance
  • DB_USER is the database username that was created in the DB instance
  • DB_PASS is the database password created in the DB instance

Deploy app

  1. Restart the Express server. Use Nodemon to save time
npm install --save-dev nodemon

Deploy app

  1. Start the local server
npm start

Deploy app

  1. Access to EC2
  • Select Instances
  • Select FCJ-Management instance
  • Copy Public IPv4 address
  1. Use the browser and paste the Public IPv4 address and port to test the application. Syntax
 <Public IPv4 address>:5000
  • Example: 3.91.32.39:5000

Deploy app