FoxCloud Deployment Guide
This guide covers all available methods for deploying FoxCloud to Cloudflare Workers.
Prerequisites
Before deploying, ensure you have:
- A Cloudflare account
- A domain configured in Cloudflare
- Wrangler CLI installed:
npm install -g wrangler
- Node.js 18 or higher
Method 1: Download Pre-built Worker (Recommended for Quick Setup)
- Download the latest
worker.js
from Releases
- Install Wrangler globally:
- Deploy to Cloudflare Workers:
wrangler deploy worker.js
- Configure environment variables as described in Environment Variables Guide
Method 2: Build from Source (Recommended for Development)
- Clone the repository:
git clone https://github.com/code3-dev/foxcloud.git
cd foxcloud
- Install dependencies:
- Build the project:
- Deploy to Cloudflare Workers:
- Configure environment variables as described in Environment Variables Guide
Method 3: GitHub Actions (Recommended for Production)
- Fork the repository
- Set up Cloudflare credentials in repository secrets:
CLOUDFLARE_API_TOKEN
: Your Cloudflare API token
CLOUDFLARE_ACCOUNT_ID
: Your Cloudflare account ID
- Enable GitHub Actions in repository settings
- Push to
master
branch to trigger automatic deployment
- Configure environment variables in the Cloudflare Dashboard
Setting Up Cloudflare Credentials
- Create a Cloudflare API token:
- Go to Cloudflare Dashboard → My Profile → API Tokens
- Create a token with
Workers Scripts: Edit
permission
- Get your Account ID:
- Go to Cloudflare Dashboard → Workers & Pages
- Your Account ID is displayed in the sidebar
- Add secrets to GitHub:
- Go to your forked repository → Settings → Secrets and variables → Actions
- Add
CLOUDFLARE_API_TOKEN
and CLOUDFLARE_ACCOUNT_ID
as repository secrets
Configuration After Deployment
After deploying, you need to configure environment variables:
- Go to Cloudflare Dashboard → Workers & Pages
- Select your deployed Worker
- Go to Settings → Variables
- Add the following variables:
UUID
: Your user UUID(s)
PROXY_IP
: Your proxy server IP(s)
Custom Domain Setup
To use a custom domain:
- In the Cloudflare Dashboard, go to your Worker
- Navigate to “Settings” → “Triggers”
- Under “Custom Domains”, add your domain
- Ensure your domain is configured in Cloudflare DNS
Troubleshooting Deployment
Common Issues
- Authentication errors: Verify your Cloudflare API token has the correct permissions
- Build failures: Ensure all dependencies are installed with
npm install
- Deployment timeouts: Check your internet connection and try again
- Environment variables not found: Verify variables are set in the Cloudflare Dashboard
Checking Deployment Status
- View deployment logs in GitHub Actions (for CI/CD deployments)
- Check Cloudflare Dashboard for deployment status
- Test your deployment by visiting your Worker URL
Updating Your Deployment
For Pre-built Worker
- Download the new
worker.js
from Releases
- Redeploy using
wrangler deploy worker.js
For Source Builds
- Pull the latest changes:
git pull
- Rebuild:
npm run build
- Redeploy:
npm run deploy
For GitHub Actions
- Pull the latest changes or merge upstream changes
- Push to your repository to trigger automatic deployment
Rollback Procedure
If you need to rollback to a previous version:
- Identify the previous working version
- Either:
- Download the previous release’s
worker.js
and redeploy
- Revert your repository to the previous commit and redeploy
- Use Cloudflare’s rollback feature in the dashboard
Monitoring and Logs
Monitor your Worker performance through:
- Cloudflare Dashboard → Workers & Pages → Your Worker → Analytics
- Real-time logs with
wrangler tail
- Custom logging in your application code
For any deployment issues not covered in this guide, please check the Issues section of the repository or create a new issue.