# ry deploy

> Deploy from a source directory (--source) or a prebuilt OCI image (--image); reads rytiv.json if present.

```text
ry deploy [options] [app]
```

## Options

- `-s, --source <dir>`: Source directory to build and deploy.
- `-i, --image <image>`: Prebuilt OCI image, e.g. nginx:alpine.
- `-m, --memory <mb>`: Memory in MB (default: keep the app's current size; 512 for a new app).
- `-c, --vcpus <n>`: vCPUs (default: keep the app's current size; 1 for a new app).
- `--build-memory <mb>`: Memory for the BUILD machine in MB (default: by framework, 4096 / 8192 for next and dockerfile).
- `--disk <mb>`: Disk for the machine in MB (default: image size + headroom; raise it when the app installs or builds inside its own machine).
- `-p, --port <port>`: Internal port. Default: `3000`.
- `-n, --count <n>`: Number of machines (default: keep current, min 1).
- `--start <command>`: Start command, overriding what detection chose (one source, several process types).
- `--health-path <path>`: HTTP health-check path for app-level readiness, e.g. /health.
- `--health-timeout <seconds>`: How long a new instance may take to open its port (default 60, 120 with a volume).
- `--restart <policy>`: Never: a crashed guest stays down and a silent one is only reported; on-failure: also restart a guest that stops listening (3 tries, growing gap). Without it a crashed guest is restarted (10 in 5 min) and a silent one is reported.
- `--kill-signal <signal>`: Signal a stop, deploy replacement or migrate sends the app before it ends (SIGTERM, SIGINT, SIGQUIT, SIGHUP, SIGUSR1, SIGUSR2, SIGWINCH, SIGKILL; default: the image's STOPSIGNAL, else SIGTERM).
- `--kill-timeout <seconds>`: How long the app gets after that signal before SIGKILL (default 30, at most 300).
- `--sleep <off|duration>`: When the machines sleep: off (always on, e.g. a worker or cron) or after an idle time like 5m, 2h, 1d (10s to 1d) without requests and without CPU load; default: keep the app's current rule - an app whose rule was never chosen never sleeps.
- `-e, --env <pairs...>`: Plain (unencrypted) env vars, e.g. LOG_LEVEL=debug NODE_ENV=production.
- `--with <kinds...>`: Accept the suggestion: postgres | redis | bucket | all - creates and attaches BEFORE the build.

## Example

```bash
ry deploy web --source .
ry deploy web --image nginx:alpine --port 80
ry deploy web --sleep 5m
```
