A Practical Guide to Deploying Local LLMs and an Application Orchestration Platform
This guide walks through deploying a local large language model together with an application orchestration platform. It explains why teams choose on-premises setups, how to structure a three-layer architecture, how to plan compute resources, and how to start the orchestration platform with containers. It also covers installing the inference runtime, pulling models, connecting the orchestration layer to the inference layer, and troubleshooting common failures such as port conflicts, container restarts, and connection refused errors. Readers will find practical commands, a troubleshooting table, and recommendations for RAG and workflow orchestration.
1. Why Deploy Locally: Requirements and Constraints
As generative AI applications move into production, more teams want to run both inference and application orchestration inside their own environment or on their own infrastructure. There are usually three main drivers:
- Data compliance and privacy requirements, where sensitive data must not leave the organization.
- Restricted network environments, such as intranets or offline data centers, that cannot rely on external online services.
- Debugging and validation stages that need a controllable, repeatable, low-latency experimental environment.
The cost of local deployment is equally clear: you must provide your own compute (CPU/GPU/memory/VRAM), there is a trade-off between model size and inference throughput, and operational complexity increases. Before you start, it is worth defining three things: the target scenario (chat, summarization, retrieval QA, or workflow automation), the concurrency level, and the acceptable response latency. These three points directly determine the model specification and resource planning that follow.
2. Overall Architecture: A Three-Layer Decoupled Design
A robust local generative AI pipeline can be abstracted into three layers:
- Inference layer: loads the model and generates tokens, exposing a unified HTTP interface.
- Orchestration layer: handles prompt orchestration, knowledge base retrieval (RAG), agent workflows, and API exposure.
- Access layer: a browser console and external business systems connecting through APIs/SDKs.
The value of decoupling these three layers is that the model can be swapped, the orchestration layer can evolve independently, and the access layer can be reused across multiple clients. In practice, it is recommended to run the orchestration layer on a container platform and the inference layer in a separate process or service, with the two communicating over a network port. This avoids the tight coupling that makes upgrades difficult.
3. Environment Preparation and Resource Planning
3.1 Container Runtime Environment
The orchestration layer is usually delivered as containers, so you need a container engine and a container orchestration tool (common components such as Docker and Docker Compose) installed in advance. After installation, run a quick self-check:
docker --versiondocker compose versiondocker info
If docker info returns a permission error, on Linux either add the current user to the container user group or run the command with an account that has the required privileges.
3.2 Rules of Thumb for Resource Estimation
VRAM/memory requirements scale with the number of model parameters, and quantization can significantly reduce the footprint. A reusable estimation approach:
- A 7B-class model at 4-bit quantization typically needs only a few GB of VRAM and can run on a mainstream consumer GPU.
- A 14B-class model needs more VRAM or higher memory bandwidth.
- 32B and above generally call for professional accelerator cards or multi-GPU parallelism.
- Pure CPU inference is feasible but latency rises noticeably, making it suitable for offline batch processing rather than real-time interaction.
Always leave some headroom for the context length (the KV cache grows with the context), which is the hidden cost beginners most often overlook.
4. Starting the Orchestration Platform with Containers
After obtaining the platform source code, go to its container orchestration directory and prepare the environment variable file: copy the example configuration file to the actual configuration file, then adjust the port, database password, cache, and object storage settings as needed.
cp .env.example .env# Adjust ports, secrets, and storage settings in .env as neededdocker compose up -ddocker compose ps
Key points when starting:
- Do not press
Ctrl+Cto interrupt the foreground wait; in detached mode (-d), wait for image pulls and initialization to finish. docker compose psshould show everything asrunningorhealthy; repeated restarts mean you need to check the logs.- The first startup initializes the database and vector store, so a longer wait is normal.
Common startup failures and the order in which to check them:
- Port already in use: check
netstat -tunlpor the platform’s built-in port panel, and change the mapped port in.env. - Slow or failed image pulls: configure a working image mirror or import image packages offline.
- Insufficient memory: the container platform has no resource limits by default, so set explicit limits in the orchestration file and disable unrelated services.
- Permission issues: read/write permissions on bind-mounted directories, and SELinux/AppArmor policies.
5. Installing the Inference Service and Obtaining Models
For the inference layer, it is recommended to choose a general-purpose runtime that supports local model management and unified API exposure. After installation, check the version first:
ollama -v # or the version query command of the chosen runtime
Keep that terminal or service running, and do not close the window or process hosting the inference service.
Follow a “select on demand” principle for models: choose the parameter size and quantization version based on VRAM, memory, context length, and business latency. Run a minimal validation:
# Pull a model of the specified size (placeholder example; actual names follow the model library of the chosen runtime)runtime pull <model-name:tag>runtime run <model-name:tag> "Explain retrieval-augmented generation in one sentence"
Once validation passes, confirm that its external HTTP interface is reachable (commonly a local port such as 11434, but follow the documentation of the chosen runtime):
curl http://127.0.0.1:11434/api/tags
If a model list is returned, the inference layer is ready.
6. Connecting the Orchestration Layer to the Inference Layer
This is the most critical step, and it is missing from the original text. The orchestration platform requires a “model provider” configuration, and a local inference service is usually integrated through an OpenAI-compatible interface:
- Base URL:
http://<inference-host-ip>:<port>/v1 - API Key: any non-empty string usually works for a local runtime
- Model name: exactly the same identifier as the model actually loaded in the inference layer
When accessing the host from inside a container on Linux, 127.0.0.1 points to the container itself, so you must replace it with the host’s address on the container network (such as host.docker.internal or the host’s LAN IP). This is the number one reason “the container cannot reach the model.”
Example call (generic HTTP form):
curl http://127.0.0.1:11434/v1/chat/completions \-H "Content-Type: application/json" \-d '{"model":"<model-name:tag>","messages":[{"role":"user","content":"Hello"}]}'
7. Common Problems and How to Fix Them
| Symptom | Frequent cause | Fix |
|---|---|---|
| Orchestration platform page does not open | Wrong port mapping / service not ready | Check the port in .env and docker compose ps |
| Container restarts repeatedly | Insufficient memory, failed initialization | Check logs, limit resources, disable extra services |
| Model pull interrupted | Unstable network, insufficient disk | Retry, free up disk space, import offline |
| Orchestration layer reports connection refused | The container accessed its own loopback address | Switch to the host address or the container network address |
| Empty or timed-out answers | Context too long, insufficient VRAM | Reduce context, switch quantization, use a smaller model |
| Garbled or broken Chinese text | Inconsistent terminal encoding | Standardize on UTF-8 and check environment variables |
Three additional engineering recommendations: first, set the inference service to start automatically on boot and enable log rotation, so the service does not disappear when a window is closed; second, persist the model, vector store, and configuration directories with mounted volumes so data survives container rebuilds; third, use monitoring alerts and a log service to collect latency, failure rate, and resource utilization, forming a closed observability loop.
8. Advanced: Retrieval Augmentation and Workflow Orchestration
The inference layer only makes the system “able to talk”; business value comes from the knowledge integration and workflow design in the orchestration layer. The recommended path is to first build a small knowledge base to validate chunking and recall quality, then introduce reranking and citation tracing. Next, use a visual workflow to chain “retrieve - assemble prompt - call the model - post-process - output” into a reusable template, and connect it to business systems through an open API. If stronger reliability is needed, you can extend with common cloud capabilities such as a container platform, object storage, and message queues to achieve elasticity and decoupling.
9. Summary
The essence of local deployment is “putting uncertainty in a cage”: containers guarantee environment consistency, decoupling guarantees replaceability, and self-checks plus logs guarantee diagnosability. By proceeding in the order of environment - startup - model - connectivity - troubleshooting - orchestration, most problems can be located within ten minutes. For teams that want to further reduce the operational burden, it is also worth evaluating general-purpose container and model service offerings such as those from Baidu AI Cloud, balancing self-hosting and managed services under compliance requirements.
