Skip to content

Commit

Permalink
Merge pull request #8157 from MinaProtocol/devnet2-and-mainnet-master
Browse files Browse the repository at this point in the history
devnet-2 and mainnet
  • Loading branch information
lk86 authored Mar 9, 2021
2 parents 8202b60 + 59d6ec4 commit 68200c7
Show file tree
Hide file tree
Showing 29 changed files with 40,589 additions and 21,717 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@ automation/block_tree.gv.png
automation/gcloud-keyfile.json
automation/services/watchdog/check_libp2p/check_libp2p

*.backup
*.backup

*.terraform.lock.hcl
8 changes: 3 additions & 5 deletions automation/bake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ RUN mkdir -p /root/.mina-config && echo "{}" > /root/.mina-config/daemon.json
RUN mina daemon -config-file ${CONFIG_FILE} -generate-genesis-proof true; \
mv ~/.mina-config/genesis/genesis_* /var/lib/coda/

RUN curl https://raw.githubusercontent.com/MinaProtocol/mina/${COMMIT_HASH}/automation/terraform/testnets/${TESTNET_NAME}/peers.txt -o /root/peers.txt

#RUN curl https://raw.githubusercontent.com/MinaProtocol/mina/develop/dockerfiles/scripts/healthcheck-utilities.sh -o /healthcheck/utilities.sh

RUN echo '#!/bin/bash -x\n\
Expand All @@ -38,11 +36,11 @@ shift \n\
while true; do\n\
rm -f /root/.mina-config/.mina-lock\n\
mina "$command" -config-file "'${CONFIG_FILE}'" "$@" 2>&1 >mina.log &\n\
coda_pid=$!\n\
mina_pid=$!\n\
tail -q -f mina.log &\n\
tail_pid=$!\n\
wait "$coda_pid"\n\
echo "Coda process exited with status code $?"\n\
wait "$mina_pid"\n\
echo "Mina process exited with status code $?"\n\
sleep 10\n\
kill "$tail_pid"\n\
if [ ! -f stay_alive ]; then\n\
Expand Down
27 changes: 27 additions & 0 deletions automation/scripts/patch-archive-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash


IMAGE="codaprotocol/coda-archive:1.0.2"


read -r -d '' PATCH << SPEC
spec:
template:
spec:
containers:
- name: archive
image: $IMAGE
args:
- coda-archive
- run
- -postgres-uri
- postgres://postgres:foobar@archive-1-postgresql:5432/archive
- -config-file
- /config/daemon.json
- -server-port
- "3086"
SPEC

echo -e "$PATCH"

kubectl patch deploy/archive-1 -p "$PATCH"
37 changes: 37 additions & 0 deletions automation/scripts/patch-watchdog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash


IMAGE="gcr.io/o1labs-192920/watchdog:0.4.2"


read -r -d '' PATCH << SPEC
spec:
template:
spec:
containers:
- name: watchdog
image: $IMAGE
SPEC

echo -e "$PATCH"

kubectl patch deploy/archive-1 -p "$PATCH"

# ====================================


read -r -d '' PATCH << SPEC
spec:
jobTemplate:
spec:
template:
spec:
containers:
- name: watchdog
image: $IMAGE
SPEC

echo -e "$PATCH"

kubectl patch cronjobs/watchdog-make-reports -p "$PATCH"

4 changes: 2 additions & 2 deletions automation/services/watchdog/make_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main():
parser.add_argument("-d", "--discord_webhook_url", help="discord webhook url", required=False, type=str, dest="discord_webhook_url")
parser.add_argument("-a", "--accounts", help="community accounts csv", required=False, type=str, dest="accounts_csv")
parser.add_argument("-l", "--local", help="run with a local node", required=False, type=bool, default=False)
parser.add_argument("-c", "--coda", help="local coda binary", required=False, type=str, default="coda")
parser.add_argument("-b", "--bin", help="local mina binary", required=False, type=str, default="mina", dest="binary")

# ==========================================

Expand Down Expand Up @@ -85,7 +85,7 @@ def main():
request_timeout_seconds = 600

