This guide provides a full Ansible playbook to deploy Onyx with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
- name: Deploy Onyx
hosts: onyx
become: true
vars:
app_root: /opt/onyx
app_port: 3000
postgres_password: "replace-with-strong-password"
auth_secret: "replace-with-long-random-secret"
domain: "onyx.example.com"
tasks:
- name: Install Docker on Debian/Ubuntu
apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker on RHEL family
dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start Docker
service:
name: docker
state: started
enabled: true
- name: Create application directory
file:
path: "{{ app_root }}"
state: directory
mode: "0755"
- name: Create data directories
file:
path: "{{ item }}"
state: directory
mode: "0755"
loop:
- "{{ app_root }}/data/nginx"
- "{{ app_root }}/data/certbot/conf"
- "{{ app_root }}/data/certbot/www"
- name: Write Docker Compose file
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
api_server:
image: onyxdotapp/onyx-backend:latest
restart: unless-stopped
depends_on:
- relational_db
- index
- cache
environment:
- POSTGRES_HOST=relational_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD={{ postgres_password }}
- VESPA_HOST=index
- REDIS_HOST=cache
- AUTH_TYPE=basic
- DOMAIN={{ domain }}
background:
image: onyxdotapp/onyx-backend:latest
restart: unless-stopped
depends_on:
- relational_db
- index
- cache
environment:
- POSTGRES_HOST=relational_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD={{ postgres_password }}
- VESPA_HOST=index
- REDIS_HOST=cache
web_server:
image: onyxdotapp/onyx-web-server:latest
restart: unless-stopped
depends_on:
- api_server
environment:
- DOMAIN={{ domain }}
inference_model_server:
image: onyxdotapp/onyx-model-server:latest
restart: unless-stopped
volumes:
- model_cache_huggingface:/root/.cache/huggingface
indexing_model_server:
image: onyxdotapp/onyx-model-server:latest
restart: unless-stopped
volumes:
- indexing_huggingface_model_cache:/root/.cache/huggingface
relational_db:
image: postgres:15.2-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD={{ postgres_password }}
- POSTGRES_DB=onyx
volumes:
- db_volume:/var/lib/postgresql/data
index:
image: vespaengine/vespa:8.609.39
restart: unless-stopped
volumes:
- vespa_volume:/opt/vespa/var
cache:
image: redis:7.4-alpine
restart: unless-stopped
volumes:
- redis_data:/data
nginx:
image: nginx:1.25.5-alpine
restart: unless-stopped
ports:
- "{{ app_port }}:80"
depends_on:
- web_server
volumes:
- ./data/nginx:/etc/nginx/conf.d
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
volumes:
db_volume:
vespa_volume:
redis_data:
model_cache_huggingface:
indexing_huggingface_model_cache:
- name: Start application stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
- name: Wait for Onyx to be ready
uri:
url: "http://localhost:{{ app_port }}"
status_code: 200
register: result
until: result.status == 200
retries: 30
delay: 10
onyxdotapp/ organization.latest tags with specific version tags for production deployments.http://your-server:3000Any questions?
Feel free to contact us. Find all contact information on our contact page.