☁️Free Practice for CodeArts
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 ⭐️
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.
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.
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.
After -u is our username, -p is the password and the last one is the code repository address.
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 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.
When the build is finished successfully, images will be at the organization which is created before.
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.
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.
Select the free machine and disk.
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❗
We will also use free EIP for online access. Just click traffic, do not choose any bandwidth size.
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 😊
After buying an ECS, we have to add it to CodeArts. We can do this from the settings.
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.
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.
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.
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 😊
Firstly, we will choose the phoenix-sample-predeploy. The purpose here is to install docker in ECS and add the necessary libraries.
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.
After creating the environment, we will just choose the environment from deployment actions. Then click save&deploy and start the deployment.
You should also get successful result on this page. In this way, we install the tools of the project.
Secondly, we will deploy the second step. In this deployment, we will execute the project. Let's click phoenix-sample-standalone.
Create the environment in the same way as the previous step.
Then just change the environment on the deployment actions page.
And the last part, we will add the username, password, and repository address to the parameters. Now we can save and deploy.
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.
At the information of the ECS, public IP is listed. Copy that.
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! 🙌