- Add docker-compose.yml with web, meilisearch, chrome, ollama services - Add deploy-karakeep.yml Ansible playbook - Karakeep web on port 3054, meilisearch on 7700, ollama on 11434 - Fixed ollama CPU limit for 2-core VM - Migrated data (bookmarks, assets, llama3.2:3b model) from alien Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
134 lines
4.4 KiB
YAML
134 lines
4.4 KiB
YAML
---
|
|
# Deploy Karakeep Stack to databases VM
|
|
# Containers: web, meilisearch, chrome, ollama
|
|
# Target: databases (192.168.1.81)
|
|
|
|
- name: Deploy Karakeep Stack
|
|
hosts: databases
|
|
vars:
|
|
appdata_path: /home/docker/appdata
|
|
service_name: karakeep
|
|
service_dir: "{{ appdata_path }}/{{ service_name }}"
|
|
compose_src: "{{ playbook_dir }}/../compose-files/databases/{{ service_name }}"
|
|
|
|
tasks:
|
|
# =========================================================================
|
|
# PRE-FLIGHT CHECKS
|
|
# =========================================================================
|
|
- name: Check if .env file exists on control server
|
|
delegate_to: localhost
|
|
ansible.builtin.stat:
|
|
path: "{{ compose_src }}/.env"
|
|
register: env_file
|
|
|
|
- name: Fail if .env is missing
|
|
ansible.builtin.fail:
|
|
msg: |
|
|
.env file not found at {{ compose_src }}/.env
|
|
Copy .env.example to .env and fill in the secrets!
|
|
when: not env_file.stat.exists
|
|
|
|
# =========================================================================
|
|
# DIRECTORY SETUP
|
|
# =========================================================================
|
|
- name: Create karakeep base directory
|
|
ansible.builtin.file:
|
|
path: "{{ service_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Create karakeep data directory
|
|
ansible.builtin.file:
|
|
path: "{{ service_dir }}/data"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Create meilisearch directory
|
|
ansible.builtin.file:
|
|
path: "{{ service_dir }}/meilisearch"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Create ollama directory
|
|
ansible.builtin.file:
|
|
path: "{{ service_dir }}/ollama"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
# =========================================================================
|
|
# FILE DEPLOYMENT
|
|
# =========================================================================
|
|
- name: Copy docker-compose.yml
|
|
ansible.builtin.copy:
|
|
src: "{{ compose_src }}/docker-compose.yml"
|
|
dest: "{{ service_dir }}/docker-compose.yml"
|
|
mode: '0644'
|
|
|
|
- name: Copy .env file
|
|
ansible.builtin.copy:
|
|
src: "{{ compose_src }}/.env"
|
|
dest: "{{ service_dir }}/.env"
|
|
mode: '0600'
|
|
|
|
# =========================================================================
|
|
# CONTAINER DEPLOYMENT
|
|
# =========================================================================
|
|
- name: Deploy karakeep stack
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ service_dir }}"
|
|
state: present
|
|
pull: always
|
|
register: karakeep_result
|
|
|
|
- name: Show deployment status
|
|
ansible.builtin.debug:
|
|
msg: "Karakeep stack deployed: {{ karakeep_result.changed }}"
|
|
|
|
# =========================================================================
|
|
# VERIFICATION
|
|
# =========================================================================
|
|
- name: Wait for karakeep-web to be healthy
|
|
ansible.builtin.uri:
|
|
url: "http://localhost:3054/api/health"
|
|
status_code: 200
|
|
timeout: 10
|
|
register: web_health
|
|
retries: 15
|
|
delay: 10
|
|
until: web_health.status == 200
|
|
ignore_errors: true
|
|
|
|
- name: Wait for meilisearch to be ready
|
|
ansible.builtin.uri:
|
|
url: "http://localhost:7700/health"
|
|
status_code: 200
|
|
timeout: 5
|
|
register: meili_health
|
|
retries: 10
|
|
delay: 5
|
|
until: meili_health.status == 200
|
|
ignore_errors: true
|
|
|
|
- name: Wait for ollama to be ready
|
|
ansible.builtin.uri:
|
|
url: "http://localhost:11434/api/version"
|
|
status_code: 200
|
|
timeout: 5
|
|
register: ollama_health
|
|
retries: 10
|
|
delay: 5
|
|
until: ollama_health.status == 200
|
|
ignore_errors: true
|
|
|
|
- name: Summary
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "========================================="
|
|
- "Karakeep Stack Deployment Complete"
|
|
- "========================================="
|
|
- "✅ Karakeep Web: http://192.168.1.81:3054"
|
|
- "✅ Meilisearch: http://192.168.1.81:7700"
|
|
- "✅ Ollama: http://192.168.1.81:11434"
|
|
- "========================================="
|
|
- "NOTE: Ollama running on CPU only (no GPU)"
|
|
- "Models may need to be re-pulled after migration"
|