Huawei Cloud Yunyao Cloud Server L Instance Evaluation | Yunyao Cloud Server L Instance Deployment Gogs Server
1. Introduction to Yunyao Cloud Server L Instance
1.1 Introduction to Yunyao Cloud Server L instance
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.
1.2 Features of Yunyao Cloud Server L instance
-
Intelligent and non-stuck: Huawei Cloud Qingtian architecture supports software and hardware collaboration combined with AI algorithm intelligent scheduling to provide you with high-quality performance. Huawei Cloud has a global storage and computing network with data transmission latency shorter than the blink of an eye, meeting the high requirements of low network latency scenarios such as games and audio and video.
-
Excellent price, easy to use: super cost-effective, ultra-low threshold, open to use as you like. Multiple instance specifications to balance performance and cost. Technology upgrades optimize cloud costs and benefit more start-ups and developers.
-
It’s easier to get started: order multiple images and resource combinations with one click. A variety of high-quality images have been carefully selected and rigorously tested by Huawei Cloud officials. They cover seven major scenarios and have preset templates, which are quick to build, safe and trustworthy. Automated orchestration, one-click activation of resources, and business online in minutes. Smooth learning curve, wizard-based application construction, and easy application activation.
-
Management is more worry-free: topology, resources, and mirroring are managed visually, and business architecture is transparently managed. Intimate service status reminders, one-click resource renewal and withdrawal, and simplified management. Real-time monitoring of resource load, security, and usage ensures that services are always online. A wide range of optional security services are available, including extensive backup, host security and other services, providing the highest level of security protection.
2. Introduction to Gogs
2.1 Introduction to Gogs
Gogs is a self-service Git service developed based on the Go language, which can provide a lightweight and easy-to-use Git server.
2.2 Features of Gogs
- User dashboard, user profiles and activity schedule.
- Access the repository via SSH, HTTP, and HTTPS protocols.
- User, organization and repository management.
- Repository and organizational webhooks including Slack, Discord and Dingtalk.
- Repository Git hooks, deployment keys, and Git LFS.
- Repository issues, pull requests, wikis, protected branches, and collaboration.
- Use the wiki to migrate and mirror repositories from other code hosts.
- Web editor for quick editing of repository files and wikis.
- Jupyter Notebook and PDF rendering.
- Authentication via SMTP, LDAP, reverse proxy, GitHub.com and GitHub Enterprise with 2FA.
- Custom HTML templates, static files and many other files.
- Rich database backends, including PostgreSQL, MySQL, SQLite3 and TiDB.
- Has localization in over 31 languages.
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 Gogs server on the Huawei Cloud Yaoyun Server L instance.
3.2 This environmental plan
Server category | Application image | Intranet IP address | Docker version | Portainer version | Operating system version |
---|---|---|---|---|---|
Yunyao cloud server L instance | Docker visualization Portainer | 192.168.0.168 | 24.0.4 | 2.18.4 | Ubuntu 22.04.1 LTS |
4. Remotely log in to Huawei Cloud Yaoyun Server L instance
4.1 Copy the elastic public IP address
Please purchase the Huawei Cloud Server L instance in advance. Since you have purchased it before, you can use it directly. Click to enter the Yunyao Cloud Server L instance management page and copy its elastic public IP address, which will be used later for remote connections and external network access.
4.2 Xshell remote connection server
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.
4.3 Check operating system version
When the Huawei Cloud Server L instance uses the Portainer application image, the operating system version used 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
4.4 Check Docker environment
Check the Docker version, the current version is 24.0.4.
root@hcss-ecs-f91c:~# docker -v
Docker version 24.0.4, build 3713ee1
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; 2 days ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 1058 (dockerd)
Tasks: 75
Memory: 72.6M
CPU: 2min 17.783s
CGroup: /system.slice/docker.service
5. Deploy Mysql database
5.1 Download container image
Pull the Gogs and Mysql images from docker hub.
docker pull gogs/gogs:latest
docker pull mysql:5.7
5.2 Create mounting directory
Create the mounting directory /data/gogs/{data,mysql}.
mkdir -p /data/gogs/{
data,mysql}
Authorize the /data/gogs/{data,mysql} directory.
chmod -R 777 /data/gogs/
5.3 Create Mysql container
Use the following command to create a Mysql container.
docker run -d --name gogs-mysql --restart always -e MYSQL_ROOT_PASSWORD=gogs -e MYSQL_DATABASE=gogs -e MYSQL_USER=gogs -e MYSQL_PASSWORD=gogs -p 3306:3306 -v /data/gogs/mysql:/var/lib/mysql mysql:5.7
5.4 Check Mysql container status
Check the status of the Mysql container to ensure that the Mysql container starts normally.
root@hcss-ecs-f91c:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
23b9dc78b17b mysql:5.7 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp gogs-mysql
5.5 Set Mysql user permissions
Enter the Mysql container and authorize the gogs user.
docker exec -it gogs-mysql /bin/bash # 进入mysql容器内
mysql -uroot -p # 连接本地mysql数据库
Authorize the gogs user.
GRANT ALL PRIVILEGES ON gogs.* TO 'gogs'@'%' IDENTIFIED BY 'gogs';
FLUSH PRIVILEGES;
6. Deploy Gogs
6.1 Create Gogs container
Execute the following command to create a Gogs container.
docker run -d --name=gogs --restart always -v /data/gogs/data:/data -p 10022:22 -p 3000:3000 --link=gogs-mysql:mysql gogs/gogs
6.2 View Gogs container status
Check the Gogs container status to ensure that the Gogs container starts normally.
root@hcss-ecs-f91c:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d50d4e85bb34 gogs/gogs "/app/gogs/docker/st…" 20 seconds ago Up 19 seconds (health: starting) 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp, 0.0.0.0:10022->22/tcp, :::10022->22/tcp gogs
23b9dc78b17b mysql:5.7 "docker-entrypoint.s…" 39 minutes ago Up 39 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp gogs-mysql
6.3 Check Gogs container logs
Check the Gogs container running log to ensure that the Gogs service is running normally.
docker logs gogs
7. Access the Gogs server
7.1 Release security group ports
Enter the security group management page of Huawei Cloud Yaoyun Server L instance and allow ports 10080 and 3000 in the inbound direction.
7.2 Initial configuration of Gogs server
Access address: http://Elastic public IP address:3000/, enter the initial configuration interface.
Database settings:
Database type: Mysql;
Database host: 127.0.0.1:3306;
Database user: gogs;
Database password: gogs;
Database name: gogs;
Apply basic settings and set the application URL to http://Elastic public IP address: 3000/, the rest can be defaulted.
Create an administrator account, customize settings, and click "Install Now".
8. Basic use of Gogs server
8.1 Update user avatar
User Settings - Avatar Settings. After uploading the avatar, click "Update Avatar Settings" and the user avatar will be refreshed.
8.2 Create warehouse
Select Create Warehouse to enter the warehouse creation page.
Select the warehouse name and click "Create Warehouse".
8.3 Local server configuration
On the local server, execute the following command to push local content to the new warehouse of the Gogs server.
mkdir /test && cd /test
echo "test01-aa" > myweb.sh
git init
git add myweb.sh
git commit -m "first commit by wangming -v1.0.0"
git remote add origin http://120.46.81.11:3000/jeven/myweb.git
git push -u origin master
8.4 View Gogs server repository
Check the status of the new warehouse myweb and find that the local content has been successfully uploaded.