# Vision Monday Connector

Standalone API service for moving data between Velon and Monday.com.

## Runtime

- PHP 8.3
- Laravel 13
- No application database
- No mail setup
- No frontend build pipeline

## Local Setup

```bash
composer install
cp .env.example .env
php artisan key:generate
php artisan serve
```

## Health Check

```bash
curl http://127.0.0.1:8000/api/status
```

Expected response:

```json
{
    "success": true,
    "service": "vision-monday-connector"
}
```

## Queue Worker & Scheduler (Production)
Ubuntu on EC2 — Supervisor is the standard choice.

**Install Supervisor**
```bash
sudo apt-get install supervisor
```

**Create the config file:**
```bash
sudo nano /etc/supervisor/conf.d/vision-monday-connector.conf
```

Paste this (adjust the path to match where your app lives on EC2):
```bash
[program:connector-queue-worker]
command=php /var/www/vision-monday-connector/artisan queue:work database --sleep=3 --tries=3 --max-time=3600
directory=/var/www/html
autostart=true
autorestart=true
user=www-data
numprocs=1
stdout_logfile=/var/log/supervisor/connector-queue-worker.log
stderr_logfile=/var/log/supervisor/connector-queue-worker.log
```

**Tell Supervisor to load it:**
```bash
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start connector-queue-worker
```

**Add the scheduler cron (one entry, runs every minute, Laravel decides internally what's due):**
```bash
crontab -e
```

Add this line:
```bash
* * * * * cd /var/www/vision-monday-connector && php artisan schedule:run >> /dev/null 2>&1
```

**Verify the worker is running:**
```bash
sudo supervisorctl status
```
