*Cloud*

# The service settings object

Everything that decides how a service is built, started and sized. Read it, change the fields you want and send base_generation back, so a change made by someone else in between is never overwritten.

## Attributes

- `generation` (number): The settings' version. Send it as base_generation when you change them.
- `source_kind` (string): repo or image.
- `repo_id` (string): The GitHub repository, for a repo service.
- `branch` (string): The branch it deploys from.
- `root_dir` (string): The folder of the repository to build, relative to its root.
- `watch_paths` (array): Only pushes that change these paths deploy. Empty means every push.
- `image_ref` (string): The image, for an image service.
- `builder` (string): railpack (detects the stack) or dockerfile.
- `dockerfile_path` (string): The Dockerfile, for the dockerfile builder.
- `build_cmd` (string): Overrides the build command.
- `start_cmd` (string): Overrides the start command.
- `restart_policy` (string): always, on_failure or never.
- `max_restarts` (number): For on_failure: restarts before giving up. 0 retries forever with backoff.
- `cpu_millis` (number): CPU per replica in millicores, 50 to 64000.
- `memory_mb` (number): Memory per replica in MB, 64 to 262144.
- `disk_mb` (number): Temporary disk per replica in MB, whole GB from 1024 to 102400. Wiped on every deploy.
- `replicas` (number): Replicas a deployment runs, 1 to 10. A service with a volume runs one.
- `healthcheck_path` (string): The path the platform probes before sending traffic. Empty: a TCP check.
- `healthcheck_timeout_s` (number): Seconds before one check fails, or null for the default (3).
- `healthcheck_interval_s` (number): Seconds between checks, or null for the default (5).
- `stop_grace_s` (number): Read only: seconds a replica gets to stop. 10, or 30 with a volume.
- `has_volume` (boolean): Read only: a volume is attached.

## Example

```json
{
  "data": {
    "generation": 7,
    "source_kind": "repo",
    "repo_id": "gh-918273645",
    "branch": "main",
    "root_dir": "apps/api",
    "watch_paths": ["apps/api/**"],
    "image_ref": "ghcr.io/acme/api:1.4.2",
    "builder": "railpack",
    "dockerfile_path": "Dockerfile",
    "build_cmd": "npm run build",
    "start_cmd": "node dist/server.js",
    "restart_policy": "on_failure",
    "max_restarts": 5,
    "cpu_millis": 1000,
    "memory_mb": 1024,
    "disk_mb": 2048,
    "replicas": 2,
    "healthcheck_path": "/healthz",
    "healthcheck_timeout_s": 5,
    "healthcheck_interval_s": 10,
    "stop_grace_s": 10,
    "has_volume": false
  }
}
```

## Endpoints

- `GET` [Check a file on the branch](https://docs.dispralabs.com/api/check-a-file-on-the-branch.md)
- `POST` [Create a service](https://docs.dispralabs.com/api/create-a-service.md)
- `GET` [Get service settings](https://docs.dispralabs.com/api/get-service-settings.md)
- `PUT` [Set service limits](https://docs.dispralabs.com/api/set-service-limits.md)
- `POST` [Test a health check](https://docs.dispralabs.com/api/test-a-health-check.md)
- `PATCH` [Update service settings](https://docs.dispralabs.com/api/update-service-settings.md)