def exec_locally(command):
command = command.replace('coda', args.coda)
command = command.replace('mina', args.binary)
print(command)
import subprocess
subprocess = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, text=True)
Expand Down
1 change: 0 additions & 1 deletion automation/services/watchdog/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def pods_with_no_new_logs(v1, namespace, nodes_with_no_new_logs):
for pod in pods.items:
containers = pod.status.container_statuses
mina_containers = list(filter(lambda c: c.name in [ 'coda', 'seed', 'coordinator' ], containers))
print(mina_containers)
if len(mina_containers) != 0:
name = pod.metadata.name
recent_logs = v1.read_namespaced_pod_log(name=name, namespace=namespace, since_seconds=ten_minutes)
Expand Down
13 changes: 7 additions & 6 deletions automation/services/watchdog/node_status_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_deepest_child(p):
return max(children_and_depths, key=lambda x: x[1])

best_protocol_states = [ get_deepest_child(root) for root in roots ]
best_protocol_state = max(best_protocol_states, key=lambda x: x[1])[0]
best_protocol_state = max(best_protocol_states, key=lambda x: x[1], default=[ None ])[0]

n = 3
last_n_protocol_states = [ best_protocol_state ]
Expand Down Expand Up @@ -121,25 +121,26 @@ def add_resp(resp, direct_queried_peers):
peer_table[k] = v

queried_peers.update([ p['node_peer_id'] for p in peers ])
queried_peers.update([p['peer_id'] for p in direct_queried_peers])
queried_peers.update([ p['peer_id'] for p in direct_queried_peers ])
for p in itertools.chain(*[ p['peers'] for p in peers ]):
unqueried_peers[p['peer_id']] = p
unqueried_peers[p['peer_id']] = p
for p in queried_peers:
if p in unqueried_peers:
del unqueried_peers[p]

cmd = "mina advanced node-status -daemon-port " + seed_daemon_port + " -daemon-peers" + " -show-errors"
resp = util.exec_on_pod(v1, namespace, seed, 'seed', cmd)
resp = util.exec_on_pod(v1, namespace, seed, 'coda', cmd)
add_resp(resp, [])

requests = 0

while len(unqueried_peers) > 0 and requests < max_crawl_requests:
peers_to_query = list(unqueried_peers.values())
peers = ','.join(to_multiaddr_string(p) for p in peers_to_query)
peers = ','.join(peer_to_multiaddr(p) for p in peers_to_query)

print ('Queried ' + str(len(queried_peers)) + ' peers. Gathering node status on %s unqueried peers'%(str(len(unqueried_peers))))

resp = util.exec_on_pod(v1, namespace, seed, 'seed', "mina advanced node-status -daemon-port " + seed_daemon_port + " -peers " + peers + " -show-errors")
resp = util.exec_on_pod(v1, namespace, seed, 'coda', "mina advanced node-status -daemon-port " + seed_daemon_port + " -peers " + peers + " -show-errors")
add_resp(resp, peers_to_query)

requests += 1
Expand Down
2 changes: 1 addition & 1 deletion automation/services/watchdog/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.9
0.4.3
2 changes: 1 addition & 1 deletion automation/terraform/modules/kubernetes/testnet/helm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ resource "helm_release" "seeds" {
name = "${var.testnet_name}-seeds"
repository = var.use_local_charts ? "" : local.mina_helm_repo
chart = var.use_local_charts ? "../../../../helm/seed-node" : "seed-node"
version = "0.6.2"
version = "1.0.3"
namespace = kubernetes_namespace.testnet_namespace.metadata[0].name
values = [
yamlencode(local.seed_vars)
Expand Down
2 changes: 1 addition & 1 deletion automation/terraform/monitoring/o1-testnet-alerts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module "o1testnet_alerts" {

rule_filter = "{testnet=~\".+\"}" # any non-empty testnet name
rule_timeframe = "1h"
pagerduty_alert_filter = "devnet"
pagerduty_alert_filter = "devnet|finalfinal2|mainnet|devnet2"
}

output "testnet_alert_rules" {
Expand Down
Loading

0 comments on commit 68200c7

Please sign in to comment.