This playbook deploys a Docker Compose based Docspell stack on Debian 10+, Ubuntu LTS, and RHEL 9+ systems.
[docspell]
10.10.10.40
- name: Deploy Docspell with Docker Compose
hosts: docspell
become: true
vars:
docspell_root: /opt/docspell
docspell_http_port: 7880
tasks:
- name: Install Docker packages on Debian and Ubuntu
ansible.builtin.apt:
name:
- docker.io
- docker-compose-plugin
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install Docker packages on RHEL family
ansible.builtin.dnf:
name:
- docker
- docker-compose-plugin
state: present
when: ansible_os_family == "RedHat"
- name: Enable Docker service
ansible.builtin.service:
name: docker
state: started
enabled: true
- name: Create project directory
ansible.builtin.file:
path: "{{ docspell_root }}"
state: directory
mode: "0755"
- name: Write docker-compose.yml
ansible.builtin.copy:
dest: "{{ docspell_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
postgres:
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_DB: docspell
POSTGRES_USER: docspell
POSTGRES_PASSWORD: change-me
volumes:
- ./postgres/data:/var/lib/postgresql/data
solr:
image: solr:9
restart: unless-stopped
docspell:
image: ghcr.io/eikek/docspell-restserver:latest
restart: unless-stopped
depends_on:
- postgres
- solr
ports:
- "{{ docspell_http_port }}:7880"
- name: Start Docspell stack
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ docspell_root }}"
- name: Show endpoint
ansible.builtin.debug:
msg: "Docspell is available on http://{{ ansible_default_ipv4.address }}:{{ docspell_http_port }}"
Note: Docspell supports both Apache Solr and PostgreSQL as full-text search backends. The above uses Solr; to use PostgreSQL instead, omit the Solr service and configure the search backend accordingly.
Any questions?
Feel free to contact us. Find all contact information on our contact page.