add docker speedup

This commit is contained in:
vvzvlad 2024-09-08 23:06:58 +03:00
parent 3e35a26af4
commit 0dc71205dc

View File

@ -216,7 +216,7 @@
changed_when: false changed_when: false
- name: Build docker compose - name: Build docker compose
ansible.builtin.command: docker compose build ansible.builtin.command: docker compose build -q
args: args:
chdir: "{{ ansible_env.HOME }}/basic-coin-prediction-node" chdir: "{{ ansible_env.HOME }}/basic-coin-prediction-node"
environment: environment:
@ -225,6 +225,36 @@
async: "{{ 60 * 45 }}" async: "{{ 60 * 45 }}"
poll: "{{ 60 * 5 }}" 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 - name: Check external IP before
ansible.builtin.command: curl https://ifconfig.me ansible.builtin.command: curl https://ifconfig.me
register: ip_before register: ip_before
@ -317,7 +347,7 @@
timeout: 30 timeout: 30
register: rpc_url_response register: rpc_url_response
retries: 3 retries: 3
delay: 60 delay: 120
failed_when: failed_when:
- rpc_url_response.status != 200 - rpc_url_response.status != 200
- rpc_url_response.json is not none and rpc_url_response.json is not defined - rpc_url_response.json is not none and rpc_url_response.json is not defined