Deploying FCJ Management Application
Deploy FCJ Management application
- We use git to clone the source code. First of all, install git with the following command:
sudo yum install git
- Use the git init command used to create and initialize a new Git repository (Git Repo) locally.
git init
- Make a clone of the application code repository
git clone https://github.com/First-Cloud-Journey/000004-EC2.git
- Go to the directory of the lab 000004-EC2
cd 000004-EC2
- 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
-
Next we do the dependencies installation
- express
- Dotenv
- express-handlebars
- body-parser
- mysql
npm install express dotenv express-handlebars body-parser mysql
- 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.
- 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
- Restart the Express server. Use Nodemon to save time
npm install --save-dev nodemon
- Start the local server
npm start
- Access to EC2
- Select Instances
- Select FCJ-Management instance
- Copy Public IPv4 address
- Use the browser and paste the Public IPv4 address and port to test the application. Syntax
<Public IPv4 address>:5000