Skip to content

Instantly share code, notes, and snippets.

@pjanzen
Created February 5, 2019 11:31
Show Gist options
  • Save pjanzen/9de7496a2ce1fa6cd4a3d9d0041789ad to your computer and use it in GitHub Desktop.
Save pjanzen/9de7496a2ce1fa6cd4a3d9d0041789ad to your computer and use it in GitHub Desktop.

Requirements:

Manual deployment

To manually deploy and install Saltshaker, you need to prepare the Python environment first.

  1. download: $ git clone https://github.com/yueyongyue/saltshaker_api.git

  2. Enter saltshaker_api directory $ cd saltshaker_api

  3. Install depenencies $ pip install -r requirements.txt

  4. Import 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

  5. 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 is as follows: 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, initialize the username: admin password: admin $ mysql> source $HOME/saltshaker_api/saltshaker_plus.sql;

  1. Start the Flask App, the port of 9000 will be started after successful startup.
  • Development model $ python $Home/saltshaker_api/app.py
  • Gunicorn mode $ cd $Home/saltshaker_api/ && gunicorn -c gun.py app:app
  • Production mode The directory configuration item in supervisord.conf is modified to its own code path. $ /usr/local/bin/supervisord -c $Home/saltshaker_api/supervisord.conf
  1. Start Celery (Ignore this step using production mode because Celery is already started in Supervisor) $ cd $Home/saltshaker_api/ && celery -A app.celery worker --loglevel=info

  2. Combine front-end projects https://github.com/yueyongyue/saltshaker_frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment