Deploying with Baota Panel
This document provides a graphical tutorial for deploying New API using the Baota Panel Docker feature.
Prerequisites
| Item | Requirement |
|---|---|
| Baota Panel | Version 9.2.0 or higher |
| Recommended OS | CentOS 7+, Ubuntu 18.04+, Debian 10+ |
| Server Configuration | At least 1 core and 2GB RAM |
Step 1: Install Baota Panel
- Go to the Baota Panel Official Website to download the installation script suitable for your system
- Run the installation script to install Baota Panel
- After installation, use the provided address, username, and password to log in to Baota Panel
Step 2: Install Docker
- After logging in to Baota Panel, find and click Docker in the left sidebar
- The first time you enter, you will be prompted to install the Docker service. Click Install Now
- Follow the prompts to complete the Docker service installation
Step 3: Install New API
Method One: Using Baota App Store (Recommended)
- In the Baota Panel Docker feature, click App Store
- Search for and find New-API
- Click Install
- 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
/datadirectory is mapped to a host directory
- Container Name: Customizable, defaults to
- Click Confirm to start installation
- After installation completes, access
http://your-server-ip:3000
Method Two: Using Docker Compose
Suitable for scenarios requiring more custom configuration.
- Create a website directory in Baota Panel, such as
/www/wwwroot/new-api - Create a
docker-compose.ymlfile:
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- Enter the directory via SSH terminal and start:
cd /www/wwwroot/new-api
docker-compose up -dMethod Three: Using Custom Image
Advanced Usage
It is strongly recommended to install via "App Store". This section is for advanced users familiar with Docker.
- In the Baota Panel Docker feature, click Image Management
- Click Get Image → Pull Image
- Enter Image Name:
calciumion/new-api:latest - Click Submit and wait for the image pull to complete
- After the pull is complete, go to Container List and click Create Container
- Fill in the following information:
- Container Name:
new-api(customizable) - Image: Select the
calciumion/new-api:latestimage 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
- Container Name:
- Click Submit to complete the installation
Environment Variables
Required Environment Variables
| Variable | Description | Required |
|---|---|---|
SESSION_SECRET | Session secret, must be consistent for multi-node deployment | Required |
CRYPTO_SECRET | Encryption secret, required when using Redis | Conditional |
SQL_DSN | Database connection string (when using external database) | Optional |
REDIS_CONN_STRING | Redis connection string | Optional |
Generate Random Secrets
# Generate SESSION_SECRET
openssl rand -hex 16
# Or use Linux command
head -c 16 /dev/urandom | xxd -pAccess 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
- Check if the server firewall allows port 3000
- In Baota Panel Security, allow port 3000
- 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:/dataHow 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 managementRelated Links
How is this guide?
Last updated on