1. Rename postcss.config.js to postcss.config.cjs - Fixes CommonJS syntax in ES module project - Allows build to complete successfully 2. Remove --production flag from Dockerfile - Install ALL dependencies including sharp - Sharp required for Astro image optimization - Fixes sharp missing error Both fixes enable successful Docker build and favicon to work.
5.9 KiB
5.9 KiB
🚀 Easypanel API Deployment Guide
Overview
This guide shows how to deploy the Deal Plus Tech Astro site to Easypanel using their API.
Prerequisites
-
Easypanel Access
- URL:
http://110.164.146.46:3000 - Admin credentials
- URL:
-
API Token
- Login to Easypanel
- Go to Settings → API
- Generate new API token
-
Docker Image
- Already built locally:
dealplustech-astro:latest - Size: 564MB
- Already built locally:
Method 1: Manual Deployment (Recommended)
Step 1: Login to Easypanel
URL: http://110.164.146.46:3000
Step 2: Create Project
- Click "New Project"
- Name:
dealplustech - Description: "Deal Plus Tech Websites"
- Click "Create"
Step 3: Deploy Docker Image
- Select project:
dealplustech - Click "New Service"
- Choose: "Docker Image"
- Configure:
- Name:
dealplustech-astro - Image:
dealplustech-astro:latest - Port:
4321
- Name:
- Click "Deploy"
Step 4: Verify Deployment
- Wait for build to complete (~2-3 minutes)
- Click on service to view logs
- Look for: "Astro preview ready"
- Access URL provided by Easypanel
Method 2: Automated Deployment (API)
Step 1: Get API Token
# Login to Easypanel and get token from Settings → API
export EASYPANEL_API_TOKEN="your-api-token-here"
Step 2: Run Deployment Script
cd dealplustech-astro
# Option A: With token as argument
./deploy-easypanel.sh your-api-token
# Option B: With environment variable
export EASYPANEL_API_TOKEN="your-api-token"
./deploy-easypanel.sh
Step 3: Monitor Deployment
# View service status
curl -s "http://110.164.146.46:3000/api/trpc/services.app.inspectService" \
-H "Authorization: Bearer $EASYPANEL_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input":{"json":{"projectName":"dealplustech","serviceName":"dealplustech-astro"}}}' \
--insecure | python3 -m json.tool
Method 3: Direct Docker Deployment
If you have direct Docker access to the Easypanel server:
# SSH to Easypanel server
ssh user@110.164.146.46
# Run container directly
docker run -d \
-p 4321:4321 \
--name dealplustech-astro \
--restart unless-stopped \
-e NODE_ENV=production \
-e PORT=4321 \
-e HOST=0.0.0.0 \
dealplustech-astro:latest
API Endpoints
List Projects
curl -X GET "http://110.164.146.46:3000/api/trpc/projects.listProjects" \
-H "Authorization: Bearer YOUR_TOKEN" \
--insecure
Create Service
curl -X POST "http://110.164.146.46:3000/api/trpc/services.app.create" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"projectName": "dealplustech",
"name": "dealplustech-astro",
"type": "docker",
"docker": {
"image": "dealplustech-astro:latest",
"port": 4321
},
"env": {
"NODE_ENV": "production",
"PORT": "4321"
}
}' \
--insecure
Inspect Service
curl -X GET "http://110.164.146.46:3000/api/trpc/services.app.inspectService" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"input":{"json":{"projectName":"dealplustech","serviceName":"dealplustech-astro"}}}' \
--insecure
Get Service Logs
curl -X GET "http://110.164.146.46:3000/api/trpc/services.common.getLogs" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"input":{"json":{"projectName":"dealplustech","serviceName":"dealplustech-astro","lines":50}}}' \
--insecure
Deploy/Redeploy Service
curl -X POST "http://110.164.146.46:3000/api/trpc/services.app.deploy" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"input":{"json":{"projectName":"dealplustech","serviceName":"dealplustech-astro"}}}' \
--insecure
Environment Variables
| Variable | Value | Required |
|---|---|---|
NODE_ENV |
production |
✅ Yes |
PORT |
4321 |
✅ Yes |
HOST |
0.0.0.0 |
✅ Yes |
Troubleshooting
API Returns 401 Unauthorized
Problem: Invalid or missing API token
Solution:
# Verify token is set
echo $EASYPANEL_API_TOKEN
# Regenerate token in Easypanel dashboard
Service Won't Start
Problem: Container crashes on startup
Solution:
# Check logs
docker logs dealplustech-astro
# Common issues:
# - Port already in use
# - Missing environment variables
# - Image build failed
Build Fails
Problem: Docker build errors
Solution:
# Rebuild with verbose output
cd dealplustech-astro
docker build --no-cache -t dealplustech-astro:latest .
# Check for errors in output
Can't Access Easypanel
Problem: Connection timeout
Solution:
# Test connection
curl -I http://110.164.146.46:3000
# Check if Easypanel is running
# Contact server administrator if needed
Post-Deployment
1. Verify Service
curl http://your-easypanel-url:4321/
Should return HTML with Thai content
2. Check Health
curl -I http://your-easypanel-url:4321/
Should return HTTP/1.1 200 OK
3. Setup Domain (Optional)
- Go to Easypanel → Service Settings → Domains
- Add domain:
dealplustech.co.th - Update DNS records
- Enable SSL
4. Enable Auto-Deploy
For Git-based auto-deploy:
- Go to Service Settings → Git
- Connect repository
- Enable auto-deploy on push
Resources
- Easypanel Dashboard: http://110.164.146.46:3000
- API Documentation: http://110.164.146.46:3000/api
- Swagger UI: http://110.164.146.46:3000/api (Swagger UI)
- Easypanel Docs: https://docs.easypanel.io
Support
For issues:
- Check service logs in Easypanel
- Review deployment script output
- Contact Easypanel support
- Check project documentation
Last Updated: 2026-03-02
Status: ✅ Ready for Deployment