76 lines
2.3 KiB
YAML
76 lines
2.3 KiB
YAML
|
|
---
|
||
|
|
- name: Create mempool directories
|
||
|
|
file:
|
||
|
|
path: "{{ item }}"
|
||
|
|
state: directory
|
||
|
|
owner: "{{ ansible_user }}"
|
||
|
|
group: "{{ ansible_user }}"
|
||
|
|
mode: '0755'
|
||
|
|
loop:
|
||
|
|
- "{{ mempool_dir }}"
|
||
|
|
- "{{ mempool_data_dir }}"
|
||
|
|
|
||
|
|
# MariaDB owns its own data directory. The container runs as uid 999 and has to
|
||
|
|
# create files in there; this playbook declared owner: {{ ansible_user }} (1000),
|
||
|
|
# which had been drifting from reality ever since the containers were created and
|
||
|
|
# would have broken MariaDB the first time it needed a new file. It went
|
||
|
|
# unnoticed only because the playbook had not been run since.
|
||
|
|
#
|
||
|
|
# So: ensure the directory exists, and let the container own it. On a fresh
|
||
|
|
# install the mariadb image's entrypoint sets ownership itself.
|
||
|
|
- name: Ensure the MariaDB data directory exists
|
||
|
|
file:
|
||
|
|
path: "{{ mempool_mysql_dir }}"
|
||
|
|
state: directory
|
||
|
|
|
||
|
|
- name: Create docker-compose.yml for Mempool
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: docker-compose.yml.j2
|
||
|
|
dest: "{{ mempool_dir }}/docker-compose.yml"
|
||
|
|
owner: "{{ ansible_user }}"
|
||
|
|
group: "{{ ansible_user }}"
|
||
|
|
mode: '0644'
|
||
|
|
- name: Pull Mempool images
|
||
|
|
command: docker compose pull
|
||
|
|
args:
|
||
|
|
chdir: "{{ mempool_dir }}"
|
||
|
|
|
||
|
|
- name: Deploy Mempool containers with docker compose
|
||
|
|
command: docker compose up -d
|
||
|
|
args:
|
||
|
|
chdir: "{{ mempool_dir }}"
|
||
|
|
|
||
|
|
- name: Wait for MariaDB to be healthy
|
||
|
|
command: docker inspect --format='{{ '{{' }}.State.Health.Status{{ '}}' }}' mempool-db
|
||
|
|
register: mariadb_health
|
||
|
|
until: mariadb_health.stdout == 'healthy'
|
||
|
|
retries: 30
|
||
|
|
delay: 10
|
||
|
|
changed_when: false
|
||
|
|
|
||
|
|
- name: Wait for Mempool backend to start
|
||
|
|
uri:
|
||
|
|
url: "http://localhost:{{ mempool_backend_port }}/api/v1/backend-info"
|
||
|
|
method: GET
|
||
|
|
status_code: 200
|
||
|
|
timeout: 10
|
||
|
|
register: backend_check
|
||
|
|
until: backend_check.status == 200
|
||
|
|
retries: 30
|
||
|
|
delay: 10
|
||
|
|
ignore_errors: yes
|
||
|
|
|
||
|
|
- name: Wait for Mempool frontend to be available
|
||
|
|
uri:
|
||
|
|
url: "http://localhost:{{ mempool_frontend_port }}"
|
||
|
|
method: GET
|
||
|
|
status_code: 200
|
||
|
|
timeout: 10
|
||
|
|
register: frontend_check
|
||
|
|
until: frontend_check.status == 200
|
||
|
|
retries: 20
|
||
|
|
delay: 5
|
||
|
|
ignore_errors: yes
|
||
|
|
|
||
|
|
# ═════════════════════════════════════════════════════════════════════════
|