Skip to content

Commit

Permalink
Fix: server and agents deployment on AWS without config file
Browse files Browse the repository at this point in the history
Fix: build process and local deployment
  • Loading branch information
Jose Luis Lucas committed Apr 11, 2019
1 parent ec66aac commit 8f967d0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 112 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN mv /tmp/qed/c-deps/* c-deps/
# Build QED, Storage binary and riot
RUN go build -o /usr/local/bin/qed &&\
go build -o /usr/local/bin/riot tests/riot.go &&\
go build -o /usr/local/bin/storage tests/gossip/test_service.go
go build -o /usr/local/bin/storage testutils/notifierstore.go

# Clean
RUN rm -rf /var/lib/apt/lists/* /tmp/qed
9 changes: 0 additions & 9 deletions deploy/aws/provision/tasks/qed/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@
with_items:
- qed

- name: Create QED config
template:
dest: /var/qed/{{ item }}
src: ../../templates/qed-{{ item }}.j2
force: true
with_items:
- config.yml
register: qed_config

- name: Create QED start|stop script
template:
dest: /var/qed/{{ item }}
Expand Down
95 changes: 0 additions & 95 deletions deploy/aws/provision/templates/qed-config.yml.j2

This file was deleted.

46 changes: 40 additions & 6 deletions deploy/aws/provision/templates/qed-start.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,52 @@
#}
#!/bin/bash

ulimit -n 819200

export QED_HOME=/var/qed
{% if 'role_qed' in group_names %}
$QED_HOME/qed start
$QED_HOME/qed server start \
--log info \
--api-key key \
--db-path /var/qed/db \
--gossip-addr "{{ ansible_eth0.ipv4.address }}:8400" \
--http-addr "{{ ansible_eth0.ipv4.address }}:8800" \
--metrics-addr "{{ ansible_eth0.ipv4.address }}:8600" \
--mgmt-addr "{{ ansible_eth0.ipv4.address }}:8700" \
--node-id server-{{ansible_hostname}} \
--private-key-path /var/qed/id_ed25519 \
--raft-addr "{{ ansible_eth0.ipv4.address }}:8500" \
{% if groups.role_qed.index(inventory_hostname) != 0 %}
{% for host in groups['name_qed-0'] %}
--raft-join-addr "{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8700" \
--gossip-join-addr "{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8400" \
{% endfor %}
{% endif %}
--raft-path /var/qed/wal
{% endif %}

{% if 'role_monitor' in group_names %}
$QED_HOME/qed agent monitor
$QED_HOME/qed agent monitor \
--role monitor \
--node-name monitor-{{ansible_hostname}} \
--qed-endpoints "{% for host in groups['role_qed'] %}http://{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8800{% if not loop.last %},{% endif %}{% endfor %}" \
{% endif %}
{% if 'role_auditor' in group_names %}
$QED_HOME/qed agent auditor
$QED_HOME/qed agent auditor \
--role auditor \
--node-name auditor-{{ansible_hostname}} \
--qed-endpoints "{% for host in groups['role_qed'] %}http://{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8800{% if not loop.last %},{% endif %}{% endfor %}" \
{% endif %}
{% if 'role_publisher' in group_names %}
$QED_HOME/qed agent publisher
$QED_HOME/qed agent publisher \
--role publisher \
--node-name publisher-{{ansible_hostname}} \
{% endif %}
{% if 'role_monitor' in group_names or 'role_auditor' in group_names or 'role_publisher' in group_names %}
--bind-addr "{{ ansible_eth0.ipv4.address }}:8100" \
--metrics-addr "{{ ansible_eth0.ipv4.address }}:18100" \
--start-join "{% for host in groups['role_qed'] %}{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8400{% if not loop.last %},{% endif %}{% endfor %}" \
{% for host in groups['role_storage'] %}
--notifier-endpoint http://{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8888 \
--store-endpoint http://{{ hostvars[host]['ansible_eth0']['ipv4']['address'] }}:8888 \
--log info
{% endfor %}
{% endif %}
2 changes: 1 addition & 1 deletion deploy/aws/provision/templates/qed.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RuntimeDirectory=root
RuntimeDirectoryMode=0750
ExecStart=/var/qed/qed-start.sh
ExecStop=/var/qed/qed-stop.sh
LimitNOFILE=10000
LimitNOFILE=819200
TimeoutStopSec=20

[Install]
Expand Down
1 change: 1 addition & 0 deletions tests/start_server
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ LEADER_CONFIG+=('--raft-addr 127.0.0.1:850${i}')
LEADER_CONFIG+=('--raft-path /var/tmp/qed${i}/wal')

FOLLOWER_CONFIG=("${LEADER_CONFIG[@]}")
FOLLOWER_CONFIG+=('--raft-addr-join 127.0.0.1:8700')
FOLLOWER_CONFIG+=('--gossip-join-addr 127.0.0.1:8400')

pids=()
Expand Down

0 comments on commit 8f967d0

Please sign in to comment.