This guide provides a full Ansible playbook to deploy Kallithea on Debian 10+, Ubuntu LTS, and RHEL 9+ compatible hosts using traditional installation (no Docker).
- name: Deploy Kallithea
hosts: kallithea
become: true
vars:
kallithea_user: kallithea
kallithea_home: /opt/kallithea
kallithea_venv: "{{ kallithea_home }}/venv"
kallithea_config: /etc/kallithea/kallithea.ini
app_port: 5000
tasks:
- name: Install dependencies on Debian/Ubuntu
apt:
name:
- git
- mercurial
- python3
- python3-pip
- python3-venv
- postgresql-client
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install dependencies on RHEL family
dnf:
name:
- git
- mercurial
- python3
- python3-pip
- postgresql-client
state: present
when: ansible_os_family == "RedHat"
- name: Create Kallithea user
user:
name: "{{ kallithea_user }}"
home: "{{ kallithea_home }}"
shell: /bin/bash
system: true
- name: Create application directory
file:
path: "{{ kallithea_home }}"
state: directory
owner: "{{ kallithea_user }}"
group: "{{ kallithea_user }}"
mode: "0755"
- name: Create Python virtual environment
command: python3 -m venv {{ kallithea_venv }}
args:
creates: "{{ kallithea_venv }}/bin/activate"
- name: Install Kallithea in virtual environment
pip:
name: kallithea
virtualenv: "{{ kallithea_venv }}"
- name: Create config directory
file:
path: /etc/kallithea
state: directory
mode: "0755"
- name: Initialize Kallithea configuration
command: "{{ kallithea_venv }}/bin/paster make-config kallithea {{ kallithea_config }}"
args:
creates: "{{ kallithea_config }}"
- name: Initialize database
command: "{{ kallithea_venv }}/bin/paster setup-db {{ kallithea_config }}"
become_user: "{{ kallithea_user }}"
- name: Install gunicorn
pip:
name: gunicorn
virtualenv: "{{ kallithea_venv }}"
- name: Write systemd service file
copy:
dest: /etc/systemd/system/kallithea.service
mode: "0644"
content: |
[Unit]
Description=Kallithea
After=network.target
[Service]
User={{ kallithea_user }}
Group={{ kallithea_user }}
WorkingDirectory={{ kallithea_home }}
ExecStart={{ kallithea_venv }}/bin/gunicorn --bind 127.0.0.1:{{ app_port }} kallithea:app
Restart=always
[Install]
WantedBy=multi-user.target
- name: Enable and start Kallithea
systemd:
name: kallithea
enabled: true
state: started
daemon_reload: true
/etc/kallithea/kallithea.iniAny questions?
Feel free to contact us. Find all contact information on our contact page.