From 249e80e70e31b673a965a5b62e64b058cbb15dae Mon Sep 17 00:00:00 2001 From: b0xxer Date: Mon, 12 Feb 2024 10:24:59 -0600 Subject: [PATCH] Added electrs-init.sh to start with proper arguments for listening typo in cockpit-storage name removed task for linger as need to find another way to do it --- hosts | 4 +++- roles/apps/files/electrs/electrs-init.sh | 9 +++++++++ roles/apps/tasks/electrs.yml | 5 +++++ roles/apps/templates/electrs/Containerfile.j2 | 6 +++++- roles/config/tasks/main.yml | 15 +++++++++------ roles/install/tasks/main.yml | 2 +- 6 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 roles/apps/files/electrs/electrs-init.sh diff --git a/hosts b/hosts index 2732b07..91f7d34 100644 --- a/hosts +++ b/hosts @@ -34,12 +34,14 @@ bitcoin_rpcpassword=rVhfmriXjB8uFekmn7sLvnUiY610JaOx electrs_version=0.10.2 zerotier_network= #Update wariness - 1 = very reluctant to update, 0 = eager to update +#timezone - which timezone update schedule is in #days - which days to update (its a list) #starttime - 24hr time format of when updates are permitted #length - how long is update window open update_wariness=0.75 +update_schedule_timezone="America/Eastern" update_schedule_days=['Sat'] -update_schedule_starttime="02:00" +update_schedule_starttime="03:00" update_schedule_length=60 diff --git a/roles/apps/files/electrs/electrs-init.sh b/roles/apps/files/electrs/electrs-init.sh new file mode 100644 index 0000000..0ae473e --- /dev/null +++ b/roles/apps/files/electrs/electrs-init.sh @@ -0,0 +1,9 @@ +#! /bin/sh +# +# electrs-init.sh +# +# Distributed under terms of the MIT license. +# + + +/bin/electrs --log-filters INFO --db-dir /db --electrum-rpc-addr="0.0.0.0:50001" diff --git a/roles/apps/tasks/electrs.yml b/roles/apps/tasks/electrs.yml index 4429651..3b51eb6 100644 --- a/roles/apps/tasks/electrs.yml +++ b/roles/apps/tasks/electrs.yml @@ -25,6 +25,11 @@ dest: ~/Containers/electrs/Containerfile notify: rebuild_electrs +- name: electrs - Copy electrs-init.sh + ansible.builtin.copy: + src: electrs/electrs-init.sh + dest: ~/Containers/electrs/electrs-init.sh + - name: electrs - Copy build script ansible.builtin.template: src: electrs/build.sh.j2 diff --git a/roles/apps/templates/electrs/Containerfile.j2 b/roles/apps/templates/electrs/Containerfile.j2 index 4b5513a..3b97d82 100644 --- a/roles/apps/templates/electrs/Containerfile.j2 +++ b/roles/apps/templates/electrs/Containerfile.j2 @@ -25,6 +25,10 @@ RUN microdnf update -y && microdnf clean all COPY --from=builder /build/target/release/electrs /bin/electrs +COPY electrs-init.sh /bin/electrs-init.sh + +RUN chmod +x /bin/electrs-init.sh + # Electrum RPC Mainnet EXPOSE 50001 # Electrum RPC Testnet @@ -39,4 +43,4 @@ STOPSIGNAL SIGINT HEALTHCHECK CMD curl -fSs http://localhost:4224/ || exit 1 -ENTRYPOINT [ "electrs" ] +ENTRYPOINT [ "/bin/electrs-init.sh" ] diff --git a/roles/config/tasks/main.yml b/roles/config/tasks/main.yml index 859d5eb..94fe448 100644 --- a/roles/config/tasks/main.yml +++ b/roles/config/tasks/main.yml @@ -89,12 +89,12 @@ state: stopped masked: true -- name: Set {{ ansible_user }} user to linger - become: yes - become_method: sudo - command: loginctl enable-linger {{ ansible_user }} - args: - creates: /var/lib/systemd/linger/{{ ansible_user }} +#- name: Set {{ ansible_user }} user to linger + #become: yes + #become_method: sudo + #command: loginctl enable-linger {{ ansible_user }} + #args: + #creates: /var/lib/systemd/linger/{{ ansible_user }} - name: Set update zincati wariness to {{update_wariness}} become: yes @@ -114,6 +114,9 @@ [updates] strategy = "periodic" + [updates.periodic] + time_zone={{ update_schedule_timezone }} + [[updates.periodic.window]] days = {{ update_schedule_days }} start_time = {{ update_schedule_starttime }} diff --git a/roles/install/tasks/main.yml b/roles/install/tasks/main.yml index e456ddd..916edb5 100644 --- a/roles/install/tasks/main.yml +++ b/roles/install/tasks/main.yml @@ -35,9 +35,9 @@ - telnet - cockpit - cockpit-networkmanager - - cockpit-storage - cockpit-ostree - cockpit-podman + - cockpit-storaged - zerotier-one - python3-pip - smartmontools