Documentation renewed! For old docs, visit doc.newapi.pro
New APINew API
User GuideInstallationAPI ReferenceAI ApplicationsSkillsHelp & SupportBusiness Cooperation

Deploying with Baota Panel

This document provides a graphical tutorial for deploying New API using the Baota Panel Docker feature.

Prerequisites

ItemRequirement
Baota PanelVersion 9.2.0 or higher
Recommended OSCentOS 7+, Ubuntu 18.04+, Debian 10+
Server ConfigurationAt least 1 core and 2GB RAM

Step 1: Install Baota Panel

  1. Go to the Baota Panel Official Website to download the installation script suitable for your system
  2. Run the installation script to install Baota Panel
  3. After installation, use the provided address, username, and password to log in to Baota Panel

Step 2: Install Docker

  1. After logging in to Baota Panel, find and click Docker in the left sidebar
  2. The first time you enter, you will be prompted to install the Docker service. Click Install Now
  3. Follow the prompts to complete the Docker service installation

Step 3: Install New API

  1. In the Baota Panel Docker feature, click App Store
  2. Search for and find New-API
  3. Click Install
  4. Configure the following basic options:
    • Container Name: Customizable, defaults to new-api
    • Port Mapping: Defaults to 3000:3000
    • Environment Variables:
      • SESSION_SECRET: Session secret (Required, must be consistent for multi-node deployment)
      • CRYPTO_SECRET: Encryption secret (Required when using Redis)
    • Directory Mapping: Ensure the /data directory is mapped to a host directory
  5. Click Confirm to start installation
  6. After installation completes, access http://your-server-ip:3000

Method Two: Using Docker Compose

Suitable for scenarios requiring more custom configuration.

  1. Create a website directory in Baota Panel, such as /www/wwwroot/new-api
  2. Create a docker-compose.yml file:
version: '3'
services:
  new-api:
    image: calciumion/new-api:latest
    container_name: new-api
    restart: always
    ports:
      - "3000:3000"
    volumes:
      - ./data:/data
    environment:
      - SESSION_SECRET=your_session_secret_here  # Replace with random string
      - TZ=Asia/Shanghai
  1. Enter the directory via SSH terminal and start:
cd /www/wwwroot/new-api
docker-compose up -d

Method Three: Using Custom Image

Advanced Usage

It is strongly recommended to install via "App Store". This section is for advanced users familiar with Docker.

  1. In the Baota Panel Docker feature, click Image Management
  2. Click Get ImagePull Image
  3. Enter Image Name: calciumion/new-api:latest
  4. Click Submit and wait for the image pull to complete
  5. After the pull is complete, go to Container List and click Create Container
  6. Fill in the following information:
    • Container Name: new-api (customizable)
    • Image: Select the calciumion/new-api:latest image you just pulled
    • Port Mapping: Add 3000:3000
    • Directory Mapping: Add /your/host/path:/data (replace with your host path)
    • Environment Variables: Add as needed
  7. Click Submit to complete the installation

Environment Variables

Required Environment Variables

VariableDescriptionRequired
SESSION_SECRETSession secret, must be consistent for multi-node deploymentRequired
CRYPTO_SECRETEncryption secret, required when using RedisConditional
SQL_DSNDatabase connection string (when using external database)Optional
REDIS_CONN_STRINGRedis connection stringOptional

Generate Random Secrets

# Generate SESSION_SECRET
openssl rand -hex 16

# Or use Linux command
head -c 16 /dev/urandom | xxd -p

Access and Initialization

After installation, access http://server-ip:3000

The first visit will automatically guide you to the initialization page. Follow the on-screen instructions to set up an administrator account and password.

Common Issues

Cannot access port 3000

  1. Check if the server firewall allows port 3000
  2. In Baota Panel Security, allow port 3000
  3. Check if the cloud server security group allows the port

Session invalid after login

Ensure the SESSION_SECRET environment variable is set and not empty.

How to persist data

Use Docker volume mapping for the data directory:

volumes:
  - ./data:/data

How to update version

# Pull latest image
docker pull calciumion/new-api:latest

# Restart with Docker Compose
docker-compose down && docker-compose up -d

# Or restart container via Baota container management

How is this guide?

Last updated on