> ## Documentation Index
> Fetch the complete documentation index at: https://redop.useagents.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy to Unkey

> Deploy a Docker-based Redop HTTP server to Unkey Deploy, configure production and preview environments, and verify the MCP endpoint.

Use Unkey when you want Docker-based deployment with automatic domains, preview environments, rollbacks, and Sentinel in front of your Redop app.

## Before you start

This guide assumes:

* your server uses the HTTP transport
* the app binds `0.0.0.0`
* the app reads `PORT` from `process.env.PORT`
* your repository includes a `Dockerfile`

If you scaffolded with `create-redop-app --transport http --deploy unkey`, the starter already generated:

* a production `Dockerfile` (compiled Bun binary)
* a listener on `PORT` (default `8080`) with `health: true`
* README deploy commands for GitHub and `unkey deploy`

If you still need a container setup from scratch, start with [Deploy with Docker](/docs/guides/deploy/docker) and come back once your Redop app builds cleanly in Docker.

If your Redop app lives inside a monorepo, use the monorepo production image pattern from [Deploy with Docker](/docs/guides/deploy/docker) and point Unkey at that Dockerfile.

## Unkey fit

| Item                      | Value                                                                  |
| ------------------------- | ---------------------------------------------------------------------- |
| Recommended transport     | `http`                                                                 |
| App shape                 | long-running Bun service from a Docker image                           |
| Deploy trigger            | GitHub push, CLI, or dashboard                                         |
| Required files            | `Dockerfile`                                                           |
| Runtime port              | Unkey injects `PORT` and defaults it to `8080`                         |
| Environment model         | default branch deploys to production, other branches deploy to preview |
| `create-redop-app` preset | `unkey`                                                                |
| Recommended for           | teams that want Docker deploys plus preview environments and Sentinel  |

## Example listener shape

Use a listener like this so the same app works locally and on Unkey:

```ts theme={null}
import { Redop } from "@redopjs/redop";

new Redop({
  serverInfo: {
    name: "unkey-redop",
    version: "0.1.0",
  },
})
  .tool("ping", {
    handler: () => ({ ok: true }),
  })
  .listen({
    port: Number(process.env.PORT ?? 8080),
    hostname: "0.0.0.0",
  });
```

If you want Unkey to probe a dedicated health endpoint, enable one explicitly:

```ts theme={null}
.listen({
  port: Number(process.env.PORT ?? 8080),
  hostname: "0.0.0.0",
  health: { path: "/health" },
});
```

## Example Dockerfile

Unkey Deploy expects a Dockerfile. Use a compiled production image so Unkey runs a single built executable:

```dockerfile theme={null}
FROM oven/bun:1.3.11 AS build

WORKDIR /app

COPY package.json bun.lock* ./
RUN bun install

COPY . .

RUN bun build \
  --compile \
  --minify-whitespace \
  --minify-syntax \
  --target bun-linux-x64 \
  --outfile redop-server \
  src/index.ts

FROM gcr.io/distroless/base

WORKDIR /app

COPY --from=build /app/redop-server redop-server

EXPOSE 8080

CMD ["./redop-server"]
```

If your Redop app lives inside a monorepo, replace the example copy steps and entry path with your real workspace layout by following the monorepo production image example in [Deploy with Docker](/docs/guides/deploy/docker).

## Deploy steps

1. Push your Redop project to GitHub.

2. In Unkey, create a new project and choose your repository.

3. Review the build settings:

   * set the root directory if your Redop app is inside a monorepo
   * point Unkey at the correct `Dockerfile`
   * add watch paths if you only want specific folders to trigger deploys

4. Review the runtime settings:

   * keep the port aligned with your app listener
   * leave the command empty if you want to use the Dockerfile `CMD`
   * configure a health check path only if you enabled one in Redop

5. Add environment variables in the Environment Variables tab.

6. Click Deploy.

After the first deployment:

* the default branch maps to production
* other branches map to preview
* each environment gets its own generated domain
* production and preview can use different variables, regions, and Sentinel settings

## Variables and redeploys

Use Unkey environment variables for secrets and environment-specific configuration such as database URLs, API keys, and feature flags.

Keep in mind:

* variables are scoped per environment
* keep preview and production values separate
* after changing variables, trigger a new deployment if you want the new values applied immediately

## Verify the deployment

Use the generated Unkey production or preview URL from the dashboard:

```sh theme={null}
curl -X POST https://your-unkey-domain/mcp \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"unkey-check","version":"1.0.0"}}}'
```

What success looks like:

* the deployment URL answers over HTTPS
* `/mcp` returns a valid JSON-RPC initialize response
* the response includes `serverInfo` from your Redop app

If you enabled Sentinel API key enforcement in Unkey, include the headers required by that policy when you test.

## Next

* [Deploy to Production overview](/docs/guides/deploy/index)
* [Deploy with Docker](/docs/guides/deploy/docker)
* [Unkey: Deploy with the CLI](https://www.unkey.com/docs/build-and-deploy/cli)
* [Unkey CLI overview](https://www.unkey.com/docs/cli/overview)
* [Connect over HTTP](/docs/getting-started/connect-http)
