Make archivebox role customizable

External HDD is no longer needed.
UID, GID and container tag may be changed.
The time zone now matches the host.
This commit is contained in:
Ivan R. 2024-11-19 17:26:34 +05:00
parent a73cebb48f
commit ca070782c9
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
4 changed files with 27 additions and 8 deletions

View file

@ -4,3 +4,4 @@
- name: archivebox - name: archivebox
csrf_trusted_origins: https://archive.comfycamp.space csrf_trusted_origins: https://archive.comfycamp.space
allowed_hosts: archive.comfycamp.space allowed_hosts: archive.comfycamp.space
archive_dir: /mnt/hdd/archivebox-data

View file

@ -2,12 +2,23 @@
argument_specs: argument_specs:
main: main:
options: options:
tag:
type: str
uid:
type: int
gid:
type: int
archive_dir:
type: str
description: "Path to the archive directory"
csrf_trusted_origins: csrf_trusted_origins:
type: str type: str
required: true required: true
description: "Full URL to your instance, e.g. https://example.com"
allowed_hosts: allowed_hosts:
type: str type: str
required: true required: true
description: "The domain of your instance, e.g. example.com"
public_index: public_index:
type: bool type: bool
public_snapshots: public_snapshots:

View file

@ -6,33 +6,34 @@
- name: Create data dir - name: Create data dir
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: /mnt/hdd/archivebox-data path: "{{ archive_dir }}"
state: directory state: directory
mode: "1700" mode: "1700"
owner: root owner: root
- name: Create nested data dir - name: Create nested data dir
become: true become: true
ansible.builtin.file: ansible.builtin.file:
path: /mnt/hdd/archivebox-data/_data path: "{{ archive_dir }}/_data"
state: directory state: directory
mode: "1700" mode: "1700"
owner: "911" owner: "{{ uid | string }}"
- name: Run archivebox - name: Run archivebox
become: true become: true
community.docker.docker_container: community.docker.docker_container:
name: archivebox-1 name: archivebox-1
image: archivebox/archivebox:0.7.2 image: archivebox/archivebox:{{ tag }}
env: env:
PUBLIC_INDEX: "{{ public_index | string }}" PUBLIC_INDEX: "{{ public_index | string }}"
PUBLIC_SNAPSHOTS: "{{ public_snapshots | string }}" PUBLIC_SNAPSHOTS: "{{ public_snapshots | string }}"
SAVE_ARCHIVE_DOT_ORG: "{{ save_archive_dot_org | string }}" SAVE_ARCHIVE_DOT_ORG: "{{ save_archive_dot_org | string }}"
CSRF_TRUSTED_ORIGINS: "{{ csrf_trusted_origins }}" CSRF_TRUSTED_ORIGINS: "{{ csrf_trusted_origins }}"
ALLOWED_HOSTS: "{{ allowed_hosts }}" ALLOWED_HOSTS: "{{ allowed_hosts }}"
PUID: "911" PUID: "{{ uid | string }}"
PGID: "911" PGID: "{{ gid | string }}"
networks: networks:
- name: haproxy - name: haproxy
volumes: volumes:
- archivebox:/data - "archivebox:/data"
- /mnt/hdd/archivebox-data/_data:/data/archive - "{{ archive_dir }}/_data:/data/archive"
- "/etc/timezone:/etc/timezone:ro"
restart_policy: unless-stopped restart_policy: unless-stopped

View file

@ -1,3 +1,9 @@
uid: 911
gid: 911
tag: "0.7.2"
public_index: false public_index: false
public_snapshots: false public_snapshots: false
save_archive_dot_org: false save_archive_dot_org: false
archive_dir: /var/lib/docker/volumes/archivebox/_data/archive