python+django开发的运维管理系统,整合单机docker管理
django+python+celery+saltstack+docker实现的运维管理后台
作者QQ:923401910
v1.0:完成资产信息录入及使用saltstack自动采集更新 完成单机版docker主机的基本管理,日志实时刷新
安装环境
pip install requirements.txt
安装nginx
yum install nginx -y
安装saltstack
yum install salt-master -y yum install salt-minion -y
配置docker ``` [[email protected] ~]# vim /etc/sysconfig/docker
# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs OPTIONS='--selinux-enabled -H 0.0.0.0:2375 -H unix:///var/run/docker.sock ' DOCKERCERTPATH=/etc/docker ```
部署流程 以下为部署流程 修改 settings.py中db连接
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'SimpletourDevops', 'HOST': '192.168.2.232', 'USER': 'root', 'PORT': 3306, 'PASSWORD': 'redhat', 'OPTIONS': { 'init_command': 'SET storage_engine=INNODB', }, } }
部署程序到/data
[[email protected] ~]# mv /root/SimpletourDevops /data/ [[email protected] ~]# cd /data/SimpletourDevops [[email protected] SimpletourDevops]#python manage.py makemigrations [[email protected] SimpletourDevops]#python manage.py migrate
复制supervisor配置
[[email protected] SimpletourDevops]# cp supervisord.conf /etc/ [[email protected] supervisord.d]# supervisord -c /etc/supervisord.conf 修改配置文件 ``` 在settings.py中添加STATICROOT STATICROOT = '/data/SimpletourDevops/static/suit'python manage.py collectstatic <--生成静态文件
配置nginxserver { listen 80; servername localhost; accesslog /var/log/nginx/devops.simpletour.com.access.log main; error_log /var/log/nginx/devops.simpletour.com.error.log error;location / { include uwsgi_params; uwsgi_pass 127.0.0.1:8098; uwsgi_read_timeout 600; uwsgi_connect_timeout 60; uwsgi_send_timeout 600; client_max_body_size 35m; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; uwsgi_ignore_client_abort on; } location ^~ /docker/getSocket{ proxy_pass http://127.0.0.1:8099; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; uwsgi_ignore_client_abort on; }location /static { alias /data/SimpletourDevops/static/suit; }
}
启动访问
首页及docker
![]()
![]()
![]()
![]()
![]()
![]()
saltstack
后台
![]()