logo
2
2
WeChat Login

Install Docker

curl -fsSL https://get.docker.com | bash -s docker

Run with Docker Compose

Create docker-compose.yml

version: "3.3"
services:
  spug-mysql:
    image: mysql:8.0
    container_name: spug-mysql
    restart: always
    environment:
      MYSQL_DATABASE: "spug"
      MYSQL_ROOT_PASSWORD: "123456"
    ports:
      - '3306:3306'
    volumes:
      - ./docker/mysql/data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 30s
      timeout: 10s
      retries: 5

  spug:
    image: zhiqiangwang/spug:latest
    container_name: spug
    privileged: true
    restart: always
    volumes:
      - ./redis:/var/lib/redis
      - ./nginx:/var/log/nginx
      - ./spug/logs:/data/spug/spug_api/logs
      - ./spug/repos:/data/repos
      
    ports:
      # If port 80 is occupied, you can use another port, e.g.: - "8000:80"
      - "80:80"
    depends_on:
      - spug-mysql
    environment:
      - MYSQL_DATABASE=spug
      - MYSQL_USER=root
      - MYSQL_PASSWORD=123456
      - MYSQL_HOST=spug-mysql
      - MYSQL_PORT=3306

Start containers

docker compose up -d

Common Commands

# Initialize
docker exec spug init_spug admin spug.cc

# Initialize database
docker exec spug python3 /data/spug/spug_api/manage.py updatedb

# Reset account password
docker exec spug python3 /data/spug/spug_api/manage.py user reset -u admin -p 123456

# Enable account
docker exec spug python3 /data/spug/spug_api/manage.py user enable -u admin

# Disable MFA login
docker exec spug python3 /data/spug/spug_api/manage.py set mfa disable

Install Languages

# Install Go 1.18
curl -sSL https://raw.githubusercontent.com/izhiqiang/sh/main/lang/binary-install.sh | bash -s go 1.18
# Add to PATH (execute in "After Code Checkout" section of deployment config)
export PATH=$PATH:/usr/local/lang/golang/1.18/bin

# Install Node.js 20.18.0
curl -sSL https://raw.githubusercontent.com/izhiqiang/sh/main/lang/binary-install.sh | bash -s node 20.18.0
# Add to PATH (execute in "After Code Checkout" section of deployment config)
export PATH=$PATH:/usr/local/lang/nodejs/20.18.0/bin

Golang Dockerfile

FROM zhiqiangwang/spug:latest

RUN apt update

# Install Go
ARG GOLANGURL=https://go.dev/dl/go1.21.13.linux-amd64.tar.gz
RUN cd /tmp && wget ${GOLANGURL} -O go.tar.gz && tar -xf go.tar.gz -C /usr/local 
ENV GOROOT=/usr/local/go 
ENV GOPATH=/root/go
ENV GO111MODULE=auto
ENV GOPROXY=https://goproxy.io,direct
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin

# Install Node.js
ARG NODEJS_URL=https://nodejs.org/dist/v20.15.1/node-v20.15.1-linux-x64.tar.gz
RUN mkdir -p /usr/local/nodejs
RUN cd /tmp && wget ${NODEJS_URL} -O nodejs.tar.gz && tar --strip-components 1 -xf nodejs.tar.gz -C /usr/local/nodejs
ENV PATH=$PATH:/usr/local/nodejs/bin
RUN npm config set registry https://registry.npmmirror.com

# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN rm -rf /tmp/*

Links

SPUG Official Website

Docker Installation Guide

About

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

192.00 KiB
2 forks2 stars1 branches1 TagREADMEApache-2.0 licensehttps://ops.spug.cc/
spugrepo-named
Language
Markdown41.2%
License33.5%
Dockerfile10.7%
Shell7.7%
Others6.9%