Guide: Deploy your application using the Alibaba Cloud Toolkit plugin

This article presents best practices for writing commands when deploying applications using the ** Alibaba Cloud Toolkit ** plugin.

This article provides best practices for writing commands when deploying the following applications using the Alibaba Cloud Toolkit (https://cn.aliyun.com/product/cloudtoolkit_en) plugin.

--Standard Java Web Tomcat application --Standard Java Fatjar application --Standard Spring Boot application --Standard Go application

Standard Java Web Tomcat application

image.png

Suppose / root / tomcat / on your Linux system is the root directory of your Tomcat application, as shown above. You need to deploy the Java web application WAR package (javademo.war) in this / root / tomcat / webapps directory.

The corresponding command configuration is as follows.

sh /root/sh/restart-tomcat.sh

The contents of the restart-tomcat.sh script are as follows.

source /etc/profile
killall java
rm -rf /root/tomcat/webapps/javademo
sh /root/tomcat/bin/startup.sh

The / ect / profile file is used to set environment variables and contains the following:

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
export JAVA_HOME=/usr/share/jdk1.8.0_14
export PATH=$JAVA_HOME/bin:.....

Standard Java Fatjar application

Suppose the / root / javademo directory on your Linux system is used as the root directory for your Java application. You need to deploy the Java application jar package to the / root / javademo directory.

The corresponding command settings are as follows.

sh /root/sh/restart-java.sh

The contents of the restart-java.sh script are as follows.

source /etc/profile
killall java
nohup java -jar /root/javademo/javademo-0.0.1-SNAPSHOT.jar > nohup.log 2>&1 &

Standard Spring Boot application

Suppose your Linux system's / root / springbootdemo directory is used as the root directory for your Spring Boot application. Deploy the Spring Boot application jar package (springbootdemo-0.0.1-SNAPSHOT.jar) to the / root / springbootdemo directory.

The corresponding command settings are as follows.

sh /root/sh/restart-springboot.sh

The contents of the restart-springboot.sh script are as follows.

source /etc/profile
killall java
nohup java -jar /root/springbootdemo/springbootdemo-0.0.1-SNAPSHOT.jar > nohup.log 2>&1 &

Standard Go application

Suppose the / root / godemo directory on your Linux system is used as the root directory for your Go application. You need to deploy the Go application executable (godemo) to the / root / godemo directory.

The corresponding command configuration is as follows.

sh /root/sh/restart-go.sh

The contents of the restart-go.sh script are as follows.

source /etc/profile
pkill -f 'godemo'
chmod 755 /root/godemo/godemo; 
sh -c /root/godemo/godemo

Recommended Posts

Guide: Deploy your application using the Alibaba Cloud Toolkit plugin
Deploy your application to EDAS using the Cloud Toolkit Maven plugin
Deploy a Node.js application to an ECS instance using the Cloud Toolkit
Deploy a Java application developed locally with the Cloud Toolkit to an Alibaba Cloud ECS instance
I tried using the Migration Toolkit for Application Binaries
Deploy your application to WildFly
How to deploy Java application to Alibaba Cloud EDAS in Eclipse
I tried using the cache function of Application Container Cloud Service
Deploy your application with VPC + EC2 + Docker.
Deploy Java application developed in IntelliJ IDEA environment to Alibaba Cloud ECS instance