If you deploy an APP on an Alibaba Cloud server, there may be some operations that need to be completed. The instructions below can serve as a reference.
With the growing popularity of mobile communication devices, mobile internet plays an increasingly significant role in internet communications. Pure web applications account for a very small portion of mobile internet; instead, APP software is emerging at a rapid pace, such as many APPs in the Apple iOS market and Google Android market. While some APPs operate through various app markets, many choose to rent their own servers and configure their own environments for operation. This approach offers greater autonomy and reduces restrictions found in comprehensive app markets. Many large-scale APPs adopt this self-operated model. If you plan to deploy an APP on an Alibaba Cloud server, the following steps may be worth your reference:
1. What kind of cloud server does an APP application require?
To help users understand how to use Alibaba Cloud ECS and related applications, Alibaba Cloud’s Mobile Cloud team developed a simple APP called “Mobile Cloud Album.” It primarily uses ECS to deploy the API services for the cloud album (image information retrieval, image list retrieval) and thumbnail processing. Since the application server was developed using Java, Tomcat was installed to deploy the application.
Specific Deployment Steps:
1. Remote Login:
After purchasing an ECS instance for the first time, the root account and password for the ECS server will be sent to the purchaser’s email. You can then remotely log in to the ECS server.
For specific remote login instructions, please refer to:
Windows: http://help.aliyun.com/manual?spm=5176.383518.5.16.4lLZzn&helpId=59
Linux: http://help.aliyun.com/manual?spm=5176.383518.5.16.4lLZzn&helpId=59
2. Install Web Environment:
Choose to install relevant web servers such as Tomcat or Jetty based on your application’s characteristics. Alibaba Cloud provides one-click installation and deployment scripts to provide more convenience for developers. Please refer to the following link: http://help.aliyun.com/manual?spm=0.0.0.0.RGeYy4&helpId=129
3. Package the Application:
Download the web source code locally and use the command `mvn package` to create a WAR file. If it is not a Maven project, you can use tools like Ant to create a WAR file.
4. Upload the WAR File:
On Linux, you can use SFTP to upload the WAR file. After uploading the WAR file to the specified directory, unzip it. For specific usage methods, refer to: http://help.aliyun.com/manual?spm=0.0.0.0.PnfpSL&helpId=1848
5. Start the Web Service:
Start the Tomcat or Jetty service.
6. Configure Reverse Proxy and Bind Domain Name:
For specific configuration details, refer to: http://help.aliyun.com/manual?spm=0.0.0.0.Ti7iuA&helpId=532, http://help.aliyun.com/manual?spm=0.0.0.0.MKbFj1&helpId=65
2. How can an APP store images on cloud storage servers?
The core architecture of image-based APP applications lies in the storage and access of a large number of small files. Storing files directly on hard drives when there are many files can significantly impact application access efficiency. Alibaba Cloud Object Storage Service (OSS) has great advantages in storing and managing massive amounts of small files. Images are no longer downloaded from the server, reducing server pressure. Alibaba Cloud OSS’s backup mechanism also ensures file storage security. Its storage capacity can be expanded infinitely, with over 50,000 requests per second, and multi-line BGP networks ensure smooth access across the country.
Steps to use Alibaba Cloud OSS:
1) Log in to the Alibaba Cloud official website (aliyun.com) and activate OSS.
2) Obtain the AccessKey ID and AccessKey Secret.
3) Download the SDK
(JAVA version download link: http://bbs.aliyun.com/job.php?action=download&aid=38817
Help Manual: http://aliyun_portal_storage.oss.aliyuncs.com/oss_api/oss_javahtml/index.html)
4) Start APP Development
It’s quite simple. Below is a code sample for uploading images using Alibaba Cloud OSS:
String upLoadURI = OSSClient.generateUploadUrl(Constants.SERVER_URL.GENERATE_URL, fileName, null);
int status = OSSClient.uploadFile(upLoadURI, path);
3. How to use cloud databases after moving the APP to the cloud?
To help users understand how to use Alibaba Cloud ECS and related applications, Alibaba Cloud’s Mobile Cloud team developed a simple APP called “Mobile Cloud Album.” It uses the MySQL service provided by RDS. The database mainly stores user-uploaded image information, including original images, thumbnails, and storage addresses, providing data retrieval via WEB API to clients.
Using Alibaba Cloud RDS is basically no different from using local databases. A usage example is as follows:
1) Create a Database Instance:
After purchasing RDS with an Alibaba Cloud account, you can create a database instance.
2) Create a Database and Management Account:
Create a database name and management account for the application to call the database connection.
3) Access the Database:
After creating the database (test), add an account: username ‘test’, password ‘test’ in the database test. You can view the database-related information in the RDS console, from which you can obtain the public IP address of the database, such as: xxxx.mysql.rds.aliyuncs.com. You can connect to the database using an application. Here is a sample code for connecting to the database using Java JDBC:
String url = “jdbc:mysql://xxxx.mysql.rds.aliyun:3306/test”;
String username = “test”;
String password = “test”;
try{
Connection con = DriverManager.getConnection(url, username, password);
}catch(SQLException e){
e.printStackTrace(); // Exception handling is required
}
For specific database access steps, please refer to: http://help.aliyun.com/manual?spm=0.0.0.0.dAfLT5&helpId=227