This guide provides a full Ansible playbook to deploy Keila with Docker Compose on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts.
keila.example.com)- name: Deploy Keila
hosts: keila
become: true
vars:
app_root: /opt/keila
app_port: 4000
db_password: "ChangeMe123!"
secret_key_base: "generate-a-long-random-string-here"
keila_url: "https://keila.example.com"
tasks:
- name: Generate secret key if not provided
set_fact:
secret_key_base: "{{ lookup('password', '/dev/null chars=ascii_letters,digits length=64') }}"
when: secret_key_base == "generate-a-long-random-string-here"
- 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: Write Docker Compose file
copy:
dest: "{{ app_root }}/docker-compose.yml"
mode: "0644"
content: |
services:
keila:
image: pentacent/keila:latest
container_name: keila
restart: unless-stopped
ports:
- "{{ app_port }}:4000"
environment:
- SECRET_KEY_BASE={{ secret_key_base }}
- DATABASE_URL=postgresql://keila:{{ db_password }}@db:5432/keila
- KEILA_URL={{ keila_url }}
volumes:
- keila_data:/var/lib/keila
depends_on:
- db
db:
image: postgres:15
container_name: keila-db
restart: unless-stopped
environment:
- POSTGRES_DB=keila
- POSTGRES_USER=keila
- POSTGRES_PASSWORD={{ db_password }}
volumes:
- db_data:/var/lib/postgresql/data
volumes:
keila_data:
db_data:
- name: Start application stack
command: docker compose up -d
args:
chdir: "{{ app_root }}"
pentacent/keila on Docker HubSECRET_KEY_BASE for each installation (playbook auto-generates if not provided)http://your-server:4000Any questions?
Feel free to contact us. Find all contact information on our contact page.