feat: add Seafile service deployment and configuration with Caddy integration
Some checks failed
Ansible Lint Check / check-ansible (push) Failing after 17s
Nix Format Check / check-format (push) Successful in 57s
Python Lint Check / check-python (push) Failing after 13s

This commit is contained in:
2025-03-17 13:41:22 +01:00
parent e1dec22136
commit 9386a6d00c
6 changed files with 179 additions and 27 deletions

View File

@@ -6,6 +6,40 @@
seafile_data_dir: "/mnt/object_storage/services/seafile"
seafile_service_dir: "{{ ansible_env.HOME }}/services/seafile"
- name: Set Seafile configuration variables
ansible.builtin.set_fact:
# Docker images
seafile_image: "seafileltd/seafile-mc:12.0-latest"
seafile_db_image: "mariadb:10.11"
seafile_memcached_image: "memcached:1.6.29"
seadoc_image: "seafileltd/sdoc-server:1.0-latest"
notification_server_image: "seafileltd/notification-server:12.0-latest"
# Volume paths
seafile_volume: "{{ seafile_data_dir }}/seafile-data"
seafile_mysql_volume: "{{ seafile_data_dir }}/seafile-mysql/db"
seadoc_volume: "{{ seafile_data_dir }}/seadoc-data"
notification_server_volume: "{{ seafile_data_dir }}/notification-data"
# Database settings
seafile_mysql_db_host: "db"
seafile_mysql_root_password: "{{ lookup('community.general.onepassword', 'bbzudwdo3byqs4pscd2wy7qsn4', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='MYSQL_ROOT_PASSWORD') }}"
seafile_mysql_db_user: "seafile"
seafile_mysql_db_password: "{{ lookup('community.general.onepassword', 'bbzudwdo3byqs4pscd2wy7qsn4', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='MYSQL_PASSWORD') }}"
# Server settings
time_zone: "Europe/Amsterdam"
jwt_private_key: "{{ lookup('community.general.onepassword', 'bbzudwdo3byqs4pscd2wy7qsn4', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='jwt_private_key') }}"
seafile_server_hostname: "sf.mvl.sh"
seafile_server_protocol: "https"
# Admin credentials
seafile_admin_email: "menno@vleeuwen.me"
seafile_admin_password: "{{ lookup('community.general.onepassword', 'bbzudwdo3byqs4pscd2wy7qsn4', vault='j7nmhqlsjmp2r6umly5t75hzb4', field='password') }}"
# Features
enable_seadoc: "true"
- name: Create Seafile directories
ansible.builtin.file:
path: "{{ seafile_dir }}"
@@ -17,17 +51,30 @@
loop_control:
loop_var: seafile_dir
- name: Deploy Seafile docker-compose.yml
- name: Deploy Seafile configuration files
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ seafile_service_dir }}/docker-compose.yml"
src: "{{ item }}"
dest: "{{ seafile_service_dir }}/{{ item | replace('.j2', '') }}"
mode: "0644"
register: seafile_compose
loop:
- docker-compose.yml.j2
- seadoc.yml.j2
- .env.j2
register: seafile_configs
- name: Ensure containers are on the caddy network
ansible.builtin.command: docker network connect caddy_default seafile
register: connect_network
changed_when: connect_network.rc == 0
failed_when:
- connect_network.rc != 0
- "'already exists' not in connect_network.stderr"
when: seafile_configs.changed
- name: Stop Seafile service
ansible.builtin.command: docker compose -f "{{ seafile_service_dir }}/docker-compose.yml" down --remove-orphans
when: seafile_compose.changed or seafile_act_runner_config.changed
when: seafile_configs.changed
- name: Start Seafile service
ansible.builtin.command: docker compose -f "{{ seafile_service_dir }}/docker-compose.yml" up -d
when: seafile_compose.changed or seafile_act_runner_config.changed
when: seafile_configs.changed