Compare commits
2 Commits
834ddb4438
...
b988582553
Author | SHA1 | Date | |
---|---|---|---|
|
b988582553 | ||
|
22ce6c07c3 |
@ -159,13 +159,14 @@ def check_logs(logger):
|
||||
if id_match:
|
||||
head_sub_id = id_match.group(1)
|
||||
|
||||
if last_subscription_id:
|
||||
logger.info(f"Subscription: {last_subscription_id}")
|
||||
return {"status": f"Sync: {format_number(last_subscription_id)}"}
|
||||
|
||||
if head_sub_id:
|
||||
logger.info(f"Head sub id: {head_sub_id}")
|
||||
return {"status": f"OK: {head_sub_id}"}
|
||||
|
||||
if last_subscription_id:
|
||||
logger.info(f"Subscription: {last_subscription_id}")
|
||||
return {"status": f"Sync: {format_number(last_subscription_id)}"}
|
||||
|
||||
logger.info("Not found subscription")
|
||||
return {"status": "Idle"}
|
||||
|
@ -1,15 +0,0 @@
|
||||
[Unit]
|
||||
Description=GRPC Balancer Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
ExecStart=/usr/bin/python3 /usr/local/bin/grpc-balancer.py
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
41
playbook.yml
41
playbook.yml
@ -203,12 +203,41 @@
|
||||
- waitress
|
||||
extra_args: --break-system-packages
|
||||
|
||||
- name: Copy grpcbalancer files
|
||||
ansible.builtin.shell: |
|
||||
cp {{ ansible_env.HOME }}/node/grpcbalancer/grpc-balancer.py /usr/local/bin/
|
||||
chmod 755 /usr/local/bin/grpc-balancer.py
|
||||
args:
|
||||
executable: /bin/bash
|
||||
- name: Copy grpcbalancer service file
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/systemd/system/grpcbalancer.service
|
||||
content: |
|
||||
[Unit]
|
||||
Description=GRPC Balancer Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory={{ ansible_env.HOME }}/node
|
||||
ExecStart=/usr/bin/python3 {{ ansible_env.HOME }}/node/grpc-balancer.py
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
mode: '0644'
|
||||
|
||||
- name: Enable and start node-checker service
|
||||
ansible.builtin.systemd:
|
||||
name: grpcbalancer
|
||||
enabled: yes
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
|
||||
|
||||
|
||||
#- name: Copy grpcbalancer files
|
||||
# ansible.builtin.shell: |
|
||||
# cp {{ ansible_env.HOME }}/node/grpcbalancer/grpc-balancer.py /usr/local/bin/
|
||||
# chmod 755 /usr/local/bin/grpc-balancer.py
|
||||
# args:
|
||||
# executable: /bin/bash
|
||||
|
||||
#- name: Install grpcbalancer service
|
||||
# ansible.builtin.shell: |
|
||||
|
Loading…
Reference in New Issue
Block a user