A Practical Guide to Deploying Local LLMs and an Application Orchestration Platform

    This guide explains how to deploy a local inference runtime and a containerized application orchestration platform as separate layers. It covers hardware and capacity planning, environment configuration, model pulling and verification, connecting the inference service to the platform, a troubleshooting checklist for common failures, and pre-launch operations practices. Follow the order of inference self-check, container stack startup, and platform integration to locate most deployment issues quickly.

    1. Why Separate Inference and Orchestration

    A common architectural mistake in production generative AI applications is bundling “model capability” and “application logic” into a single service. A more robust approach is to split them into layers: a local inference runtime at the bottom handles model loading and inference requests, while an application orchestration platform on top handles prompt assembly, knowledge base retrieval, workflow orchestration, and external APIs. The two layers communicate over standard HTTP interfaces, which brings three benefits.

    First, replacement cost is low. Model upgrades, quantized version switches, and parameter tuning all happen in the inference layer, so application configuration in the orchestration layer stays largely untouched. Second, failure boundaries are clear. When the inference layer runs out of GPU memory or its process crashes, the orchestration platform remains available and only model calls fail, making it easy to fall back to a backup model. Third, resources scale independently. The inference layer is sensitive to GPU memory and system memory, while the orchestration layer is more sensitive to CPU, disk, and databases, so separate deployment lets each layer scale according to its own bottleneck.

    This article uses a “local inference runtime + containerized application orchestration platform” combination to describe a reproducible deployment process and how to handle common problems.

    2. Environment Preparation and Capacity Assessment

    2.1 Hardware and System Baseline

    The first constraint on the inference layer is GPU memory. A practical rule of thumb: estimate roughly 1GB of GPU memory per billion parameters, then add the KV cache overhead introduced by context length, and finally reserve about 20% headroom for concurrency and fragmentation. If GPU memory is insufficient, the runtime falls back to system memory or even disk swapping, and time to first token rises sharply. In that case, choose a smaller parameter size or a more aggressive quantization scheme rather than blindly increasing concurrency.

    At the system level: system memory should be at least twice the GPU memory; model files should sit on a disk with sufficient bandwidth, since a mechanical drive noticeably slows loading; and the container platform should have virtualization support enabled, otherwise container networking and file mounts can produce anomalies that are hard to diagnose.

    2.2 Role Separation Between the Two Services

    • Inference runtime: installed via the command line and kept running in the background, exposing a local HTTP port that provides model listing, model pulling, and inference chat capabilities.
    • Application orchestration platform: described by a container orchestration file covering multiple services, typically including a gateway, backend services, a task queue, a relational database, a vector database, a cache, and object storage.

    This separation determines the troubleshooting order: first confirm the inference port is reachable, then confirm the container network can reach that port, and only then check dependencies among the platform’s internal components.

    3. Deploying the Containerized Orchestration Platform

    3.1 Configuration Before Startup

    After obtaining the source directory, enter the subdirectory responsible for container orchestration, copy the example environment variable file as the actual configuration file, and confirm each entry against its comments. Four categories of variables deserve attention:

    1. Port mapping: if the gateway’s external port conflicts with another service on the host, change it to an unused port.
    2. Data directories: host paths for the model library files, database data, and uploaded files; point them to a separate directory with ample capacity.
    3. Secrets: replace them with random long strings before the first startup to avoid privilege risks from default values.
    4. Resource limits: too low a memory limit causes the task queue to restart repeatedly.

    Example commands (replace the placeholders with actual paths and ports):

    1. cp example.env .env
    2. # Edit .env: set ports, data directories, and random secrets
    3. docker compose up -d
    4. docker compose ps

    Do not close the terminal midway through startup, since the first pull of images and dependencies takes a long time. If a component keeps restarting in the ps output, check its logs first instead of restarting the whole stack:

    1. docker compose logs -f --tail=100 <service_name>

    3.2 Initialization and Account Security

    Once the gateway is ready, open the initialization page via the local address and create an administrator account. Three recommendations: use a strong password and store it safely; do not expose this page to the public internet, and use a controlled gateway or an internal network channel if remote access is required; and immediately after initialization, check whether any default secret configuration remains unchanged. Plan data persistence before the first startup, otherwise later migration will miss content in the vector database and object storage.

    4. Installing the Local Inference Service and Preparing Models

    4.1 Installation and Self-Check

    Install the runtime client on the inference host. After installation, open a terminal and run the version query command to confirm it works. If the command produces no output or reports that it cannot be found, the installation directory is usually missing from the environment variable path; add it manually and reopen the terminal. Keep this terminal window running, as the inference service depends on a persistent process.

    4.2 Pulling and Verifying Models

    The general form of the model pull command is “pull + model identifier:parameter size-quantization tag”. Choose the size using the following logic:

    GPU/Memory Condition Recommended Size Use Case
    Under 8GB 1.5B~3B Intent classification, summary drafts
    8~16GB 7B~8B General Q&A, main RAG workload
    16~32GB 14B~32B Complex reasoning, long-form writing
    Over 32GB 70B and above Scenarios requiring high accuracy

    After pulling, run a minimal verification before connecting to the upper platform:

    1. # List locally available models
    2. ollama list
    3. # Minimal inference verification
    4. ollama run <model_tag> "Explain retrieval-augmented generation in one sentence"
    5. # API connectivity verification
    6. curl http://127.0.0.1:11434/api/tags

    5. Connecting the Inference Service to the Orchestration Platform

    In the platform’s model provider configuration, add a “local/custom” endpoint and fill in three items: the API base URL, the model identifier, and a key (for local deployment any placeholder value works, but do not leave it empty or validation will fail).

    The key point is how to write the API base URL. If the platform runs inside a container, 127.0.0.1 points to the container itself rather than the host, so use the host’s address on the container network or the host alias provided by the container platform. Example configuration:

    1. # Orchestration platform environment variable snippet (illustrative)
    2. MODEL_BASE_URL: "http://host.docker.internal:11434"
    3. MODEL_NAME: "<model_tag>"
    4. MODEL_API_KEY: "local-placeholder"

    Support for the host alias varies across operating systems. If the alias is unavailable, fall back to “host LAN IP + open port”, but make sure firewall rules allow access only from the internal network. After saving the configuration, run a connectivity test on the platform’s model list page; if models are listed, the connection is working.

    6. Troubleshooting Checklist for Frequent Issues

    1. Container exits immediately on startup: check that component’s logs; the cause is usually a missing environment variable, a port conflict, or no write permission on the data directory.
    2. Platform model call times out: first run the API connectivity check on the host, then investigate the in-container address format.
    3. Extremely slow inference responses: insufficient GPU memory is causing swapping, so reduce the parameter size or shorten the context length; also check whether multiple applications share the same inference port and cause queuing.
    4. Poor knowledge base retrieval quality: adjust chunk size and overlap length first, then consider switching the embedding model, and only last change the number of retrieved results and the reranking strategy.
    5. Data loss after an upgrade: confirm the data directories and database volumes are persisted, and take a cold backup of the data directories before upgrading.
    6. Port conflict: switch to an unused port and update the platform-side callback address accordingly, so you do not change only one side.

    7. Pre-Launch Checks and Operations Recommendations

    Before going live, put together a fixed checklist: have the administrator password and secrets been replaced; is the externally exposed surface limited to the internal network; are the data directories included in the backup plan; are health probes and automatic restarts configured for the inference layer; are logs and metrics connected to a unified logging service and monitoring alerts; and do model calls have timeouts and a failure fallback path.

    If more complete managed capabilities are needed later, evaluate cloud-based general capability combinations once the self-hosted environment is stable, for example using a container platform to host the orchestration services, object storage to hold models and documents, managed relational databases and caches to reduce operational overhead, and logging and monitoring services for unified observability. Such replacements should keep the interfaces standard unchanged, avoiding binding application code to a specific implementation.

    Overall, the value of local deployment lies in keeping data inside the internal network and controlling costs, at the price of handling capacity planning and failure recovery yourself. Proceed in the order of inference layer self-check, container stack startup, and platform integration, and with the checklist above, most deployment problems can be traced to a specific step within ten minutes.