1️⃣ Direct Deployment
⚠️ Important Note: The current project directory is missing backend and frontend source code, direct deployment is temporarily unavailable. The following documentation is a theoretical deployment guide that will be available once the project code is complete.
Direct deployment is suitable for development environments or scenarios requiring deep customization, involving manual configuration and startup of each component.
Prerequisites
- Java 21: OpenJDK 21 or Temurin 21
- Node.js 18+: For frontend building
- MySQL 8.0+: Database service
- Maven: Project includes Maven Wrapper, no separate installation needed
Deployment Steps
1. Environment Preparation
# Check Java version
java -version
# Check Node.js version
node --version
# Check MySQL version
mysql --version2. Database Initialization
# Log in to MySQL
mysql -u root -p
# Create database and user
CREATE DATABASE IF NOT EXISTS astrnest CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS 'astrnest'@'localhost' IDENTIFIED BY 'astrnestPass!';
GRANT ALL PRIVILEGES ON astrnest.* TO 'astrnest'@'localhost';
FLUSH PRIVILEGES;
# Or use the project's initialization script
mysql -u root -p < backend/db/init.sql3. Environment Variables Configuration
Create .env file (based on .env.example):
# Database Configuration
MYSQL_ROOT_PASSWORD=your_root_password
MYSQL_DATABASE=astrnest
MYSQL_USER=astrnest
MYSQL_PASSWORD=astrnestPass!
# Backend Configuration
ASTRNEST_DB_URL=jdbc:mysql://localhost:3306/astrnest?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
ASTRNEST_DB_USERNAME=astrnest
ASTRNEST_DB_PASSWORD=astrnestPass!
ASTRNEST_STORAGE_ROOT=/storage/upload
ASTRNEST_STORAGE_PUBLIC=/upload
ASTRNEST_ADMIN_USERNAME=admin
ASTRNEST_ADMIN_PASSWORD=chenxi123
ASTRNEST_ADMIN_DISPLAY=Super Administrator
ASTRNEST_ADMIN_EMAIL=admin@example.com
# Frontend Configuration
VITE_API_BASE_URL=http://localhost:8080
VITE_PUBLIC_ASSET_BASE=http://localhost:8080/upload
VITE_SITE_NAME=AstrNest4. Start Backend Service
# Enter backend directory
cd backend
# Start with Maven Wrapper (recommended)
./mvnw spring-boot:run
# Or build and run
./mvnw clean package
java -jar target/backend-0.0.1-SNAPSHOT.jarBackend service will start at http://localhost:8080.
5. Start Frontend Service
# New terminal, enter frontend directory
cd frontend
# Install dependencies
npm install
# Start in development mode
npm run dev
# Or build and preview
npm run build
npm run previewFrontend service will start at http://localhost:5173.
Deployment Verification
Access the following addresses to verify service status:
- Frontend Interface: http://localhost:5173
- Backend API: http://localhost:8080
- API Documentation: http://localhost:8080/swagger-ui.html
- Health Check: http://localhost:8080/actuator/health
Default Administrator Account
- Username:
admin - Password:
chenxi123
Service Management
Using PM2 for Process Management
# Install PM2
npm install -g pm2
# Start backend service
cd backend
pm2 start "java -jar target/backend-0.0.1-SNAPSHOT.jar" --name "astrnest-backend"
# Start frontend service (built static files)
cd frontend
npm run build
pm2 serve dist 5173 --name "astrnest-frontend"
# Check service status
pm2 statusUsing systemd for Service Management
Create backend service file /etc/systemd/system/astrnest-backend.service:
[Unit]
Description=AstrNest Backend Service
After=network.target
[Service]
Type=simple
User=astrnest
WorkingDirectory=/opt/astrnest/backend
ExecStart=/usr/bin/java -jar target/backend-0.0.1-SNAPSHOT.jar
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetCommon Issues
Port Conflicts
If ports are occupied, modify configuration:
# Backend port modification
java -jar target/backend-0.0.1-SNAPSHOT.jar --server.port=8081
# Frontend port modification (development mode)
VITE_API_BASE_URL=http://localhost:8081 npm run dev -- --port=3000Database Connection Failure
Check MySQL service status and connection configuration:
# Check MySQL service status
sudo systemctl status mysql
# Check firewall settings
sudo ufw statusInsufficient Memory
Increase JVM memory configuration:
java -Xmx2g -Xms1g -jar target/backend-0.0.1-SNAPSHOT.jarAdvantages and Limitations
Advantages
- Complete control over each component
- Easy for debugging and development
- Flexible configuration and customization
Limitations
- Higher deployment complexity
- Manual service management required
- Not suitable for large-scale production environments
Choosing direct deployment gives you full control over every component of AstrNest, suitable for deep customization and development debugging.