Compare commits
No commits in common. "b988582553885fe50f5ea62e78bbaf08a69c96ba" and "834ddb443855e5802cbfadc18aa1b7d05d2bd37b" have entirely different histories.
b988582553
...
834ddb4438
@ -159,14 +159,13 @@ 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"}
|
||||
|
15
grpcbalancer/grpc-balancer.service
Normal file
15
grpcbalancer/grpc-balancer.service
Normal file
@ -0,0 +1,15 @@
|
||||
[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,41 +203,12 @@
|
||||
- waitress
|
||||
extra_args: --break-system-packages
|
||||
|
||||
- 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: 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