Huawei Cloud Yunyao Cloud Server L instance evaluation | Yunyao Cloud Server L instance deploys Django-CMS enterprise content management system
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 Django-CMS
2.1 Introduction to Django-CMS
Django-CMS is an open source enterprise content management system based on the Django framework. It is functional, safe and reliable. It supports drag-and-drop uploading of images, carousel images, Docker deployment and other functions. It can be easily used for secondary development and is mostly used to build corporate official websites. .
2.2 Django-CMS features
- Hierarchical pages
- Extensive built-in support for multilingual websites
- Multisite support
- Draft/publish workflow
- version control
- Complex publishing architecture that can also be used in your own applications
- Front-end content editing
- Hierarchical content structure for nested plugins
- A scalable navigation system that your own apps can hook into
- SEO Friendly URLs
- Designed to be fully integrated into other applications
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 Django-CMS on the Huawei Cloud Cloud 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. Purchase Huawei Cloud Yaoyun 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.
4.2 Check the status of Yunyao Cloud Server L instance
Generally, after the purchase is completed, the Yunyao Cloud Server L instance can be quickly started. Just check the running status and it will show "Running". In the resource list, the expiration time will be displayed, calculated from the current purchase time. Since it has been purchased before, the remaining period is running out.
4.3 Copy the elastic public IP address
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.4 Reset server password
- Click to remotely log in to Yunyao Cloud Server L instance
- Enter the Huawei Cloud CloudShell page
- 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.
4.5 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.
5. Check the Docker environment
5.1 Check operating system version
Check the operating system version of Yunyao Cloud Server L instance. The current operating system version is Ubuntu 22.04.1 LTS.
root@hcss-ecs-f91c:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 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
Check system kernel version
root@hcss-ecs-f91c:~# uname -r
5.15.0-60-generic
5.2 Check Docker version
When the Huawei Cloud Yaoyun Server L instance uses the Portainer application image, the Docker environment has been deployed and the Portainer tool has been automatically installed. The currently installed Docker version is 24.0.6.
root@hcss-ecs-f91c:~# docker -v
Docker version 24.0.6, build ed223bc
5.3 Check Docker 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 Sat 2023-09-23 23:24:32 CST; 3 days ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 1294 (dockerd)
Tasks: 122
Memory: 65.5M
CPU: 3min 32.346s
CGroup: /system.slice/docker.service
5.4 Check docker compose version
Check the docker compose version, the current version is
root@hcss-ecs-f91c:~# docker compose version
Docker Compose version v2.19.1
6. Download django-cms-quickstart
6.1 Download django-cms-quickstart
In the django-cms-quickstart project, this version uses running Python 3.9 and the latest versions of Django 3.2 and Django CMS 3.11.
git clone https://github.com/django-cms/django-cms-quickstart.git
6.2 View dockerfile
Enter the django-cms-quickstart directory and view the dockerfile file.
root@hcss-ecs-f91c:/data/django-cms-quickstart# cat Dockerfile
FROM python:3.9
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
RUN python manage.py collectstatic --noinput
CMD uwsgi --http=0.0.0.0:80 --module=backend.wsgiscms/core:latest
docker.io/sscms/core:latest
6.3 View the contents of docker-compose.yml
In the django-cms-quickstart directory, view the contents of docker-compose.yml. The default external access port mapped by the container is 8000. You can also modify the port yourself.
root@hcss-ecs-f91c:/data/django-cms-quickstart# cat Dockerfile
FROM python:3.9
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
RUN python manage.py collectstatic --noinput
CMD uwsgi --http=0.0.0.0:80 --module=backend.wsgi
root@hcss-ecs-f91c:/data/django-cms-quickstart#
root@hcss-ecs-f91c:/data/django-cms-quickstart# cat docker-compose.yml
version: "3"
services:
web:
# the application's web service (container) will use an image based on our Dockerfile
build: .
# map the internal port 80 to port 8000 on the host
ports:
- "8000:80"
# map the host directory to app (which allows us to see and edit files inside the container)
volumes:
- ".:/app:rw"
- "./data:/data:rw"
# the default command to run whenever the container is launched
command: python manage.py runserver 0.0.0.0:80
# the URL 'postgres' or 'mysql' will point to the application's db service
networks:
- djangocmsnet
env_file: .env-local
database_default:
# Select one of the following db configurations for the database
image: postgres:13.5-alpine
ports:
- "5432:5432/tcp" # allow your local dev env to connect to the db
environment:
POSTGRES_DB: "db"
POSTGRES_PASSWORD: "password"
POSTGRES_HOST_AUTH_METHOD: "trust"
SERVICE_MANAGER: "fsm-postgres"
networks:
- djangocmsnet
volumes:
- ".:/app:rw"
networks:
djangocmsnet:
6.4 View the contents of .env-local file
View the contents of the environment variable file .env-local file.
root@hcss-ecs-f91c:/data/django-cms-quickstart# cat .env-local
DATABASE_URL=postgres://postgres:password@database_default:5432/db
DEFAULT_STORAGE_DSN=file:///data/media/?url=%2Fmedia%2F
DEBUG=True
DOMAIN_ALIASES="localhost, 127.0.0.1"
SECURE_SSL_REDIRECT=False
6.5 Build Django-CMS image
In the django-cms-quickstart directory, build the Django-CMS image named django-cms-quickstart_web.
docker compose build web
7. Deploy Django-CMS
7.1 Create database_default container
First create the database_default container to prepare for data migration.
docker compose up -d database_default
7.2 Data migration operation
Use the following command to perform data migration.
docker compose run web python manage.py migrate
7.3 Create users
Set the administrative user and password of Django-CMS and use the following commands to customize the settings.
docker compose run web python manage.py createsuperuser
7.4 Deploy Django-CMS
Use docker compose to quickly deploy Django-CMS with one click.
docker compose up -d
7.5 Check Django-CMS container status
Check the status of the Django-CMS container to ensure that each Django-CMS container starts normally.
root@hcss-ecs-f91c:/data/django-cms-quickstart# docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
django-cms-quickstart-database_default-1 postgres:13.5-alpine "docker-entrypoint.s…" database_default 11 minutes ago Up 11 minutes 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp
django-cms-quickstart-web-1 django-cms-quickstart-web "python manage.py ru…" web About a minute ago Up About a minute 0.0.0.0:8000->80/tcp, :::8000->80/tcp
8. Access Django-CMS enterprise content management system
8.1 Release security group ports
Go to the security group management page of Huawei Cloud Yaoyun Server L instance and allow inbound port 8000.
8.2 Log in to the background management
Access address: http://elastic public IP address/admin, account password: root/admin, which is the administrator account and password set previously.
8.3 Create a test website
Click Add Page and click Next.
Enter the basic information of the website, as well as the website content.
8.4 Visit the website to test the effect
Access address: http://Elastic public IP address:8000/