Add the Affine playbook

This commit is contained in:
tanshu committed 2026-10-18 21:35:52 +05:30
1 parent a9ac51bd43
commit 34cb4aa3dc
8 files changed
+164

No files matched your search

@@ -0,0 +1,44 @@
---
# Tasks for Sharelatex role
- name: Pull Affine migration image
docker_image:
name: "{{ migration_image }}"
source: pull
force_source: yes
- name: Ensure Affine Storage Directory exists
file:
path: "/var/lib/{{ host_directory }}/storage"
state: directory
mode: 0755
- name: Ensure Affine Config Directory exists
file:
path: "/var/lib/{{ host_directory }}/config"
state: directory
mode: 0755
- name: Ensure 'affine' Docker network exists
docker_network:
name: "{{ docker_network }}"
state: present
connected:
- "{{ postgres_container }}"
- "{{ redis_container }}"
- name: Create Affine migration container
docker_container:
name: "{{ migration_container }}"
image: "{{ migration_image }}"
state: started
restart_policy: "no"
command: "sh -c node ./scripts/self-host-predeploy.js"
env:
REDIS_SERVER_HOST: "{{ redis_container }}"
DATABASE_URL: "{{ db_url }}"
AFFINE_INDEXER_ENABLED: "false"
volumes:
- "/var/lib/{{ host_directory }}/storage:/root/.affine/storage"
- "/var/lib/{{ host_directory }}/config:/root/.affine/config"
networks:
- name: "{{ docker_network }}"