-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor scripts to facilitate dynamic monitoring #7
Open
thanethomson
wants to merge
5
commits into
main
Choose a base branch
from
thane/2-dynamic-monitoring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5746257
Refactor scripts to facilitate dynamic monitoring
thanethomson 30882c8
Ignore the correct secret file
thanethomson 9fda607
Remove unnecessary config folder creation
thanethomson 480710c
Remove unused Ansible Makefile
thanethomson dc84bf4
Restore testnet.toml file to its original state
thanethomson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,50 +1,34 @@ | ||
DO_INSTANCE_TAGNAME=v035-testnet | ||
LOAD_RUNNER_COMMIT_HASH ?= 51685158fe36869ab600527b852437ca0939d0cc | ||
LOAD_RUNNER_CMD=go run github.com/tendermint/tendermint/test/e2e/runner@$(LOAD_RUNNER_COMMIT_HASH) | ||
E2E_RUNNER_VERSION=v0.35.5 | ||
export DO_INSTANCE_TAGNAME | ||
export LOAD_RUNNER_CMD | ||
export E2E_RUNNER_VERSION | ||
|
||
.PHONY: terraform-init | ||
terraform-init: | ||
.PHONY: init | ||
init: | ||
$(MAKE) -C ./tf/ init | ||
|
||
.PHONY: terraform-apply | ||
terraform-apply: | ||
.PHONY: deploy | ||
deploy: | ||
$(MAKE) -C ./tf/ apply | ||
./script/configgen.sh ./ansible/hosts | ||
./script/secretsgen.sh ./ansible/secrets.yaml | ||
ANSIBLE_HOST_KEY_CHECKING=False \ | ||
ansible-playbook -i ./ansible/hosts -u root ./ansible/deploy.yaml -f 10 | ||
|
||
.PHONY: hosts | ||
hosts: | ||
echo "[validators]" > ./ansible/hosts | ||
doctl compute droplet list --tag-name $(DO_INSTANCE_TAGNAME) --tag-name "testnet-node" | tail -n+2 | tr -s ' ' | cut -d' ' -f2,3 | sort -k1 | sed 's/\(.*\) \(.*\)/\2 name=\1/g' >> ./ansible/hosts | ||
echo "[prometheus]" >> ./ansible/hosts | ||
doctl compute droplet list --tag-name $(DO_INSTANCE_TAGNAME) --tag-name "testnet-observability" | tail -n+2 | tr -s ' ' | cut -d' ' -f3 >> ./ansible/hosts | ||
|
||
.PHONY: configgen | ||
configgen: | ||
./script/configgen.sh `tail -n+2 ./ansible/hosts | head -n -2 |cut -d' ' -f1| paste -s -d, -` | ||
|
||
.PHONY: ansible-install | ||
ansible-install: | ||
cd ansible && \ | ||
ansible-playbook -i hosts -u root base.yaml -f 10 && \ | ||
ansible-playbook -i hosts -u root prometheus-node-exporter.yaml -f 10 && \ | ||
ansible-playbook -i hosts -u root init-testapp.yaml -f 10 && \ | ||
ansible-playbook -i hosts -u root update-testapp.yaml -f 10 | ||
|
||
.PHONY: prometheus-init | ||
prometheus-init: | ||
cd ansible && ansible-playbook -i hosts -u root prometheus.yaml -f 10 | ||
|
||
.PHONY: start-network | ||
start-network: | ||
cd ansible && ansible-playbook -i hosts -u root start-testapp.yaml -f 10 | ||
.PHONY: update-testapp | ||
update-testapp: | ||
./script/configgen.sh ./ansible/hosts | ||
ANSIBLE_HOST_KEY_CHECKING=False \ | ||
ansible-playbook -i ./ansible/hosts -u root ./ansible/update-testapp.yaml | ||
|
||
.PHONY: runload | ||
runload: | ||
$(LOAD_RUNNER_CMD) load \ | ||
--ip-list `tail -n+2 ./ansible/hosts | head -n -2 |cut -d' ' -f1| paste -s -d, -` \ | ||
--seed-delta $(shell echo $$RANDOM) | ||
./script/runload.sh ./ansible/hosts | ||
|
||
.PHONY: terraform-destroy | ||
terraform-destroy: | ||
.PHONY: destroy | ||
destroy: | ||
$(MAKE) -C ./tf/ destroy | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
--- | ||
# This playbook must be executed as root. | ||
# | ||
# It's also critical that the monitor is deployed first before the nodes | ||
# because the monitor deployment generates an API token for Telegraf instances | ||
# on the nodes to access the InfluxDB database on the monitor. | ||
- hosts: monitor | ||
become: no | ||
vars_files: | ||
- ./vars.yaml | ||
- ./secrets.yaml | ||
roles: | ||
- common | ||
- influxdb | ||
|
||
- hosts: nodes | ||
become: no | ||
vars_files: | ||
- ./vars.yaml | ||
- ./secrets.yaml | ||
roles: | ||
- common | ||
- telegraf | ||
- tendermint | ||
- testapp |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
# Allow SSH on port 22 and related traffic. Rate-limit SSH login attempts. | ||
# Log and drop failed SSH logins. | ||
*filter | ||
:INPUT ACCEPT [0:0] | ||
:FORWARD ACCEPT [0:0] | ||
:OUTPUT ACCEPT [368:94560] | ||
:LOGDROP - [0:0] | ||
-A INPUT -i lo -j ACCEPT | ||
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | ||
-A INPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 11 --name DEFAULT --mask 255.255.255.255 --rsource -j LOGDROP | ||
-A INPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -m recent --set --name DEFAULT --mask 255.255.255.255 --rsource | ||
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | ||
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7 | ||
-A INPUT -j DROP | ||
-A LOGDROP -j LOG --log-prefix "iptables denied ssh: " --log-level 7 | ||
-A LOGDROP -j DROP | ||
COMMIT |
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,17 @@ | ||
# Allow SSH on port 22 and related traffic. Rate-limit SSH login attempts. | ||
# Log and drop failed SSH logins. | ||
*filter | ||
:INPUT ACCEPT [0:0] | ||
:FORWARD ACCEPT [0:0] | ||
:OUTPUT ACCEPT [0:0] | ||
:LOGDROP - [0:0] | ||
-A INPUT -i lo -j ACCEPT | ||
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT | ||
-A INPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 11 --name DEFAULT --mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff --rsource -j LOGDROP | ||
-A INPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -m recent --set --name DEFAULT --mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff --rsource | ||
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT | ||
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "ip6tables denied: " --log-level 7 | ||
-A INPUT -j DROP | ||
-A LOGDROP -j LOG --log-prefix "ip6tables denied ssh: " --log-level 7 | ||
-A LOGDROP -j DROP | ||
COMMIT |
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,27 @@ | ||
- name: install common dependencies | ||
ansible.builtin.apt: | ||
name: | ||
- iptables | ||
- iptables-persistent | ||
state: latest | ||
update_cache: yes | ||
cache_valid_time: 60 | ||
|
||
- name: ensure persistent iptables dir exists | ||
ansible.builtin.file: | ||
path: /etc/iptables | ||
state: directory | ||
|
||
- name: copy base iptables rules | ||
ansible.builtin.copy: | ||
src: "iptables-{{ item }}" | ||
dest: "/etc/iptables/{{ item }}" | ||
loop: | ||
- rules.v4 | ||
- rules.v6 | ||
|
||
- name: apply base ipv4 iptables rules | ||
ansible.builtin.shell: "iptables-restore /etc/iptables/rules.v4" | ||
|
||
- name: apply base ipv6 iptables rules | ||
ansible.builtin.shell: "ip6tables-restore /etc/iptables/rules.v6" |
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,4 @@ | ||
bolt-path = "/var/lib/influxdb/influxd.bolt" | ||
engine-path = "/var/lib/influxdb/engine" | ||
reporting-disabled = true | ||
http-bind-address = ":8086" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you mean root on the machine you're deploying to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll clarify that 🙂