一键部署自动化运维工具spug

本文详细介绍了如何在中小型企业中部署和初始化Spug无Agent自动化运维平台,包括创建目录、编写docker-compose.yml配置、设置MySQL连接、启动容器并创建管理员账户。官方文档和源码链接也提供参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简介

Spug是面向中小型企业设计的轻量级无Agent的自动化运维平台,整合了主机管理、主机批量执行、主机在线终端、应用发布部署、在线任务计划、配置中心、监控、报警等一系列功能。

部署

1.创建目录

mkdir -p /opt/spug/{mysql,service,repos}

2.进入目录

cd /opt/spug

3.编写配置文件

vim docker-compose.yml

内容如下

version: "3.3"
services:
  db:
    image: mariadb:10.8.2
    container_name: spug-db
    restart: always
    command: --port 3306 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    volumes:
      - /opt/spug/mysql:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=spug
      - MYSQL_USER=spug
      - MYSQL_PASSWORD=spug.cc
      - MYSQL_ROOT_PASSWORD=spug.cc
  spug:
    image: openspug/spug-service
    container_name: spug
    privileged: true
    restart: always
    volumes:
      - /opt/spug/service:/data/spug
      - /opt/spug/repos:/data/repos
    ports:
      # 如果80端口被占用可替换为其他端口,例如: - "8000:80"
      - "10060:80"
    environment:
      - MYSQL_DATABASE=spug
      - MYSQL_USER=spug
      - MYSQL_PASSWORD=spug.cc
      - MYSQL_HOST=db
      - MYSQL_PORT=3306
    depends_on:
      - db

4.启动

docker compose up -d

 5.设置账户密码

下面设置的账户/密码:admin/123456

docker exec spug init_spug admin 123456

创建账户成功示例: 

[root@mini110 spug]# docker exec spug init_spug admin 123456
/usr/local/lib/python3.6/site-packages/OpenSSL/_util.py:6: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.bindings.openssl.binding import Binding
Migrations for 'account':
  data/spug/spug_api/apps/account/migrations/0001_initial.py
    - Create model History
    - Create model Role
    - Create model User
    - Add field created_by to role
Migrations for 'alarm':
  data/spug/spug_api/apps/alarm/migrations/0001_initial.py
    - Create model Alarm
    - Create model Group
    - Create model Contact
Migrations for 'config':
  data/spug/spug_api/apps/config/migrations/0001_initial.py
    - Create model Service
    - Create model Environment
    - Create model ConfigHistory
    - Create model Config
Migrations for 'exec':
  data/spug/spug_api/apps/exec/migrations/0001_initial.py
    - Create model Transfer
    - Create model ExecTemplate
    - Create model ExecHistory
Migrations for 'home':
  data/spug/spug_api/apps/home/migrations/0001_initial.py
    - Create model Navigation
    - Create model Notice
Migrations for 'host':
  data/spug/spug_api/apps/host/migrations/0001_initial.py
    - Create model Host
    - Create model HostExtend
    - Create model Group
Migrations for 'monitor':
  data/spug/spug_api/apps/monitor/migrations/0001_initial.py
    - Create model Detection
Migrations for 'notify':
  data/spug/spug_api/apps/notify/migrations/0001_initial.py
    - Create model Notify
Migrations for 'schedule':
  data/spug/spug_api/apps/schedule/migrations/0001_initial.py
    - Create model History
    - Create model Task
Migrations for 'setting':
  data/spug/spug_api/apps/setting/migrations/0001_initial.py
    - Create model Setting
    - Create model UserSetting
Migrations for 'app':
  data/spug/spug_api/apps/app/migrations/0001_initial.py
    - Create model App
    - Create model Deploy
    - Create model DeployExtend1
    - Create model DeployExtend2
Migrations for 'repository':
  data/spug/spug_api/apps/repository/migrations/0001_initial.py
    - Create model Repository
Migrations for 'deploy':
  data/spug/spug_api/apps/deploy/migrations/0001_initial.py
    - Create model DeployRequest
Operations to perform:
  Apply all migrations: account, alarm, app, config, deploy, exec, home, host, monitor, notify, repository, schedule, setting
Running migrations:
  Applying account.0001_initial... OK
  Applying alarm.0001_initial... OK
  Applying config.0001_initial... OK
  Applying app.0001_initial... OK
  Applying repository.0001_initial... OK
  Applying deploy.0001_initial... OK
  Applying exec.0001_initial... OK
  Applying home.0001_initial... OK
  Applying host.0001_initial... OK
  Applying monitor.0001_initial... OK
  Applying notify.0001_initial... OK
  Applying schedule.0001_initial... OK
  Applying setting.0001_initial... OK
初始化/更新成功
/usr/local/lib/python3.6/site-packages/OpenSSL/_util.py:6: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.bindings.openssl.binding import Binding
创建用户成功

使用

打开浏览器

输入192.168.168.110:10060

官方文档

https://spug.cc/docs

源码地址

https://github.com/openspug/spug

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值