> ## Documentation Index
> Fetch the complete documentation index at: https://bilanc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Commands

> Reference for Make and Docker commands to manage your Bilanc instance.

This guide covers all the commands you'll need to manage your self-hosted Bilanc deployment.

## Make Commands

The Makefile provides convenient shortcuts for common operations:

### Starting Bilanc

| Command    | Description                                              |
| ---------- | -------------------------------------------------------- |
| `make r`   | Build and start all containers in detached mode          |
| `make run` | Same as `make r`                                         |
| `make up`  | Build and start all containers in foreground (with logs) |

```bash theme={null}
# Start Bilanc (detached - recommended for production)
make r

# Start Bilanc with live logs (useful for debugging)
make up
```

### Stopping Bilanc

| Command     | Description                    |
| ----------- | ------------------------------ |
| `make d`    | Stop and remove all containers |
| `make down` | Same as `make d`               |

```bash theme={null}
# Stop all containers
make down
```

### Rebuilding

| Command          | Description                               |
| ---------------- | ----------------------------------------- |
| `make recompose` | Stop, rebuild, and restart all containers |

```bash theme={null}
# Rebuild after configuration changes
make recompose
```

***

## Docker Compose Commands

For more granular control, use Docker Compose directly:

### Container Management

```bash theme={null}
# Start all services
docker compose up -d

# Stop all services
docker compose down

# Restart a specific service
docker compose restart api

# Rebuild and start
docker compose up -d --build
```

### Viewing Logs

```bash theme={null}
# View logs for all services
docker compose logs

# View logs for a specific service
docker compose logs api
docker compose logs frontend
docker compose logs dagster_daemon

# Follow logs in real-time
docker compose logs -f

# Follow logs for a specific service
docker compose logs -f api

# View last 100 lines
docker compose logs --tail 100 api
```

### Service Status

```bash theme={null}
# List running containers
docker compose ps

# Check container health
docker compose ps --format "table {{.Name}}\t{{.Status}}"
```

### Executing Commands

```bash theme={null}
# Open a shell in a container
docker compose exec api bash
docker compose exec frontend sh

# Run a one-off command
docker compose exec api python -c "print('hello')"
```

***

## Service Names

When working with Docker Compose, use these service names:

| Service           | Name                |
| ----------------- | ------------------- |
| Dashboard         | `frontend`          |
| API Server        | `api`               |
| Dagster Webserver | `dagster_webserver` |
| Dagster Daemon    | `dagster_daemon`    |
| Celery Worker     | `worker`            |
| Redis Broker      | `broker`            |

***

## Common Operations

### Restart After Configuration Change

After modifying `.env` or `tenant_config.yaml`:

```bash theme={null}
make recompose
```

### Check Pipeline Status

```bash theme={null}
# View Dagster daemon logs
docker compose logs -f dagster_daemon

# Or open the Dagster UI
open http://localhost:4000
```

### Debug API Issues

```bash theme={null}
# View API logs
docker compose logs -f api

# Check API health
curl http://localhost:8000/health
```

### Debug Frontend Issues

```bash theme={null}
# View frontend logs
docker compose logs -f frontend

# Check if frontend is responding
curl http://localhost:3000
```

### Clear All Data (Caution)

<Warning>
  This will delete all data including the database. Only use for fresh installs.
</Warning>

```bash theme={null}
# Stop and remove containers, networks, and volumes
docker compose down -v
```

***

## Updating Bilanc

When a new version is available:

```bash theme={null}
# Pull the latest images
docker compose pull

# Rebuild and restart
make recompose
```

<Tip>
  Always test updates in a staging environment before applying to production.
</Tip>

***

## Troubleshooting Commands

### Check Container Status

```bash theme={null}
# See which containers are running
docker compose ps

# See all containers (including stopped)
docker compose ps -a
```

### Inspect Container

```bash theme={null}
# View container details
docker compose inspect api

# View container resource usage
docker stats
```

### Force Rebuild

If you're experiencing issues after an update:

```bash theme={null}
# Remove all containers and rebuild from scratch
docker compose down
docker compose build --no-cache
docker compose up -d
```

### Database Access

```bash theme={null}
# Connect to PostgreSQL
docker compose exec db psql -U bilanc -d bilanc

# Or if using an external database
psql -h your_host -U your_user -d bilanc
```
