# 🚀 Easypanel Deploy Skill **Skill Name:** `easypanel-deploy` **Category:** `quick` **Load Skills:** `[]` (standalone) --- ## 🎯 Purpose Deploy and manage services on Easypanel automatically via API. **CRITICAL:** Follow the workflow exactly. Do NOT add parameters by yourself. Use ONLY the exact JSON structure provided. --- ## 🔧 Prerequisites ### Easypanel API Credentials MUST exist in `~/.easypanel/credentials`: ```bash EASYPANEL_URL=http://110.164.146.47:3000 EASYPANEL_API_TOKEN=your-api-token-here EASYPANEL_DEFAULT_PROJECT=default ``` **If credentials don't exist, ask user to create them first.** --- ## 🚀 Workflow - FOLLOW EXACTLY ### Phase 1: Deploy New Service **Input Required:** - Project name (ask user) - Service name (ask user) - Git repository URL (ask user) - Branch (default: main) - Port (default: 4321) **Execute in EXACT order:** #### Step 1: Create Project (if not exists) ```bash curl -X POST "$EASYPANEL_URL/api/trpc/projects.createProject" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"input":{"json":{"name":"PROJECT_NAME"}}}' ``` #### Step 2: Create Service ```bash curl -X POST "$EASYPANEL_URL/api/trpc/services.app.createService" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"input":{"json":{"projectName":"PROJECT_NAME","domains":[{"host":"$(EASYPANEL_DOMAIN)"}],"serviceName":"SERVICE_NAME"}}}' ``` #### Step 3: Update Git Source ```bash curl -X POST "$EASYPANEL_URL/api/trpc/services.app.updateSourceGit" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"input":{"json":{"projectName":"PROJECT_NAME","serviceName":"SERVICE_NAME","repo":"GIT_URL","ref":"main","path":"/"}}}' ``` #### Step 4: Update Build Type ```bash curl -X POST "$EASYPANEL_URL/api/trpc/services.app.updateBuild" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"input":{"json":{"projectName":"PROJECT_NAME","serviceName":"SERVICE_NAME","build":{"type":"dockerfile"}}}}' ``` #### Step 5: Deploy Service ```bash curl -X POST "$EASYPANEL_URL/api/trpc/services.app.deployService" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"input":{"json":{"projectName":"PROJECT_NAME","serviceName":"SERVICE_NAME"}}}' ``` #### Step 6: Check Status ```bash curl "$EASYPANEL_URL/api/trpc/services.app.inspectService?input=%7B%22json%22%3A%7B%22projectName%22%3A%22PROJECT_NAME%22%2C%22serviceName%22%3A%22SERVICE_NAME%22%7D%7D" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" ``` --- ### Phase 2: Redeploy Existing Service **Input Required:** - Project name (ask user) - Service name (ask user) **Execute in EXACT order:** #### Step 1: Find Service ```bash curl "$EASYPANEL_URL/api/trpc/projects.listProjectsAndServices" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" ``` #### Step 2: Trigger Redeploy ```bash curl -X POST "$EASYPANEL_URL/api/trpc/services.app.deployService" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"input":{"json":{"projectName":"PROJECT_NAME","serviceName":"SERVICE_NAME"}}}' ``` #### Step 3: Check Status ```bash curl "$EASYPANEL_URL/api/trpc/services.app.inspectService?input=%7B%22json%22%3A%7B%22projectName%22%3A%22PROJECT_NAME%22%2C%22serviceName%22%3A%22SERVICE_NAME%22%7D%7D" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" ``` --- ### Phase 3: Check Status **Input Required:** - Project name (ask user) - Service name (ask user) **Execute:** ```bash curl "$EASYPANEL_URL/api/trpc/services.app.inspectService?input=%7B%22json%22%3A%7B%22projectName%22%3A%22PROJECT_NAME%22%2C%22serviceName%22%3A%22SERVICE_NAME%22%7D%7D" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" ``` --- ### Phase 4: View Logs **Input Required:** - Project name (ask user) - Service name (ask user) - Lines (default: 50, ask user) **Execute:** ```bash curl "$EASYPANEL_URL/api/trpc/services.common.getLogs?input=%7B%22json%22%3A%7B%22projectName%22%3A%22PROJECT_NAME%22%2C%22serviceName%22%3A%22SERVICE_NAME%22%2C%22lines%22%3A50%7D%7D" \ -H "Authorization: Bearer $EASYPANEL_API_TOKEN" ``` --- ## ⚠️ IMPORTANT RULES 1. **DO NOT add parameters** - Use ONLY the exact JSON structure provided 2. **Follow workflow order** - Execute steps in exact order 3. **Use URL-encoded GET** - For inspect/logs endpoints 4. **Use POST for actions** - For create/deploy/update endpoints 5. **Verify credentials** - Check `~/.easypanel/credentials` exists 6. **Report status** - After each step, report success/failure --- ## 🔒 Authentication **ALL API calls MUST include:** ``` Authorization: Bearer $EASYPANEL_API_TOKEN Content-Type: application/json ``` --- ## ⚠️ Error Handling | Error | Action | |-------|--------| | 401 Unauthorized | Tell user: "API token invalid. Check ~/.easypanel/credentials" | | 404 Not Found | Tell user: "Project or service not found. Verify names." | | 500 Server Error | Tell user: "Easypanel server error. Check server status." | | Build Failed | Tell user: "Build failed. Check logs with /use easypanel-deploy logs" | --- ## 🎯 Success Criteria After deployment, verify: - ✅ Service created (Step 2 success) - ✅ Git connected (Step 3 success) - ✅ Build type set (Step 4 success) - ✅ Deployment triggered (Step 5 success) - ✅ Status shows "running" or "ready" (Step 6 success) --- ## 📝 JSON Structure - DO NOT MODIFY ### Create Service ```json { "input": { "json": { "projectName": "my-project", "domains": [{"host":"$(EASYPANEL_DOMAIN)"}], "serviceName": "my-service" } } } ``` ### Update Git Source ```json { "input": { "json": { "projectName": "my-project", "serviceName": "my-service", "repo": "https://git.moreminimore.com/user/repo.git", "ref": "main", "path": "/" } } } ``` ### Update Build ```json { "input": { "json": { "projectName": "my-project", "serviceName": "my-service", "build": { "type": "dockerfile" } } } } ``` ### Deploy Service ```json { "input": { "json": { "projectName": "my-project", "serviceName": "my-service" } } } ``` ### Inspect Service (URL-encoded) ``` ?input=%7B%22json%22%3A%7B%22projectName%22%3A%22my-project%22%2C%22serviceName%22%3A%22my-service%22%7D%7D ``` --- ## 🔄 Ongoing Operations **For auto-deploy enabled services:** - User pushes to Git → Easypanel auto-deploys - User checks status → Use Phase 3 - User views logs → Use Phase 4 **For manual deployments:** - Use Phase 2 to trigger redeploy - Monitor build progress with Phase 3 - Verify deployment with Phase 3 --- ## 🎯 Example Session ``` User: /use easypanel-deploy deploy AI: I'll help you deploy a service to Easypanel. First, what's your project name? User: my-website AI: What's your service name? User: my-website-service AI: What's your Git repository URL? User: https://git.moreminimore.com/user/my-website.git AI: Great! Deploying now... [Execute Step 1: Create Project] ✅ Project created [Execute Step 2: Create Service] ✅ Service created [Execute Step 3: Update Git Source] ✅ Git repository connected [Execute Step 4: Update Build Type] ✅ Build type set to dockerfile [Execute Step 5: Deploy Service] ✅ Deployment triggered [Execute Step 6: Check Status] ✅ Status: building Your service is deploying! Check status with: /use easypanel-deploy status ```