55 lines
2.8 KiB
Markdown
55 lines
2.8 KiB
Markdown
# Deploy Cloudflare Worker to `celld` Action
|
|
|
|
Custom Gitea Action for bundling and deploying Cloudflare Workers, Durable Objects, D1, KV, Queues, Workflows, R2, and Static Assets (`wrangler.json`) to a self-hosted [`denoland/celld`](https://github.com/denoland/celld) fleet on TrueNAS SCALE backed by RustFS S3 (`s3.rodydavis.dev`).
|
|
|
|
## Features
|
|
|
|
- **Zero-Docker-Build Hot Deploys**: Bundles TypeScript/JS Worker projects via `esbuild` and publishes directly to `s3://celld-<repo-name>`. Running `celld` daemons on TrueNAS adopt new deployments in place with zero container restarts.
|
|
- **Auto-Bucket Provisioning**: Automatically creates the S3 fleet bucket on RustFS (`s3.rodydavis.dev`) on first deploy.
|
|
- **Sub-Millisecond Internal S3 Path**: Configures the TrueNAS `celld` daemon to communicate directly with `http://minio-s3:9000` over the internal `apps-net` Docker bridge.
|
|
- **Automated D1 Migrations**: Optionally applies `.sql` migrations from `./migrations` via `celld d1 migrations apply`.
|
|
|
|
## Inputs
|
|
|
|
| Name | Description | Default | Required |
|
|
| :--- | :--- | :--- | :---: |
|
|
| `ssh_key` | Private SSH key for authenticating to TrueNAS SCALE | — | **Yes** |
|
|
| `s3_access_key` | S3 Access Key ID (`secrets.CELLD_S3_ACCESS_KEY`) | — | **Yes** |
|
|
| `s3_secret_key` | S3 Secret Key (`secrets.CELLD_S3_SECRET_KEY`) | — | **Yes** |
|
|
| `working_directory` | Path to Wrangler project directory | `.` | No |
|
|
| `app_name` | Application subpath under `/mnt/jupiter/apps/<owner>/<repo>` | `<owner>/<repo>` | No |
|
|
| `bucket` | S3 bucket name for the `celld` fleet | `celld-<repo-name>` | No |
|
|
| `domain` | Target domain(s) for Traefik router (comma-separated) | `<repo-name>.rodydavis.dev` | No |
|
|
| `d1_database` | Optional D1 database name to run `celld d1 migrations apply` | `""` | No |
|
|
| `env_file_content` | Optional additional `.env` variables for the TrueNAS container | `""` | No |
|
|
| `idle_evict_s` | Seconds before idle Durable Objects hibernate (`CELLD_IDLE_EVICT_S`) | `60` | No |
|
|
| `ltx_retention_secs` | Seconds to retain old LTX epochs before GC (`CELLD_LTX_RETENTION_SECS`) | `86400` | No |
|
|
| `deploy_poll_s` | Seconds between bucket deployment checks (`CELLD_DEPLOY_POLL_S`) | `5` | No |
|
|
|
|
## Usage Example
|
|
|
|
```yaml
|
|
name: Deploy Worker to celld
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Deploy to TrueNAS celld Fleet
|
|
uses: https://git.rodydavis.dev/rodydavis/shared-actions/celld-deploy@main
|
|
with:
|
|
ssh_key: ${{ secrets.TRUENAS_SSH_KEY }}
|
|
s3_access_key: ${{ secrets.CELLD_S3_ACCESS_KEY }}
|
|
s3_secret_key: ${{ secrets.CELLD_S3_SECRET_KEY }}
|
|
domain: my-worker.rodydavis.dev
|
|
# Optional if using D1 SQLite migrations in ./migrations:
|
|
# d1_database: main-db
|
|
```
|