Home/Server & Website Managed Operations/Best Practices for Alibaba Cloud AppDeploy Operations and Deployment Tool
Server & Website Managed Operations

Best Practices for Alibaba Cloud AppDeploy Operations and Deployment Tool

Alibaba Cloud AppDeploy is a streaming command-line tool implemented via SSH, designed for application deployment and remote operations management. Operating on the Python platform, it offers excellent portability; AppDeploy uploads local application software to remote servers and executes user-defined product deployment commands.

The tool is currently available for free download at:
http://market.aliyun.com/products/53690006/cmgj000331.html
http://market.aliyun.com/products/53690006/cmgj000321.html

This article introduces AppDeploy through three usage scenarios:

1. Efficient Operations Management Commands:
1) Real-time server status monitoring
Execute the command: $ adep check_status to obtain detailed server information, including IP, route, DNS, resolve, iptables, mount, disk, load, etc.;

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::0

You can also add specific parameters after the command to view partial information. For example:
Currently supported: ip, route, dns, resolve, iptables, mount, disk, load;
$ adep check_status:resolve

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::1

$ adep check_status:disk

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::2

2) Real-time server bandwidth monitoring
Executing $ adepcheck_bandwidth in the command line will display the following dynamic data:

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::3

The data within the red boxes are as follows:
Prompt to press “e” to exit monitoring mode: Note the input format here;
Real-time server inbound bandwidth data (dynamic display): Displays two common data formats, KB/s and Mb/s;
Real-time server outbound bandwidth data (dynamic display): Displays two common data formats, KB/s and Mb/s;

3) File upload and download:
Implemented via command-line similar to shell commands:
The specific servers, usernames, and passwords for operations are defined in the appdeploy.py file;

File upload command format: $ adep put:localfile,remoteFolder
There are no spaces between “put”, “:”, “localFile”, “,”, and “remoteFolder”;
LocalFile: Path and name of the local file to upload; RemoteFolder: Specific directory on the server to upload to;

File download command format: $ adep get:remoteFile,localFolder
There are no spaces between “get”, “:”, “remoteFile”, “,”, and “localFolder”;
RemoteFile: Name of the file to download from the server; localFolder: Local directory to store the downloaded file;
For example:

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::4

4) Remote command execution:
Implemented via command-line similar to shell commands:
The specific servers, usernames, and passwords for operations are defined in the appdeploy.py file;

Remote command execution format: $ adep run:shellCommand
There are no spaces between “run” and “:” and “shellCommand”;
ShellCommand: The command executed remotely; if it contains spaces, enclose it in quotes;

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::5

5) One-click update of server sources
Enter $ adep update_source in the command line
This updates the source configuration on the server, supporting source updates for multiple versions of Ubuntu, CentOS, Redhat, Opensuse, Debian, and other systems;

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::6

2. One-Click Deployment of Web Server: MySQL + Nginx + PHP
1) Enter the following definition in appdeploy.py
def runtime():
componets={“nginx” : “1.4.4”,
“php” : “5.6.11”,
“mysql” : “5.6.26”
}
install_runtime(componets)

2) Execute the following command in the command line. Since all installations are from source code, the installation will take relatively longer.
$ adep runtime

3) Application deployment online: Upload your PHP project
The following code indicates uploading the local PHP project to the server directory /aliyun/www/phpwind;
def deploy_php():
put(“./php/*”, “/aliyun/www/phpwind/”)
Execute: $ adep deploy_php

4) Verify application deployment results

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::7

3. One-Click Deployment of Web Server: JDK + MySQL + Nginx + Tomcat
1) Enter the following definition in appdeploy.py
def runtime():
componets={ “jdk” : “1.8.0”,
“nginx” : “1.4.4”,
“tomcat” : “7.0.63”,
“mysql” : “5.6.26”
}
install_runtime(componets)

2) Execute the following command in the command line. Since all installations are from source code, it will take relatively longer.
$ adep runtime

3) Application deployment: Upload your Java project
The following task will compile, package, and upload the local Java project to the server (based on Maven; AppDeploy will automatically detect if your Maven program is installed. If not, it will install it automatically), and finally upload it to the server’s /aliyun/server/tomcat/webapps directory;
def pack_deploy():
componets={“plugin”: “maven”,
“project_dir” : “./java/myFirstWebApp”,
“web_dir” : “/aliyun/server/tomcat/webapps”
}
package(componets)
deploy(componets)
Execute: $ adep pack_deploy

4) Verify application deployment results

::__IHACKLOG_REMOTE_IMAGE_AUTODOWN_BLOCK__::8

FREE CHECKUP

Free server checkup

We will send a problem checklist and remediation advice within one business day — no obligation to engage.

135 410 16684
Weekdays Mon – Fri 10:00 – 22:00 (UTC+8) · 7×24 emergency response
Call now
CONTACT

Contact Us

How can we help?

* Required