Deploying Local LLMs and an Application Orchestration Platform: A Practical Guide
This guide walks through a layered deployment that separates local model inference from the application orchestration layer. It covers container runtime setup, hardware and resource estimation, bringing up the orchestration platform, pulling and running models with Ollama, and the connectivity issues that cause most deployment failures. You will also find production hardening recommendations for persistence, monitoring, asynchronous knowledge base processing, access control, and version tracking. The result is a decoupled, observable, horizontally scalable private generative AI stack.
1. Why Inference and Application Orchestration Should Be Deployed Separately
When putting generative AI applications into production, a common architectural mistake is coupling model inference and application orchestration inside a single process. A more robust approach is to layer them: the local inference service at the bottom handles model loading and token generation, while the application orchestration platform on top handles prompt orchestration, knowledge base retrieval, agent workflows, and the external API. The two layers communicate over a standard HTTP interface. The benefit is that the model can be upgraded independently, compute can be scaled independently, and the application side does not need to know the underlying implementation details.
This layering also dictates the troubleshooting order: first confirm the inference service is healthy, then confirm the orchestration platform can reach it, and only then investigate application logic. The vast majority of “deployment failures” originate in the first two layers.
2. Environment Preparation: Container Runtime and Resource Assessment
2.1 Installing the Container Runtime
The application orchestration platform is typically distributed as a container compose file, so the first step is installing the container runtime and orchestration tooling. After installation, run a minimal verification:
docker --versiondocker compose version
If the version commands produce no output or return a permission error, check first whether the service is running and whether the current user belongs to the container management group.
2.2 Resource Assessment
Local inference is sensitive to memory and VRAM, so estimate the requirements in advance. Rules of thumb:
- The larger the parameter count, the more VRAM or memory the weights occupy.
- Quantized builds (such as 4-bit or 8-bit) significantly reduce resource usage, at the cost of some accuracy loss.
- Increasing the context length raises KV Cache usage linearly, so long-text scenarios need extra headroom.
If the hardware has only a CPU, inference will still run but throughput drops noticeably. Start with a small model to validate the pipeline, then decide whether to add an accelerator. In a virtualized environment, also confirm that the accelerator device is correctly passed through.
3. Starting the Application Orchestration Platform
After obtaining the source package, enter its container configuration directory and prepare the environment variable file:
cp .env.example .envdocker compose up -ddocker compose ps
Key points:
- The environment variable file must be copied first; otherwise the variable references in the compose file resolve to empty values and the service restarts repeatedly.
- The first startup pulls several base images and takes a while. If interrupted, you must run it again.
- If image pulls time out, configure a registry mirror or proxy. For corporate intranets, prepare an offline image bundle in advance.
- All services should show a running state in
docker compose ps. If a service keeps restarting, locate the cause in the logs:
docker compose logs -f --tail=100
Once startup succeeds, open the corresponding port on the local machine in a browser to reach the initialization page and create an administrator account. Store the account details securely. In production, also change the default secret and close any unnecessary externally exposed ports.
4. Deploying the Local Inference Service and Pulling Models
After installing the inference service, confirm it works with the version command. Do not automatically pick the largest parameter variant when pulling a model; choose based on your hardware:
# Check local service status and cached modelsollama list# Pull a specific model (example name; use the tags actually available in the repository)ollama pull <model-name:tag># Run it and enter the interactive sessionollama run <model-name:tag>
The service listens on the loopback address by default. If the orchestration platform runs inside a container, note that the address a container uses to reach a service on the host differs from the container’s own loopback. You can adjust the listening scope with an environment variable when starting the inference service, but use this only on a trusted intranet and never expose it directly to the public internet.
5. Connectivity: The Most Frequent Failure Points
- Unreachable address: reaching the host from inside a container requires a host alias or the host address, not the container’s own loopback.
- Wrong API path: different services use different path prefixes, so the configuration must match the path the inference service actually exposes.
- Timeouts and concurrency: local inference has limited concurrency, so the orchestration platform should lower concurrency and extend timeouts to keep batch jobs from overwhelming the inference service.
- Insufficient VRAM: this shows up as a load failure or an interrupted generation. The fix is a smaller model, a shorter context length, or quantization.
- Port conflicts: when default ports collide, change the host-side mapped port rather than the in-container port to avoid configuration confusion.
The recommended troubleshooting order is fixed: container status → logs → port connectivity → model presence → application-side configuration.
6. Production Recommendations
- Mount data and model caches to a persistent host directory to avoid re-downloading after a container rebuild.
- Connect a centralized logging service and monitoring alerts, with thresholds on inference latency and failure rate.
- Separate the knowledge base from object storage, and turn document parsing and vectorization into asynchronous tasks backed by a message queue to smooth out spikes.
- Apply least privilege; open management ports only to the intranet and use a gateway for authentication and rate limiting.
- Keep bidirectional records of model versions and prompt versions so results remain traceable.
After completing these steps, you have a decoupled, observable, horizontally scalable foundation for private generative AI: the underlying model is replaceable, the upper-layer applications are iterable, and fault localization follows a clear path.
