# Customer Deployment

This package supports two customer deployment paths:

- New machine: bootstrap missing runtime dependencies, install project dependencies, copy the bundled env file, and start the app.
- Existing machine: keep the existing `.env`, refresh dependencies with `pnpm install --frozen-lockfile`, and start the app.

## Quick Start

From the package root:

```bash
bash scripts/install.sh
```

Useful variants:

```bash
bash scripts/install.sh --no-start
bash scripts/install.sh --prod
bash scripts/install.sh --prod --reset-db
bash scripts/install.sh --with-python
bash scripts/install.sh --env-file /secure/path/.env
```

By default, Python is not installed because the current document extraction flow does not require the old local document conversion runtime. Use `--with-python` only for deployments that explicitly need uv and Python 3.13.

## Env Handling

Real secrets must not be committed to Git.


The generated archive contains:

```text
.env
```

On the customer machine, `scripts/install.sh` keeps that root `.env` in place. Existing customer `.env` files are never overwritten by the installer.

## Startup Modes

Default mode runs:

```bash
pnpm install --frozen-lockfile
pnpm run dev
```

Production mode delegates to the existing deployment script:

```bash
bash scripts/install.sh --prod
```

That path reuses `scripts/deploy.sh` for Docker, Supabase, build, and systemd/nohup startup behavior.

## Logs

Runtime logs are written under:

```text
logs/
```

When production mode falls back to nohup, the app log is:

```text
logs/app.log
```
