From 0dc71205dcbb19a8b42bafa2b00f51b5f194dcd6 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Sun, 8 Sep 2024 23:06:58 +0300 Subject: [PATCH] add docker speedup --- playbook.yaml | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/playbook.yaml b/playbook.yaml index 5502b25..a6ab174 100644 --- a/playbook.yaml +++ b/playbook.yaml @@ -216,7 +216,7 @@ changed_when: false - name: Build docker compose - ansible.builtin.command: docker compose build + ansible.builtin.command: docker compose build -q args: chdir: "{{ ansible_env.HOME }}/basic-coin-prediction-node" environment: @@ -225,6 +225,36 @@ async: "{{ 60 * 45 }}" poll: "{{ 60 * 5 }}" + - name: Up docker compose stack + ansible.builtin.command: docker compose up -d + args: + chdir: "{{ ansible_env.HOME }}/basic-coin-prediction-node" + environment: + COMPOSE_INTERACTIVE_NO_CLI: 'true' + changed_when: false + async: "{{ 60 * 80 }}" + poll: "{{ 60 * 5 }}" + + - name: Check Docker container status + ansible.builtin.shell: > + if [ $(docker ps -q | wc -l) -eq $(docker ps -a -q | wc -l) ]; then + echo "all_running"; + else + echo "not_all_running"; + fi + register: container_status + retries: 10 + delay: 30 + until: container_status.stdout.find("all_running") != -1 + + - name: Stop docker compose stack + ansible.builtin.command: docker compose stop + args: + chdir: "{{ ansible_env.HOME }}/basic-coin-prediction-node" + environment: + COMPOSE_INTERACTIVE_NO_CLI: 'true' + changed_when: false + - name: Check external IP before ansible.builtin.command: curl https://ifconfig.me register: ip_before @@ -317,7 +347,7 @@ timeout: 30 register: rpc_url_response retries: 3 - delay: 60 + delay: 120 failed_when: - rpc_url_response.status != 200 - rpc_url_response.json is not none and rpc_url_response.json is not defined