Code Monkey home page Code Monkey logo

soms's Introduction

SOMS

20220731 看不下去的代码,清了吧

OMS自动化运维平台

20181012更新:代码优化、功能完善

一直想写个运维平台,无奈前端太差(虽然也不懂开发语言),所以没实现。。

还好有不少人共享了各种各样的平台,其中就有OMS运维平台

binbin开源的OMS平台 链接:https://github.com/binbin91/oms

所以自己拿来捣鼓,根据自己的需求,也算是写了点东西出来

  • 批量管理
  • 文件管理
  • 用户管理
  • 项目管理等  

利用空闲时间,启用了全新模板,并不停的修改完善,想到什么就写些什么
放到github上也是希望可以给有需要的人一些帮助,也希望可以得到大家的提拔指点

另外,还是要说一下,希望使用的人可以保留版权出处

语言:python
框架:django
工具:saltstack

使用模板gentelella: https://github.com/puikinsh/gentelella

SOMS演示地址: https://soms.imaojia.com

User: admin Passwd: soms123

主机管理  

命令执行

模块部署

文件下载

文件上传

用户管理
soms-user

安装saltstack(salt version 2018.3)

# yum install salt-master salt-minion salt-api salt-ssh -y

安装PIP

# wget https://bootstrap.pypa.io/get-pip.py
# python get-pip.py
# cat > /etc/pip.conf <<EOF
[global]
index-url = https://pypi.douban.com/simple
trusted-host = pypi.douban.com
disable-pip-version-check = true
timeout = 120
EOF

配置salt-api

# pip install pyOpenSSL==16.2.0
# useradd -M -s /sbin/nologin saltapi && echo "password"|/usr/bin/passwd saltapi --stdin
# salt-call --local tls.create_self_signed_cert

配置salt-master 我这里把soms解压到了/data/wwwroot下

# cat > /etc/salt/master <<EOF
interface: 0.0.0.0

external_auth:
  pam:
    saltapi:
      - .*
      - '@wheel'
      - '@runner'
      - '@jobs'

rest_cherrypy:
  port: 8000
  ssl_crt: /etc/pki/tls/certs/localhost.crt
  ssl_key: /etc/pki/tls/certs/localhost.key

file_recv: True

include: /data/wwwroot/soms/saltconfig/*.conf
EOF

配置好后,把服务启起来,并测试salt-api

##centos6
# service salt-master start
# service salt-api start
# service salt-minion start
##centos7
# systemctl start salt-master salt-api salt-minion
##
# curl -sSk https://localhost:8000/login -H 'Accept: application/x-yaml' -d username=saltapi -d password=password -d eauth=pam

返回如下信息则配置成功:

return:
- eauth: pam
  expire: 1472695867.308063
  perms:
  - .*
  - '@wheel'
  - '@runner'
  - '@jobs'
  start: 1472652667.308062
  token: 99993ca778fa4f31dce472421cbf01d37be936ad
  user: saltapi

上面这些操作都完成后就可以部署soms项目了

安装依赖(组件要求查看requirements.txt)

# pip install -r requirements.txt

同步数据库

# python manage.py makemigrations
# python manage.py migrate

创建管理员

# python manage.py createsuperuser

runserver运行检查是否正常

# python manage.py runserver 0.0.0.0:8080

如果无法正常运行,请检查以上步骤

20180201新增:
新增file_bakup.py文件,放至项目下media/salt/_modules目录下,然后执行如下命令同步到minion
salt '*' saltutil.sync_all

20170721新增:
关于部署完后报401错误的,需要修改soms/settings_local.py里的相关信息

有任何问题或指教可加QQ群或在本人博客留言
QQ群:291809453
爱猫家 https://imaojia.com
或者email:[email protected]

PS:

soms正常运行后,正式上线最好部署django+nginx+uwsgi环境
https://imaojia.com/blog/linux/django-nginx-uwsgi-setup-on-centos

代码写的比较烂,欢迎吐槽 -_-||

soms's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soms's Issues

安装了好几次,刷新主机有问题

系统版本:centos 7.3 python 使用系统默认安装的 版本2.7.5
yum 安装 c++ 修改为 gcc-c++
yum -y update && yum -y install mariadb mariadb-devel mariadb-server wget epel-release python-devel gcc gcc-c++ make openssl openssl-devel passwd libffi libffi-devel
后按照流程安装完
python manage.py runserver 0.0.0.0:8080后进入主机管理刷新,页面报如下错

HTTPError at /deploy/key_list_import/
HTTP Error 401: Unauthorized
Request Method: GET
Request URL: http://192.168.91.150:8080/deploy/key_list_import/
Django Version: 1.9
Exception Type: HTTPError
Exception Value:
HTTP Error 401: Unauthorized
Exception Location: /usr/lib64/python2.7/urllib2.py in http_error_default, line 558
Python Executable: /usr/bin/python
Python Version: 2.7.5
Python Path:
['/data/wwwroot/SOMS',
'/usr/lib64/python27.zip',
'/usr/lib64/python2.7',
'/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk',
'/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages']

下载google身份验证器

第一次登录用身份验证器扫描QR码,退出后,打开身份验证器里复制验证码,然后在登录页面的验证码里粘贴,就可以登录 了。

我是一个职场新手

非常感谢您的开源奉献精神,同时也非常敬佩您的能力,但是我作为一个职场新手在遇到问题的时候,找不到合适的社区,虽然网站但是我无法立即解决我的问题。我强烈建议弄几个qq群作为讨论群。来满足下我这样的小白。

搭建出现问题

include: /data/wwwroot/soms/saltconfig/*.conf #这个路径clone仓库中没有该目录

可以使用pyton3.5版本以上的来使用?

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/python35/lib/python3.5/site-packages/django/core/management/init.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/local/python35/lib/python3.5/site-packages/django/core/management/init.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/python35/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/python35/lib/python3.5/site-packages/django/core/management/base.py", line 327, in execute
self.check()
File "/usr/local/python35/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/python35/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/python35/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/python35/lib/python3.5/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/usr/local/python35/lib/python3.5/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/usr/local/python35/lib/python3.5/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/usr/local/python35/lib/python3.5/site-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/python35/lib/python3.5/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/python35/lib/python3.5/site-packages/django/utils/functional.py", line 35, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/python35/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/python35/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 673, in exec_module
File "", line 222, in _call_with_frames_removed
File "/data/wwwroot/soms/urls.py", line 23, in
from asset import views as aviews
File "/data/wwwroot/asset/views.py", line 15, in

其中一些模块无法使用 也没有资料显示。。。。

不能手动添加资产和导入?

小哥,在安装完之后,我发现没有手动添加资产和资产导入呢?那么问题来了,整个资产的入库的流程是什么样的呢?能否给小弟讲解一下。

还有你的那个salt配置文件,没有其他配置吧。我自己写个配置应该也可以吧。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.