Web+: 3 "How-to" topics related to deployment
By: Alibaba Cloud
Tags: Deployment, Jenkins, DevOps, Web, Alibabacloud

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.

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

Jenkins | Web App Service | Alibaba Cloud

The Web app service or Web+ works on Infrastructure as Code (IAC). It is provided as a Platform as a Service (PaaS) to its users. When implementing using DevOps, many tools like Jenkins can prove vital to your project. Web+ supports application configuration templates that help to create an exclusive environment and that are the reasons behind a more scalable and customization friendly product.

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.

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.

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

The Web App service uses wpctl for the command line interface. Wpctl is a client that enables you to run commands for creating, managing, and deploying configurations in Web+. It is an alternative to the Web+ console that is a GUI based management platform for the Web App service on Alibaba Cloud. You can also replace the Web+ console with CLI.

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

The Web+ console presents you with a fully immersive GUI experience, where everything related to the Web App service can be managed and used to deploy applications. We are going to guide you through the process of deploying an application using the Web+ console.

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

Web+, the Web App Service from Alibaba Cloud is a PaaS service that works on an Infrastructure as a Code platform. This service provides users with endless benefits and an architecture to deploy their applications on, without having to worry about backend resource orchestration. Web+ includes most of the industry-leading products by Alibaba Cloud and provides users with productive possibilities to work with their application. Support of products like the Identity and Access Control (RAM) makes it one of the most desirable services to work with. Web+ settles itself into the product zone of the SDLC where DevOps Implementation is a viable scenario and most of the current trends and practices are being followed.

NEXT in Line

API Gateway — An Introduction

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: