- Move all Astro files from dealplustech-astro/ to root - Archive Next.js code in _nextjs-backup/ - Update .gitignore for Astro project - Simplify project structure This completes the migration from Next.js to Astro. The Astro project is now at the root level.
5.8 KiB
🚀 Easypanel Deployment Guide
Project: Deal Plus Tech Astro Migration
Deployment Target: Easypanel (Docker-based)
Build Command: npm run build
Output: Static site served via npm run preview
📋 Prerequisites
- Easypanel Account - Access to Easypanel instance at
http://110.164.146.46:3000 - Git Repository - Code pushed to Git (Gitea/GitHub/GitLab)
- Domain (optional) - Custom domain for production
🛠️ Deployment Steps
Option 1: Deploy from Git Repository (Recommended)
Step 1: Connect Git Repository
- Login to Easypanel:
http://110.164.146.46:3000 - Click "New Project" or select existing project
- Click "New Service" → "Git Repository"
- Connect your Git provider (Gitea, GitHub, GitLab)
- Select repository:
dealplustech/dealplustech-astro - Select branch:
main
Step 2: Configure Build Settings
Build Configuration:
- Build Command:
npm run build - Publish Directory:
dist - Dockerfile: (Leave empty - uses auto-detection)
- Node Version:
20
Environment Variables:
NODE_ENV=production
PORT=4321
HOST=0.0.0.0
Step 3: Deploy
- Click "Deploy"
- Wait for build to complete (~2-3 minutes)
- Easypanel will automatically assign a URL (e.g.,
dealplustech-astro.easypanel.app) - Test the deployment
Step 4: Auto-Deploy (Optional)
Enable auto-deploy on push:
- Go to Service Settings → Git
- Enable "Auto Deploy"
- Select branch:
main
Now every push to main will trigger automatic deployment!
Option 2: Deploy with Dockerfile
If you prefer using the provided Dockerfile:
Step 1: Build Docker Image Locally
cd dealplustech-astro
# Build Docker image
docker build -t dealplustech-astro:latest .
# Test locally
docker run -p 4321:4321 dealplustech-astro:latest
Visit http://localhost:4321 to test
Step 2: Push to Container Registry
# Tag for your registry
docker tag dealplustech-astro:latest your-registry.com/dealplustech-astro:latest
# Push to registry
docker push your-registry.com/dealplustech-astro:latest
Step 3: Deploy on Easypanel
- Login to Easypanel
- New Service → "Docker Image"
- Enter image URL:
your-registry.com/dealplustech-astro:latest - Configure port:
4321 - Click "Deploy"
🔧 Configuration
Environment Variables
| Variable | Value | Description |
|---|---|---|
NODE_ENV |
production |
Production mode |
PORT |
4321 |
Astro preview server port |
HOST |
0.0.0.0 |
Listen on all interfaces |
Resource Allocation
Recommended Resources:
- CPU: 0.5 - 1 vCPU
- Memory: 512MB - 1GB
- Storage: 1GB (for logs and assets)
Custom Domain
To add a custom domain:
- Go to Service Settings → Domains
- Click "Add Domain"
- Enter your domain:
dealplustech.co.th - Update DNS records:
Type: CNAME Name: www Value: your-easypanel-url.easypanel.app - Enable SSL (Easypanel provides auto-SSL)
📊 Monitoring
Health Check
The Dockerfile includes a health check endpoint:
- URL:
http://your-domain:4321/ - Expected: HTTP 200 OK
Logs
View logs in Easypanel:
- Select Service
- Click "Logs" tab
- Filter by date/time
Metrics
Easypanel provides:
- CPU usage
- Memory usage
- Network traffic
- Request count
🔄 Update Deployment
Automatic Updates (Git Auto-Deploy)
If auto-deploy is enabled:
- Push changes to
mainbranch - Easypanel automatically rebuilds
- New version deploys in ~2-3 minutes
Manual Updates
- Go to Service → Deployments
- Click "Redeploy"
- Select latest commit
- Click "Deploy Now"
🐛 Troubleshooting
Build Fails
Issue: npm run build fails
Solution:
- Check build logs in Easypanel
- Verify
package.jsonscripts - Test build locally:
npm run build - Check Node version (must be 20+)
502 Bad Gateway
Issue: Service returns 502 error
Solution:
- Check if container is running
- Verify port is 4321
- Check health check endpoint
- Review container logs
Static Assets Not Loading
Issue: Images/CSS return 404
Solution:
- Verify
public/folder is copied in Dockerfile - Check asset paths in code
- Rebuild and redeploy
📝 Post-Deployment Checklist
- Test homepage loads
- Test product pages (6 products)
- Test blog posts (3 posts)
- Test mobile responsiveness
- Verify FloatingContact buttons work
- Test all navigation links
- Check SEO metadata
- Setup custom domain (if needed)
- Enable SSL certificate
- Configure CDN (optional)
- Setup monitoring alerts
🎯 Production Optimization
Enable Compression
Easypanel automatically enables gzip compression for static assets.
CDN Integration
For better performance:
- Sign up for CDN (Cloudflare, BunnyCDN, etc.)
- Point CDN to Easypanel URL
- Update DNS to point to CDN
- Configure cache rules
Caching Headers
Astro sets optimal cache headers by default:
- HTML: No cache (always fresh)
- Assets: 1 year (immutable)
- Images: 1 year (immutable)
📞 Support
Easypanel Documentation: https://docs.easypanel.io
Astro Documentation: https://docs.astro.build
Project Repository: [Your Git Repo]
🚀 Quick Deploy Commands
# Build locally
npm run build
# Test production build locally
npm run preview
# Build Docker image
docker build -t dealplustech-astro:latest .
# Run Docker container
docker run -p 4321:4321 dealplustech-astro:latest
# Push to registry
docker push your-registry.com/dealplustech-astro:latest
Deployment Status: ✅ Ready to Deploy
Estimated Deploy Time: 2-3 minutes
First Deploy: Manual
Subsequent Deploys: Automatic (if enabled)