# Server deployment

Recommended deployment: use an HTTPS subdomain whose document root points to this project's `public/` folder.

Example:

- Project: `/home/USER/granola-php-bridge`
- Public document root: `/home/USER/granola-php-bridge/public`
- URL: `https://granola.example.com`

## Commands

```bash
cd /home/USER
unzip granola-php-bridge.zip -d granola-php-bridge
cd granola-php-bridge
php scripts/install.php
nano config/config.php
php scripts/check.php
```

Update `app.base_url` and Gmail `redirect_uri` to HTTPS. In Google Cloud, add the same server callback URL as an Authorized redirect URI.

## Worker cron

Find PHP:

```bash
which php
```

Then add a cron job every minute:

```cron
* * * * * /usr/bin/php /home/USER/granola-php-bridge/bin/worker.php >> /home/USER/granola-php-bridge/storage/logs/cron.log 2>&1
```

Use the exact PHP path returned by `which php`.

## Webhook

After the server works over HTTPS:

1. Open `https://granola.example.com/setup-webhook.php`
2. Confirm `https://granola.example.com/webhook.php`
3. Click **Create Granola Webhook**
4. The project saves the one-time `whsec_...` signing secret under `storage/secrets/`

Granola webhooks require a public HTTPS URL and are available on Business/Enterprise.
