Skip to main content
Version: 3.x

Manual Deployment


We recommend that you use Docker installation to ensure the consistency of the experience.

Requirements Environment

  • Python 3.6 and above
  • Mysql 5.6 and above
  • Modern browser
  • From v2.3.9 , Git version needs 2.17.0+ (affects new regular release application)

Installation Steps

The following installation steps assume that the project is installed in the /data/spug directory of a Centos7 system.

1. Clone project code

git clone /data/spug
cd /data/spug
git checkout x.x.x # x.x.x is the specified release version, for example git checkout v2.2.2

2. Download the compiled and packaged front-end project

Extract the downloaded front-end package to the specified directory, assuming web_x.y.z.tar.gz is the compressed package you downloaded.

tar xf web_x.y.z.tar.gz -C /data/spug/spug_web/;

3. Create running environment

If you need to use the regular release function, you need to install git v2.17.0+.

# Install dependencies
yum install mariadb-devel python3-devel gcc openldap-devel redis nginx supervisor rsync sshfs

# Create virtual environment
cd /data/spug/spug_api
python3 -m venv venv
source venv/bin/activate

# Install python packages
pip install -U pip setuptools
pip install -r requirements.txt
pip install gunicorn mysqlclient

4. Modify backend configuration

The backend uses the Sqlite database by default. Modify the configuration to use MYSQL as the backend database. How to use SqlServer database?


Create a file in the spug_api/spug/ directory. The backend service will automatically overwrite the default configuration after startup, avoiding direct modification of to facilitate the acquisition of new versions in the future.

DEBUG = False

'default': {
'ENGINE': 'django.db.backends.mysql',
'Name': 'spug', # Replace with your own database name, please create a database with the encoding of utf8mb4 in advance
'USER': 'spug_user', # Database user name
'PASSWORD': 'spug_passwd', # Database password
'HOST': '', # Database host
'charset': 'utf8mb4',
'sql_mode': 'STRICT_TRANS_TABLES',
#'unix_socket': '/opt/mysql/mysql.sock' # if the database is on the local machine and is not installed by default, you need to specify the socket file path of Mysql

5. Initialize the database

cd /data/spug/spug_api
python updatedb

6. Create default administrator account

python user add -u admin -p -s -n admin

# -u username
# -p password
# -s superuser
# -n nickname

7. Create startup service script

command = bash /data/spug/spug_api/tools/
autostart = true
stdout_logfile = /data/spug/spug_api/logs/api.log
redirect_stderr = true

command = bash /data/spug/spug_api/tools/
autostart = true
stdout_logfile = /data/spug/spug_api/logs/ws.log
redirect_stderr = true

command = bash /data/spug/spug_api/tools/
autostart = true
stdout_logfile = /data/spug/spug_api/logs/worker.log
redirect_stderr = true

command = bash /data/spug/spug_api/tools/
autostart = true
stdout_logfile = /data/spug/spug_api/logs/monitor.log
redirect_stderr = true

command = bash /data/spug/spug_api/tools/
autostart = true
stdout_logfile = /data/spug/spug_api/logs/scheduler.log
redirect_stderr = true

8. 创建前端nginx配置文件

8. Create front-end nginx configuration file

server {
listen 80;
server_name _; # Modify to custom access domain name
root /data/spug/spug_web/build/;
client_max_body_size 20m; # This value will affect the size limit of the file that can be uploaded by the file manager. Please adjust it reasonably

gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 7;
gzip_types text/plain text/css text/javascript application/javascript application/json;
gzip_vary on;

location ^~ /api/ {
rewrite ^/api(.*) $1 break;
proxy_read_timeout 180s;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location ^~ /api/ws/ {
rewrite ^/api(.*) $1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location / {
try_files $uri /index.html;

Warning: If you do not specify server_name in spug.conf, you need to comment or delete the default server block in /etc/nginx/nginx.conf to access normally, otherwise you will open the Nginx default page.

9. Start service

# Set boot startup
systemctl enable nginx
systemctl enable redis
systemctl enable supervisord

# Start service
systemctl restart nginx
systemctl restart redis
systemctl restart supervisord

10. Access test

By accessing the browser for testing.

11. Security Suggestions

  • Please make sure that the installed Redis only listens on if you need to use a Redis service with password authentication, please refer to How to configure and use a Redis service with a password?

  • Please make sure that the X-Real-IP in the HTTP Header of the request received by the server is the real client address. Spug will use this IP to improve security (when the IP of the logged-in user changes, the Token will automatically expire). Reference document.