☁️Building Node.js Application Deployment Pipeline on Huawei Cloud CodeArts
Introduction
In this article, we will discuss what the CodeArts platform is and we will prepare a demo pipeline environment to learn how to manage an end-to-end project on this platform from project management to deployment with the CodeArts platform.
What is CodeArts?
CodeArts is a one-stop DevSecOps platform that provides out-of-the-box cloud services for requirement delivery, code commit, check, build, verification, deployment, and release throughout the entire software lifecycle.
CodeArts consists of several main parts. These parts include CodeArts Req, CodeArts Repo, CodeArts Pipeline, CodeArts Check, CodeArts Build, CodeArts Deploy, CodeArts TestPlan, and CodeArts Artifact.
High-Quality, Efficient, and Agile Delivery
- Supports customization and automation of code check, build, test, and deployment tasks, and provides continuous delivery pipelines with visualized orchestration, one-click application deployment, and zero wait for release.
- Incorporates guidelines and experience from Huawei into CodeArts Req, CodeArts Check, CodeArts TestPlan, and CodeArts Pipeline, effectively improving application R&D quality and detecting issues as early as possible.
Built-in R&D Security
- Security guidelines and protection capabilities from application design, development, test, and running to secure the application R&D supply chain
- Capabilities to check code quality security, web vulnerabilities, host vulnerabilities, open-source vulnerabilities and compliance, and mobile application security.
End-to-end Project Management
Using CodeArts, we will first set up a project management environment and add the relevant user stories, epics and tasks in the “CodeArts Req” section, assign them to the relevant people and start project management in order of priority.
After accessing the CodeArts service, we are greeted with the All Projects page. Here we can see our existing projects and create new projects. Since we don’t have a project yet, we create a new project by clicking the “Create Project” button.
After selecting “New”, we create a new project by entering the relevant project parameters.
Work
Here we can add new items such as epic in the work items section and update the related features such as start — end dates priority.
By going to the “Plans” section, we can see the project management steps such as epic, feature, story and task as a visual mindmap in this section and make the relevant updates.
Repo
From the left menu, we can go to the “Code” tab and start the development phase of our project. There are templates in different software languages and libraries. I choose Nodejs Webpack Demo and we see the codes.
Check
After we add our repo, we create a new “Check” template from the Check section and perform the check operations of our codes in the repo. We can start the check process with start check.
After the check is completed, if there are no issues in our repo, we get a “passed” output. If there was an issue, we would be able to see the related issues on the cards on the right side.
Pipeline
In the “Pipeline” section, we will create a CI/CD pipeline and our project will run on a specified flow and eventually deployment will take place. We will create a new pipeline by clicking on the “Create Pipeline” button.
We enter the pipeline information. We add some information such as our repo source, which repo it is, authorization and description and proceed.
I continue by choosing the NodeJS-Build template as a template. There are templates in different languages for your projects developed in different languages.
When I reach the pipeline task orchestration section, I can see my end-to-end pipeline. Here we can manage all the steps of the pipeline and add different job steps. You can configure a variable structure according to the project’s requirements. Various job definitions are available in the tool list on the right. You can continue by selecting the job you want.
I continue by selecting “Deploy” and it asks me to select a deployment template. I don’t have a deployment task so I will click on the “Create One” button and create a new task.
There are also different types of templates here. I continue by choosing the Nodejs Application template.
I am creating a new environment, I will use Linux and run my application on Ubuntu. After entering the relevant information, I proceed.
I need ECS information where I will run my application. If you don’t have any ECS, you need to go to the ECS page from the console and create an ECS with enough config.
I am creating a host cluster. I am not going to use a proxy, so I disable it.
In the second tab I need to select target host. In the modal that opens, I will define as host by adding my ECS information. I say import ECS and enter information such as ECS name, username, password, etc. This way, after the repo is built during the deployment phase, ECS will start serving on my host.
After selecting my host cluster, my relevant ECS is listed as ready for selection and I import it by selecting it.
I have prepared my environment and I can start the deployment process.
Some packages need to be uploaded to my target host for deployment. Since we are going to deploy a Nodejs application, we should install our packages in versions suitable for the project requirements. Here I continue by selecting the relevant node version. I have my deployment flow on the left side. We can make changes on this flow.
Now we have made our relevant deployment settings and let’s add the deployment phase to our pipeline. We select and add values such as task, host group and name.
Our demo pipeline is ready. When there is a change in the repo, the build will run, our file will be packaged and in the deployment phase, it will be uploaded to our server and ready for service. So we will have successfully completed the continuous delivery process.
I trigger the pipeline by clicking on the “Run” button. On the right we specify the execution configuration parameters and which stages to select. We can monitor the step-by-step task logs via the terminal.
In a short time, our pipeline completes, and the deployment process takes place. If there was any error, the pipeline would not complete and it would tell us at which stage there was an error and we would trigger the pipeline again after fixing the problem.
In the “Artifact” section, we can see the builder, versions and other release details.
Key Points
What we need to focus on in this demo is that since we are doing an end-to-end deployment, it is necessary to check all the selected parameters meticulously. Also, when doing deployment, it is very important to build the project as an executable project from the beginning to the end of the project and decide the architecture accordingly. Attention should be paid to these steps for the ability to manage multiple phases at the same time and especially for the continuity of project management.
Conclusion
In this article, we discussed how to deploy a Node.js application with a specific project management and deployment pipeline using the CodeArts platform. This demo provides us with the opportunity to use and learn about different yet interconnected domains. From project management to delivering the application to the end user, you manage and configure every single step. You acquire DevOps knowledge and grasp the importance of CI/CD pipelines in large projects.