
Jina Serve is an open-source framework for building neural search and multimodal AI applications. It provides a cloud-native architecture for managing AI workloads including high-latency inference, dynamic batching, async streaming, and microservice orchestration. Jina handles the infrastructure layer so you can focus on building AI pipelines rather than managing service communication.
This article explains how to deploy Jina Serve on a Linux server using Docker Compose. It covers directory setup, environment configuration, Traefik reverse proxy integration for automatic HTTPS, and demonstrates the deployment by running a sample service and sending test queries.
Before you begin, you need to:
jina.example.com).Jina Serve runs as a containerized Flow that automatically wires the gateway and executors together. The project directory stores the Flow configuration, executor code, and environment variables.
Create the project directory structure for Jina Serve.
This directory stores the Docker Compose configuration, environment variables, and executor code.
Navigate to the project directory.
Create a simple text processing executor.
Add the following configuration:
Save and close the file.
Create the executor requirements file.
Add the following dependencies:
Save and close the file.
Create the executor configuration file.
Add the following configuration:
Save and close the file.
Create the Flow configuration file. This defines the processing pipeline and wires the executor to the gateway automatically.
Add the following configuration:
Save and close the file.
Create the Dockerfile to build the Jina Flow container.
Add the following configuration:
Save and close the file.
Create the environment configuration file.
Add the following configuration:
Replace:
jina.example.com with your registered domain name.admin@example.com with your email address for Let's Encrypt notifications.Save and close the file.
The deployment stack consists of two services: Traefik handles reverse proxy and automatic TLS certificate management via Let's Encrypt, and the Jina Flow runs the gateway and executor in a single container with automatic wiring.
Create the Docker Compose configuration file.
Add the following configuration:
Save and close the file.
In the above manifest:
8080 available internally for Traefik routing without exposing it to the host network../letsencrypt bind mount stores TLS certificates persistently across container restarts.8080.Build and start the containers in detached mode.
Verify that all containers are running.
The output displays two running containers: the Jina Flow and Traefik with ports 80 and 443 exposed.
View the logs for the services.
For more information on managing a Docker Compose stack, see the How to Use Docker Compose article.
The Jina Flow exposes HTTP endpoints for health checks and document processing operations. Traefik routes HTTPS traffic to the Flow and provisions TLS certificates from Let's Encrypt.
Run the following command to verify that the gateway is accessible. Replace jina.example.com with your configured domain name.
Output:
Open your web browser and navigate to https://jina.example.com/status, replacing jina.example.com with your configured domain name.
The page displays the status JSON, confirming HTTPS routing through Traefik is working correctly.
Jina processes documents through the executor pipeline defined in the Flow configuration. Send test queries to verify the deployment is working correctly.
Send a test document to the /index endpoint. Replace jina.example.com with your configured domain name.
Output:
The executor converts the input text to uppercase, confirming the pipeline is functional.
Send a test document to the /search endpoint.
Output:
The search endpoint returns the document unchanged, demonstrating multiple endpoints on a single executor.
Test with multiple documents in a single request.
Output:
Jina processes all documents in a single batch, demonstrating the framework's batch processing capability.
You have deployed Jina Serve on your server using Docker Compose with Traefik for automatic HTTPS. The Flow configuration automatically wires the gateway and executor together, eliminating manual topology management. Jina supports building more complex pipelines by adding additional executors, enabling GPU acceleration, and integrating with vector databases for neural search applications. For advanced configuration, executor development, and Flow orchestration, visit the official Jina documentation.
0 Comments
Be the first to comment and share your perspective with the community.