-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from Constellation-Labs/adding-monitoring-service
Adding monitoring service
- Loading branch information
Showing
51 changed files
with
789 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
infra/docker/monitoring/grafana/config/ | ||
infra/docker/monitoring/prometheus/data/ | ||
infra/docker/monitoring/prometheus/monitoring/ | ||
infra/docker/grafana/grafana/config/ | ||
infra/docker/grafana/prometheus/data/ | ||
infra/docker/grafana/prometheus/monitoring/ | ||
.idea | ||
infra/docker/shared/jars/**.jar | ||
.vscode | ||
source/project/* | ||
source/metagraph-l0/genesis/genesis.address | ||
source/metagraph-l0/genesis/genesis.snapshot | ||
source/metagraph-l0/genesis/genesis.snapshot | ||
source/*-monitoring-service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
66 changes: 66 additions & 0 deletions
66
infra/ansible/remote/monitoring/playbooks/deploy/configure.ansible.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
- name: Install monitoring dependencies | ||
hosts: monitoring | ||
become: true | ||
gather_facts: false | ||
tasks: | ||
- name: Update apt cache | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
|
||
- name: Install Python and pip | ||
ansible.builtin.apt: | ||
name: | ||
- python3 | ||
- python3-pip | ||
state: present | ||
|
||
- name: Install build essential tools | ||
ansible.builtin.apt: | ||
name: build-essential | ||
state: present | ||
|
||
- name: Install additional libraries | ||
ansible.builtin.apt: | ||
name: | ||
- gcc | ||
- g++ | ||
- make | ||
state: present | ||
|
||
- name: Download and run NodeSource Node.js 20.x setup script | ||
ansible.builtin.get_url: | ||
url: https://deb.nodesource.com/setup_20.x | ||
dest: /tmp/setup_node_20.sh | ||
mode: '0755' | ||
register: download_nodesource_script | ||
|
||
- name: Execute NodeSource setup script | ||
ansible.builtin.shell: /tmp/setup_node_20.sh | ||
when: download_nodesource_script is succeeded | ||
|
||
- name: Install Node.js and npm | ||
ansible.builtin.apt: | ||
name: | ||
- nodejs | ||
state: present | ||
update_cache: yes | ||
|
||
- name: Install node-gyp globally | ||
ansible.builtin.npm: | ||
name: node-gyp | ||
global: yes | ||
|
||
- name: Check if Yarn is already installed | ||
ansible.builtin.command: which yarn | ||
register: yarn_installed | ||
ignore_errors: true | ||
|
||
- name: Install Yarn | ||
ansible.builtin.shell: | ||
cmd: npm install --global yarn | ||
when: yarn_installed.rc != 0 | ||
|
||
- name: Install PM2 | ||
ansible.builtin.shell: | ||
cmd: yarn global add pm2 |
24 changes: 24 additions & 0 deletions
24
infra/ansible/remote/monitoring/playbooks/deploy/deploy.ansible.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- import_playbook: configure.ansible.yml | ||
|
||
- name: Send metagraph-monitoring-service to remote host | ||
hosts: monitoring | ||
gather_facts: false | ||
tasks: | ||
- name: Create directory | ||
ansible.builtin.file: | ||
path: /home/{{ ansible_user }}/code | ||
state: directory | ||
|
||
- name: Sending metagraph-monitoring-service excluding node_modules | ||
ansible.builtin.synchronize: | ||
src: "{{ lookup('env', 'SOURCE_PATH') }}/metagraph-monitoring-service/" | ||
dest: "/home/{{ ansible_user }}/code/metagraph-monitoring-service" | ||
delete: yes | ||
rsync_opts: | ||
- "--exclude=node_modules/" | ||
|
||
- name: Install project dependencies | ||
shell: | | ||
cd "/home/{{ ansible_user }}/code/metagraph-monitoring-service" | ||
yarn |
37 changes: 37 additions & 0 deletions
37
infra/ansible/remote/monitoring/playbooks/start/start.ansible.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
- name: Start monitoring service | ||
hosts: monitoring | ||
gather_facts: false | ||
become: false | ||
tasks: | ||
- name: Check if monitoring-service exists | ||
stat: | ||
path: /home/{{ ansible_user }}/code/metagraph-monitoring-service | ||
register: result_dir | ||
|
||
- name: Fail if monitoring-service does not exist | ||
fail: | ||
msg: "The metagraph-monitoring-service does not exist." | ||
when: not (result_dir.stat.exists and result_dir.stat.isdir) | ||
|
||
- name: Stop current process | ||
shell: | | ||
cd /home/{{ ansible_user }}/code/metagraph-monitoring-service | ||
yarn kill | ||
ignore_errors: true | ||
|
||
- name: Check if should force_restart | ||
set_fact: | ||
force_restart_bool: "{{ force_restart | default(false) | bool }}" | ||
|
||
- name: Start monitoring service | ||
shell: | | ||
cd /home/{{ ansible_user }}/code/metagraph-monitoring-service | ||
yarn start | ||
when: not force_restart_bool | ||
|
||
- name: Start monitoring service forcing restart | ||
shell: | | ||
cd /home/{{ ansible_user }}/code/metagraph-monitoring-service | ||
yarn force-restart | ||
when: force_restart_bool |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
Oops, something went wrong.