Architecture Center
Deploy COVID-19 Tracker Web App on Alibaba Cloud

Deploy COVID-19 Tracker Web App on Alibaba Cloud

Overview
This solution deploys a simple cloud-native web app, COVID-19 Tracker, on Alibaba Cloud to visualize the spread and impact of COVID-19. You can subscribe for daily updates and view statistics information of the epidemic through this app.
Reference Architecture
Steps
Deploy Resources
Use this main.tf file in Terraform to provision ECS and ApsaraDB RDS for MySQL instances from this solution.
If you do not specify the provider parameters in the environment, please use the following command to set your Alibaba Cloud access key and secret key.
provider "alicloud" {
# access_key = "${var.access_key}"
# secret_key = "${var.secret_key}"
region = "ap-southeast-1" }
For more information about how to use Terraform, please refer to Getting Started With Terraform for RDS MySQL on Alibaba Cloud.
Install NodeJS
1 Go to ECS console. You can see the new ECS instance you just created. Log in to the instance.
The default account name and password of the ECS instance are:
Account name: root
Password: Aliyun-test
2 Run the following command to download the NodeJS installation package.
wget https://nodejs.org/dist/v14.17.1/node-v14.17.1-linux-x64.tar.xz
3 Run the following command to decompress the installation package.
tar -xf node-v14.17.1-linux-x64.tar.xz
4 Run the following command to create a command soft link. ln -s /root/node-v14.17.1-linux-x64/bin/node /usr/bin/
ln -s /root/node-v14.17.1-linux-x64/bin/npm /usr/bin/
5 Run the following command to check the node version and verify that NodeJS has been installed successsfully.
node -v
npm -v
Install COVID-19 Tracker
1 Download Project
1.1 Run the following command to install git.
apt update && apt -y install git
1.2 Run the following command to copy the sample project.
git clone https://github.com/yankidank/covid-19-tracker.git
1.3 Run the following command to enter the project directory.
cd covid-19-tracker
1.4 Run the following command to install project dependencies.
npm install --unsafe-perm
2 Import Data
2.1 Go to the Alibaba RDS console, find the RDS database you just created with Terraform. You can see the "covid19" database and account have been created automatically. You can also see the Intranet address of RDS.
2.2 Run the following command to install the mysql client.
apt -y install mysql-client
2.3 Run the following command to log in to the RDS instance database.
Note: Replace YOUR-RDS-INTERNAL-ENDPOINT with the intranet address of your RDS instance.
mysql -hYOUR-RDS-INTERNAL-ENDPOINT -ucovid19 -pAliyun-test -Dcovid19
2.4 Run the following command to create the "stats" table.
CREATE TABLE stats
(
id int NOT NULL AUTO_INCREMENT,
FIPS INTEGER NULL,
Admin2 VARCHAR(100) NULL,
city VARCHAR(100) NULL,
province VARCHAR(500) NULL,
country VARCHAR(100) NULL,
confirmed INTEGER default 0,
deaths INTEGER default 0,
recovery INTEGER default 0,
last_update datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
latitude Decimal(18,15) NULL,
longitude Decimal(18,15) NULL,
active INTEGER NULL,
combined_key VARCHAR(500) NULL,
primary key(id)
);
2.5 Run the following command to exit the database first.
exit
2.6 Run the following command to open the configuration file and modify the connection configuration of the database.
vim config/config.json
2.7 Run the following command to open the configuration file and modify the connection configuration of the database.
vim csv_to_mysql/read-file-4.js
2.8 Run the following command to execute the script file to import data to the database.
cd csv_to_mysql
node read-file-4.js
3 Get the Sparkpost Key
Log in to https://www.sparkpost.com to register an account and create an API key.
4 Run COVID-19 Tracker
4.1 Run the command vim /etc/profile and add the following content to the end of the file.
Note: Replace YOUR-API-KEY and YOUR-SECRET with the value you set.
export SPARKPOST_API_KEY=YOUR-API-KEY
export LOGIN_SECRET=YOUR-SECRET
4.2 Run the following command to activate the modification.
source /etc/profile
4.3 Run the following command to start the application.
cd /root/covid-19-tracker
node server.js
Visit http://ECS_Public_IP:8080 to view the graphical interface of COVID-19 Tracker.

Epidemic Prediction Technology

Predict the spread of COVID-19 and help decision makers evaluate the impact of control measures

Learn More >

Reach Alibaba Cloud experts for support

phone Contact Us