Auto-sync from website-creator
This commit is contained in:
309
skills/website-creator/EASYPANEL_INTEGRATION.md
Normal file
309
skills/website-creator/EASYPANEL_INTEGRATION.md
Normal file
@@ -0,0 +1,309 @@
|
||||
# 🚀 Easypanel Deployment Integration Guide
|
||||
|
||||
**How to deploy websites created with website-creator skill to Easypanel**
|
||||
|
||||
---
|
||||
|
||||
## 📋 Current Implementation
|
||||
|
||||
The `website-creator` skill **generates Docker-ready websites** but does **NOT automatically deploy** to Easypanel. You need to use the `easypanel-deploy` skill separately.
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Deployment Workflow
|
||||
|
||||
### Step 1: Generate Website
|
||||
|
||||
```bash
|
||||
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/website-creator
|
||||
|
||||
python3 scripts/create_astro_website.py \
|
||||
--name "My Website" \
|
||||
--languages "th,en" \
|
||||
--output "./my-website"
|
||||
```
|
||||
|
||||
### Step 2: Initialize Git Repository
|
||||
|
||||
```bash
|
||||
cd ./my-website
|
||||
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit - PDPA compliant Astro website"
|
||||
|
||||
# Create remote repository on Gitea first, then:
|
||||
git remote add origin https://git.moreminimore.com/username/my-website.git
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
### Step 3: Deploy to Easypanel
|
||||
|
||||
Use the `easypanel-deploy` skill:
|
||||
|
||||
```
|
||||
/use easypanel-deploy deploy
|
||||
```
|
||||
|
||||
**You'll be asked:**
|
||||
|
||||
1. **Project name:** `my-website`
|
||||
2. **Service name:** `my-website-service`
|
||||
3. **Git repository URL:** `https://git.moreminimore.com/username/my-website.git`
|
||||
4. **Branch:** `main`
|
||||
5. **Port:** `80`
|
||||
|
||||
**The skill will:**
|
||||
- Create project (if not exists)
|
||||
- Create service
|
||||
- Connect Git repository
|
||||
- Set build type to Dockerfile
|
||||
- Trigger deployment
|
||||
- Check status
|
||||
|
||||
### Step 4: Verify Deployment
|
||||
|
||||
```
|
||||
/use easypanel-deploy status
|
||||
→ Project: my-website
|
||||
→ Service: my-website-service
|
||||
```
|
||||
|
||||
### Step 5: Set Environment Variables
|
||||
|
||||
In Easypanel dashboard:
|
||||
|
||||
1. Go to your service
|
||||
2. Settings → Environment Variables
|
||||
3. Add these variables:
|
||||
|
||||
```
|
||||
UMAMI_WEBSITE_ID=your-website-id
|
||||
UMAMI_DOMAIN=analytics.example.com
|
||||
ADMIN_PASSWORD=your-secure-password
|
||||
ASTRO_DB_REMOTE_URL=file:/app/data/consent.db
|
||||
```
|
||||
|
||||
4. Redeploy to apply changes
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Auto-Deploy After Initial Setup
|
||||
|
||||
Once deployed, Easypanel will **auto-deploy** on every push to `main` branch:
|
||||
|
||||
```bash
|
||||
# Make changes
|
||||
git add .
|
||||
git commit -m "Update privacy policy"
|
||||
git push origin main
|
||||
|
||||
# Easypanel will automatically rebuild and deploy
|
||||
# Check status:
|
||||
/use easypanel-deploy status
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Integration Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────┐
|
||||
│ website-creator │
|
||||
│ (Python script) │
|
||||
│ │
|
||||
│ Generates: │
|
||||
│ - Astro website │
|
||||
│ - Dockerfile │
|
||||
│ - docker-compose │
|
||||
└──────────┬──────────┘
|
||||
│
|
||||
│ Manual step:
|
||||
│ git push
|
||||
↓
|
||||
┌─────────────────────┐
|
||||
│ Gitea Repository │
|
||||
│ (git.moreminimore) │
|
||||
└──────────┬──────────┘
|
||||
│
|
||||
│ Auto-deploy
|
||||
│ or manual trigger
|
||||
↓
|
||||
┌─────────────────────┐
|
||||
│ easypanel-deploy │
|
||||
│ (Skill via API) │
|
||||
│ │
|
||||
│ Deploys to: │
|
||||
│ - Easypanel │
|
||||
│ - Docker │
|
||||
└──────────┬──────────┘
|
||||
│
|
||||
↓
|
||||
┌─────────────────────┐
|
||||
│ Production URL │
|
||||
│ https://... │
|
||||
└─────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Future Enhancement: Automatic Integration
|
||||
|
||||
**To fully automate deployment**, the `website-creator` skill could be extended to:
|
||||
|
||||
### Option 1: Call easypanel-deploy via subprocess
|
||||
|
||||
```python
|
||||
# In create_astro_website.py
|
||||
import subprocess
|
||||
|
||||
def deploy_to_easypanel(project_name, service_name, git_url):
|
||||
"""Deploy to Easypanel using easypanel-deploy skill."""
|
||||
|
||||
# Push to Git first
|
||||
subprocess.run(['git', 'add', '.'])
|
||||
subprocess.run(['git', 'commit', '-m', 'Initial commit'])
|
||||
subprocess.run(['git', 'push', '-u', 'origin', 'main'])
|
||||
|
||||
# Call easypanel-deploy via curl commands
|
||||
# (from easypanel-deploy SKILL.md workflow)
|
||||
|
||||
print("✅ Deployed to Easypanel!")
|
||||
print(f"URL: https://{project_name}.easypanel.app")
|
||||
```
|
||||
|
||||
### Option 2: Use task() delegation
|
||||
|
||||
```python
|
||||
# If running within OpenCode agent context
|
||||
from opencode import task
|
||||
|
||||
def deploy_to_easypanel(project_name, service_name, git_url):
|
||||
"""Delegate to easypanel-deploy skill."""
|
||||
|
||||
result = task(
|
||||
category="quick",
|
||||
load_skills=["easypanel-deploy"],
|
||||
description="Deploy website to Easypanel",
|
||||
prompt=f"""Deploy to Easypanel:
|
||||
- Project: {project_name}
|
||||
- Service: {service_name}
|
||||
- Git URL: {git_url}
|
||||
- Branch: main
|
||||
- Port: 80
|
||||
|
||||
Follow easypanel-deploy workflow exactly."""
|
||||
)
|
||||
|
||||
return result
|
||||
```
|
||||
|
||||
### Option 3: Generate deployment script
|
||||
|
||||
```python
|
||||
# Generate deploy.sh in website root
|
||||
deploy_script = """#!/bin/bash
|
||||
# Auto-deploy to Easypanel
|
||||
|
||||
PROJECT_NAME="{project_name}"
|
||||
SERVICE_NAME="{service_name}"
|
||||
GIT_URL="{git_url}"
|
||||
|
||||
# Push to Git
|
||||
git add .
|
||||
git commit -m "Deploy $(date)"
|
||||
git push origin main
|
||||
|
||||
echo "✅ Code pushed. Easypanel will auto-deploy."
|
||||
echo "Check status: /use easypanel-deploy status"
|
||||
"""
|
||||
|
||||
(output_dir / 'deploy.sh').write_text(deploy_script)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Current Status
|
||||
|
||||
| Feature | Status | Notes |
|
||||
|---------|--------|-------|
|
||||
| Generate website | ✅ Complete | Docker-ready |
|
||||
| Push to Git | ⚠️ Manual | User must run git commands |
|
||||
| Deploy to Easypanel | ⚠️ Manual | Use `/use easypanel-deploy` |
|
||||
| Auto-deploy on push | ✅ Works | After initial setup |
|
||||
| Direct integration | ❌ Not implemented | Future enhancement |
|
||||
|
||||
---
|
||||
|
||||
## 📞 Quick Reference
|
||||
|
||||
### Deploy Commands
|
||||
|
||||
```bash
|
||||
# 1. Generate
|
||||
python3 scripts/create_astro_website.py --name "site" --output "./site"
|
||||
|
||||
# 2. Git
|
||||
cd ./site && git init && git add . && git commit -m "Initial"
|
||||
git remote add origin <url> && git push -u origin main
|
||||
|
||||
# 3. Easypanel (via skill)
|
||||
/use easypanel-deploy deploy
|
||||
→ Project: site
|
||||
→ Service: site-service
|
||||
→ Git URL: <url>
|
||||
→ Branch: main
|
||||
→ Port: 80
|
||||
|
||||
# 4. Check status
|
||||
/use easypanel-deploy status
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Set in Easypanel dashboard:
|
||||
|
||||
```bash
|
||||
UMAMI_WEBSITE_ID=xxx-xxx-xxx
|
||||
UMAMI_DOMAIN=analytics.example.com
|
||||
ADMIN_PASSWORD=change-me-before-production
|
||||
ASTRO_DB_REMOTE_URL=file:/app/data/consent.db
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Recommended Workflow
|
||||
|
||||
**For Production:**
|
||||
|
||||
1. Generate website with `website-creator`
|
||||
2. Test locally (`npm run dev`)
|
||||
3. Push to Gitea
|
||||
4. Deploy with `easypanel-deploy`
|
||||
5. Set environment variables
|
||||
6. Verify deployment
|
||||
7. Future updates: just `git push`
|
||||
|
||||
**For Development:**
|
||||
|
||||
1. Generate website
|
||||
2. Test locally
|
||||
3. Make changes
|
||||
4. Commit when ready
|
||||
5. Push to trigger deployment
|
||||
|
||||
---
|
||||
|
||||
## 📝 Summary
|
||||
|
||||
**Current:** Two separate skills, manual deployment step
|
||||
|
||||
- `website-creator` → Generates website ✅
|
||||
- User → Pushes to Git ⚠️
|
||||
- `easypanel-deploy` → Deploys to Easypanel ⚠️
|
||||
|
||||
**Future (if implemented):** Single command deployment
|
||||
|
||||
- `website-creator` → Generates AND deploys ✅
|
||||
|
||||
**For now:** Use the workflow above for deployment.
|
||||
Reference in New Issue
Block a user