Actually completed the development and deployment of Spring Boot applications using only a browser!

Recently, I was fortunate to try out a new product of Alibaba Cloud: the cloud development platform , and experience a brand new development model! Although there were some problems in the middle, the overall experience revealed a sense of the future, because the whole process did not need to use our most commonly used IDEA, relying only on the browser to put a Spring Boot trunk online!

What is a cloud development platform? The cloud development platform ( https://workbench.aliyun.com ) is a cloud-based R&D work platform provided by Alibaba Cloud for developers to help R&D teams achieve online work (team online, environment online, code online, collaborative online ) And Serverless R&D model, to help R&D teams realize the efficient sharing and dissemination of industry architecture experience and architecture services, which greatly improves R&D efficiency and reduces R&D costs.

Next, I will share how to develop and deploy Spring Boot applications on this platform! If you are interested in children's shoes, you can click to enter the cloud development platform and experience the complete development experience with me step by step!

Basic configuration

Step 1: Create a new application

Step 2: Select "Microservice", and select "Spring Boot Application Migration Solution (SAE)" or "Spring Boot Application Migration Solution (ASK)" as the solution. I have written a lot of Spring Boot examples before , so let's use the migration plan to try to pull in the already developed Spring Boot scene!

Step 3: Enter the information related to the Spring Boot application

After clicking "Finish", you can see the newly created hello-world application in the application list.

From the above card elements, we can see that although it is just a simple creation of an application operation, it actually does a lot of things, such as: allocating the environment, creating a Git repository, etc.

Application development

There are two ways to develop in the cloud development platform: online development (completed in the browser), offline development (traditional editor development).

Online development

Click "Development and Deployment" in the application card, and you will be taken to the following cloud development page:

In the middle left position, you can see the files already in the project (mainly some mirror construction configuration, running scripts and documentation, etc.).

Take out our previous Spring Boot sample (if you haven't played Spring Boot, see the free series of tutorials ), drag a Spring Boot application written before to try:

After dragging in the code, according to the specification requirements of the cloud development platform, some changes to the project organization are required, so open pom.xml and make the following configuration changes:

  1. Add applicationName configuration in properties, must have, cannot be omitted
  2. The finalName configuration added in the build must be consistent with the applicationName, so it can also be used by reference
  3. Configure the spring-boot-maven-plugin plug-in, use ZIP as the packaging format, and pay attention to modifying the application main class path

online test

After importing the project, we tried to run the application.

  1. Click on the "Terminal" tab at the bottom
  2. Enter in the command line: mvn spring-boot:run

Not surprisingly, the terminal will output something similar to the following, and the application will start successfully!

But the application is launched on the cloud platform, not locally, how do we verify the interface provided by the application?

Click the "Preview" button above, and then enter the port number you want to expose in the pop-up box at the top, for example: 8080

According to the prompt, after pressing Enter, a prompt will appear at the bottom right of whether to access immediately, and you can directly click on access to enter the accessible domain name address (the address is mapped to the startup address on the cloud platform)

file

Code submission

After completing the above related development work, we usually pay attention to the code submission. At this time, you can click on the branch icon on the left to modify the code to commit

Then click the arrow at the bottom left to push the code into the warehouse (for Git-related operations, I didn't get my head at first, not very smooth, I look forward to better user experience improvements in the future)

Local development

Maybe you may feel that the current online editor is not powerful enough. For example, we saw above that the pom.xml has not been highlighted yet. Then at this time, you can also choose the local development mode. Just click "Code Repository" in the application card, enter the following page, enter and save your local ssh key, and then you can pull the Git repository of the application to the local for development according to the code repository!

file

Tips: You can see that the warehouse name here is constructed by date and time. If you use online development, it's okay, it's not sensitive to this content. But if you want to develop locally, such naming is not so friendly to users, and sometimes they think it is a temporary directory, looking forward to subsequent improvements!

Application deployment

After completing application development and local testing, all we have to do is application delivery and deployment. So, let's try the deployment function of this platform next!

Before deploying, we need to check whether the current environment has the deployment conditions. Click the "Environment Management" button in the application card, you can see the following page:

file

If there are dependent cloud services that have not been activated, click Activate Now to activate the services one by one. The deployment process will not be completed normally if it is not continued.

If your application involves the use of some environment variables, then continue to click the "application configuration" in the application card to set.

file

If your application needs to be developed by multiple people, you can use Aliyun account to join other developers in "Member Management", and they can access your application code just like you.

file

Ready, continue to the topic. Continue to open the development deployment interface, click the first button in the left column, you can see the deployment column pops up:

file

Choose the environment to be deployed (daily environment, pre-release environment, online environment), first select the first environment: daily environment, and click Deploy.

Regarding the environment, visual inspection here cannot add or modify the environment. Still look forward to a certain degree of flexibility in the configuration of the environment, no matter from the name or the number of environments, there are still many different possibilities for different management styles.

file

Click "Continue Deployment" to start the entire CI and CD process:

file

Enter from the log link in the log, you can also see the current container construction:

file

If something goes wrong, click the log to see the specific situation, such as:

file

If your services have been activated before and the project configuration is ok, then the deployment will be completed as follows. After the deployment is complete, the accessible domain name will be output, and you can use it to access the interface you provide to verify whether the application starts correctly.

file

Continuous deployment

Above we have completed the deployment of an environment, which has covered the basic operations of CI and CD. Let's try the flexibility of the continuous deployment (CD) part.

In the deployment bar, choose another environment to try

file

You can see that there is a special option: publish the daily environment to the pre-release environment. After checking, it is to deploy the image of the daily environment to the pre-release environment, which conforms to the definition of CD. If it is not checked, it will be recompiled and then deployed, which is another complete CI + CD process.

file

App offline

The offline operation is very simple. You only need to find the button corresponding to the environment in the corresponding application card. If it is in the green status, it is in service. You only need to click to start the offline operation of the application.

file

However, the current offline sometimes encounters a slower situation, for example, I clicked offline in the card, and the status in the card has changed to Offline, but it cannot be redeployed in the development deployment page, and the log shows that it is still uninstalling task.

file

Some tips

The environment description in the log does not match the environment definition, it is recommended to have a unified description and explanation

file

xml is not highlighted, editing is a bit difficult

file

After starting the deployment, there is no manual termination operation, if the operation is wrong, you can only wait

file

The first article of this article: Actually completed the development and deployment of Spring Boot applications using only a browser! ,Please indicate the source.

to sum up

Although there are still some discomforts in using the new product of the cloud development platform, the overall user experience can still solve many development efficiency problems, especially for independent developers like me (the content of collaboration is still weak, but I don’t Need, haha). Basically, I can cover the most commonly used functions from development, testing, and launching. At the same time, the development platform in the browser is my favorite. Although there is still a big functional gap compared with IDEA, the basic functions Already, there are no obstacles in the development process. However, because there is no need to configure the operating environment, install the editor, etc., the development work becomes relatively lightweight.

There is also a little discovery that makes people have more associations. In the menu of the platform, click the headline in the upper right corner, click "Account Settings", and jump to the Alibaba Cloud version of the team collaboration software Teambition: cloud-effect collaboration. Therefore, I felt that the collaboration function was still relatively weak before, and there may be more room for development in the future. The combination of the two will be able to get through all the way from demand management, R&D management, operation and maintenance management in the future, but what will be done? Look forward to the follow-up of this platform to show us their products!

Welcome to pay attention to my official account: Program Ape DD, to get exclusive learning resources, daily dry goods and welfare gifts.

Guess you like

Origin blog.csdn.net/dyc87112/article/details/108592610