# Deploy commands

These commands deploy a project and show what it is doing.

## grayspar deploy

Build a folder and deploy it as a project.

```sh
grayspar deploy [flags] [folder]
```

| Argument | Description |
| --- | --- |
| `folder` | Deploy only the files under this folder of the project (default: "."). |

| Flag | Description |
| --- | --- |
| `-y, --yes` | Take the plan as shown without asking. |
| `--name <name>` | Create a new project with this name. |
| `--no-env` | Deploy without reading any .env file. |
| `--env-file <path>` | Read variables from a specific file. |
| `--env-conflict <winner>` | Which value wins where your .env differs from a saved one (choices: "saved", "file"). |
| `-s, --service <name>` | Deploy only this service, repeatable. |
| `--path <name=path>` | Where a new service answers, repeatable. |
| `--no-path <name>` | A new service that takes no requests, like a background worker. |
| `--dockerfile <name=path>` | The Dockerfile a new service builds from. |
| `--volume <name=path>` | A folder a service keeps across deploys, repeatable. |

The first deploy creates the project and links the folder to it. Later deploys in that folder update the same project.

```sh
grayspar deploy
grayspar deploy --yes --name <project-name>
grayspar deploy --service web
grayspar deploy --path web=/ --path api=/api --no-path worker
grayspar deploy --volume app=/app/data
```

## grayspar status

Show each service's address and status.

```sh
grayspar status [flags]
```

```text frame="terminal"
<project-name>

SERVICE    URL                                   STATUS
app        https://<project-name>.grayspar.com   Running
```

## grayspar logs

Show a service's logs, or with --build its last build log.

```sh
grayspar logs [flags]
```

| Flag | Description |
| --- | --- |
| `-s, --service <name>` | Which service to read. |
| `--build` | Show the log from the last build instead. |
| `-f` | Keep printing new lines as they arrive. |

```sh
grayspar logs --service api -f
grayspar logs --build
```

## grayspar restart

Start a fresh copy of a service's running version.

```sh
grayspar restart [flags]
```

| Flag | Description |
| --- | --- |
| `-s, --service <name>` | Which service to restart. |

```sh
grayspar restart --service api
```

## grayspar link

Link this folder to a project.

```sh
grayspar link [flags]
```

Run this command in a folder that has no link, such as a second copy of the code. The link is saved in `.grayspar/project.json`.

## grayspar unlink

Unlink this folder from its project.

```sh
grayspar unlink [flags]
```

The next `grayspar deploy` in that folder can create a new project. The project itself keeps running.