Web+: The Web App Service (Part 4)

Image for post
Image for post

By Shantanu Kaushik

Alibaba Cloud has come up with a number of products that decrease the total time taken in the software development lifecycle. These products and services work in-sync with each other to host an environment best suited for a business or organization. One of the products is the Web App service. We have discussed different aspects of the Web+ service in this article series. Now, we will conclude everything with three additional “How-to” topics.

  1. Deploying Jenkins with the Web App service
  2. Using the Command Line Interface (CLI) for Deployment
  3. Deploying an Application with the Web+ Console (GUI)

Jenkins | Web App Service | Alibaba Cloud

Quick Info: Jenkins is an open-source automation tool that is used for Continuous Integration. It enables a user to develop and test applications. Continuous Integration of Jenkins counts for better productivity and ease of access for any developer. Continuous Integration is one of the most important phases in a DevOps lifecycle and provides better and more refined practice.

Image for post
Image for post

As the whole DevOps practice depends on how well your phases are aligned with each other, Continuous Integration counts for one of these vital steps.

Let’s look at how Jenkins comes into play with Web+ that works with Alibaba Cloud IAC.

Image for post
Image for post

Let’s take a look and follow these steps to install and use Jenkins with Web+:

1. Successfully activate Web+ and related services needed for deployment.

2. Download the deployment package for Jenkins. You can follow this link to download Jenkins.

3. Now, within your Web App console, make sure to select the right region. In my case, it is Mumbai (India.)

4. Within Tech Stack Type :arrow_right: Select “Java”

5. Within Application Name :arrow_right: Choose a name of your choice (Jenkins)

6. You can select the Use Free Storage Space option to use the available free storage locally

Note: Disabling this option is a more secure way to store data. When you disable this option, everything is stored in the connected Object Storage Service (OSS).

7. Select the Tech Stack Version

8. Give a name to the environment example: doc — demo-env.

9. Within “Package Source”, upload the previously downloaded Jenkins Package

10. Now Select “Preset Configuration” in the custom field within Configurations.

11. Click on “Create” with Custom Configuration and press OK

12. You can select Elastic Compute Instances (ECS) within the “Host Instance” section and select your login credentials for the ECS instance.

13. Click “Finish”

14. Now, log in using the password you created for the ECS instance and run the command:

cat /home/admin/.jenkins/secrets/initialAdminPassword

15. Write down the administrator password that is displayed in the output

16. Unlock Jenkins using this password

17. Click on “Install suggested plugins

Note: You can also select the plugin you wish to install

18. Create the first admin user. Use your username and password.

19. Click Save and Continue

20. Within the Instance configuration, confirm your Jenkins URL

21. Click Save and Finish

22. Restart and you are ready to go

Jenkins provides a great environment when your DevOps practice is highly influenced by Continuous Integration (CI). With Web+ and Jenkins, the entire productivity takes a step further and provides you with a better system.

Using CLI for Deployment | Web+ | Alibaba Cloud

First, let’s install the wpctl interface in Linux.

In your terminal, run the following command:

eval "$(curl -s -L https://webplus-cn-shenzhen.oss-cn-shenzhen.aliyuncs.com/cli/install.sh)"

If you are already using a CLI and wish to upgrade it, you can use the following command:

rm /usr/local/bin/wpctl

Now, let’s configure the Command Line Interface (CLI) tool

For this step, you will need the AccessKey ID and AccessKey secret from your Alibaba Cloud account. Make sure to keep these handy. Now run the command here and replace both AccessKey ID and AccessKey secret with your values and create a folder. I will name the folder “CLIdemo”.

wpctl configure --access-key-id "$ALICLOUD_ACCESS_KEY" --access-key-secret "$ALICLOUD_SECRET_KEY" --region "$ALICLOUD_REGION"  --profile demo

For me, ap-south1 is the Mumbai data center of Alibaba Cloud. Make sure to select the correct region.

Clone Your Program

git clone https://alibabacloud.com/alibabacloud-CLI-demo-java.git && cd alibabacloud-webplus-cli-demo

You can replace the URL with your program’s URL.

Create an Application

After you have cloned the application, run this command to create a package:

mvn package

Now, you have to upload this package to your deployment environment. If there is no environment already present, this command will create one for you:

wpctl env:apply --package target/webplus-clidemo*.jar --label webplus--category Java --env webplusEnvDemo --app webplusAppDemo --create-on-absent

Run Your Application

Make sure you have purchased the necessary resources. If not, the Web App service will purchase the necessary resources for you before you start to access the application.

The first command here will let you switch to the newly created deployment environment and application:

wpctl env:use webplusEnvDemo --app webplusAppDemo

To verify that the switch is complete, run this command:

wpctl env:events

Now, after making sure that everything is in place, obtain the URL for your application by running this command:

wpctl env:info

Now, when you have the URL of your application, you can release it to the world. When you decide to deploy your application, Web+ automatically provisions the necessary resources like ECS instances and Server Load Balancer. These come into play depending on the load generated by your application.

Use this command to release your application to the world:

wpctl env:terminate --app webplusAppDemo --env webplusEnvDemo

Using the Web+ Console to Deploy an Application | Alibaba Cloud

Note: Provisioning resources that are under the pay-as-you-go model doesn’t require too much configuration. Alibaba Cloud has taken care of almost every aspect of this model. The best part is that the default setting itself suffices for most of the basic deployment scenarios. You can choose to custom configure these settings to increase or decrease the resources or automate the process by choosing a setting that best suits your deployment scenario.

Let’s follow these steps to deploy an application using Alibaba Cloud Web+

1. Log into your Web+ console

2. Go to the “Overview” page

3. Click on “Create”

4. Fill in the required information in the “Basic Information” pane

Here, you will need to fill in information, like Tech Stack Type, Application Name, and Description.

5. Click “Next”

6. Click on “Creation Complete” and then click OK

7. Navigate to the “Last Updated Environments”

8. Click on “Application and Environments”

9. Click on Application ID to see the details

10. Select your Deployment Name and click on “Overview”

11. Click on the link next to the Public IP Address to open the homepage of your application.

You have successfully deployed your application.

Conclusion

NEXT in Line

We will commence a discussion about the API Gateway and start a 3-part series on API Gateway by Alibaba Cloud.

The views expressed herein are for reference only and don’t necessarily represent the official views of Alibaba Cloud.

Original Source:

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store