diff --git a/roles/changedetection/tasks/main.yml b/roles/changedetection/tasks/main.yml index 11663ee..5ad0c80 100644 --- a/roles/changedetection/tasks/main.yml +++ b/roles/changedetection/tasks/main.yml @@ -1,19 +1,20 @@ --- -- name: Create a volume +- name: Create the compose project directory + ansible.builtin.file: + path: "/home/{{ ansible_user_id }}/changedetection" + state: directory + owner: "{{ ansible_user_id }}" + mode: '0744' +- name: Create the compose project + ansible.builtin.template: + src: docker-compose.yaml.j2 + dest: "/home/{{ ansible_user_id }}/changedetection/docker-compose.yaml" + owner: "{{ ansible_user_id }}" + mode: '0644' +- name: Create and start services become: true - community.docker.docker_volume: - name: changedetection_data -- name: Install the container - become: true - community.docker.docker_container: - name: changedetection-server - image: "docker.io/dgtlmoon/changedetection.io:{{ changedetection_version }}" - ports: - - "127.0.0.1:5000:5000/tcp" - mounts: - - source: changedetection_data - target: /datastore - restart_policy: always + community.docker.docker_compose_v2: + project_src: "/home/{{ ansible_user_id }}/changedetection/" - name: Include simple-reverse-proxy role ansible.builtin.include_role: name: simple-reverse-proxy diff --git a/roles/changedetection/templates/docker-compose.yaml.j2 b/roles/changedetection/templates/docker-compose.yaml.j2 new file mode 100644 index 0000000..1faa0b2 --- /dev/null +++ b/roles/changedetection/templates/docker-compose.yaml.j2 @@ -0,0 +1,30 @@ +--- +services: + changedetection-server: + image: "docker.io/dgtlmoon/changedetection.io:{{ changedetection_version }}" + hostname: changedetection + restart: always + ports: + - "127.0.0.1:5000:5000/tcp" + volumes: + - "changedetection_data:/datastore" + environment: + - PLAYWRIGHT_DRIVER_URL=ws://browserless-chrome:3000 + # See configuration from: https://www.youtube.com/watch?v=o_iG4Wunh98 + browserless-chrome: + image: "browserless/chrome:{{ browserless_chrome_version }}" + hostname: browserless-chrome + restart: always + environment: + - SCREEN_WIDTH=1920 + - SCREEN_HEIGHT=1024 + - SCREEN_DEPTH=16 + - ENABLE_DEBUGGER=false + - PREBOOT_CHROME=true + - CONNECTION_TIMEOUT=300000 + - MAX_CONCURRENT_SESSIONS=10 + - CHROME_REFRESH_TIME=600000 + - DEFAULT_BLOCK_ADS=true + - DEFAULT_STEALTH=true +volumes: + changedetection_data: diff --git a/roles/changedetection/vars/main/defaults.yml b/roles/changedetection/vars/main/defaults.yml index 58c9019..a19afb6 100644 --- a/roles/changedetection/vars/main/defaults.yml +++ b/roles/changedetection/vars/main/defaults.yml @@ -1,2 +1,6 @@ --- changedetection_version: 0.47.06 +# This isn't preferable, i'd rather pin a version. However +# it's quite hard to find a suitable candidate (https://hub.docker.com/r/browserless/chrome/tags) +# for arm64. +browserless_chrome_version: latest diff --git a/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml index 1041d81..18c05dd 100644 --- a/roles/postgres/tasks/main.yml +++ b/roles/postgres/tasks/main.yml @@ -26,6 +26,8 @@ --agree-tos -m {{ administration_email }} -d postgres.kleinendorst.info creates: "/etc/letsencrypt/live/postgres.kleinendorst.info" +# TODO: Instead of creating a seperate postgres user specifically for storing +# the files we might also upload the compose to the default account and run from there. - name: Create the compose project directory become: true become_user: "{{ postgres_unix_username }}" @@ -38,12 +40,11 @@ become: true become_user: "{{ postgres_unix_username }}" ansible.builtin.template: - src: docker-compose.yml.j2 - dest: "/home/{{ postgres_unix_username }}/postgres/docker-compose.yml" + src: docker-compose.yaml.j2 + dest: "/home/{{ postgres_unix_username }}/postgres/docker-compose.yaml" owner: "{{ postgres_unix_username }}" mode: '0644' - name: Create and start services become: true community.docker.docker_compose_v2: project_src: "/home/{{ postgres_unix_username }}/postgres/" - register: docker_compose_output diff --git a/roles/postgres/templates/docker-compose.yml.j2 b/roles/postgres/templates/docker-compose.yaml.j2 similarity index 100% rename from roles/postgres/templates/docker-compose.yml.j2 rename to roles/postgres/templates/docker-compose.yaml.j2