> For the complete documentation index, see [llms.txt](https://docs.veriscript.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veriscript.app/01-installation-guide/04-local-llm-and-deployment.md). Agents can also search and read this documentation through its [MCP server](https://docs.veriscript.app/~gitbook/mcp).

# 04 local llm and deployment

## 🔗 ขั้นตอนที่ 1: กำหนดค่า `.env.production`

สร้างไฟล์ `/opt/veriscript/config/.env.production` เพื่อเชื่อมโยงกับ **AI Server Suite** แบบออฟไลน์ 100%:

```env
NODE_ENV=production
NEXT_PUBLIC_APP_URL=https://veriscript.your-university.ac.th
OFFLINE_AIRGAP_MODE=true
VERISCRIPT_LICENSE_KEY=VS-OEM-ARTTECH-XXXX-XXXX-XXXX

# PostgreSQL 16 + pgvector
DATABASE_URL=postgresql://veriscript_admin:CHANGE_STRONG_PASSWORD@veriscript-pgvector:5432/veriscript

# Local LLM Bridge (AI Server Suite OpenAI-Compatible Endpoint)
LOCAL_LLM_BASE_URL=http://host.docker.internal:8000/v1
LOCAL_LLM_API_KEY=local-aiserver-internal-token
LOCAL_LLM_DEFAULT_MODEL=typhoon-2.5-instruct
LOCAL_EMBEDDING_URL=http://host.docker.internal:8000/v1/embeddings
LOCAL_EMBEDDING_DIMENSIONS=768
```

## 🐳 ขั้นตอนที่ 2: สร้างไฟล์ `docker-compose.yml`

```yaml
services:
  veriscript-pgvector:
    image: pgvector/pgvector:pg16
    container_name: veriscript-pgvector
    restart: unless-stopped
    environment:
      POSTGRES_DB: veriscript
      POSTGRES_USER: veriscript_admin
      POSTGRES_PASSWORD: CHANGE_STRONG_PASSWORD
    volumes:
      - /opt/veriscript/pgdata:/var/lib/postgresql/data
      - /opt/veriscript/config/postgresql.conf:/etc/postgresql/postgresql.conf:ro
    command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U veriscript_admin -d veriscript"]
      interval: 10s
      timeout: 5s
      retries: 5

  veriscript-app:
    image: registry.veriscript.app/enterprise/veriscript-appliance:2.0-arm64
    container_name: veriscript-app
    restart: unless-stopped
    depends_on:
      veriscript-pgvector:
        condition: service_healthy
    env_file:
      - /opt/veriscript/config/.env.production
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - /opt/veriscript/uploads:/app/uploads
    ports:
      - "127.0.0.1:3000:3000"

  veriscript-proxy:
    image: caddy:2-alpine
    container_name: veriscript-proxy
    restart: unless-stopped
    depends_on:
      - veriscript-app
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /opt/veriscript/config/Caddyfile:/etc/caddy/Caddyfile:ro
      - /opt/veriscript/certs:/data/caddy
```

## 🚀 ขั้นตอนที่ 3: สั่งเปิดระบบ

```bash
cd /opt/veriscript
docker compose up -d
docker compose ps
docker compose logs -f --tail=50 veriscript-app
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.veriscript.app/01-installation-guide/04-local-llm-and-deployment.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
