Skip to content

Commit 9114b1a

Browse files
committed
WIP
1 parent 6ff8a3b commit 9114b1a

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

ansible/playbooks/files/transfer-speed/docker-compose-cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ services:
1616
volumes:
1717
- ./qdrant_data:/qdrant/storage
1818
command: >
19-
sh -c "./qdrant ${CLUSTER_BOOTSTRAP_URI:+--uri $CLUSTER_BOOTSTRAP_URI}"
19+
sh -c "./qdrant --uri '${NODE_URI}' ${BOOTSTRAP_URI:+--bootstrap '${BOOTSTRAP_URI}'}"

ansible/playbooks/playbook-transfer-speed.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
- name: Load variables
88
include_vars: "group_vars/transfer-speed.yml"
99

10-
- name: Set bootstrap URI for non-first nodes
10+
- name: Set cluster URIs
1111
set_fact:
12-
cluster_bootstrap_uri: "{{ 'http://' + hostvars[groups['remote_machines'][0]]['ansible_host'] + ':6335' if inventory_hostname != groups['remote_machines'][0] else '' }}"
12+
node_uri: "http://{{ ansible_host }}:6335"
13+
bootstrap_uri: "{{ '' if inventory_hostname == groups['remote_machines'][0] else 'http://' + hostvars[groups['remote_machines'][0]]['ansible_host'] + ':6335' }}"
1314

1415
- name: Setup Qdrant cluster node
1516
include_role:

ansible/playbooks/roles/setup-qdrant-cluster/tasks/main.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616

1717
- name: Stop existing containers
1818
ansible.builtin.shell: |
19-
docker compose down || true
20-
docker rm -f qdrant-node || true
21-
args:
22-
chdir: "{{ working_dir }}"
19+
cd {{ working_dir }} && docker compose down 2>/dev/null || true
20+
docker rm -f qdrant-node 2>/dev/null || true
21+
docker rm -f qdrant-continuous 2>/dev/null || true
22+
# Kill any container using port 6333
23+
docker ps -q --filter "publish=6333" | xargs -r docker rm -f 2>/dev/null || true
24+
# Also remove the data directory to ensure clean state
25+
rm -rf {{ working_dir }}/qdrant_data || true
2326
ignore_errors: yes
2427

2528
- name: Remove old image to ensure fresh pull
@@ -35,7 +38,8 @@
3538
environment:
3639
QDRANT_VERSION: "{{ server_version }}"
3740
CONTAINER_REGISTRY: "{{ server_registry }}"
38-
CLUSTER_BOOTSTRAP_URI: "{{ cluster_bootstrap_uri | default('') }}"
41+
NODE_URI: "{{ node_uri }}"
42+
BOOTSTRAP_URI: "{{ bootstrap_uri | default('') }}"
3943
QDRANT__FEATURE_FLAGS__ALL: "{{ feature_flags | default('false') }}"
4044
register: compose_result
4145
failed_when: compose_result.rc != 0
@@ -46,7 +50,7 @@
4650
status_code: 200
4751
register: result
4852
until: result.status == 200
49-
retries: 60
53+
retries: 10
5054
delay: 2
5155

5256
- name: Wait for node to join cluster
@@ -56,6 +60,6 @@
5660
return_content: yes
5761
register: cluster_status
5862
until: cluster_status.json.result.peer_id is defined
59-
retries: 30
63+
retries: 10
6064
delay: 2
61-
when: cluster_bootstrap_uri | default('') != ''
65+
when: bootstrap_uri | default('') != ''

0 commit comments

Comments
 (0)