Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 12, 2024
1 parent 5fb5073 commit 5363db5
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Here's some common ways to use pitchfork.

### Launching a one-off daemon

This workflow is an alternative to something like shell jobs—`mytask &`. This just runs a process in
This workflow is an alternative to something like shell jobs—`mytask &`. [`pitchfork run`](/cli/run) just runs a process in
the background:

```bash
Expand All @@ -40,7 +40,7 @@ You need to label the daemon with a name, in this case "docs". Once it's started
we reference it. If you run `pitchfork run docs "..."` again, it will not do anything if the daemon
is still running—this way you can start one-off daemons without thinking if you've already done so.

On `pitchfork run`, pitchfork will emit the output of `npm start docs-dev-server` for a few seconds.
On [`pitchfork run`](/cli/run), pitchfork will emit the output of `npm start docs-dev-server` for a few seconds.
If it fails during that time, it will exit non-zero to help you see if the daemon was configured/setup
correctly. -- TODO this needs to be implemented

Expand All @@ -57,7 +57,7 @@ run = "npm run server:api"
run = "npm run server:docs"
```

You can start all the daemons with `pitchfork start --all` or individual ones with their name, e.g.: `pitchfork start redis`.
You can start all the daemons with [`pitchfork start --all`](/cli/start) or individual ones with their name, e.g.: `pitchfork start redis`.
If it's already started, nothing happens.
You can also have pitchfork automatically start the daemons when entering the project in your terminal with the [shell hook](#shell_hook).

Expand All @@ -69,7 +69,7 @@ TODO - implement this

Pitchfork has an optional shell hook for bash, zsh, and fish that will autostart and autostop daemons when entering/leaving projects.

To install it, run the command below for your shell:
To install it, run the [`pitchfork activate`](/cli/activate) command below for your shell:

```bash
echo '$(pitchfork activate bash)' >> ~/.bashrc
Expand All @@ -81,7 +81,7 @@ Then when you restart your shell pitchfork will automatically start "autostart"
"autostop" will stop daemons when leaving the directory after a bit of a delay if no terminal sessions are still inside the directory.

:::tip
You can also have daemons only autostop. You can manually start them with `pitchfork start` then they
You can also have daemons only autostop. You can manually start them with [`pitchfork start`](/cli/start) then they
will be stopped when you leave the directory.
:::

Expand All @@ -92,3 +92,43 @@ Here's a `pitchfork.toml` with this configured:
run = "npm run server:api"
auto = ["start", "stop"]
```

## Logs

Logs for daemons started with pitchfork can be viewed with [`pitchfork logs`](/cli/logs).

```bash
$ pitchfork logs api
[2021-08-01T12:00:00Z] api: starting
[2021-08-01T12:00:01Z] api: listening on
```

You can also view the supervisor logs with `pitchfork logs pitchfork`.

## Supervisor

pitchfork has a supervisor daemon that automatically starts when you run commands like `pitchfork start|run`.
You can manually start/stop it with [`pitchfork supervisor start|stop`](/cli/supervisor/start) or
run a blocking supervisor with [`pitchfork supervisor run`](/cli/supervisor/run).

This watches the daemons status, restarts them if the fail, and a bunch of other things. Ideally
you shouldn't need to really be aware of it. It should just run in the background quietly.

## Configuration

TODO: For now, you'll need to reference [the code](https://github.com/jdx/pitchfork/blob/main/src/env.rs).

## Troubleshooting

You can get extra logs by setting `PITCHFORK_LOG=debug` or `PITCHFORK_LOG=trace` in your environment.
The supervisor will output extra logs but _only_ if this was set when it was started. To ensure the
supervisor is printing debug logs, restart it with this set:

```bash
PITCHFORK_LOG=debug pitchfork supervisor start --force
pitchfork logs pitchfork
```

:::tip
The `--force` is likely needed to kill an existing supervisor process.
:::

0 comments on commit 5363db5

Please sign in to comment.