Last active
February 27, 2025 23:27
-
-
Save wsargent/66c19413049135ce01c9e252faf7a8f2 to your computer and use it in GitHub Desktop.
Ansible playbook for installing Letta with an external pgvector database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Install Letta Server with Docker | |
hosts: all | |
become: true | |
vars: | |
letta_data_dir: /opt/letta/data | |
postgres_password: "" | |
anthropic_api_key: "" | |
mistral_api_key: "" | |
postgres_host: "" | |
letta_server_secure: "true" | |
letta_server_password: "" | |
ollama_base_url: "" | |
tasks: | |
- name: Install required packages | |
apt: | |
name: | |
- apt-transport-https | |
- ca-certificates | |
- curl | |
- software-properties-common | |
- python3-pip | |
state: present | |
update_cache: yes | |
- name: Add Docker GPG key | |
apt_key: | |
url: https://download.docker.com/linux/ubuntu/gpg | |
state: present | |
- name: Add Docker repository | |
apt_repository: | |
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable | |
state: present | |
- name: Install Docker | |
apt: | |
name: docker-ce | |
state: present | |
update_cache: yes | |
- name: Create Letta directories | |
file: | |
path: "{{ item }}" | |
state: directory | |
mode: '0755' | |
loop: | |
- "{{ letta_data_dir }}" | |
- name: Install Docker Python dependencies | |
pip: | |
name: | |
- "docker>=3.0.0,<7.0.0" | |
- "requests<2.32" | |
- "dbus-python" | |
state: present | |
- name: Start Docker service | |
service: | |
name: docker | |
state: started | |
enabled: yes | |
- name: Pull Letta Docker image | |
docker_image: | |
name: letta/letta | |
source: pull | |
tag: latest | |
# https://github.com/letta-ai/letta/discussions/2276 | |
- name: Run Letta container | |
docker_container: | |
name: letta-server | |
image: letta/letta:latest | |
network_mode: host | |
state: started | |
restart_policy: unless-stopped | |
volumes: | |
- "{{ letta_data_dir }}:/data" | |
env: | |
SECURE: "{{ letta_server_secure }}" | |
LETTA_SERVER_PASSWORD: "{{ letta_server_password }}" | |
LETTA_DEBUG: "false" | |
ANTHROPIC_API_KEY: "{{ anthropic_api_key }}" | |
MISTRAL_API_KEY: "{{ mistral_api_key }}" | |
OLLAMA_BASE_URL: "{{ ollama_base_url }}" | |
LETTA_PG_URI: "postgresql://letta:{{ postgres_password }}@{{ postgres_host }}:5432/letta" | |
ports: | |
- "8283:8283" | |
- name: Wait for Letta server to be ready | |
wait_for: | |
port: 8283 | |
timeout: 60 | |
- name: add vagrant to docker group | |
ansible.builtin.user: | |
name: USERNAME | |
groups: docker | |
append: true | |
# You will need to expose the server IP to letta ADE | |
# https://docs.letta.com/quickstart/docker#access-the-letta-ade-agent-development-environment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment