AI Code Review Tutorial Part 10: Integrating DeepSeek R1 for Automated Code Review
This tutorial walks through privately deploying the DeepSeek R1 14B model on an AutoDL GPU server using Ollama, configuring systemd and ports, exposing the service, and integrating it with a GitLab CI pipeline to generate AI‑driven code review results sent via a Feishu bot.
The author begins by describing the need for a private deployment of an open‑source large language model to power AI‑assisted code review. They choose DeepSeek R1 14B and the Ollama tool, and provision a GPU‑accelerated server from AutoDL.
After registering on AutoDL, they select a 4090 (or 3090) GPU instance, configure the region, and note the one‑month trial membership. SSH access is obtained via the provided connection string and the JupyterLab interface (finalShell) is used.
To prepare the environment, they install missing system packages:
sudo apt-get update
sudo apt-get install lshw
apt-get install net-tools -y
apt-get install systemd -y
apt-get install systemctl -yThey then install Ollama by running the official script: curl -fsSL https://ollama.com/install.sh | sh After confirming the service status with systemctl status ollama.service, they start it and, based on personal experience, prefer launching it with nohup ollama serve &. The service port is changed from the default 11434 to 6006 by editing /etc/systemd/system/ollama.service and adding Environment="OLLAMA_HOST=0.0.0.0:6006", then reloading the daemon.
GPU support is enabled by setting the environment variable export OLLAMA_GPU_LAYER=cuda. The model is pulled with:
OLLAMA_HOST=127.0.0.1:6006 ollama run deepseek-r1:14bor, when the service is already running: ollama run deepseek-r1:14b Running the model on the server responds quickly, as shown in the screenshot.
Because the instance has no public IP, the author uses AutoDL’s “custom service” feature to expose port 6006, then creates a local proxy (e.g., with SSH) so that http://localhost:6006 can be accessed from any machine. Verification is done by checking for “Ollama is running”.
For the CI integration, the GitLab CI job’s YAML file is updated to point to the Ollama‑compatible OpenAI endpoint, e.g., http://localhost:6006/v1/chat/completions or http://localhost:6006/api/generate. After committing the change, the pipeline runs and produces AI‑generated code review comments, illustrated by the final screenshot.
The article also briefly compares general‑purpose LLMs with inference‑optimized models, noting that DeepSeek R1 is an inference model.
Finally, the author reminds readers to shut down the pay‑as‑you‑go GPU instance after use to avoid unnecessary charges.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubiquitous Tech
A ubiquitous public account for pirate enthusiasts, regularly sharing curated experiences, tech learning, and growth insights. Currently publishing articles on AI RAG customer service, AI MCP technology, and open-source design. Personal free Knowledge Planet: Awakening New World Programmer.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
