Huawei Cloud Yunyao Cloud Server L Instance Evaluation | Yunyao Cloud Server L Instance Deployment Sokoban Classic Mini Game

I. Introduction

Yunyao Cloud Server L instance is a new generation of lightweight application cloud server, specially designed for small and medium-sized enterprises and developers, providing a convenient out-of-box experience. This product provides rich and strictly screened application images and can deploy applications with one click, greatly simplifying the process of customers building e-commerce websites, web applications, applets, learning environments, and various development and testing tasks in the cloud.

Insert image description here

2. Introduction to Sokoban mini-games

2.1 Introduction to Sokoban mini-game

Sokoban is a puzzle game where players need to control the protagonist to push the box to the designated location. The rules of the game are very simple, but the difficulty is high and requires players' patience and thinking.

2.2 Sokoban mini-game gameplay

In the game, players need to walk to the back of the box and press the arrow keys to push the box forward. The box can only move forward one unit and cannot be pulled back or jumped over other objects. The goal is to push all the boxes to the designated location to complete each level. Each level has a different layout and difficulty. The Sokoban game has many versions and variations, such as setting time limits, adding obstacles, etc. It is considered a very interesting and exciting puzzle game suitable for players of all ages.

3. Introduction to this practice

3.1 Introduction to this practice

1. This practice is a personal test learning environment, aiming to quickly deploy applications. Please be cautious in the production environment;
2. This practice environment is a Yunyao Cloud Server L instance, and the application image used is Portainer 2.18.4;
3. Due to the use The application image is Portainer, and the cloud server has automatically deployed the Docker environment;
4. Deploy the Sokoban classic mini game on the Huawei Cloud Yaoyun Server L instance.

3.2 This environmental plan

Server category Application image Intranet IP address Docker version Portainer version
Yunyao cloud server L instance Docker visualization Portainer 192.168.0.168 24.0.4 2.18.4

4. Purchase an L instance of Yunyao Cloud Server

4.1 Purchase Yunyao Cloud Server L instance

  • Purchase steps:

1. Official website link: https://www.huaweicloud.com/product/hecs-light.html
2. Purchase specifications:
Region: North China-Beijing IV;
Application image: Docker visualization-Portainer;
Instance specifications: 2 cores 2G/system Disk 40G/peak bandwidth 3Mbps/traffic package 400G;
instance name: Customize it, edit it here as HECS-L-Portainer;
purchase duration: 1 month.

  • Just pay after selecting the specifications.

Insert image description here

4.2 Check the status of Yunyao Cloud Server L instance

  • Check the status of the purchased Huawei Cloud Yaoyun Server L instance. It is running normally after startup. This is the status when it was first purchased. The expiration time will be displayed, which is generally calculated from the current purchase time.

Insert image description here

4.3 Reset server password

  • Click to remotely log in to Yunyao Cloud Server L instance

Insert image description here

  • Enter the Huawei Cloud web version Shell tool CloudShell.

Insert image description here

  • Reset password: Click the reset password option on the right. Identity verification is required. After selecting mobile phone verification, the password can be reset successfully.

Insert image description here

Insert image description here

4.4 Xshell remote connection server

  • Copy the elastic public IP address of Yunyao Cloud Server L instance and use it when connecting to the server remotely.

Insert image description here

  • In the Xshell tool, fill in the server's elastic public IP address, account and password information, and connect to the remote server via ssh.

Insert image description here

5. Check the server environment

5.1 Check operating system version

Check the operating system version of the Huawei Cloud Yaoyun Server L instance. The current version is Ubuntu 22.04.1 LTS.

root@hcss-ecs-f91c:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

5.2 Display basic system information

Use the neofetch command to see basic system information.

neofetch

Insert image description here

5.3 Check Docker version

Check the Docker version, the current version is 24.0.4.

root@hcss-ecs-f91c:~# docker -v
Docker version 24.0.4, build 3713ee1

5.4 Check Dokcer service status

Check the Docker service status to ensure that the Docker service is running normally.

root@hcss-ecs-f91c:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-09-27 15:05:06 CST; 6h ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1058 (dockerd)
      Tasks: 57
     Memory: 155.2M
        CPU: 1min 2.109s
     CGroup: /system.slice/docker.service

5.5 Check docker compose version

Check the docker compose version, the current version is v2.19.1.

root@hcss-ecs-f91c:~# docker compose version
Docker Compose version v2.19.1

6. Deploy the Sokoban pushing box game

6.1 Download Sokoban image

Pull the image from the Huawei Cloud container image warehouse. The image name is: swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0.

root@hcss-ecs-f91c:~# docker pull swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0
v1.0: Pulling from jeven/sokoban
550fe1bea624: Already exists
af3988949040: Already exists
d6642feac728: Already exists
c20f0a205eaa: Already exists
d9a28c88a4e8: Pull complete
Digest: sha256:924afeb83309bdd774031dad7e45b6943ee8a60ed441829c265b9924b5fdae57
Status: Downloaded newer image for swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0
swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0

6.2 Deployment using docker-cli

Use docker-cli to quickly deploy the Sokoban pushing box game.

docker run -d \
   --restart always \
   --name sokoban \
   -p 8900:80 \
  swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0 

6.3 Deployment using docker compose

Use docker compose to deploy the Sokoban box pushing game. This practice uses this method to deploy.

version: '3.6'

services:
  sokoban:
    image: swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0 
    container_name: sokoban
    restart: always
    ports:
      - 8900:80
    deploy:
      resources:
         limits:
            cpus: "2.00"
            memory: 1G
         reservations:
            cpus: "1.00"
            memory: 200M

6.4 Create Sokoban container

Use the following command to create a Sokoban container.

docker compose up -d

Insert image description here

6.5 View container status

Check the running status of the container to ensure that the Sokoban container starts normally.

root@hcss-ecs-f91c:~# docker ps
CONTAINER ID   IMAGE                                                 COMMAND                  CREATED          STATUS          PORTS      NAMES
cd1a3539fa07   swr.cn-north-4.myhuaweicloud.com/jeven/sokoban:v1.0   "nginx -g 'daemon of…"   19 minutes ago   Up 19 minutes   0.0.0.0:8900->80/tcp, :::8900->80/tcp      sokoban

7. Try the classic Sokoban Sokoban game

7.1 Release security group ports

Enter the security group management page of Huawei Cloud Yaoyun Server L instance and allow the inbound port 8900.

Insert image description here
Insert image description here

7.2 Try Sokoban mini-game

Access address: http://Elastic public network IP address: 8900, you can access the web page of Sokoban mini game, come and play happily!

Insert image description here

8. Summary

This time "Huawei Cloud Yaoyun Server L Instance Evaluation|Yunyao Cloud Server L Instance Deployment Sokoban Classic Game" was successfully deployed. The overall experience of using the Huawei Cloud Yunyao Server L instance is good, the network connection is stable, and the operation is smooth and free of lags. In particular, the use of application images greatly facilitates daily use. For example, the Portainer application image can automatically provide us with a Docker environment, saving the deployment time of the Docker environment, which is very useful. Through Docker container technology, we can maximize the use of Yunyao Cloud Server L instance resources and deploy more services and applications. Huawei Cloud Yaoyun Server L instance is a cost-effective cloud server that is worth buying!

Guess you like

Origin blog.csdn.net/jks212454/article/details/133418756