File tree Expand file tree Collapse file tree
roles/setup-qdrant-cluster/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff 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}' }"
Original file line number Diff line number Diff line change 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 :
Original file line number Diff line number Diff line change 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
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
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
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('') != ''
You can’t perform that action at this time.
0 commit comments