运维平台演示 https://demo.imaojia.com/
登录页及Dashboard
CMDB产品应用管理、流水线及kubernetes模板编排
CICD持续构建部署
应用重启、构建发布日志、容器配置及上下线
工单流程管理
镜像打包
docker build -t docker.imaojia.com/allinone/devops-backend:ce1.0 --build-arg 'APP=devops-backend' -f Dockerfile .
docker run -it --name t1 -p 10000:80 -v `pwd`/config.py:/app/devops-backend/config.py -d docker.imaojia.com/allinone/devops-backend:ce1.0
初始数据
python manage.py makemigrations
python manage.py migrate
python manage.py initdata --type all
创建管理员
python manage.py createsuperuser
- Python 3.9
- MySQL 8.0.25
- ElasticSearch 7.14.0
- Harbor v1.7
- http request
- docker
- Docker Pipeline
python3
依赖
pycryptodome==3.9.8
xmltodict==0.12.0
requests==2.25.0
ansible==2.10.4
部署MySQL
docker run -it --name mysqldb -p 43306:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=ydevopsdb -e MYSQL_USER=devops -e MYSQL_PASSWORD=ops123456 -d mysql:8.0.18 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
部署redis
docker run -d --name redis -p 6379:6379 daocloud.io/redis --requirepass 'ops123456'
部署ElasticSearch
docker run --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -d elasticsearch:7.14.0
部署GitLab
docker run -d --name gitlab -p 8090:8090 -p 2222:2222 gitlab/gitlab-ce
mysqlclient:
- debian系
sudo apt install mysql-client-8.0 libmysqlclient-dev python3-dev python-dev libldap2-dev libsasl2-dev libssl-dev
- redhat系
--
openldap:
- debian系
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
- redhat系:
yum install python-devel openldap-devel
yum -y install sshpass
from rest_framework.schemas.openapi import SchemaGenerator
generator = SchemaGenerator(title='DevOps API')
data = []
try:
generator.get_schema()
except BaseException as e:
print(str(e))
finally:
data = generator.endpoints
python manage.py migrate
# 注释好之后再执行初始化数据
python manage.py initdata --help
server {
listen 9000;
server_name localhost;
error_log /usr/local/nginx/logs/devops_error.log;
#access_log off;
access_log /usr/local/nginx/logs/devops_access.log;
error_page 404 /404.html;
location = /404.html {
root /etc/nginx;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /etc/nginx;
}
underscores_in_headers on;
client_max_body_size 2048m;
location / {
root /data/frontend/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ~ ^/(admin|api) {
proxy_pass http://localhost:8000;
proxy_connect_timeout 1200s;
proxy_read_timeout 1200s;
proxy_send_timeout 1200s;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
模型定义了扩展元数据
- 表是否可关联由related控制
- 报表是否可展示由dashboard控制
class ExtMeta:
related = False
dashboard = False