About Saltstack halite configuration management and secondary development ui [original salt-ui]

Source: Internet
Author: User
Tags saltstack

Saltstack officially has a web ui called halite, which executes management on the page. The backend uses the saltstack api


I have been writing my own ui some time ago, using flask and metro. The project was also put aside, so I was too lazy to move. I can see the ui tools on the official website today. Although the functions are incomplete, the basic execution and status check are still available.

We will build halite first, and then develop some functions on it ....


This is the address:

Https://github.com/saltstack/halite



First ~


650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F5363M3-0.jpg "style =" float: none; "title =" 1aaa_.jpg "/>


Source Address: http://rfyiamcool.blog.51cto.com/1030776/1275443



650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F5362350-1.jpg "style =" float: none; "title =" pppp_ 文.jpg "/>



There are tutorials on the official website, but all the things that can be done according to this tutorial are gods...

Summary: there are problems.

I modified the official configuration document and posted it.


1 clone address, you know:


git clone https://github.com/saltstack/halite


2 generate the index.html file:


cd halite/halite./genindex.py -C


3. Install salt-api

Check this installation

Https://github.com/saltstack/salt-api

Or you can directly use yum install salt-api


4. Configure the master file

We configure the salt master file with the accessed ip address, port, and path.

rest_cherrypy: host: 0.0.0.0 port: 8080 debug: true static: /ui/halite/halite app: /ui/halite/halite/index.htmlexternal_auth:   pam:     admin:         - '*'


650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F5362356-2.jpg "title =" QQ20130817160712.jpg "/>


5. Run it!

Add an rui SYSTEM account and password.

Then run the salt-api ~~~ The browser can access it ~


650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F53612T-3.jpg "title =" 000_ 文.jpg "/>


Halite can run ~ Saltstack halite is a ui developed based on the cherrypy web framework. Since it was written by cherrypy, we need to learn this framework.

I wrote a common demo using cherrypy. It seems that his usage is quite unusual. By default, CherryPy maps the URI to the Python callable object Python ). Of course, CherryPy also provides other dispatch mechanisms.


Let's start with a hello demo ~


import cherrypyclass HelloWorld:    def index(self):        return "Hello world!"    index.exposed = Truecherrypy.quickstart(HelloWorld())


The result is:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F5362L4-4.jpg "title =" 000.jpg"/>


One nested

import cherrypyclass OnePage(object):    def index(self):        return "one page!"    index.exposed = Trueclass HelloWorld(object):    onepage = OnePage()    def index(self):        return "hello world"    index.exposed = Trueroot = HelloWorld()cherrypy.quickstart(root)


Result:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F53C161-5.jpg "title =" 000.jpg"/>


# Coding: utf-8import cherrypyimport OS, sys # curl http: // localhost: 8080 or/indexclass HelloWorld: def index (self): return "Hello world! "Index. exposed = Trueroot = HelloWorld () ''' def foo (): return 'foo! 'Foo. exposed = Trueroot. foo = foo ''' dir is the route address ''' # curl http: // localhost: 8080/dirdef dir (): return '% s' % OS. popen ('dir '). read () dir. exposed = Trueroot. dir = dirdef foo (year, month, day): return '\ n first: % s \ n Second: % s \ n third: % s \ n \ n' % (year, month, day) foo. exposed = Trueroot. foo = foo # @ cherrypy. exposedef xiaorui (form): # return '{}{}'. format (form ['username'], form ['Password']) return '% s % s' % (form ['username'], form ['Password']) xiaorui. exposed = Trueroot. xiaorui = xiaorui ''' conf = {'global': {'server. socket_host ': '0. 0.0.0 ', 'server. socket_port ': 1970, 'tools. encode. on ': True,' tools. encode. encoding ': 'utf8',},} ''' # cherrypy. quickstart (root, '/', conf) cherrypy. quickstart (root)


Demo for my test interface ~

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F53633Q-6.jpg "title =" 999.jpg"/>


File Upload demo ~


import oslocalDir = os.path.dirname(__file__)absDir = os.path.join(os.getcwd(), localDir)import cherrypyclass FileDemo(object):    def index(self):        return """        


Source Address: http://rfyiamcool.blog.51cto.com/1030776/1275443


650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F53C263-7.jpg "style =" float: none; "title =" aaaa.jpg "/>

I used lynx to access ~

yum -y install lynxlynx 127.0.0.1:8080


650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F53A561-8.jpg "style =" float: none; "title =" QQ20130818083832.jpg "/>

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F5361929-9.jpg "style =" float: none; "title =" bbbb.jpg "/>


Halite uses angularjs to render many things, and the page is too complicated ....

The official website did not write the documents and Development logs...

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1F53BT4-10.jpg "title =" QQ20130818090747.jpg "/>

The Code is as follows:

<Div class = "row-fluid"> <div class = "span12"> <a href = \ '# \' "class =" btn-primary "> authenticated key </a> <a href = \' # \ '"class =" btn-success "> perform all authentication </a> <br/> <div class = 'well' id = 'jieguo '> </div> <br/> <form action = "rmkey" method = 'post'> <input type = "text" class = "input-medium search-query"> <button type = "submit" class = "btn-danger"> Delete authentication </button> </form> </div> <! --/Row-fluid -->


Source Address: http://rfyiamcool.blog.51cto.com/1030776/1275443

Now, I can't find the CRUD interface he provided to the js framework ....

Potholes .... Continue searching

Since the official website uses the js framework, I will also use this framework...



This article is from "Fengyun, it's her ." Blog, please be sure to keep this source http://rfyiamcool.blog.51cto.com/1030776/1275443

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.