☁️Free Practice for CodeArts

Ozan Timur
Huawei Developers
Published in
6 min readMar 29, 2024
CodeArts Free Practice

Introduction

Hi everyone, in this session I will show all the steps for setting up a free demo website on Huawei Cloud CodeArts🙌 This demo will be built in the Singapore region. If you follow me carefully you can deploy your own projects in the Singapore region 💮

Build Process

Firstly we need to create a project, we will choose a DevOps Full-Process template. This project includes all the steps which I will show ⭐️

Creating a project on CodeArts

Now, let’s check the repository from the DevOps Full-Process template on CodeArts Repo. This is a service where you can store your codes like GitHub. When you click the phoenix-sample, you can see the source files.

Project Repository

After making sure to see the source codes, let's build the project. Go to the CodeArts build tab and execute build phoenix-sample-ci. CodeArts Build is the best place to build your codes which were created before or now.

CodeArts Build

Click to edit task and configure build steps as you wish. General info; CodeArts automatically suggested the most suitable build for our codes.

Now we will fill in the parameters in the build task. But before that, we have to open an organization and get our information via SWR. Open SWR and click Create Organization and give a name. Then, click the generate login command.

Creating organization on SWR
Generating Login Command

After -u is our username, -p is the password and the last one is the code repository address.

Parameter settings

Now, we can fill in parameters like the image above. We should write the code repository address for dockerServer parameter. It starts with SWR and ends with com.

After running the build

After filling parameters, let's click save and run. We can follow the build steps. We can detect the problem on this page if we get an error.

SWR organization

When the build is finished successfully, images will be at the organization which is created before.

Check the images inside of the organization

You can also check the images by clicking the organization name.

Creating ECS and implementing it to the project

Next step we will create an ECS (Elastic Cloud Service) with Linux OS. ECS provides secure, scalable, on-demand compute resources, enabling you to flexibly deploy applications and workloads 🌟

Lets open Elastic Cloud Service(ECS) and click the buy ECS.

ECS purchase settings

When creating ECS, don’t forget to pay attention to the red areas marked in the images. Most importantly, there are free machines in the Singapour region. You should be careful about which service you buy.

ECS machine settings

Select the free machine and disk.

ECS network settings 1

Select a created VPC and a security group.

❗ Don’t forget to assign EIP(Elastic IP) to access the internet and set a security group with opened web ports 5000 and 5001❗

ECS network settings 2

We will also use free EIP for online access. Just click traffic, do not choose any bandwidth size.

ECS user settings

Let's give a name and password for ECS. Do not forget your password. We will use the password on Codearts. After that, confirm the agreement. Congrats, you bought an ECS 😊

Implementing ECS to CodeArts

After buying an ECS, we have to add it to CodeArts. We can do this from the settings.

Decide the name of Host Cluster

After clicking to create a host cluster, just give a name. We don’t have to change OS or host connection mode. A proxy connection is more reliable but we will use a direct connection. Because it’s just an example demo.

Import the ECS

Then, we will add the ECS. We created the ECS in the same region. So, we can click the import ECS. Thanks to Cloud Service, we can easily see and add the ECS to CodeArts.

Enter ECS access information

On that page, you should just enter the username, password, and SSH port number. The username and password were created when we bought ECS. Ssh port is always 22.

Check verification result

After clicking ok, the verification result should be successful. If it’s not successful, check the information of ECS.

Deployment

Let’s deploy the project 😊

Deploying the Docker

Firstly, we will choose the phoenix-sample-predeploy. The purpose here is to install docker in ECS and add the necessary libraries.

Deployment environment

In order to complete our goal, we will define the ECS we will use in the deployment. So, we are creating an environment in the deployment.

Adding environment to deployment

After creating the environment, we will just choose the environment from deployment actions. Then click save&deploy and start the deployment.

Result of predeploy

You should also get successful result on this page. In this way, we install the tools of the project.

Deployment of the last part

Secondly, we will deploy the second step. In this deployment, we will execute the project. Let's click phoenix-sample-standalone.

Creating environment

Create the environment in the same way as the previous step.

Adding the environment to deployment

Then just change the environment on the deployment actions page.

Parameter settings

And the last part, we will add the username, password, and repository address to the parameters. Now we can save and deploy.

End of deployment

And result should also be successful on this page. In this way, we deployed the project to the ECS.

Now, we can access the website with EIP. We can easily take the EIP from the ECS page.

Getting EIP

At the information of the ECS, public IP is listed. Copy that.

Project website

Congratulations!🎉 You have successfully run the project and prepared it for use.

👉Conclusion

In this article, we created a free CodeArts project!💮 We work on this by using the free services and project source codes that Huawei Cloud provides to its users. You can use this article as an example in your private work or other projects. I hope it was a useful article for you. Stay healthy! 🙌

💁REFERENCES

--

--