- Use an existing Cloudflare account or create a new one
- Click "Deploy to Cloudflare Workers" above
- Follow the instructions. At the end, this repo will be forked in your organization and the following will be created on your Cloudflare account:
release-relay
workerdesktop-cdn
workerdesktop-download-cdn
workerdesktop-app-distributables-staging
R2 bucketdesktop-app-distributables
R2 bucket
- Create a GitHub PAT (Personal Access Token) with the following scopes:
- Scope it to the
self-hosted
repo that has just been forked - Read access to repository Metadata
- Read and Write access to repository Pull Requests
- Read and Write access to repository Contents
- Scope it to the
- Create a "Release webhook" on ToDesktop.
- Go to https://www.todesktop.com/apps/{YOUR_APP_ID}/settings
- Scroll to "App webhooks"
- Click the
+
button and select "Release webhook" - Enter the URL of the
new-release-webhook
endpoint of therelease-relay
worker. It may look like this: https://release-relay.your-org.workers.dev/new-release-webhook - Click "Save" and note the webhook secret
- Add the variables and secrets to the
release-relay
worker:WEBHOOK_HMAC_KEY
(SECRET) - the webhook secret from step 5GITHUB_TOKEN
(SECRET) - a github token with the required scopes from step 4GITHUB_OWNER
(VAR) - the owner of the forkedself-hosted
repoGITHUB_REPO
(VAR) - the name of the forkedself-hosted
repo
- (Optional) Create custom domains for your self-hosted workers.
That's it!
- Make sure that you have the latest version of
@todesktop/cli
installed. - Add
updateUrlBase
to yourtodesktop.json
file and set it to the URL of thedesktop-cdn
worker. - Run
todesktop build
to build your app. - "Partially release" your app on ToDesktop to your local IP address (or multiple IPs if you wish to test the migration with multiple users).
- Merge the PR created by the
release-relay
worker. - When you open the app then it should update to the new version. From now on, the app will check for updates on your self-hosted workers.
- Repeat steps 3-6 again to test a full update on your self-hosted workers.
- If all looks good, then do a full "Release" of your app on ToDesktop and merge the PR created by the
release-relay
worker. - You may also update your download URLs to point to your
desktop-download-cdn
worker.
Now every time you create a release on ToDesktop, the following will happen:
- The
release-relay
worker will be triggered with the release data - It will upload the artifacts to the
desktop-app-distributables-staging
R2 bucket - It will create a pull request on the
self-hosted
repo with details of the release - If you choose to merge the PR, the artifacts will be uploaded to the
desktop-app-distributables
R2 bucket and your release will go live
See desktop-download-cdn/README.md for more details on how the download CDN works and available routes.