import * as restate from "@restatedev/restate-sdk/fetch";// Create the Restate endpoint// Here you need to register your servicesconst handler = restate.createEndpointHandler({ services: [greeter], bidirectional: true,});// Serve using DenoDeno.serve({ port: 9080 }, handler);
Once deployed on Deno Deploy EA, register the service with Restate using the CLI or UI. Use Preview URLs so that Restate can target specific Deno deployments:
In order to make sure only a specific Restate Cloud environment can push requests to your Deno Deploy deployment,
head over to your Restate Cloud Dashboard to set up Restate identity keys.
For Deno Deploy Classic, we suggest the following CI/CD setup that deploys to Deno and then registers the deployment with Restate:
name: Deploy Denoon: push: branches: - mainenv: # Create the Deno project going to https://dash.deno.com/new_project linking this repository. # When creating the project, check **Just link the repo, I’ll set up GitHub Actions myself**. # Make sure this project name matches the deno project. DENO_PROJECT_NAME: ${{ vars.DENO_PROJECT_NAME }}jobs: deploy: permissions: id-token: write # required contents: read runs-on: ubuntu-latest timeout-minutes: 60 steps: - uses: actions/checkout@v4 - uses: denoland/setup-deno@v2 with: deno-version: v2.x # Deploy using deployctl - name: Deploy to Deno Deploy uses: denoland/deployctl@v1 id: deploy with: project: ${{ env.DENO_PROJECT_NAME }} entrypoint: main.ts - name: Register Restate deployment env: RESTATE_ADMIN_URL: ${{ secrets.RESTATE_ADMIN_URL }} RESTATE_AUTH_TOKEN: ${{ secrets.RESTATE_AUTH_TOKEN }} # Revision URL https://docs.deno.com/deploy/classic/deployments/#production-vs.-preview-deployments run: npx -y @restatedev/restate deployment register -y https://${{ env.DENO_PROJECT_NAME }}-${{ steps.deploy.outputs.deployment-id }}.deno.dev
Self-hosted Restate
You can use this workflow with Self-hosted Restate as well,
just make sure to correctly set up RESTATE_AUTH_TOKEN and RESTATE_ADMIN_URL to reach your Restate cluster.