Saltshaker is a Web-based configuration management management tool developed by Saltstack. It simplifies the daily use of saltstack, enriches the functions of saltstack, and supports multi-master management. This project is Saltshaker's backend Restful API, which needs to be combined with front-end projects.
- Requirements
- [Manual deployment](#Manual deployment)
- Python >= 3.6
- Mysql >= 5.7.8 (With json support)
- Redis
- RabbitMQ
- Supervisor (version 4.0.0.dev0 does not support python3) Please use this command to install:pip install git+https://github.com/Supervisor/supervisor@master
- GitLab >= 9.0
To install Saltshaker, you need to prepare the Python environment first.
-
Create saltshaker home and clone repo:
$ cd /opt
$ git clone https://github.com/pjanzen/saltshaker_api.git
-
Install python requirements: You can run this from an python virtual env. If you choose to do so, create it first.
$ python3 -m venv /opt/salt/virtual_envs/python3
$ source /opt/salt/virtual_envs/bin/activate
$ cd /opt/saltshaker_api
$ pip install -r requirements.txt
-
Set the FLASK_APP environment variable to use the Flask CLI tool, the path to the path of the deployed app
$ export FLASK_APP=$Home/saltshaker_api/app.py
-
Initialize the database table and related information, type the super administrator username and password (see the saltshaker.conf for the configuration of the database, please ensure that the database can be connected and the corresponding database has been created)
$ mkdir /var/log/saltshaker_plus $ flask init
Output: Enter the initial administrators username [admin]: admin Enter the initial Administrators password: Repeat for confirmation: Create user table is successful Create role table is successful Create acl table is successful Create groups table is successful Create product table is successful Create audit_log table is successful Create event table is successful Create cmd_history table is successful Create host table is successful Create grains table is successful Create period_task table is successful Create period_result table is successful Create period_audit table is successful Create sls table is successful Init super administrator role successful Init general user role successful Init product manager role successful Init user administrator role successful Init access control administrator role successful Init user successful Successful
You can also directly import the database file saltshaker_plus.sql, initial username: admin password: admin
mysql> source $HOME/saltshaker_api/saltshaker_plus.sql;
-
Start Flask App, will listen at port 9000 after succesfull startup.
-
Development mode
$ cd /opt/saltshaker_api $ export HOME=$(pwd) $ export $FLAKSAPP=$HOME/app.py
activate virtual_env when you use it.
$ source ../virtual_env/python3/bin/activate
$ python $Home/saltshaker_api/app.py
-
Gunicorn mode
$ cd $Home/saltshaker_api/ && gunicorn -c gun.py app:app
-
Production mode
supervisord.conf change config to adapt your setup $ /usr/local/bin/supervisord -c $Home/saltshaker_api/supervisord.conf
-
-
Start celery (Ignore this step when you use supervisord)
$ cd $Home/saltshaker_api/ && celery -A app.celery worker --loglevel=info
-
Combine front-end projects
https://github.com/pjanzen/saltshaker_frontend